Lines Matching refs:adapter

180 static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,  in ixgbe_read_pci_cfg_word_parent()  argument
186 parent_bus = adapter->pdev->bus->parent; in ixgbe_read_pci_cfg_word_parent()
199 ixgbe_check_cfg_remove(&adapter->hw, parent_dev)) in ixgbe_read_pci_cfg_word_parent()
204 static s32 ixgbe_get_parent_bus_info(struct ixgbe_adapter *adapter) in ixgbe_get_parent_bus_info() argument
206 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_parent_bus_info()
215 err = ixgbe_read_pci_cfg_word_parent(adapter, 18, &link_status); in ixgbe_get_parent_bus_info()
247 static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter, in ixgbe_check_minimum_link() argument
250 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_minimum_link()
264 if (ixgbe_pcie_from_parent(&adapter->hw)) in ixgbe_check_minimum_link()
265 pdev = adapter->pdev->bus->parent->self; in ixgbe_check_minimum_link()
267 pdev = adapter->pdev; in ixgbe_check_minimum_link()
314 static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) in ixgbe_service_event_schedule() argument
316 if (!test_bit(__IXGBE_DOWN, &adapter->state) && in ixgbe_service_event_schedule()
317 !test_bit(__IXGBE_REMOVING, &adapter->state) && in ixgbe_service_event_schedule()
318 !test_and_set_bit(__IXGBE_SERVICE_SCHED, &adapter->state)) in ixgbe_service_event_schedule()
319 schedule_work(&adapter->service_task); in ixgbe_service_event_schedule()
324 struct ixgbe_adapter *adapter = hw->back; in ixgbe_remove_adapter() local
330 if (test_bit(__IXGBE_SERVICE_INITED, &adapter->state)) in ixgbe_remove_adapter()
331 ixgbe_service_event_schedule(adapter); in ixgbe_remove_adapter()
393 struct ixgbe_adapter *adapter = hw->back; in ixgbe_read_pci_cfg_word() local
398 pci_read_config_word(adapter->pdev, reg, &value); in ixgbe_read_pci_cfg_word()
400 ixgbe_check_cfg_remove(hw, adapter->pdev)) in ixgbe_read_pci_cfg_word()
408 struct ixgbe_adapter *adapter = hw->back; in ixgbe_read_pci_cfg_dword() local
413 pci_read_config_dword(adapter->pdev, reg, &value); in ixgbe_read_pci_cfg_dword()
415 ixgbe_check_cfg_remove(hw, adapter->pdev)) in ixgbe_read_pci_cfg_dword()
423 struct ixgbe_adapter *adapter = hw->back; in ixgbe_write_pci_cfg_word() local
427 pci_write_config_word(adapter->pdev, reg, value); in ixgbe_write_pci_cfg_word()
430 static void ixgbe_service_event_complete(struct ixgbe_adapter *adapter) in ixgbe_service_event_complete() argument
432 BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state)); in ixgbe_service_event_complete()
436 clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); in ixgbe_service_event_complete()
562 static void ixgbe_dump(struct ixgbe_adapter *adapter) in ixgbe_dump() argument
564 struct net_device *netdev = adapter->netdev; in ixgbe_dump()
565 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_dump()
578 if (!netif_msg_hw(adapter)) in ixgbe_dump()
583 dev_info(&adapter->pdev->dev, "Net device Info\n"); in ixgbe_dump()
594 dev_info(&adapter->pdev->dev, "Register Dump\n"); in ixgbe_dump()
605 dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); in ixgbe_dump()
609 for (n = 0; n < adapter->num_tx_queues; n++) { in ixgbe_dump()
610 tx_ring = adapter->tx_ring[n]; in ixgbe_dump()
621 if (!netif_msg_tx_done(adapter)) in ixgbe_dump()
624 dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); in ixgbe_dump()
661 for (n = 0; n < adapter->num_tx_queues; n++) { in ixgbe_dump()
662 tx_ring = adapter->tx_ring[n]; in ixgbe_dump()
695 if (netif_msg_pktdata(adapter) && in ixgbe_dump()
708 dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); in ixgbe_dump()
710 for (n = 0; n < adapter->num_rx_queues; n++) { in ixgbe_dump()
711 rx_ring = adapter->rx_ring[n]; in ixgbe_dump()
717 if (!netif_msg_rx_status(adapter)) in ixgbe_dump()
720 dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); in ixgbe_dump()
767 for (n = 0; n < adapter->num_rx_queues; n++) { in ixgbe_dump()
768 rx_ring = adapter->rx_ring[n]; in ixgbe_dump()
801 if (netif_msg_pktdata(adapter) && in ixgbe_dump()
822 static void ixgbe_release_hw_control(struct ixgbe_adapter *adapter) in ixgbe_release_hw_control() argument
827 ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); in ixgbe_release_hw_control()
828 IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, in ixgbe_release_hw_control()
832 static void ixgbe_get_hw_control(struct ixgbe_adapter *adapter) in ixgbe_get_hw_control() argument
837 ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); in ixgbe_get_hw_control()
838 IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, in ixgbe_get_hw_control()
850 static void ixgbe_set_ivar(struct ixgbe_adapter *adapter, s8 direction, in ixgbe_set_ivar() argument
854 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_ivar()
874 ivar = IXGBE_READ_REG(&adapter->hw, IXGBE_IVAR_MISC); in ixgbe_set_ivar()
877 IXGBE_WRITE_REG(&adapter->hw, IXGBE_IVAR_MISC, ivar); in ixgbe_set_ivar()
894 static inline void ixgbe_irq_rearm_queues(struct ixgbe_adapter *adapter, in ixgbe_irq_rearm_queues() argument
899 switch (adapter->hw.mac.type) { in ixgbe_irq_rearm_queues()
902 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_irq_rearm_queues()
909 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(0), mask); in ixgbe_irq_rearm_queues()
911 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(1), mask); in ixgbe_irq_rearm_queues()
940 static void ixgbe_update_xoff_rx_lfc(struct ixgbe_adapter *adapter) in ixgbe_update_xoff_rx_lfc() argument
942 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_xoff_rx_lfc()
943 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_update_xoff_rx_lfc()
964 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_update_xoff_rx_lfc()
966 &adapter->tx_ring[i]->state); in ixgbe_update_xoff_rx_lfc()
969 static void ixgbe_update_xoff_received(struct ixgbe_adapter *adapter) in ixgbe_update_xoff_received() argument
971 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_xoff_received()
972 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_update_xoff_received()
976 bool pfc_en = adapter->dcb_cfg.pfc_mode_enable; in ixgbe_update_xoff_received()
978 if (adapter->ixgbe_ieee_pfc) in ixgbe_update_xoff_received()
979 pfc_en |= !!(adapter->ixgbe_ieee_pfc->pfc_en); in ixgbe_update_xoff_received()
981 if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED) || !pfc_en) { in ixgbe_update_xoff_received()
982 ixgbe_update_xoff_rx_lfc(adapter); in ixgbe_update_xoff_received()
999 tc = netdev_get_prio_tc_map(adapter->netdev, i); in ixgbe_update_xoff_received()
1004 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_update_xoff_received()
1005 struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; in ixgbe_update_xoff_received()
1020 struct ixgbe_adapter *adapter; in ixgbe_get_tx_pending() local
1025 adapter = ring->l2_accel_priv->real_adapter; in ixgbe_get_tx_pending()
1027 adapter = netdev_priv(ring->netdev); in ixgbe_get_tx_pending()
1029 hw = &adapter->hw; in ixgbe_get_tx_pending()
1076 static void ixgbe_tx_timeout_reset(struct ixgbe_adapter *adapter) in ixgbe_tx_timeout_reset() argument
1080 if (!test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_tx_timeout_reset()
1081 adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; in ixgbe_tx_timeout_reset()
1083 ixgbe_service_event_schedule(adapter); in ixgbe_tx_timeout_reset()
1095 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_clean_tx_irq() local
1102 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_clean_tx_irq()
1192 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_clean_tx_irq()
1211 adapter->tx_timeout_count + 1, tx_ring->queue_index); in ixgbe_clean_tx_irq()
1214 ixgbe_tx_timeout_reset(adapter); in ixgbe_clean_tx_irq()
1232 && !test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_clean_tx_irq()
1243 static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter, in ixgbe_update_tx_dca() argument
1247 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_tx_dca()
1251 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) in ixgbe_update_tx_dca()
1280 static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter, in ixgbe_update_rx_dca() argument
1284 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_rx_dca()
1288 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) in ixgbe_update_rx_dca()
1314 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_update_dca() local
1322 ixgbe_update_tx_dca(adapter, ring, cpu); in ixgbe_update_dca()
1325 ixgbe_update_rx_dca(adapter, ring, cpu); in ixgbe_update_dca()
1332 static void ixgbe_setup_dca(struct ixgbe_adapter *adapter) in ixgbe_setup_dca() argument
1337 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) in ixgbe_setup_dca()
1338 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, in ixgbe_setup_dca()
1341 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, in ixgbe_setup_dca()
1344 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_setup_dca()
1345 adapter->q_vector[i]->cpu = -1; in ixgbe_setup_dca()
1346 ixgbe_update_dca(adapter->q_vector[i]); in ixgbe_setup_dca()
1352 struct ixgbe_adapter *adapter = dev_get_drvdata(dev); in __ixgbe_notify_dca() local
1355 if (!(adapter->flags & IXGBE_FLAG_DCA_CAPABLE)) in __ixgbe_notify_dca()
1361 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) in __ixgbe_notify_dca()
1364 adapter->flags |= IXGBE_FLAG_DCA_ENABLED; in __ixgbe_notify_dca()
1365 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, in __ixgbe_notify_dca()
1371 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { in __ixgbe_notify_dca()
1373 adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED; in __ixgbe_notify_dca()
1374 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, in __ixgbe_notify_dca()
1646 ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector->adapter, skb); in ixgbe_process_skb_fields()
2051 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_clean_rx_irq() local
2104 ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); in ixgbe_clean_rx_irq()
2149 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_low_latency_recv() local
2153 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_low_latency_recv()
2184 static void ixgbe_configure_msix(struct ixgbe_adapter *adapter) in ixgbe_configure_msix() argument
2191 if (adapter->num_vfs > 32) { in ixgbe_configure_msix()
2192 u32 eitrsel = (1 << (adapter->num_vfs - 32)) - 1; in ixgbe_configure_msix()
2193 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITRSEL, eitrsel); in ixgbe_configure_msix()
2200 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) { in ixgbe_configure_msix()
2202 q_vector = adapter->q_vector[v_idx]; in ixgbe_configure_msix()
2205 ixgbe_set_ivar(adapter, 0, ring->reg_idx, v_idx); in ixgbe_configure_msix()
2208 ixgbe_set_ivar(adapter, 1, ring->reg_idx, v_idx); in ixgbe_configure_msix()
2213 switch (adapter->hw.mac.type) { in ixgbe_configure_msix()
2215 ixgbe_set_ivar(adapter, -1, IXGBE_IVAR_OTHER_CAUSES_INDEX, in ixgbe_configure_msix()
2222 ixgbe_set_ivar(adapter, -1, 1, v_idx); in ixgbe_configure_msix()
2227 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(v_idx), 1950); in ixgbe_configure_msix()
2235 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, mask); in ixgbe_configure_msix()
2319 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_write_eitr() local
2320 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_write_eitr()
2324 switch (adapter->hw.mac.type) { in ixgbe_write_eitr()
2386 static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) in ixgbe_check_overtemp_subtask() argument
2388 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_overtemp_subtask()
2389 u32 eicr = adapter->interrupt_event; in ixgbe_check_overtemp_subtask()
2391 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_check_overtemp_subtask()
2394 if (!(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && in ixgbe_check_overtemp_subtask()
2395 !(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_EVENT)) in ixgbe_check_overtemp_subtask()
2398 adapter->flags2 &= ~IXGBE_FLAG2_TEMP_SENSOR_EVENT; in ixgbe_check_overtemp_subtask()
2429 if (adapter->hw.mac.type >= ixgbe_mac_X540) in ixgbe_check_overtemp_subtask()
2437 adapter->interrupt_event = 0; in ixgbe_check_overtemp_subtask()
2440 static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) in ixgbe_check_fan_failure() argument
2442 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_fan_failure()
2444 if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) && in ixgbe_check_fan_failure()
2452 static void ixgbe_check_overtemp_event(struct ixgbe_adapter *adapter, u32 eicr) in ixgbe_check_overtemp_event() argument
2454 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_overtemp_event()
2456 if (!(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)) in ixgbe_check_overtemp_event()
2459 switch (adapter->hw.mac.type) { in ixgbe_check_overtemp_event()
2467 (!test_bit(__IXGBE_DOWN, &adapter->state))) { in ixgbe_check_overtemp_event()
2468 adapter->interrupt_event = eicr; in ixgbe_check_overtemp_event()
2469 adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_EVENT; in ixgbe_check_overtemp_event()
2470 ixgbe_service_event_schedule(adapter); in ixgbe_check_overtemp_event()
2506 static void ixgbe_check_sfp_event(struct ixgbe_adapter *adapter, u32 eicr) in ixgbe_check_sfp_event() argument
2508 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_sfp_event()
2521 if (!test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_check_sfp_event()
2522 adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; in ixgbe_check_sfp_event()
2523 adapter->sfp_poll_time = 0; in ixgbe_check_sfp_event()
2524 ixgbe_service_event_schedule(adapter); in ixgbe_check_sfp_event()
2528 if (adapter->hw.mac.type == ixgbe_mac_82599EB && in ixgbe_check_sfp_event()
2532 if (!test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_check_sfp_event()
2533 adapter->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; in ixgbe_check_sfp_event()
2534 ixgbe_service_event_schedule(adapter); in ixgbe_check_sfp_event()
2539 static void ixgbe_check_lsc(struct ixgbe_adapter *adapter) in ixgbe_check_lsc() argument
2541 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_lsc()
2543 adapter->lsc_int++; in ixgbe_check_lsc()
2544 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbe_check_lsc()
2545 adapter->link_check_timeout = jiffies; in ixgbe_check_lsc()
2546 if (!test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_check_lsc()
2549 ixgbe_service_event_schedule(adapter); in ixgbe_check_lsc()
2553 static inline void ixgbe_irq_enable_queues(struct ixgbe_adapter *adapter, in ixgbe_irq_enable_queues() argument
2557 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_irq_enable_queues()
2581 static inline void ixgbe_irq_disable_queues(struct ixgbe_adapter *adapter, in ixgbe_irq_disable_queues() argument
2585 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_irq_disable_queues()
2613 static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues, in ixgbe_irq_enable() argument
2616 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_irq_enable()
2620 if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) in ixgbe_irq_enable()
2623 if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) in ixgbe_irq_enable()
2624 switch (adapter->hw.mac.type) { in ixgbe_irq_enable()
2636 if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) in ixgbe_irq_enable()
2638 switch (adapter->hw.mac.type) { in ixgbe_irq_enable()
2646 if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_SFP) in ixgbe_irq_enable()
2647 mask |= IXGBE_EIMS_GPI_SDP0(&adapter->hw); in ixgbe_irq_enable()
2648 if (adapter->hw.phy.type == ixgbe_phy_x550em_ext_t) in ixgbe_irq_enable()
2657 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) && in ixgbe_irq_enable()
2658 !(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT)) in ixgbe_irq_enable()
2661 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_irq_enable()
2663 ixgbe_irq_enable_queues(adapter, ~0); in ixgbe_irq_enable()
2665 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_irq_enable()
2670 struct ixgbe_adapter *adapter = data; in ixgbe_msix_other() local
2671 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_msix_other()
2694 ixgbe_check_lsc(adapter); in ixgbe_msix_other()
2697 ixgbe_msg_task(adapter); in ixgbe_msix_other()
2706 adapter->flags2 |= IXGBE_FLAG2_PHY_INTERRUPT; in ixgbe_msix_other()
2707 ixgbe_service_event_schedule(adapter); in ixgbe_msix_other()
2713 adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; in ixgbe_msix_other()
2714 ixgbe_service_event_schedule(adapter); in ixgbe_msix_other()
2721 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_msix_other()
2722 struct ixgbe_ring *ring = adapter->tx_ring[i]; in ixgbe_msix_other()
2730 adapter->flags2 |= IXGBE_FLAG2_FDIR_REQUIRES_REINIT; in ixgbe_msix_other()
2731 ixgbe_service_event_schedule(adapter); in ixgbe_msix_other()
2734 ixgbe_check_sfp_event(adapter, eicr); in ixgbe_msix_other()
2735 ixgbe_check_overtemp_event(adapter, eicr); in ixgbe_msix_other()
2741 ixgbe_check_fan_failure(adapter, eicr); in ixgbe_msix_other()
2744 ixgbe_ptp_check_pps_event(adapter, eicr); in ixgbe_msix_other()
2747 if (!test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_msix_other()
2748 ixgbe_irq_enable(adapter, false, false); in ixgbe_msix_other()
2776 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_poll() local
2782 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) in ixgbe_poll()
2814 if (adapter->rx_itr_setting & 1) in ixgbe_poll()
2816 if (!test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_poll()
2817 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx)); in ixgbe_poll()
2829 static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) in ixgbe_request_msix_irqs() argument
2831 struct net_device *netdev = adapter->netdev; in ixgbe_request_msix_irqs()
2835 for (vector = 0; vector < adapter->num_q_vectors; vector++) { in ixgbe_request_msix_irqs()
2836 struct ixgbe_q_vector *q_vector = adapter->q_vector[vector]; in ixgbe_request_msix_irqs()
2837 struct msix_entry *entry = &adapter->msix_entries[vector]; in ixgbe_request_msix_irqs()
2861 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { in ixgbe_request_msix_irqs()
2868 err = request_irq(adapter->msix_entries[vector].vector, in ixgbe_request_msix_irqs()
2869 ixgbe_msix_other, 0, netdev->name, adapter); in ixgbe_request_msix_irqs()
2880 irq_set_affinity_hint(adapter->msix_entries[vector].vector, in ixgbe_request_msix_irqs()
2882 free_irq(adapter->msix_entries[vector].vector, in ixgbe_request_msix_irqs()
2883 adapter->q_vector[vector]); in ixgbe_request_msix_irqs()
2885 adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED; in ixgbe_request_msix_irqs()
2886 pci_disable_msix(adapter->pdev); in ixgbe_request_msix_irqs()
2887 kfree(adapter->msix_entries); in ixgbe_request_msix_irqs()
2888 adapter->msix_entries = NULL; in ixgbe_request_msix_irqs()
2899 struct ixgbe_adapter *adapter = data; in ixgbe_intr() local
2900 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_intr()
2901 struct ixgbe_q_vector *q_vector = adapter->q_vector[0]; in ixgbe_intr()
2921 if (!test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_intr()
2922 ixgbe_irq_enable(adapter, true, true); in ixgbe_intr()
2927 ixgbe_check_lsc(adapter); in ixgbe_intr()
2931 ixgbe_check_sfp_event(adapter, eicr); in ixgbe_intr()
2938 adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; in ixgbe_intr()
2939 ixgbe_service_event_schedule(adapter); in ixgbe_intr()
2942 ixgbe_check_overtemp_event(adapter, eicr); in ixgbe_intr()
2948 ixgbe_check_fan_failure(adapter, eicr); in ixgbe_intr()
2950 ixgbe_ptp_check_pps_event(adapter, eicr); in ixgbe_intr()
2959 if (!test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_intr()
2960 ixgbe_irq_enable(adapter, false, false); in ixgbe_intr()
2972 static int ixgbe_request_irq(struct ixgbe_adapter *adapter) in ixgbe_request_irq() argument
2974 struct net_device *netdev = adapter->netdev; in ixgbe_request_irq()
2977 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) in ixgbe_request_irq()
2978 err = ixgbe_request_msix_irqs(adapter); in ixgbe_request_irq()
2979 else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) in ixgbe_request_irq()
2980 err = request_irq(adapter->pdev->irq, ixgbe_intr, 0, in ixgbe_request_irq()
2981 netdev->name, adapter); in ixgbe_request_irq()
2983 err = request_irq(adapter->pdev->irq, ixgbe_intr, IRQF_SHARED, in ixgbe_request_irq()
2984 netdev->name, adapter); in ixgbe_request_irq()
2992 static void ixgbe_free_irq(struct ixgbe_adapter *adapter) in ixgbe_free_irq() argument
2996 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_free_irq()
2997 free_irq(adapter->pdev->irq, adapter); in ixgbe_free_irq()
3001 for (vector = 0; vector < adapter->num_q_vectors; vector++) { in ixgbe_free_irq()
3002 struct ixgbe_q_vector *q_vector = adapter->q_vector[vector]; in ixgbe_free_irq()
3003 struct msix_entry *entry = &adapter->msix_entries[vector]; in ixgbe_free_irq()
3015 free_irq(adapter->msix_entries[vector++].vector, adapter); in ixgbe_free_irq()
3022 static inline void ixgbe_irq_disable(struct ixgbe_adapter *adapter) in ixgbe_irq_disable() argument
3024 switch (adapter->hw.mac.type) { in ixgbe_irq_disable()
3026 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0); in ixgbe_irq_disable()
3032 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000); in ixgbe_irq_disable()
3033 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0); in ixgbe_irq_disable()
3034 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0); in ixgbe_irq_disable()
3039 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_irq_disable()
3040 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_irq_disable()
3043 for (vector = 0; vector < adapter->num_q_vectors; vector++) in ixgbe_irq_disable()
3044 synchronize_irq(adapter->msix_entries[vector].vector); in ixgbe_irq_disable()
3046 synchronize_irq(adapter->msix_entries[vector++].vector); in ixgbe_irq_disable()
3048 synchronize_irq(adapter->pdev->irq); in ixgbe_irq_disable()
3056 static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter) in ixgbe_configure_msi_and_legacy() argument
3058 struct ixgbe_q_vector *q_vector = adapter->q_vector[0]; in ixgbe_configure_msi_and_legacy()
3062 ixgbe_set_ivar(adapter, 0, 0, 0); in ixgbe_configure_msi_and_legacy()
3063 ixgbe_set_ivar(adapter, 1, 0, 0); in ixgbe_configure_msi_and_legacy()
3075 void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, in ixgbe_configure_tx_ring() argument
3078 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_tx_ring()
3095 ring->tail = adapter->io_addr + IXGBE_TDT(reg_idx); in ixgbe_configure_tx_ring()
3120 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { in ixgbe_configure_tx_ring()
3121 ring->atr_sample_rate = adapter->atr_sample_rate; in ixgbe_configure_tx_ring()
3157 static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter) in ixgbe_setup_mtqc() argument
3159 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_mtqc()
3161 u8 tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_setup_mtqc()
3172 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_setup_mtqc()
3178 else if (adapter->ring_feature[RING_F_RSS].indices == 4) in ixgbe_setup_mtqc()
3211 static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) in ixgbe_configure_tx() argument
3213 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_tx()
3217 ixgbe_setup_mtqc(adapter); in ixgbe_configure_tx()
3227 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_configure_tx()
3228 ixgbe_configure_tx_ring(adapter, adapter->tx_ring[i]); in ixgbe_configure_tx()
3231 static void ixgbe_enable_rx_drop(struct ixgbe_adapter *adapter, in ixgbe_enable_rx_drop() argument
3234 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_enable_rx_drop()
3243 static void ixgbe_disable_rx_drop(struct ixgbe_adapter *adapter, in ixgbe_disable_rx_drop() argument
3246 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_rx_drop()
3256 void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter) in ixgbe_set_rx_drop_en() argument
3258 static void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter) in ixgbe_set_rx_drop_en()
3262 bool pfc_en = adapter->dcb_cfg.pfc_mode_enable; in ixgbe_set_rx_drop_en()
3264 if (adapter->ixgbe_ieee_pfc) in ixgbe_set_rx_drop_en()
3265 pfc_en |= !!(adapter->ixgbe_ieee_pfc->pfc_en); in ixgbe_set_rx_drop_en()
3276 if (adapter->num_vfs || (adapter->num_rx_queues > 1 && in ixgbe_set_rx_drop_en()
3277 !(adapter->hw.fc.current_mode & ixgbe_fc_tx_pause) && !pfc_en)) { in ixgbe_set_rx_drop_en()
3278 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_rx_drop_en()
3279 ixgbe_enable_rx_drop(adapter, adapter->rx_ring[i]); in ixgbe_set_rx_drop_en()
3281 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_rx_drop_en()
3282 ixgbe_disable_rx_drop(adapter, adapter->rx_ring[i]); in ixgbe_set_rx_drop_en()
3288 static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, in ixgbe_configure_srrctl() argument
3291 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_srrctl()
3296 u16 mask = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_configure_srrctl()
3326 u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter) in ixgbe_rss_indir_tbl_entries() argument
3328 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_entries()
3330 else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_rss_indir_tbl_entries()
3343 void ixgbe_store_reta(struct ixgbe_adapter *adapter) in ixgbe_store_reta() argument
3345 u32 i, reta_entries = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_store_reta()
3346 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_store_reta()
3349 u8 *indir_tbl = adapter->rss_indir_tbl; in ixgbe_store_reta()
3357 if (adapter->hw.mac.type == ixgbe_mac_82598EB) in ixgbe_store_reta()
3383 static void ixgbe_store_vfreta(struct ixgbe_adapter *adapter) in ixgbe_store_vfreta() argument
3385 u32 i, reta_entries = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_store_vfreta()
3386 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_store_vfreta()
3388 unsigned int pf_pool = adapter->num_vfs; in ixgbe_store_vfreta()
3392 vfreta |= (u32)adapter->rss_indir_tbl[i] << (i & 0x3) * 8; in ixgbe_store_vfreta()
3401 static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) in ixgbe_setup_reta() argument
3403 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_reta()
3405 u32 reta_entries = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_setup_reta()
3406 u16 rss_i = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_setup_reta()
3412 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && (rss_i < 2)) in ixgbe_setup_reta()
3417 IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), adapter->rss_key[i]); in ixgbe_setup_reta()
3420 memset(adapter->rss_indir_tbl, 0, sizeof(adapter->rss_indir_tbl)); in ixgbe_setup_reta()
3426 adapter->rss_indir_tbl[i] = j; in ixgbe_setup_reta()
3429 ixgbe_store_reta(adapter); in ixgbe_setup_reta()
3432 static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter) in ixgbe_setup_vfreta() argument
3434 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_vfreta()
3435 u16 rss_i = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_setup_vfreta()
3436 unsigned int pf_pool = adapter->num_vfs; in ixgbe_setup_vfreta()
3442 adapter->rss_key[i]); in ixgbe_setup_vfreta()
3449 adapter->rss_indir_tbl[i] = j; in ixgbe_setup_vfreta()
3452 ixgbe_store_vfreta(adapter); in ixgbe_setup_vfreta()
3455 static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter) in ixgbe_setup_mrqc() argument
3457 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_mrqc()
3466 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_mrqc()
3467 if (adapter->ring_feature[RING_F_RSS].mask) in ixgbe_setup_mrqc()
3470 u8 tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_setup_mrqc()
3472 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_setup_mrqc()
3477 else if (adapter->ring_feature[RING_F_RSS].indices == 4) in ixgbe_setup_mrqc()
3497 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) in ixgbe_setup_mrqc()
3499 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) in ixgbe_setup_mrqc()
3502 netdev_rss_key_fill(adapter->rss_key, sizeof(adapter->rss_key)); in ixgbe_setup_mrqc()
3504 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) { in ixgbe_setup_mrqc()
3505 unsigned int pf_pool = adapter->num_vfs; in ixgbe_setup_mrqc()
3512 ixgbe_setup_vfreta(adapter); in ixgbe_setup_mrqc()
3517 ixgbe_setup_reta(adapter); in ixgbe_setup_mrqc()
3528 static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, in ixgbe_configure_rscctl() argument
3531 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_rscctl()
3550 static void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter, in ixgbe_rx_desc_queue_enable() argument
3553 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rx_desc_queue_enable()
3576 void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, in ixgbe_disable_rx_queue() argument
3579 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_rx_queue()
3608 void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, in ixgbe_configure_rx_ring() argument
3611 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_rx_ring()
3618 ixgbe_disable_rx_queue(adapter, ring); in ixgbe_configure_rx_ring()
3626 ring->tail = adapter->io_addr + IXGBE_RDT(reg_idx); in ixgbe_configure_rx_ring()
3628 ixgbe_configure_srrctl(adapter, ring); in ixgbe_configure_rx_ring()
3629 ixgbe_configure_rscctl(adapter, ring); in ixgbe_configure_rx_ring()
3647 ixgbe_rx_desc_queue_enable(adapter, ring); in ixgbe_configure_rx_ring()
3651 static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter) in ixgbe_setup_psrtype() argument
3653 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_psrtype()
3654 int rss_i = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_setup_psrtype()
3672 for_each_set_bit(pool, &adapter->fwd_bitmask, 32) in ixgbe_setup_psrtype()
3676 static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) in ixgbe_configure_virtualization() argument
3678 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_virtualization()
3683 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_configure_virtualization()
3701 if (adapter->bridge_mode == BRIDGE_MODE_VEB) in ixgbe_configure_virtualization()
3711 switch (adapter->ring_feature[RING_F_VMDQ].mask) { in ixgbe_configure_virtualization()
3727 hw->mac.ops.set_mac_anti_spoofing(hw, (adapter->num_vfs != 0), in ixgbe_configure_virtualization()
3728 adapter->num_vfs); in ixgbe_configure_virtualization()
3746 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_configure_virtualization()
3747 if (!adapter->vfinfo[i].spoofchk_enabled) in ixgbe_configure_virtualization()
3748 ixgbe_ndo_set_vf_spoofchk(adapter->netdev, i, false); in ixgbe_configure_virtualization()
3755 ixgbe_ndo_set_vf_rss_query_en(adapter->netdev, i, in ixgbe_configure_virtualization()
3756 adapter->vfinfo[i].rss_query_enabled); in ixgbe_configure_virtualization()
3760 static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) in ixgbe_set_rx_buffer_len() argument
3762 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rx_buffer_len()
3763 struct net_device *netdev = adapter->netdev; in ixgbe_set_rx_buffer_len()
3771 if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && in ixgbe_set_rx_buffer_len()
3798 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_rx_buffer_len()
3799 rx_ring = adapter->rx_ring[i]; in ixgbe_set_rx_buffer_len()
3800 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) in ixgbe_set_rx_buffer_len()
3807 static void ixgbe_setup_rdrxctl(struct ixgbe_adapter *adapter) in ixgbe_setup_rdrxctl() argument
3809 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_rdrxctl()
3828 if (adapter->num_vfs) in ixgbe_setup_rdrxctl()
3855 static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) in ixgbe_configure_rx() argument
3857 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_rx()
3864 ixgbe_setup_psrtype(adapter); in ixgbe_configure_rx()
3865 ixgbe_setup_rdrxctl(adapter); in ixgbe_configure_rx()
3870 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) in ixgbe_configure_rx()
3875 ixgbe_setup_mrqc(adapter); in ixgbe_configure_rx()
3878 ixgbe_set_rx_buffer_len(adapter); in ixgbe_configure_rx()
3884 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_configure_rx()
3885 ixgbe_configure_rx_ring(adapter, adapter->rx_ring[i]); in ixgbe_configure_rx()
3900 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_vlan_rx_add_vid() local
3901 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vlan_rx_add_vid()
3904 hw->mac.ops.set_vfta(&adapter->hw, vid, VMDQ_P(0), true); in ixgbe_vlan_rx_add_vid()
3905 set_bit(vid, adapter->active_vlans); in ixgbe_vlan_rx_add_vid()
3913 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_vlan_rx_kill_vid() local
3914 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vlan_rx_kill_vid()
3917 hw->mac.ops.set_vfta(&adapter->hw, vid, VMDQ_P(0), false); in ixgbe_vlan_rx_kill_vid()
3918 clear_bit(vid, adapter->active_vlans); in ixgbe_vlan_rx_kill_vid()
3927 static void ixgbe_vlan_strip_disable(struct ixgbe_adapter *adapter) in ixgbe_vlan_strip_disable() argument
3929 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vlan_strip_disable()
3943 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_vlan_strip_disable()
3944 struct ixgbe_ring *ring = adapter->rx_ring[i]; in ixgbe_vlan_strip_disable()
3963 static void ixgbe_vlan_strip_enable(struct ixgbe_adapter *adapter) in ixgbe_vlan_strip_enable() argument
3965 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vlan_strip_enable()
3979 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_vlan_strip_enable()
3980 struct ixgbe_ring *ring = adapter->rx_ring[i]; in ixgbe_vlan_strip_enable()
3995 static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter) in ixgbe_restore_vlan() argument
3999 ixgbe_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), 0); in ixgbe_restore_vlan()
4001 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) in ixgbe_restore_vlan()
4002 ixgbe_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); in ixgbe_restore_vlan()
4016 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_write_mc_addr_list() local
4017 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_write_mc_addr_list()
4028 ixgbe_restore_vf_multicasts(adapter); in ixgbe_write_mc_addr_list()
4035 void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter) in ixgbe_full_sync_mac_table() argument
4037 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_full_sync_mac_table()
4040 if (adapter->mac_table[i].state & IXGBE_MAC_STATE_IN_USE) in ixgbe_full_sync_mac_table()
4041 hw->mac.ops.set_rar(hw, i, adapter->mac_table[i].addr, in ixgbe_full_sync_mac_table()
4042 adapter->mac_table[i].queue, in ixgbe_full_sync_mac_table()
4047 adapter->mac_table[i].state &= ~(IXGBE_MAC_STATE_MODIFIED); in ixgbe_full_sync_mac_table()
4052 static void ixgbe_sync_mac_table(struct ixgbe_adapter *adapter) in ixgbe_sync_mac_table() argument
4054 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_sync_mac_table()
4057 if (adapter->mac_table[i].state & IXGBE_MAC_STATE_MODIFIED) { in ixgbe_sync_mac_table()
4058 if (adapter->mac_table[i].state & in ixgbe_sync_mac_table()
4061 adapter->mac_table[i].addr, in ixgbe_sync_mac_table()
4062 adapter->mac_table[i].queue, in ixgbe_sync_mac_table()
4067 adapter->mac_table[i].state &= in ixgbe_sync_mac_table()
4073 static void ixgbe_flush_sw_mac_table(struct ixgbe_adapter *adapter) in ixgbe_flush_sw_mac_table() argument
4076 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_flush_sw_mac_table()
4079 adapter->mac_table[i].state |= IXGBE_MAC_STATE_MODIFIED; in ixgbe_flush_sw_mac_table()
4080 adapter->mac_table[i].state &= ~IXGBE_MAC_STATE_IN_USE; in ixgbe_flush_sw_mac_table()
4081 eth_zero_addr(adapter->mac_table[i].addr); in ixgbe_flush_sw_mac_table()
4082 adapter->mac_table[i].queue = 0; in ixgbe_flush_sw_mac_table()
4084 ixgbe_sync_mac_table(adapter); in ixgbe_flush_sw_mac_table()
4087 static int ixgbe_available_rars(struct ixgbe_adapter *adapter) in ixgbe_available_rars() argument
4089 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_available_rars()
4093 if (adapter->mac_table[i].state == 0) in ixgbe_available_rars()
4100 static void ixgbe_mac_set_default_filter(struct ixgbe_adapter *adapter, in ixgbe_mac_set_default_filter() argument
4103 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_mac_set_default_filter()
4105 memcpy(&adapter->mac_table[0].addr, addr, ETH_ALEN); in ixgbe_mac_set_default_filter()
4106 adapter->mac_table[0].queue = VMDQ_P(0); in ixgbe_mac_set_default_filter()
4107 adapter->mac_table[0].state = (IXGBE_MAC_STATE_DEFAULT | in ixgbe_mac_set_default_filter()
4109 hw->mac.ops.set_rar(hw, 0, adapter->mac_table[0].addr, in ixgbe_mac_set_default_filter()
4110 adapter->mac_table[0].queue, in ixgbe_mac_set_default_filter()
4114 int ixgbe_add_mac_filter(struct ixgbe_adapter *adapter, u8 *addr, u16 queue) in ixgbe_add_mac_filter() argument
4116 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_mac_filter()
4123 if (adapter->mac_table[i].state & IXGBE_MAC_STATE_IN_USE) in ixgbe_add_mac_filter()
4125 adapter->mac_table[i].state |= (IXGBE_MAC_STATE_MODIFIED | in ixgbe_add_mac_filter()
4127 ether_addr_copy(adapter->mac_table[i].addr, addr); in ixgbe_add_mac_filter()
4128 adapter->mac_table[i].queue = queue; in ixgbe_add_mac_filter()
4129 ixgbe_sync_mac_table(adapter); in ixgbe_add_mac_filter()
4135 int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, u8 *addr, u16 queue) in ixgbe_del_mac_filter() argument
4139 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_del_mac_filter()
4145 if (ether_addr_equal(addr, adapter->mac_table[i].addr) && in ixgbe_del_mac_filter()
4146 adapter->mac_table[i].queue == queue) { in ixgbe_del_mac_filter()
4147 adapter->mac_table[i].state |= IXGBE_MAC_STATE_MODIFIED; in ixgbe_del_mac_filter()
4148 adapter->mac_table[i].state &= ~IXGBE_MAC_STATE_IN_USE; in ixgbe_del_mac_filter()
4149 eth_zero_addr(adapter->mac_table[i].addr); in ixgbe_del_mac_filter()
4150 adapter->mac_table[i].queue = 0; in ixgbe_del_mac_filter()
4151 ixgbe_sync_mac_table(adapter); in ixgbe_del_mac_filter()
4168 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_write_uc_addr_list() local
4172 if (netdev_uc_count(netdev) > ixgbe_available_rars(adapter)) in ixgbe_write_uc_addr_list()
4178 ixgbe_del_mac_filter(adapter, ha->addr, vfn); in ixgbe_write_uc_addr_list()
4179 ixgbe_add_mac_filter(adapter, ha->addr, vfn); in ixgbe_write_uc_addr_list()
4197 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_set_rx_mode() local
4198 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rx_mode()
4224 if (adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | in ixgbe_set_rx_mode()
4267 if (adapter->netdev->features & NETIF_F_RXALL) { in ixgbe_set_rx_mode()
4282 ixgbe_vlan_strip_enable(adapter); in ixgbe_set_rx_mode()
4284 ixgbe_vlan_strip_disable(adapter); in ixgbe_set_rx_mode()
4287 static void ixgbe_napi_enable_all(struct ixgbe_adapter *adapter) in ixgbe_napi_enable_all() argument
4291 for (q_idx = 0; q_idx < adapter->num_q_vectors; q_idx++) { in ixgbe_napi_enable_all()
4292 ixgbe_qv_init_lock(adapter->q_vector[q_idx]); in ixgbe_napi_enable_all()
4293 napi_enable(&adapter->q_vector[q_idx]->napi); in ixgbe_napi_enable_all()
4297 static void ixgbe_napi_disable_all(struct ixgbe_adapter *adapter) in ixgbe_napi_disable_all() argument
4301 for (q_idx = 0; q_idx < adapter->num_q_vectors; q_idx++) { in ixgbe_napi_disable_all()
4302 napi_disable(&adapter->q_vector[q_idx]->napi); in ixgbe_napi_disable_all()
4303 while (!ixgbe_qv_disable(adapter->q_vector[q_idx])) { in ixgbe_napi_disable_all()
4310 static void ixgbe_clear_vxlan_port(struct ixgbe_adapter *adapter) in ixgbe_clear_vxlan_port() argument
4312 switch (adapter->hw.mac.type) { in ixgbe_clear_vxlan_port()
4315 IXGBE_WRITE_REG(&adapter->hw, IXGBE_VXLANCTRL, 0); in ixgbe_clear_vxlan_port()
4317 adapter->vxlan_port = 0; in ixgbe_clear_vxlan_port()
4334 static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) in ixgbe_configure_dcb() argument
4336 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_dcb()
4337 int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN; in ixgbe_configure_dcb()
4339 if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) { in ixgbe_configure_dcb()
4341 netif_set_gso_max_size(adapter->netdev, 65536); in ixgbe_configure_dcb()
4346 netif_set_gso_max_size(adapter->netdev, 32768); in ixgbe_configure_dcb()
4349 if (adapter->netdev->features & NETIF_F_FCOE_MTU) in ixgbe_configure_dcb()
4354 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE) { in ixgbe_configure_dcb()
4355 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame, in ixgbe_configure_dcb()
4357 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame, in ixgbe_configure_dcb()
4359 ixgbe_dcb_hw_config(hw, &adapter->dcb_cfg); in ixgbe_configure_dcb()
4360 } else if (adapter->ixgbe_ieee_ets && adapter->ixgbe_ieee_pfc) { in ixgbe_configure_dcb()
4361 ixgbe_dcb_hw_ets(&adapter->hw, in ixgbe_configure_dcb()
4362 adapter->ixgbe_ieee_ets, in ixgbe_configure_dcb()
4364 ixgbe_dcb_hw_pfc_config(&adapter->hw, in ixgbe_configure_dcb()
4365 adapter->ixgbe_ieee_pfc->pfc_en, in ixgbe_configure_dcb()
4366 adapter->ixgbe_ieee_ets->prio_tc); in ixgbe_configure_dcb()
4372 u16 rss_i = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_configure_dcb()
4394 static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb) in ixgbe_hpbthresh() argument
4396 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_hpbthresh()
4397 struct net_device *dev = adapter->netdev; in ixgbe_hpbthresh()
4408 (pb == ixgbe_fcoe_get_tc(adapter))) in ixgbe_hpbthresh()
4425 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_hpbthresh()
4454 static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb) in ixgbe_lpbthresh() argument
4456 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_lpbthresh()
4457 struct net_device *dev = adapter->netdev; in ixgbe_lpbthresh()
4468 (pb == netdev_get_prio_tc_map(dev, adapter->fcoe.up))) in ixgbe_lpbthresh()
4491 static void ixgbe_pbthresh_setup(struct ixgbe_adapter *adapter) in ixgbe_pbthresh_setup() argument
4493 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_pbthresh_setup()
4494 int num_tc = netdev_get_num_tc(adapter->netdev); in ixgbe_pbthresh_setup()
4501 hw->fc.high_water[i] = ixgbe_hpbthresh(adapter, i); in ixgbe_pbthresh_setup()
4502 hw->fc.low_water[i] = ixgbe_lpbthresh(adapter, i); in ixgbe_pbthresh_setup()
4513 static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) in ixgbe_configure_pb() argument
4515 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_pb()
4517 u8 tc = netdev_get_num_tc(adapter->netdev); in ixgbe_configure_pb()
4519 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || in ixgbe_configure_pb()
4520 adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) in ixgbe_configure_pb()
4521 hdrm = 32 << adapter->fdir_pballoc; in ixgbe_configure_pb()
4526 ixgbe_pbthresh_setup(adapter); in ixgbe_configure_pb()
4529 static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) in ixgbe_fdir_filter_restore() argument
4531 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_fdir_filter_restore()
4535 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_fdir_filter_restore()
4537 if (!hlist_empty(&adapter->fdir_filter_list)) in ixgbe_fdir_filter_restore()
4538 ixgbe_fdir_set_input_mask_82599(hw, &adapter->fdir_mask); in ixgbe_fdir_filter_restore()
4541 &adapter->fdir_filter_list, fdir_node) { in ixgbe_fdir_filter_restore()
4547 adapter->rx_ring[filter->action]->reg_idx); in ixgbe_fdir_filter_restore()
4550 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_fdir_filter_restore()
4554 struct ixgbe_adapter *adapter) in ixgbe_macvlan_set_rx_mode() argument
4556 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_macvlan_set_rx_mode()
4572 ixgbe_write_uc_addr_list(adapter->netdev, pool); in ixgbe_macvlan_set_rx_mode()
4578 struct ixgbe_adapter *adapter = vadapter->real_adapter; in ixgbe_fwd_psrtype() local
4579 int rss_i = adapter->num_rx_queues_per_pool; in ixgbe_fwd_psrtype()
4580 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_fwd_psrtype()
4652 struct ixgbe_adapter *adapter = vadapter->real_adapter; in ixgbe_disable_fwd_ring() local
4656 ixgbe_disable_rx_queue(adapter, rx_ring); in ixgbe_disable_fwd_ring()
4658 ixgbe_irq_disable_queues(adapter, ((u64)1 << index)); in ixgbe_disable_fwd_ring()
4666 struct ixgbe_adapter *adapter = accel->real_adapter; in ixgbe_fwd_ring_down() local
4673 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { in ixgbe_fwd_ring_down()
4674 ixgbe_disable_fwd_ring(accel, adapter->rx_ring[rxbase + i]); in ixgbe_fwd_ring_down()
4675 adapter->rx_ring[rxbase + i]->netdev = adapter->netdev; in ixgbe_fwd_ring_down()
4678 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { in ixgbe_fwd_ring_down()
4679 adapter->tx_ring[txbase + i]->l2_accel_priv = NULL; in ixgbe_fwd_ring_down()
4680 adapter->tx_ring[txbase + i]->netdev = adapter->netdev; in ixgbe_fwd_ring_down()
4690 struct ixgbe_adapter *adapter = accel->real_adapter; in ixgbe_fwd_ring_up() local
4694 if (!test_bit(accel->pool, &adapter->fwd_bitmask)) in ixgbe_fwd_ring_up()
4697 baseq = accel->pool * adapter->num_rx_queues_per_pool; in ixgbe_fwd_ring_up()
4699 accel->pool, adapter->num_rx_pools, in ixgbe_fwd_ring_up()
4700 baseq, baseq + adapter->num_rx_queues_per_pool, in ixgbe_fwd_ring_up()
4701 adapter->fwd_bitmask); in ixgbe_fwd_ring_up()
4707 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) in ixgbe_fwd_ring_up()
4708 ixgbe_disable_fwd_ring(accel, adapter->rx_ring[rxbase + i]); in ixgbe_fwd_ring_up()
4710 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { in ixgbe_fwd_ring_up()
4711 adapter->rx_ring[rxbase + i]->netdev = vdev; in ixgbe_fwd_ring_up()
4712 adapter->rx_ring[rxbase + i]->l2_accel_priv = accel; in ixgbe_fwd_ring_up()
4713 ixgbe_configure_rx_ring(adapter, adapter->rx_ring[rxbase + i]); in ixgbe_fwd_ring_up()
4716 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { in ixgbe_fwd_ring_up()
4717 adapter->tx_ring[txbase + i]->netdev = vdev; in ixgbe_fwd_ring_up()
4718 adapter->tx_ring[txbase + i]->l2_accel_priv = accel; in ixgbe_fwd_ring_up()
4722 adapter->num_rx_queues_per_pool, vdev->num_tx_queues); in ixgbe_fwd_ring_up()
4732 ixgbe_add_mac_filter(adapter, vdev->dev_addr, accel->pool); in ixgbe_fwd_ring_up()
4735 ixgbe_macvlan_set_rx_mode(vdev, accel->pool, adapter); in ixgbe_fwd_ring_up()
4742 static void ixgbe_configure_dfwd(struct ixgbe_adapter *adapter) in ixgbe_configure_dfwd() argument
4748 netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { in ixgbe_configure_dfwd()
4762 static void ixgbe_configure(struct ixgbe_adapter *adapter) in ixgbe_configure() argument
4764 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure()
4766 ixgbe_configure_pb(adapter); in ixgbe_configure()
4768 ixgbe_configure_dcb(adapter); in ixgbe_configure()
4774 ixgbe_configure_virtualization(adapter); in ixgbe_configure()
4776 ixgbe_set_rx_mode(adapter->netdev); in ixgbe_configure()
4777 ixgbe_restore_vlan(adapter); in ixgbe_configure()
4788 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { in ixgbe_configure()
4789 ixgbe_init_fdir_signature_82599(&adapter->hw, in ixgbe_configure()
4790 adapter->fdir_pballoc); in ixgbe_configure()
4791 } else if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) { in ixgbe_configure()
4792 ixgbe_init_fdir_perfect_82599(&adapter->hw, in ixgbe_configure()
4793 adapter->fdir_pballoc); in ixgbe_configure()
4794 ixgbe_fdir_filter_restore(adapter); in ixgbe_configure()
4808 if (adapter->flags & IXGBE_FLAG_DCA_CAPABLE) in ixgbe_configure()
4809 ixgbe_setup_dca(adapter); in ixgbe_configure()
4814 ixgbe_configure_fcoe(adapter); in ixgbe_configure()
4817 ixgbe_configure_tx(adapter); in ixgbe_configure()
4818 ixgbe_configure_rx(adapter); in ixgbe_configure()
4819 ixgbe_configure_dfwd(adapter); in ixgbe_configure()
4826 static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) in ixgbe_sfp_link_config() argument
4834 if (adapter->hw.mac.type == ixgbe_mac_82598EB) in ixgbe_sfp_link_config()
4835 adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; in ixgbe_sfp_link_config()
4837 adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; in ixgbe_sfp_link_config()
4838 adapter->sfp_poll_time = 0; in ixgbe_sfp_link_config()
4872 static void ixgbe_setup_gpie(struct ixgbe_adapter *adapter) in ixgbe_setup_gpie() argument
4874 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_gpie()
4877 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_setup_gpie()
4907 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_setup_gpie()
4910 switch (adapter->ring_feature[RING_F_VMDQ].mask) { in ixgbe_setup_gpie()
4924 if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) { in ixgbe_setup_gpie()
4925 switch (adapter->hw.mac.type) { in ixgbe_setup_gpie()
4935 if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) in ixgbe_setup_gpie()
4952 static void ixgbe_up_complete(struct ixgbe_adapter *adapter) in ixgbe_up_complete() argument
4954 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_up_complete()
4958 ixgbe_get_hw_control(adapter); in ixgbe_up_complete()
4959 ixgbe_setup_gpie(adapter); in ixgbe_up_complete()
4961 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) in ixgbe_up_complete()
4962 ixgbe_configure_msix(adapter); in ixgbe_up_complete()
4964 ixgbe_configure_msi_and_legacy(adapter); in ixgbe_up_complete()
4974 clear_bit(__IXGBE_DOWN, &adapter->state); in ixgbe_up_complete()
4975 ixgbe_napi_enable_all(adapter); in ixgbe_up_complete()
4978 ixgbe_sfp_link_config(adapter); in ixgbe_up_complete()
4987 ixgbe_irq_enable(adapter, true, true); in ixgbe_up_complete()
4993 if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) { in ixgbe_up_complete()
5001 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbe_up_complete()
5002 adapter->link_check_timeout = jiffies; in ixgbe_up_complete()
5003 mod_timer(&adapter->service_timer, jiffies); in ixgbe_up_complete()
5011 void ixgbe_reinit_locked(struct ixgbe_adapter *adapter) in ixgbe_reinit_locked() argument
5015 adapter->netdev->trans_start = jiffies; in ixgbe_reinit_locked()
5017 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_reinit_locked()
5019 ixgbe_down(adapter); in ixgbe_reinit_locked()
5026 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_reinit_locked()
5028 ixgbe_up(adapter); in ixgbe_reinit_locked()
5029 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_reinit_locked()
5032 void ixgbe_up(struct ixgbe_adapter *adapter) in ixgbe_up() argument
5035 ixgbe_configure(adapter); in ixgbe_up()
5037 ixgbe_up_complete(adapter); in ixgbe_up()
5040 void ixgbe_reset(struct ixgbe_adapter *adapter) in ixgbe_reset() argument
5042 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_reset()
5043 struct net_device *netdev = adapter->netdev; in ixgbe_reset()
5050 while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_reset()
5054 adapter->flags2 &= ~(IXGBE_FLAG2_SEARCH_FOR_SFP | in ixgbe_reset()
5056 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; in ixgbe_reset()
5080 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_reset()
5082 memcpy(old_addr, &adapter->mac_table[0].addr, netdev->addr_len); in ixgbe_reset()
5083 ixgbe_flush_sw_mac_table(adapter); in ixgbe_reset()
5084 ixgbe_mac_set_default_filter(adapter, old_addr); in ixgbe_reset()
5090 if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) in ixgbe_reset()
5091 ixgbe_ptp_reset(adapter); in ixgbe_reset()
5094 if (!netif_running(adapter->netdev) && !adapter->wol) in ixgbe_reset()
5137 static void ixgbe_clean_all_rx_rings(struct ixgbe_adapter *adapter) in ixgbe_clean_all_rx_rings() argument
5141 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_clean_all_rx_rings()
5142 ixgbe_clean_rx_ring(adapter->rx_ring[i]); in ixgbe_clean_all_rx_rings()
5149 static void ixgbe_clean_all_tx_rings(struct ixgbe_adapter *adapter) in ixgbe_clean_all_tx_rings() argument
5153 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_clean_all_tx_rings()
5154 ixgbe_clean_tx_ring(adapter->tx_ring[i]); in ixgbe_clean_all_tx_rings()
5157 static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) in ixgbe_fdir_filter_exit() argument
5162 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_fdir_filter_exit()
5165 &adapter->fdir_filter_list, fdir_node) { in ixgbe_fdir_filter_exit()
5169 adapter->fdir_filter_count = 0; in ixgbe_fdir_filter_exit()
5171 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_fdir_filter_exit()
5174 void ixgbe_down(struct ixgbe_adapter *adapter) in ixgbe_down() argument
5176 struct net_device *netdev = adapter->netdev; in ixgbe_down()
5177 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_down()
5183 if (test_and_set_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_down()
5190 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_down()
5192 ixgbe_disable_rx_queue(adapter, adapter->rx_ring[i]); in ixgbe_down()
5203 netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { in ixgbe_down()
5215 ixgbe_irq_disable(adapter); in ixgbe_down()
5217 ixgbe_napi_disable_all(adapter); in ixgbe_down()
5219 adapter->flags2 &= ~(IXGBE_FLAG2_FDIR_REQUIRES_REINIT | in ixgbe_down()
5221 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbe_down()
5223 del_timer_sync(&adapter->service_timer); in ixgbe_down()
5225 if (adapter->num_vfs) { in ixgbe_down()
5227 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITRSEL, 0); in ixgbe_down()
5230 for (i = 0 ; i < adapter->num_vfs; i++) in ixgbe_down()
5231 adapter->vfinfo[i].clear_to_send = false; in ixgbe_down()
5234 ixgbe_ping_all_vfs(adapter); in ixgbe_down()
5237 ixgbe_disable_tx_rx(adapter); in ixgbe_down()
5241 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_down()
5242 u8 reg_idx = adapter->tx_ring[i]->reg_idx; in ixgbe_down()
5260 if (!pci_channel_offline(adapter->pdev)) in ixgbe_down()
5261 ixgbe_reset(adapter); in ixgbe_down()
5267 ixgbe_clean_all_tx_rings(adapter); in ixgbe_down()
5268 ixgbe_clean_all_rx_rings(adapter); in ixgbe_down()
5277 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_tx_timeout() local
5280 ixgbe_tx_timeout_reset(adapter); in ixgbe_tx_timeout()
5291 static int ixgbe_sw_init(struct ixgbe_adapter *adapter) in ixgbe_sw_init() argument
5293 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_sw_init()
5294 struct pci_dev *pdev = adapter->pdev; in ixgbe_sw_init()
5311 rss = min_t(int, ixgbe_max_rss_indices(adapter), num_online_cpus()); in ixgbe_sw_init()
5312 adapter->ring_feature[RING_F_RSS].limit = rss; in ixgbe_sw_init()
5313 adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE; in ixgbe_sw_init()
5314 adapter->max_q_vectors = MAX_Q_VECTORS_82599; in ixgbe_sw_init()
5315 adapter->atr_sample_rate = 20; in ixgbe_sw_init()
5317 adapter->ring_feature[RING_F_FDIR].limit = fdir; in ixgbe_sw_init()
5318 adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_64K; in ixgbe_sw_init()
5320 adapter->flags |= IXGBE_FLAG_DCA_CAPABLE; in ixgbe_sw_init()
5323 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; in ixgbe_sw_init()
5324 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; in ixgbe_sw_init()
5327 adapter->fcoe.up = IXGBE_FCOE_DEFTC; in ixgbe_sw_init()
5331 adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * in ixgbe_sw_init()
5338 adapter->flags2 &= ~IXGBE_FLAG2_RSC_CAPABLE; in ixgbe_sw_init()
5341 adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE; in ixgbe_sw_init()
5343 adapter->max_q_vectors = MAX_Q_VECTORS_82598; in ixgbe_sw_init()
5344 adapter->ring_feature[RING_F_FDIR].limit = 0; in ixgbe_sw_init()
5345 adapter->atr_sample_rate = 0; in ixgbe_sw_init()
5346 adapter->fdir_pballoc = 0; in ixgbe_sw_init()
5348 adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE; in ixgbe_sw_init()
5349 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; in ixgbe_sw_init()
5351 adapter->fcoe.up = 0; in ixgbe_sw_init()
5357 adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE; in ixgbe_sw_init()
5362 adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE; in ixgbe_sw_init()
5367 adapter->flags &= ~IXGBE_FLAG_DCA_CAPABLE; in ixgbe_sw_init()
5370 adapter->flags |= IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE; in ixgbe_sw_init()
5379 spin_lock_init(&adapter->fcoe.lock); in ixgbe_sw_init()
5383 spin_lock_init(&adapter->fdir_perfect_lock); in ixgbe_sw_init()
5390 adapter->dcb_cfg.num_tcs.pg_tcs = X540_TRAFFIC_CLASS; in ixgbe_sw_init()
5391 adapter->dcb_cfg.num_tcs.pfc_tcs = X540_TRAFFIC_CLASS; in ixgbe_sw_init()
5394 adapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS; in ixgbe_sw_init()
5395 adapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS; in ixgbe_sw_init()
5401 tc = &adapter->dcb_cfg.tc_config[j]; in ixgbe_sw_init()
5410 tc = &adapter->dcb_cfg.tc_config[0]; in ixgbe_sw_init()
5414 adapter->dcb_cfg.bw_percentage[DCB_TX_CONFIG][0] = 100; in ixgbe_sw_init()
5415 adapter->dcb_cfg.bw_percentage[DCB_RX_CONFIG][0] = 100; in ixgbe_sw_init()
5416 adapter->dcb_cfg.pfc_mode_enable = false; in ixgbe_sw_init()
5417 adapter->dcb_set_bitmap = 0x00; in ixgbe_sw_init()
5418 adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; in ixgbe_sw_init()
5419 memcpy(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, in ixgbe_sw_init()
5420 sizeof(adapter->temp_dcb_cfg)); in ixgbe_sw_init()
5427 ixgbe_pbthresh_setup(adapter); in ixgbe_sw_init()
5439 adapter->num_vfs = 0; in ixgbe_sw_init()
5442 adapter->num_vfs = max_vfs; in ixgbe_sw_init()
5448 adapter->rx_itr_setting = 1; in ixgbe_sw_init()
5449 adapter->tx_itr_setting = 1; in ixgbe_sw_init()
5452 adapter->tx_ring_count = IXGBE_DEFAULT_TXD; in ixgbe_sw_init()
5453 adapter->rx_ring_count = IXGBE_DEFAULT_RXD; in ixgbe_sw_init()
5456 adapter->tx_work_limit = IXGBE_DEFAULT_TX_WORK; in ixgbe_sw_init()
5465 set_bit(0, &adapter->fwd_bitmask); in ixgbe_sw_init()
5466 set_bit(__IXGBE_DOWN, &adapter->state); in ixgbe_sw_init()
5534 static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter) in ixgbe_setup_all_tx_resources() argument
5538 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_setup_all_tx_resources()
5539 err = ixgbe_setup_tx_resources(adapter->tx_ring[i]); in ixgbe_setup_all_tx_resources()
5551 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_setup_all_tx_resources()
5618 static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter) in ixgbe_setup_all_rx_resources() argument
5622 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_setup_all_rx_resources()
5623 err = ixgbe_setup_rx_resources(adapter->rx_ring[i]); in ixgbe_setup_all_rx_resources()
5632 err = ixgbe_setup_fcoe_ddp_resources(adapter); in ixgbe_setup_all_rx_resources()
5639 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_setup_all_rx_resources()
5672 static void ixgbe_free_all_tx_resources(struct ixgbe_adapter *adapter) in ixgbe_free_all_tx_resources() argument
5676 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_free_all_tx_resources()
5677 if (adapter->tx_ring[i]->desc) in ixgbe_free_all_tx_resources()
5678 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_free_all_tx_resources()
5710 static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter) in ixgbe_free_all_rx_resources() argument
5715 ixgbe_free_fcoe_ddp_resources(adapter); in ixgbe_free_all_rx_resources()
5718 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_free_all_rx_resources()
5719 if (adapter->rx_ring[i]->desc) in ixgbe_free_all_rx_resources()
5720 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_free_all_rx_resources()
5732 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_change_mtu() local
5744 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_change_mtu()
5745 (adapter->hw.mac.type == ixgbe_mac_82599EB) && in ixgbe_change_mtu()
5755 ixgbe_reinit_locked(adapter); in ixgbe_change_mtu()
5774 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_open() local
5775 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_open()
5779 if (test_bit(__IXGBE_TESTING, &adapter->state)) in ixgbe_open()
5785 err = ixgbe_setup_all_tx_resources(adapter); in ixgbe_open()
5790 err = ixgbe_setup_all_rx_resources(adapter); in ixgbe_open()
5794 ixgbe_configure(adapter); in ixgbe_open()
5796 err = ixgbe_request_irq(adapter); in ixgbe_open()
5801 if (adapter->num_rx_pools > 1) in ixgbe_open()
5802 queues = adapter->num_rx_queues_per_pool; in ixgbe_open()
5804 queues = adapter->num_tx_queues; in ixgbe_open()
5810 if (adapter->num_rx_pools > 1 && in ixgbe_open()
5811 adapter->num_rx_queues > IXGBE_MAX_L2A_QUEUES) in ixgbe_open()
5814 queues = adapter->num_rx_queues; in ixgbe_open()
5819 ixgbe_ptp_init(adapter); in ixgbe_open()
5821 ixgbe_up_complete(adapter); in ixgbe_open()
5823 ixgbe_clear_vxlan_port(adapter); in ixgbe_open()
5831 ixgbe_free_irq(adapter); in ixgbe_open()
5833 ixgbe_free_all_rx_resources(adapter); in ixgbe_open()
5834 if (hw->phy.ops.set_phy_power && !adapter->wol) in ixgbe_open()
5835 hw->phy.ops.set_phy_power(&adapter->hw, false); in ixgbe_open()
5837 ixgbe_free_all_tx_resources(adapter); in ixgbe_open()
5839 ixgbe_reset(adapter); in ixgbe_open()
5844 static void ixgbe_close_suspend(struct ixgbe_adapter *adapter) in ixgbe_close_suspend() argument
5846 ixgbe_ptp_suspend(adapter); in ixgbe_close_suspend()
5848 if (adapter->hw.phy.ops.enter_lplu) { in ixgbe_close_suspend()
5849 adapter->hw.phy.reset_disable = true; in ixgbe_close_suspend()
5850 ixgbe_down(adapter); in ixgbe_close_suspend()
5851 adapter->hw.phy.ops.enter_lplu(&adapter->hw); in ixgbe_close_suspend()
5852 adapter->hw.phy.reset_disable = false; in ixgbe_close_suspend()
5854 ixgbe_down(adapter); in ixgbe_close_suspend()
5857 ixgbe_free_irq(adapter); in ixgbe_close_suspend()
5859 ixgbe_free_all_tx_resources(adapter); in ixgbe_close_suspend()
5860 ixgbe_free_all_rx_resources(adapter); in ixgbe_close_suspend()
5876 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_close() local
5878 ixgbe_ptp_stop(adapter); in ixgbe_close()
5880 ixgbe_close_suspend(adapter); in ixgbe_close()
5882 ixgbe_fdir_filter_exit(adapter); in ixgbe_close()
5884 ixgbe_release_hw_control(adapter); in ixgbe_close()
5892 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_resume() local
5893 struct net_device *netdev = adapter->netdev; in ixgbe_resume()
5896 adapter->hw.hw_addr = adapter->io_addr; in ixgbe_resume()
5911 clear_bit(__IXGBE_DISABLED, &adapter->state); in ixgbe_resume()
5916 ixgbe_reset(adapter); in ixgbe_resume()
5918 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); in ixgbe_resume()
5921 err = ixgbe_init_interrupt_scheme(adapter); in ixgbe_resume()
5938 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in __ixgbe_shutdown() local
5939 struct net_device *netdev = adapter->netdev; in __ixgbe_shutdown()
5940 struct ixgbe_hw *hw = &adapter->hw; in __ixgbe_shutdown()
5942 u32 wufc = adapter->wol; in __ixgbe_shutdown()
5951 ixgbe_close_suspend(adapter); in __ixgbe_shutdown()
5954 ixgbe_clear_interrupt_scheme(adapter); in __ixgbe_shutdown()
6007 ixgbe_release_hw_control(adapter); in __ixgbe_shutdown()
6009 if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) in __ixgbe_shutdown()
6052 void ixgbe_update_stats(struct ixgbe_adapter *adapter) in ixgbe_update_stats() argument
6054 struct net_device *netdev = adapter->netdev; in ixgbe_update_stats()
6055 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_stats()
6056 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_update_stats()
6063 if (test_bit(__IXGBE_DOWN, &adapter->state) || in ixgbe_update_stats()
6064 test_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_update_stats()
6067 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_stats()
6070 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_update_stats()
6071 rsc_count += adapter->rx_ring[i]->rx_stats.rsc_count; in ixgbe_update_stats()
6072 rsc_flush += adapter->rx_ring[i]->rx_stats.rsc_flush; in ixgbe_update_stats()
6074 adapter->rsc_total_count = rsc_count; in ixgbe_update_stats()
6075 adapter->rsc_total_flush = rsc_flush; in ixgbe_update_stats()
6078 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_update_stats()
6079 struct ixgbe_ring *rx_ring = adapter->rx_ring[i]; in ixgbe_update_stats()
6087 adapter->non_eop_descs = non_eop_descs; in ixgbe_update_stats()
6088 adapter->alloc_rx_page_failed = alloc_rx_page_failed; in ixgbe_update_stats()
6089 adapter->alloc_rx_buff_failed = alloc_rx_buff_failed; in ixgbe_update_stats()
6090 adapter->hw_csum_rx_error = hw_csum_rx_error; in ixgbe_update_stats()
6097 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_update_stats()
6098 struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; in ixgbe_update_stats()
6104 adapter->restart_queue = restart_queue; in ixgbe_update_stats()
6105 adapter->tx_busy = tx_busy; in ixgbe_update_stats()
6159 ixgbe_update_xoff_received(adapter); in ixgbe_update_stats()
6179 adapter->hw_rx_no_dma_resources += in ixgbe_update_stats()
6198 if (adapter->fcoe.ddp_pool) { in ixgbe_update_stats()
6199 struct ixgbe_fcoe *fcoe = &adapter->fcoe; in ixgbe_update_stats()
6270 static void ixgbe_fdir_reinit_subtask(struct ixgbe_adapter *adapter) in ixgbe_fdir_reinit_subtask() argument
6272 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_fdir_reinit_subtask()
6275 if (!(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT)) in ixgbe_fdir_reinit_subtask()
6278 adapter->flags2 &= ~IXGBE_FLAG2_FDIR_REQUIRES_REINIT; in ixgbe_fdir_reinit_subtask()
6281 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_fdir_reinit_subtask()
6285 if (!(adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) in ixgbe_fdir_reinit_subtask()
6288 adapter->fdir_overflow++; in ixgbe_fdir_reinit_subtask()
6291 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_fdir_reinit_subtask()
6293 &(adapter->tx_ring[i]->state)); in ixgbe_fdir_reinit_subtask()
6311 static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter) in ixgbe_check_hang_subtask() argument
6313 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_hang_subtask()
6318 if (test_bit(__IXGBE_DOWN, &adapter->state) || in ixgbe_check_hang_subtask()
6319 test_bit(__IXGBE_REMOVING, &adapter->state) || in ixgbe_check_hang_subtask()
6320 test_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_check_hang_subtask()
6324 if (netif_carrier_ok(adapter->netdev)) { in ixgbe_check_hang_subtask()
6325 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_check_hang_subtask()
6326 set_check_for_tx_hang(adapter->tx_ring[i]); in ixgbe_check_hang_subtask()
6329 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_check_hang_subtask()
6339 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_check_hang_subtask()
6340 struct ixgbe_q_vector *qv = adapter->q_vector[i]; in ixgbe_check_hang_subtask()
6347 ixgbe_irq_rearm_queues(adapter, eics); in ixgbe_check_hang_subtask()
6355 static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter) in ixgbe_watchdog_update_link() argument
6357 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_watchdog_update_link()
6358 u32 link_speed = adapter->link_speed; in ixgbe_watchdog_update_link()
6359 bool link_up = adapter->link_up; in ixgbe_watchdog_update_link()
6360 bool pfc_en = adapter->dcb_cfg.pfc_mode_enable; in ixgbe_watchdog_update_link()
6362 if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE)) in ixgbe_watchdog_update_link()
6373 if (adapter->ixgbe_ieee_pfc) in ixgbe_watchdog_update_link()
6374 pfc_en |= !!(adapter->ixgbe_ieee_pfc->pfc_en); in ixgbe_watchdog_update_link()
6376 if (link_up && !((adapter->flags & IXGBE_FLAG_DCB_ENABLED) && pfc_en)) { in ixgbe_watchdog_update_link()
6378 ixgbe_set_rx_drop_en(adapter); in ixgbe_watchdog_update_link()
6382 time_after(jiffies, (adapter->link_check_timeout + in ixgbe_watchdog_update_link()
6384 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbe_watchdog_update_link()
6389 adapter->link_up = link_up; in ixgbe_watchdog_update_link()
6390 adapter->link_speed = link_speed; in ixgbe_watchdog_update_link()
6393 static void ixgbe_update_default_up(struct ixgbe_adapter *adapter) in ixgbe_update_default_up() argument
6396 struct net_device *netdev = adapter->netdev; in ixgbe_update_default_up()
6403 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) in ixgbe_update_default_up()
6406 adapter->default_up = (up > 1) ? (ffs(up) - 1) : 0; in ixgbe_update_default_up()
6415 static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) in ixgbe_watchdog_link_is_up() argument
6417 struct net_device *netdev = adapter->netdev; in ixgbe_watchdog_link_is_up()
6418 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_watchdog_link_is_up()
6421 u32 link_speed = adapter->link_speed; in ixgbe_watchdog_link_is_up()
6429 adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; in ixgbe_watchdog_link_is_up()
6455 adapter->last_rx_ptp_check = jiffies; in ixgbe_watchdog_link_is_up()
6457 if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) in ixgbe_watchdog_link_is_up()
6458 ixgbe_ptp_start_cyclecounter(adapter); in ixgbe_watchdog_link_is_up()
6483 ixgbe_check_vf_rate_limit(adapter); in ixgbe_watchdog_link_is_up()
6486 netif_tx_wake_all_queues(adapter->netdev); in ixgbe_watchdog_link_is_up()
6490 netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { in ixgbe_watchdog_link_is_up()
6501 ixgbe_update_default_up(adapter); in ixgbe_watchdog_link_is_up()
6504 ixgbe_ping_all_vfs(adapter); in ixgbe_watchdog_link_is_up()
6512 static void ixgbe_watchdog_link_is_down(struct ixgbe_adapter *adapter) in ixgbe_watchdog_link_is_down() argument
6514 struct net_device *netdev = adapter->netdev; in ixgbe_watchdog_link_is_down()
6515 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_watchdog_link_is_down()
6517 adapter->link_up = false; in ixgbe_watchdog_link_is_down()
6518 adapter->link_speed = 0; in ixgbe_watchdog_link_is_down()
6526 adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; in ixgbe_watchdog_link_is_down()
6528 if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) in ixgbe_watchdog_link_is_down()
6529 ixgbe_ptp_start_cyclecounter(adapter); in ixgbe_watchdog_link_is_down()
6535 ixgbe_ping_all_vfs(adapter); in ixgbe_watchdog_link_is_down()
6538 static bool ixgbe_ring_tx_pending(struct ixgbe_adapter *adapter) in ixgbe_ring_tx_pending() argument
6542 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_ring_tx_pending()
6543 struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; in ixgbe_ring_tx_pending()
6552 static bool ixgbe_vf_tx_pending(struct ixgbe_adapter *adapter) in ixgbe_vf_tx_pending() argument
6554 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_tx_pending()
6555 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_vf_tx_pending()
6560 if (!adapter->num_vfs) in ixgbe_vf_tx_pending()
6567 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_vf_tx_pending()
6586 static void ixgbe_watchdog_flush_tx(struct ixgbe_adapter *adapter) in ixgbe_watchdog_flush_tx() argument
6588 if (!netif_carrier_ok(adapter->netdev)) { in ixgbe_watchdog_flush_tx()
6589 if (ixgbe_ring_tx_pending(adapter) || in ixgbe_watchdog_flush_tx()
6590 ixgbe_vf_tx_pending(adapter)) { in ixgbe_watchdog_flush_tx()
6597 adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; in ixgbe_watchdog_flush_tx()
6603 static inline void ixgbe_issue_vf_flr(struct ixgbe_adapter *adapter, in ixgbe_issue_vf_flr() argument
6615 static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter) in ixgbe_check_for_bad_vf() argument
6617 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_for_bad_vf()
6618 struct pci_dev *pdev = adapter->pdev; in ixgbe_check_for_bad_vf()
6624 if (!(netif_carrier_ok(adapter->netdev))) in ixgbe_check_for_bad_vf()
6655 ixgbe_issue_vf_flr(adapter, vfdev); in ixgbe_check_for_bad_vf()
6662 static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) in ixgbe_spoof_check() argument
6667 if (adapter->hw.mac.type == ixgbe_mac_82598EB || in ixgbe_spoof_check()
6668 adapter->num_vfs == 0) in ixgbe_spoof_check()
6671 ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC); in ixgbe_spoof_check()
6683 static void ixgbe_spoof_check(struct ixgbe_adapter __always_unused *adapter) in ixgbe_spoof_check() argument
6688 ixgbe_check_for_bad_vf(struct ixgbe_adapter __always_unused *adapter) in ixgbe_check_for_bad_vf() argument
6698 static void ixgbe_watchdog_subtask(struct ixgbe_adapter *adapter) in ixgbe_watchdog_subtask() argument
6701 if (test_bit(__IXGBE_DOWN, &adapter->state) || in ixgbe_watchdog_subtask()
6702 test_bit(__IXGBE_REMOVING, &adapter->state) || in ixgbe_watchdog_subtask()
6703 test_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_watchdog_subtask()
6706 ixgbe_watchdog_update_link(adapter); in ixgbe_watchdog_subtask()
6708 if (adapter->link_up) in ixgbe_watchdog_subtask()
6709 ixgbe_watchdog_link_is_up(adapter); in ixgbe_watchdog_subtask()
6711 ixgbe_watchdog_link_is_down(adapter); in ixgbe_watchdog_subtask()
6713 ixgbe_check_for_bad_vf(adapter); in ixgbe_watchdog_subtask()
6714 ixgbe_spoof_check(adapter); in ixgbe_watchdog_subtask()
6715 ixgbe_update_stats(adapter); in ixgbe_watchdog_subtask()
6717 ixgbe_watchdog_flush_tx(adapter); in ixgbe_watchdog_subtask()
6724 static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) in ixgbe_sfp_detection_subtask() argument
6726 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_sfp_detection_subtask()
6730 if (!(adapter->flags2 & IXGBE_FLAG2_SEARCH_FOR_SFP) && in ixgbe_sfp_detection_subtask()
6731 !(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET)) in ixgbe_sfp_detection_subtask()
6734 if (adapter->sfp_poll_time && in ixgbe_sfp_detection_subtask()
6735 time_after(adapter->sfp_poll_time, jiffies)) in ixgbe_sfp_detection_subtask()
6739 if (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_sfp_detection_subtask()
6742 adapter->sfp_poll_time = jiffies + IXGBE_SFP_POLL_JIFFIES - 1; in ixgbe_sfp_detection_subtask()
6751 adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; in ixgbe_sfp_detection_subtask()
6759 if (!(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET)) in ixgbe_sfp_detection_subtask()
6762 adapter->flags2 &= ~IXGBE_FLAG2_SFP_NEEDS_RESET; in ixgbe_sfp_detection_subtask()
6777 adapter->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; in ixgbe_sfp_detection_subtask()
6781 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_sfp_detection_subtask()
6784 (adapter->netdev->reg_state == NETREG_REGISTERED)) { in ixgbe_sfp_detection_subtask()
6789 unregister_netdev(adapter->netdev); in ixgbe_sfp_detection_subtask()
6797 static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) in ixgbe_sfp_link_config_subtask() argument
6799 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_sfp_link_config_subtask()
6803 if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_CONFIG)) in ixgbe_sfp_link_config_subtask()
6807 if (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_sfp_link_config_subtask()
6810 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; in ixgbe_sfp_link_config_subtask()
6826 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbe_sfp_link_config_subtask()
6827 adapter->link_check_timeout = jiffies; in ixgbe_sfp_link_config_subtask()
6828 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_sfp_link_config_subtask()
6837 struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; in ixgbe_service_timer() local
6841 if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) in ixgbe_service_timer()
6847 mod_timer(&adapter->service_timer, next_event_offset + jiffies); in ixgbe_service_timer()
6849 ixgbe_service_event_schedule(adapter); in ixgbe_service_timer()
6852 static void ixgbe_phy_interrupt_subtask(struct ixgbe_adapter *adapter) in ixgbe_phy_interrupt_subtask() argument
6854 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_phy_interrupt_subtask()
6857 if (!(adapter->flags2 & IXGBE_FLAG2_PHY_INTERRUPT)) in ixgbe_phy_interrupt_subtask()
6860 adapter->flags2 &= ~IXGBE_FLAG2_PHY_INTERRUPT; in ixgbe_phy_interrupt_subtask()
6865 status = hw->phy.ops.handle_lasi(&adapter->hw); in ixgbe_phy_interrupt_subtask()
6872 static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter) in ixgbe_reset_subtask() argument
6874 if (!(adapter->flags2 & IXGBE_FLAG2_RESET_REQUESTED)) in ixgbe_reset_subtask()
6877 adapter->flags2 &= ~IXGBE_FLAG2_RESET_REQUESTED; in ixgbe_reset_subtask()
6880 if (test_bit(__IXGBE_DOWN, &adapter->state) || in ixgbe_reset_subtask()
6881 test_bit(__IXGBE_REMOVING, &adapter->state) || in ixgbe_reset_subtask()
6882 test_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_reset_subtask()
6885 ixgbe_dump(adapter); in ixgbe_reset_subtask()
6886 netdev_err(adapter->netdev, "Reset adapter\n"); in ixgbe_reset_subtask()
6887 adapter->tx_timeout_count++; in ixgbe_reset_subtask()
6890 ixgbe_reinit_locked(adapter); in ixgbe_reset_subtask()
6900 struct ixgbe_adapter *adapter = container_of(work, in ixgbe_service_task() local
6903 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_service_task()
6904 if (!test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_service_task()
6906 ixgbe_down(adapter); in ixgbe_service_task()
6909 ixgbe_service_event_complete(adapter); in ixgbe_service_task()
6913 if (adapter->flags2 & IXGBE_FLAG2_VXLAN_REREG_NEEDED) { in ixgbe_service_task()
6914 adapter->flags2 &= ~IXGBE_FLAG2_VXLAN_REREG_NEEDED; in ixgbe_service_task()
6915 vxlan_get_rx_port(adapter->netdev); in ixgbe_service_task()
6918 ixgbe_reset_subtask(adapter); in ixgbe_service_task()
6919 ixgbe_phy_interrupt_subtask(adapter); in ixgbe_service_task()
6920 ixgbe_sfp_detection_subtask(adapter); in ixgbe_service_task()
6921 ixgbe_sfp_link_config_subtask(adapter); in ixgbe_service_task()
6922 ixgbe_check_overtemp_subtask(adapter); in ixgbe_service_task()
6923 ixgbe_watchdog_subtask(adapter); in ixgbe_service_task()
6924 ixgbe_fdir_reinit_subtask(adapter); in ixgbe_service_task()
6925 ixgbe_check_hang_subtask(adapter); in ixgbe_service_task()
6927 if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) { in ixgbe_service_task()
6928 ixgbe_ptp_overflow_check(adapter); in ixgbe_service_task()
6929 ixgbe_ptp_rx_hang(adapter); in ixgbe_service_task()
6932 ixgbe_service_event_complete(adapter); in ixgbe_service_task()
7363 struct ixgbe_adapter *adapter = q_vector->adapter; in ixgbe_atr() local
7365 if (!adapter->vxlan_port) in ixgbe_atr()
7372 if (ntohs(udp_hdr(skb)->dest) != adapter->vxlan_port) in ixgbe_atr()
7443 ixgbe_fdir_add_signature_filter_82599(&q_vector->adapter->hw, in ixgbe_atr()
7452 struct ixgbe_adapter *adapter; in ixgbe_select_queue() local
7469 adapter = netdev_priv(dev); in ixgbe_select_queue()
7471 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) in ixgbe_select_queue()
7477 f = &adapter->ring_feature[RING_F_FCOE]; in ixgbe_select_queue()
7492 struct ixgbe_adapter *adapter, in ixgbe_xmit_frame_ring() argument
7542 adapter->ptp_clock && in ixgbe_xmit_frame_ring()
7544 &adapter->state)) { in ixgbe_xmit_frame_ring()
7549 adapter->ptp_tx_skb = skb_get(skb); in ixgbe_xmit_frame_ring()
7550 adapter->ptp_tx_start = jiffies; in ixgbe_xmit_frame_ring()
7551 schedule_work(&adapter->ptp_tx_work); in ixgbe_xmit_frame_ring()
7561 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_xmit_frame_ring()
7566 if ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) && in ixgbe_xmit_frame_ring()
7629 struct ixgbe_adapter *adapter = netdev_priv(netdev); in __ixgbe_xmit_frame() local
7639 tx_ring = ring ? ring : adapter->tx_ring[skb->queue_mapping]; in __ixgbe_xmit_frame()
7641 return ixgbe_xmit_frame_ring(skb, adapter, tx_ring); in __ixgbe_xmit_frame()
7659 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_set_mac() local
7660 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_mac()
7667 ixgbe_del_mac_filter(adapter, hw->mac.addr, VMDQ_P(0)); in ixgbe_set_mac()
7671 ret = ixgbe_add_mac_filter(adapter, hw->mac.addr, VMDQ_P(0)); in ixgbe_set_mac()
7678 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_mdio_read() local
7679 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_mdio_read()
7694 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_mdio_write() local
7695 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_mdio_write()
7704 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ioctl() local
7708 return ixgbe_ptp_set_ts_config(adapter, req); in ixgbe_ioctl()
7710 return ixgbe_ptp_get_ts_config(adapter, req); in ixgbe_ioctl()
7712 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd); in ixgbe_ioctl()
7726 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_add_sanmac_netdev() local
7727 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_sanmac_netdev()
7750 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_del_sanmac_netdev() local
7751 struct ixgbe_mac_info *mac = &adapter->hw.mac; in ixgbe_del_sanmac_netdev()
7769 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_netpoll() local
7773 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_netpoll()
7777 for (i = 0; i < adapter->num_q_vectors; i++) in ixgbe_netpoll()
7778 ixgbe_msix_clean_rings(0, adapter->q_vector[i]); in ixgbe_netpoll()
7785 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_get_stats64() local
7789 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_get_stats64()
7790 struct ixgbe_ring *ring = ACCESS_ONCE(adapter->rx_ring[i]); in ixgbe_get_stats64()
7805 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_get_stats64()
7806 struct ixgbe_ring *ring = ACCESS_ONCE(adapter->tx_ring[i]); in ixgbe_get_stats64()
7839 static void ixgbe_validate_rtr(struct ixgbe_adapter *adapter, u8 tc) in ixgbe_validate_rtr() argument
7841 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_validate_rtr()
7874 static void ixgbe_set_prio_tc_map(struct ixgbe_adapter *adapter) in ixgbe_set_prio_tc_map() argument
7876 struct net_device *dev = adapter->netdev; in ixgbe_set_prio_tc_map()
7877 struct ixgbe_dcb_config *dcb_cfg = &adapter->dcb_cfg; in ixgbe_set_prio_tc_map()
7878 struct ieee_ets *ets = adapter->ixgbe_ieee_ets; in ixgbe_set_prio_tc_map()
7884 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE) in ixgbe_set_prio_tc_map()
7902 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_setup_tc() local
7903 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_tc()
7907 if (tc > adapter->dcb_cfg.num_tcs.pg_tcs) in ixgbe_setup_tc()
7913 pools = (find_first_zero_bit(&adapter->fwd_bitmask, 32) > 1); in ixgbe_setup_tc()
7914 if (tc && pools && adapter->num_rx_pools > IXGBE_MAX_DCBMACVLANS) in ixgbe_setup_tc()
7924 ixgbe_reset(adapter); in ixgbe_setup_tc()
7926 ixgbe_clear_interrupt_scheme(adapter); in ixgbe_setup_tc()
7931 ixgbe_set_prio_tc_map(adapter); in ixgbe_setup_tc()
7933 adapter->flags |= IXGBE_FLAG_DCB_ENABLED; in ixgbe_setup_tc()
7935 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_tc()
7936 adapter->last_lfc_mode = adapter->hw.fc.requested_mode; in ixgbe_setup_tc()
7937 adapter->hw.fc.requested_mode = ixgbe_fc_none; in ixgbe_setup_tc()
7942 if (adapter->hw.mac.type == ixgbe_mac_82598EB) in ixgbe_setup_tc()
7943 adapter->hw.fc.requested_mode = adapter->last_lfc_mode; in ixgbe_setup_tc()
7945 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_setup_tc()
7947 adapter->temp_dcb_cfg.pfc_mode_enable = false; in ixgbe_setup_tc()
7948 adapter->dcb_cfg.pfc_mode_enable = false; in ixgbe_setup_tc()
7951 ixgbe_validate_rtr(adapter, tc); in ixgbe_setup_tc()
7954 ixgbe_init_interrupt_scheme(adapter); in ixgbe_setup_tc()
7963 void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter) in ixgbe_sriov_reinit() argument
7965 struct net_device *netdev = adapter->netdev; in ixgbe_sriov_reinit()
7975 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_do_reset() local
7978 ixgbe_reinit_locked(adapter); in ixgbe_do_reset()
7980 ixgbe_reset(adapter); in ixgbe_do_reset()
7986 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_fix_features() local
7993 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) in ixgbe_fix_features()
8002 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_set_features() local
8008 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) in ixgbe_set_features()
8010 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_set_features()
8011 } else if ((adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) && in ixgbe_set_features()
8012 !(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_set_features()
8013 if (adapter->rx_itr_setting == 1 || in ixgbe_set_features()
8014 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_set_features()
8015 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_set_features()
8030 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_set_features()
8033 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; in ixgbe_set_features()
8034 adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE; in ixgbe_set_features()
8038 if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) in ixgbe_set_features()
8041 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; in ixgbe_set_features()
8044 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_set_features()
8052 if (adapter->ring_feature[RING_F_RSS].limit <= 1) in ixgbe_set_features()
8056 if (!adapter->atr_sample_rate) in ixgbe_set_features()
8059 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; in ixgbe_set_features()
8064 ixgbe_vlan_strip_enable(adapter); in ixgbe_set_features()
8066 ixgbe_vlan_strip_disable(adapter); in ixgbe_set_features()
8074 if ((adapter->flags & IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE)) { in ixgbe_set_features()
8076 adapter->flags2 |= IXGBE_FLAG2_VXLAN_REREG_NEEDED; in ixgbe_set_features()
8078 ixgbe_clear_vxlan_port(adapter); in ixgbe_set_features()
8098 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_add_vxlan_port() local
8099 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_vxlan_port()
8102 if (!(adapter->flags & IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE)) in ixgbe_add_vxlan_port()
8108 if (adapter->vxlan_port == new_port) in ixgbe_add_vxlan_port()
8111 if (adapter->vxlan_port) { in ixgbe_add_vxlan_port()
8118 adapter->vxlan_port = new_port; in ixgbe_add_vxlan_port()
8131 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_del_vxlan_port() local
8134 if (!(adapter->flags & IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE)) in ixgbe_del_vxlan_port()
8140 if (adapter->vxlan_port != new_port) { in ixgbe_del_vxlan_port()
8146 ixgbe_clear_vxlan_port(adapter); in ixgbe_del_vxlan_port()
8147 adapter->flags2 |= IXGBE_FLAG2_VXLAN_REREG_NEEDED; in ixgbe_del_vxlan_port()
8172 static int ixgbe_configure_bridge_mode(struct ixgbe_adapter *adapter, in ixgbe_configure_bridge_mode() argument
8175 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_configure_bridge_mode()
8182 IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, 0); in ixgbe_configure_bridge_mode()
8195 num_pools = adapter->num_vfs + adapter->num_rx_pools; in ixgbe_configure_bridge_mode()
8205 IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, in ixgbe_configure_bridge_mode()
8212 if (!adapter->num_vfs) in ixgbe_configure_bridge_mode()
8219 num_pools = adapter->num_vfs + adapter->num_rx_pools; in ixgbe_configure_bridge_mode()
8231 adapter->bridge_mode = mode; in ixgbe_configure_bridge_mode()
8242 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_ndo_bridge_setlink() local
8246 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_ndo_bridge_setlink()
8264 status = ixgbe_configure_bridge_mode(adapter, mode); in ixgbe_ndo_bridge_setlink()
8278 struct ixgbe_adapter *adapter = netdev_priv(dev); in ixgbe_ndo_bridge_getlink() local
8280 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_ndo_bridge_getlink()
8284 adapter->bridge_mode, 0, 0, nlflags, in ixgbe_ndo_bridge_getlink()
8291 struct ixgbe_adapter *adapter = netdev_priv(pdev); in ixgbe_fwd_add() local
8292 int used_pools = adapter->num_vfs + adapter->num_rx_pools; in ixgbe_fwd_add()
8319 if (((adapter->flags & IXGBE_FLAG_DCB_ENABLED) && in ixgbe_fwd_add()
8320 adapter->num_rx_pools > IXGBE_MAX_DCBMACVLANS - 1) || in ixgbe_fwd_add()
8321 (adapter->num_rx_pools > IXGBE_MAX_MACVLANS)) in ixgbe_fwd_add()
8328 pool = find_first_zero_bit(&adapter->fwd_bitmask, 32); in ixgbe_fwd_add()
8329 adapter->num_rx_pools++; in ixgbe_fwd_add()
8330 set_bit(pool, &adapter->fwd_bitmask); in ixgbe_fwd_add()
8331 limit = find_last_bit(&adapter->fwd_bitmask, 32); in ixgbe_fwd_add()
8334 adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED | IXGBE_FLAG_SRIOV_ENABLED; in ixgbe_fwd_add()
8335 adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; in ixgbe_fwd_add()
8336 adapter->ring_feature[RING_F_RSS].limit = vdev->num_tx_queues; in ixgbe_fwd_add()
8343 fwd_adapter->real_adapter = adapter; in ixgbe_fwd_add()
8353 clear_bit(pool, &adapter->fwd_bitmask); in ixgbe_fwd_add()
8354 adapter->num_rx_pools--; in ixgbe_fwd_add()
8362 struct ixgbe_adapter *adapter = fwd_adapter->real_adapter; in ixgbe_fwd_del() local
8365 clear_bit(fwd_adapter->pool, &adapter->fwd_bitmask); in ixgbe_fwd_del()
8366 adapter->num_rx_pools--; in ixgbe_fwd_del()
8368 limit = find_last_bit(&adapter->fwd_bitmask, 32); in ixgbe_fwd_del()
8369 adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; in ixgbe_fwd_del()
8373 fwd_adapter->pool, adapter->num_rx_pools, in ixgbe_fwd_del()
8375 fwd_adapter->rx_base_queue + adapter->num_rx_queues_per_pool, in ixgbe_fwd_del()
8376 adapter->fwd_bitmask); in ixgbe_fwd_del()
8457 static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter) in ixgbe_enumerate_functions() argument
8459 struct pci_dev *entry, *pdev = adapter->pdev; in ixgbe_enumerate_functions()
8466 if (ixgbe_pcie_from_parent(&adapter->hw)) in ixgbe_enumerate_functions()
8469 list_for_each_entry(entry, &adapter->pdev->bus->devices, bus_list) { in ixgbe_enumerate_functions()
8500 int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, in ixgbe_wol_supported() argument
8503 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_supported()
8504 u16 wol_cap = adapter->eeprom_cap & IXGBE_DEVICE_CAPS_WOL_MASK; in ixgbe_wol_supported()
8563 static void ixgbe_get_platform_mac_addr(struct ixgbe_adapter *adapter) in ixgbe_get_platform_mac_addr() argument
8566 struct device_node *dp = pci_device_to_OF_node(adapter->pdev); in ixgbe_get_platform_mac_addr()
8567 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_platform_mac_addr()
8596 struct ixgbe_adapter *adapter = NULL; in ixgbe_probe() local
8663 adapter = netdev_priv(netdev); in ixgbe_probe()
8665 adapter->netdev = netdev; in ixgbe_probe()
8666 adapter->pdev = pdev; in ixgbe_probe()
8667 hw = &adapter->hw; in ixgbe_probe()
8668 hw->back = adapter; in ixgbe_probe()
8669 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in ixgbe_probe()
8673 adapter->io_addr = hw->hw_addr; in ixgbe_probe()
8714 err = ixgbe_sw_init(adapter); in ixgbe_probe()
8719 switch (adapter->hw.mac.type) { in ixgbe_probe()
8724 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); in ixgbe_probe()
8734 if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) { in ixgbe_probe()
8760 if (adapter->hw.mac.type == ixgbe_mac_82598EB) in ixgbe_probe()
8766 ixgbe_enable_sriov(adapter); in ixgbe_probe()
8782 switch (adapter->hw.mac.type) { in ixgbe_probe()
8811 switch (adapter->hw.mac.type) { in ixgbe_probe()
8828 if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) { in ixgbe_probe()
8834 adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE; in ixgbe_probe()
8839 adapter->ring_feature[RING_F_FCOE].limit = fcoe_l; in ixgbe_probe()
8854 if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) in ixgbe_probe()
8856 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) in ixgbe_probe()
8866 ixgbe_get_platform_mac_addr(adapter); in ixgbe_probe()
8876 ixgbe_mac_set_default_filter(adapter, hw->mac.perm_addr); in ixgbe_probe()
8878 setup_timer(&adapter->service_timer, &ixgbe_service_timer, in ixgbe_probe()
8879 (unsigned long) adapter); in ixgbe_probe()
8885 INIT_WORK(&adapter->service_task, ixgbe_service_task); in ixgbe_probe()
8886 set_bit(__IXGBE_SERVICE_INITED, &adapter->state); in ixgbe_probe()
8887 clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); in ixgbe_probe()
8889 err = ixgbe_init_interrupt_scheme(adapter); in ixgbe_probe()
8894 adapter->wol = 0; in ixgbe_probe()
8895 hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap); in ixgbe_probe()
8896 hw->wol_enabled = ixgbe_wol_supported(adapter, pdev->device, in ixgbe_probe()
8899 adapter->wol = IXGBE_WUFC_MAG; in ixgbe_probe()
8901 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_probe()
8904 hw->eeprom.ops.read(hw, 0x2e, &adapter->eeprom_verh); in ixgbe_probe()
8905 hw->eeprom.ops.read(hw, 0x2d, &adapter->eeprom_verl); in ixgbe_probe()
8909 ixgbe_get_parent_bus_info(adapter); in ixgbe_probe()
8920 expected_gts = min(ixgbe_enumerate_functions(adapter) * 10, 16); in ixgbe_probe()
8923 expected_gts = ixgbe_enumerate_functions(adapter) * 10; in ixgbe_probe()
8929 ixgbe_check_minimum_link(adapter, expected_gts); in ixgbe_probe()
8960 pci_set_drvdata(pdev, adapter); in ixgbe_probe()
8971 adapter->flags |= IXGBE_FLAG_DCA_ENABLED; in ixgbe_probe()
8972 ixgbe_setup_dca(adapter); in ixgbe_probe()
8975 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_probe()
8976 e_info(probe, "IOV is enabled with %d VFs\n", adapter->num_vfs); in ixgbe_probe()
8977 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_probe()
8994 if (ixgbe_sysfs_init(adapter)) in ixgbe_probe()
8998 ixgbe_dbg_adapter_init(adapter); in ixgbe_probe()
9009 ixgbe_release_hw_control(adapter); in ixgbe_probe()
9010 ixgbe_clear_interrupt_scheme(adapter); in ixgbe_probe()
9012 ixgbe_disable_sriov(adapter); in ixgbe_probe()
9013 adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; in ixgbe_probe()
9014 iounmap(adapter->io_addr); in ixgbe_probe()
9015 kfree(adapter->mac_table); in ixgbe_probe()
9017 disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); in ixgbe_probe()
9024 if (!adapter || disable_dev) in ixgbe_probe()
9040 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_remove() local
9045 if (!adapter) in ixgbe_remove()
9048 netdev = adapter->netdev; in ixgbe_remove()
9049 ixgbe_dbg_adapter_exit(adapter); in ixgbe_remove()
9051 set_bit(__IXGBE_REMOVING, &adapter->state); in ixgbe_remove()
9052 cancel_work_sync(&adapter->service_task); in ixgbe_remove()
9056 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { in ixgbe_remove()
9057 adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED; in ixgbe_remove()
9059 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, in ixgbe_remove()
9065 ixgbe_sysfs_exit(adapter); in ixgbe_remove()
9072 ixgbe_disable_sriov(adapter); in ixgbe_remove()
9077 ixgbe_clear_interrupt_scheme(adapter); in ixgbe_remove()
9079 ixgbe_release_hw_control(adapter); in ixgbe_remove()
9082 kfree(adapter->ixgbe_ieee_pfc); in ixgbe_remove()
9083 kfree(adapter->ixgbe_ieee_ets); in ixgbe_remove()
9086 iounmap(adapter->io_addr); in ixgbe_remove()
9092 kfree(adapter->mac_table); in ixgbe_remove()
9093 disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); in ixgbe_remove()
9113 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_io_error_detected() local
9114 struct net_device *netdev = adapter->netdev; in ixgbe_io_error_detected()
9117 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_io_error_detected()
9123 if (adapter->hw.mac.type == ixgbe_mac_82598EB || in ixgbe_io_error_detected()
9124 adapter->num_vfs == 0) in ixgbe_io_error_detected()
9159 switch (adapter->hw.mac.type) { in ixgbe_io_error_detected()
9191 ixgbe_issue_vf_flr(adapter, vfdev); in ixgbe_io_error_detected()
9205 adapter->vferr_refcount++; in ixgbe_io_error_detected()
9211 if (!test_bit(__IXGBE_SERVICE_INITED, &adapter->state)) in ixgbe_io_error_detected()
9223 ixgbe_down(adapter); in ixgbe_io_error_detected()
9225 if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) in ixgbe_io_error_detected()
9241 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_io_slot_reset() local
9250 clear_bit(__IXGBE_DISABLED, &adapter->state); in ixgbe_io_slot_reset()
9251 adapter->hw.hw_addr = adapter->io_addr; in ixgbe_io_slot_reset()
9258 ixgbe_reset(adapter); in ixgbe_io_slot_reset()
9259 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); in ixgbe_io_slot_reset()
9282 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_io_resume() local
9283 struct net_device *netdev = adapter->netdev; in ixgbe_io_resume()
9286 if (adapter->vferr_refcount) { in ixgbe_io_resume()
9288 adapter->vferr_refcount--; in ixgbe_io_resume()
9294 ixgbe_up(adapter); in ixgbe_io_resume()