Lines Matching +full:activity +full:- +full:signal +full:- +full:sources

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2019 Intel Corporation. */
15 * fm10k_pci_tbl - PCI Device ID Table
35 struct fm10k_intfc *interface = hw->back; in fm10k_read_pci_cfg_word()
38 if (FM10K_REMOVED(hw->hw_addr)) in fm10k_read_pci_cfg_word()
41 pci_read_config_word(interface->pdev, reg, &value); in fm10k_read_pci_cfg_word()
50 u32 __iomem *hw_addr = READ_ONCE(hw->hw_addr); in fm10k_read_reg()
58 struct fm10k_intfc *interface = hw->back; in fm10k_read_reg()
59 struct net_device *netdev = interface->netdev; in fm10k_read_reg()
61 hw->hw_addr = NULL; in fm10k_read_reg()
71 struct fm10k_hw *hw = &interface->hw; in fm10k_hw_ready()
75 return FM10K_REMOVED(hw->hw_addr) ? -ENODEV : 0; in fm10k_hw_ready()
79 * fm10k_macvlan_schedule - Schedule MAC/VLAN queue task
90 if (!test_bit(__FM10K_MACVLAN_DISABLE, interface->state) && in fm10k_macvlan_schedule()
91 !test_and_set_bit(__FM10K_MACVLAN_SCHED, interface->state)) { in fm10k_macvlan_schedule()
92 clear_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_schedule()
99 &interface->macvlan_task, 10); in fm10k_macvlan_schedule()
101 set_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_schedule()
106 * fm10k_stop_macvlan_task - Stop the MAC/VLAN queue monitor
115 set_bit(__FM10K_MACVLAN_DISABLE, interface->state); in fm10k_stop_macvlan_task()
118 cancel_delayed_work_sync(&interface->macvlan_task); in fm10k_stop_macvlan_task()
126 clear_bit(__FM10K_MACVLAN_SCHED, interface->state); in fm10k_stop_macvlan_task()
130 * fm10k_resume_macvlan_task - Restart the MAC/VLAN queue monitor
138 /* Re-enable the MAC/VLAN work item */ in fm10k_resume_macvlan_task()
139 clear_bit(__FM10K_MACVLAN_DISABLE, interface->state); in fm10k_resume_macvlan_task()
144 if (test_bit(__FM10K_MACVLAN_REQUEST, interface->state)) in fm10k_resume_macvlan_task()
150 if (!test_bit(__FM10K_SERVICE_DISABLE, interface->state) && in fm10k_service_event_schedule()
151 !test_and_set_bit(__FM10K_SERVICE_SCHED, interface->state)) { in fm10k_service_event_schedule()
152 clear_bit(__FM10K_SERVICE_REQUEST, interface->state); in fm10k_service_event_schedule()
153 queue_work(fm10k_workqueue, &interface->service_task); in fm10k_service_event_schedule()
155 set_bit(__FM10K_SERVICE_REQUEST, interface->state); in fm10k_service_event_schedule()
161 WARN_ON(!test_bit(__FM10K_SERVICE_SCHED, interface->state)); in fm10k_service_event_complete()
165 clear_bit(__FM10K_SERVICE_SCHED, interface->state); in fm10k_service_event_complete()
168 * re-schedule now. This ensures we don't drop a request until the in fm10k_service_event_complete()
171 if (test_bit(__FM10K_SERVICE_REQUEST, interface->state)) in fm10k_service_event_complete()
177 set_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_stop_service_event()
178 cancel_work_sync(&interface->service_task); in fm10k_stop_service_event()
187 clear_bit(__FM10K_SERVICE_SCHED, interface->state); in fm10k_stop_service_event()
192 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_start_service_event()
197 * fm10k_service_timer - Timer Call-back
206 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_service_timer()
212 * fm10k_prepare_for_reset - Prepare the driver and device for a pending reset
221 struct net_device *netdev = interface->netdev; in fm10k_prepare_for_reset()
227 if (test_and_set_bit(__FM10K_RESETTING, interface->state)) in fm10k_prepare_for_reset()
238 fm10k_iov_suspend(interface->pdev); in fm10k_prepare_for_reset()
249 interface->last_reset = jiffies + (10 * HZ); in fm10k_prepare_for_reset()
258 struct net_device *netdev = interface->netdev; in fm10k_handle_reset()
259 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_reset()
262 WARN_ON(!test_bit(__FM10K_RESETTING, interface->state)); in fm10k_handle_reset()
266 pci_set_master(interface->pdev); in fm10k_handle_reset()
269 err = hw->mac.ops.reset_hw(hw); in fm10k_handle_reset()
271 dev_err(&interface->pdev->dev, "reset_hw failed: %d\n", err); in fm10k_handle_reset()
275 err = hw->mac.ops.init_hw(hw); in fm10k_handle_reset()
277 dev_err(&interface->pdev->dev, "init_hw failed: %d\n", err); in fm10k_handle_reset()
283 dev_err(&interface->pdev->dev, in fm10k_handle_reset()
288 /* re-associate interrupts */ in fm10k_handle_reset()
298 if (hw->mac.type == fm10k_mac_vf) { in fm10k_handle_reset()
299 if (is_valid_ether_addr(hw->mac.perm_addr)) { in fm10k_handle_reset()
300 ether_addr_copy(hw->mac.addr, hw->mac.perm_addr); in fm10k_handle_reset()
301 ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr); in fm10k_handle_reset()
302 eth_hw_addr_set(netdev, hw->mac.perm_addr); in fm10k_handle_reset()
303 netdev->addr_assign_type &= ~NET_ADDR_RANDOM; in fm10k_handle_reset()
306 if (hw->mac.vlan_override) in fm10k_handle_reset()
307 netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; in fm10k_handle_reset()
309 netdev->features |= NETIF_F_HW_VLAN_CTAG_RX; in fm10k_handle_reset()
316 fm10k_iov_resume(interface->pdev); in fm10k_handle_reset()
322 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
334 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
341 struct net_device *netdev = interface->netdev; in fm10k_detach_subtask()
346 if (netif_device_present(netdev) || interface->hw.hw_addr) in fm10k_detach_subtask()
355 set_bit(__FM10K_RESET_DETACHED, interface->state); in fm10k_detach_subtask()
358 hw_addr = READ_ONCE(interface->uc_addr); in fm10k_detach_subtask()
367 interface->state)) in fm10k_detach_subtask()
371 interface->hw.hw_addr = interface->uc_addr; in fm10k_detach_subtask()
379 interface->hw.hw_addr = NULL; in fm10k_detach_subtask()
383 /* Re-attach the netdev */ in fm10k_detach_subtask()
395 interface->flags)) in fm10k_reset_subtask()
408 netdev_err(interface->netdev, "Reset interface\n"); in fm10k_reset_subtask()
412 dev_err(&interface->pdev->dev, in fm10k_reset_subtask()
417 * fm10k_configure_swpri_map - Configure Receive SWPRI to PC mapping
424 struct net_device *netdev = interface->netdev; in fm10k_configure_swpri_map()
425 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_swpri_map()
429 clear_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags); in fm10k_configure_swpri_map()
432 if (hw->mac.type != fm10k_mac_pf) in fm10k_configure_swpri_map()
442 * fm10k_watchdog_update_host_state - Update the link status based on host.
447 struct fm10k_hw *hw = &interface->hw; in fm10k_watchdog_update_host_state()
450 if (test_bit(__FM10K_LINK_DOWN, interface->state)) { in fm10k_watchdog_update_host_state()
451 interface->host_ready = false; in fm10k_watchdog_update_host_state()
452 if (time_is_after_jiffies(interface->link_down_event)) in fm10k_watchdog_update_host_state()
454 clear_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_watchdog_update_host_state()
457 if (test_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags)) { in fm10k_watchdog_update_host_state()
467 err = hw->mac.ops.get_host_state(hw, &interface->host_ready); in fm10k_watchdog_update_host_state()
468 if (err && time_is_before_jiffies(interface->last_reset)) in fm10k_watchdog_update_host_state()
469 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_watchdog_update_host_state()
476 * fm10k_mbx_subtask - Process upstream and downstream mailboxes
484 if (test_bit(__FM10K_RESETTING, interface->state)) in fm10k_mbx_subtask()
495 * fm10k_watchdog_host_is_ready - Update netdev status based on host ready
500 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_is_ready()
513 * fm10k_watchdog_host_not_ready - Update netdev status based on host not ready
518 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_not_ready()
531 * fm10k_update_stats - Update the board statistics counters.
536 struct net_device_stats *net_stats = &interface->netdev->stats; in fm10k_update_stats()
537 struct fm10k_hw *hw = &interface->hw; in fm10k_update_stats()
549 if (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state)) in fm10k_update_stats()
553 interface->next_stats_update = jiffies + HZ; in fm10k_update_stats()
556 for (bytes = 0, pkts = 0, i = 0; i < interface->num_tx_queues; i++) { in fm10k_update_stats()
557 struct fm10k_ring *tx_ring = READ_ONCE(interface->tx_ring[i]); in fm10k_update_stats()
562 restart_queue += tx_ring->tx_stats.restart_queue; in fm10k_update_stats()
563 tx_busy += tx_ring->tx_stats.tx_busy; in fm10k_update_stats()
564 tx_csum_errors += tx_ring->tx_stats.csum_err; in fm10k_update_stats()
565 bytes += tx_ring->stats.bytes; in fm10k_update_stats()
566 pkts += tx_ring->stats.packets; in fm10k_update_stats()
567 hw_csum_tx_good += tx_ring->tx_stats.csum_good; in fm10k_update_stats()
570 interface->restart_queue = restart_queue; in fm10k_update_stats()
571 interface->tx_busy = tx_busy; in fm10k_update_stats()
572 net_stats->tx_bytes = bytes; in fm10k_update_stats()
573 net_stats->tx_packets = pkts; in fm10k_update_stats()
574 interface->tx_csum_errors = tx_csum_errors; in fm10k_update_stats()
575 interface->hw_csum_tx_good = hw_csum_tx_good; in fm10k_update_stats()
578 for (bytes = 0, pkts = 0, i = 0; i < interface->num_rx_queues; i++) { in fm10k_update_stats()
579 struct fm10k_ring *rx_ring = READ_ONCE(interface->rx_ring[i]); in fm10k_update_stats()
584 bytes += rx_ring->stats.bytes; in fm10k_update_stats()
585 pkts += rx_ring->stats.packets; in fm10k_update_stats()
586 alloc_failed += rx_ring->rx_stats.alloc_failed; in fm10k_update_stats()
587 rx_csum_errors += rx_ring->rx_stats.csum_err; in fm10k_update_stats()
588 rx_errors += rx_ring->rx_stats.errors; in fm10k_update_stats()
589 hw_csum_rx_good += rx_ring->rx_stats.csum_good; in fm10k_update_stats()
590 rx_switch_errors += rx_ring->rx_stats.switch_errors; in fm10k_update_stats()
591 rx_drops += rx_ring->rx_stats.drops; in fm10k_update_stats()
592 rx_pp_errors += rx_ring->rx_stats.pp_errors; in fm10k_update_stats()
593 rx_link_errors += rx_ring->rx_stats.link_errors; in fm10k_update_stats()
594 rx_length_errors += rx_ring->rx_stats.length_errors; in fm10k_update_stats()
597 net_stats->rx_bytes = bytes; in fm10k_update_stats()
598 net_stats->rx_packets = pkts; in fm10k_update_stats()
599 interface->alloc_failed = alloc_failed; in fm10k_update_stats()
600 interface->rx_csum_errors = rx_csum_errors; in fm10k_update_stats()
601 interface->hw_csum_rx_good = hw_csum_rx_good; in fm10k_update_stats()
602 interface->rx_switch_errors = rx_switch_errors; in fm10k_update_stats()
603 interface->rx_drops = rx_drops; in fm10k_update_stats()
604 interface->rx_pp_errors = rx_pp_errors; in fm10k_update_stats()
605 interface->rx_link_errors = rx_link_errors; in fm10k_update_stats()
606 interface->rx_length_errors = rx_length_errors; in fm10k_update_stats()
608 hw->mac.ops.update_hw_stats(hw, &interface->stats); in fm10k_update_stats()
610 for (i = 0; i < hw->mac.max_queues; i++) { in fm10k_update_stats()
611 struct fm10k_hw_stats_q *q = &interface->stats.q[i]; in fm10k_update_stats()
613 tx_bytes_nic += q->tx_bytes.count; in fm10k_update_stats()
614 tx_pkts_nic += q->tx_packets.count; in fm10k_update_stats()
615 rx_bytes_nic += q->rx_bytes.count; in fm10k_update_stats()
616 rx_pkts_nic += q->rx_packets.count; in fm10k_update_stats()
617 rx_drops_nic += q->rx_drops.count; in fm10k_update_stats()
620 interface->tx_bytes_nic = tx_bytes_nic; in fm10k_update_stats()
621 interface->tx_packets_nic = tx_pkts_nic; in fm10k_update_stats()
622 interface->rx_bytes_nic = rx_bytes_nic; in fm10k_update_stats()
623 interface->rx_packets_nic = rx_pkts_nic; in fm10k_update_stats()
624 interface->rx_drops_nic = rx_drops_nic; in fm10k_update_stats()
627 net_stats->rx_errors = rx_errors; in fm10k_update_stats()
628 net_stats->rx_dropped = interface->stats.nodesc_drop.count; in fm10k_update_stats()
633 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_update_stats()
637 * fm10k_watchdog_flush_tx - flush queues on host not ready
646 if (netif_carrier_ok(interface->netdev)) in fm10k_watchdog_flush_tx()
649 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_watchdog_flush_tx()
650 struct fm10k_ring *tx_ring = interface->tx_ring[i]; in fm10k_watchdog_flush_tx()
652 if (tx_ring->next_to_use != tx_ring->next_to_clean) { in fm10k_watchdog_flush_tx()
663 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_watchdog_flush_tx()
667 * fm10k_watchdog_subtask - check and bring link up
673 if (test_bit(__FM10K_DOWN, interface->state) || in fm10k_watchdog_subtask()
674 test_bit(__FM10K_RESETTING, interface->state)) in fm10k_watchdog_subtask()
677 if (interface->host_ready) in fm10k_watchdog_subtask()
683 if (time_is_before_jiffies(interface->next_stats_update)) in fm10k_watchdog_subtask()
691 * fm10k_check_hang_subtask - check for hung queues and dropped interrupts
702 if (test_bit(__FM10K_DOWN, interface->state) || in fm10k_check_hang_subtask()
703 test_bit(__FM10K_RESETTING, interface->state)) in fm10k_check_hang_subtask()
707 if (time_is_after_eq_jiffies(interface->next_tx_hang_check)) in fm10k_check_hang_subtask()
709 interface->next_tx_hang_check = jiffies + (2 * HZ); in fm10k_check_hang_subtask()
711 if (netif_carrier_ok(interface->netdev)) { in fm10k_check_hang_subtask()
715 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_check_hang_subtask()
716 set_check_for_tx_hang(interface->tx_ring[i]); in fm10k_check_hang_subtask()
718 /* Rearm all in-use q_vectors for immediate firing */ in fm10k_check_hang_subtask()
719 for (i = 0; i < interface->num_q_vectors; i++) { in fm10k_check_hang_subtask()
720 struct fm10k_q_vector *qv = interface->q_vector[i]; in fm10k_check_hang_subtask()
722 if (!qv->tx.count && !qv->rx.count) in fm10k_check_hang_subtask()
724 writel(FM10K_ITR_ENABLE | FM10K_ITR_PENDING2, qv->itr); in fm10k_check_hang_subtask()
730 * fm10k_service_task - manages and runs subtasks
755 * fm10k_macvlan_task - send queued MAC/VLAN requests to switch manager
776 hw = &interface->hw; in fm10k_macvlan_task()
777 requests = &interface->macvlan_requests; in fm10k_macvlan_task()
781 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
786 list_del_init(&item->list); in fm10k_macvlan_task()
788 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
801 if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU + 5)) { in fm10k_macvlan_task()
802 hw->mbx.ops.process(hw, &hw->mbx); in fm10k_macvlan_task()
803 set_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_task()
807 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
808 list_add(&item->list, requests); in fm10k_macvlan_task()
809 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
813 switch (item->type) { in fm10k_macvlan_task()
815 hw->mac.ops.update_mc_addr(hw, in fm10k_macvlan_task()
816 item->mac.glort, in fm10k_macvlan_task()
817 item->mac.addr, in fm10k_macvlan_task()
818 item->mac.vid, in fm10k_macvlan_task()
819 item->set); in fm10k_macvlan_task()
822 hw->mac.ops.update_uc_addr(hw, in fm10k_macvlan_task()
823 item->mac.glort, in fm10k_macvlan_task()
824 item->mac.addr, in fm10k_macvlan_task()
825 item->mac.vid, in fm10k_macvlan_task()
826 item->set, in fm10k_macvlan_task()
830 hw->mac.ops.update_vlan(hw, in fm10k_macvlan_task()
831 item->vlan.vid, in fm10k_macvlan_task()
832 item->vlan.vsi, in fm10k_macvlan_task()
833 item->set); in fm10k_macvlan_task()
846 WARN_ON(!test_bit(__FM10K_MACVLAN_SCHED, interface->state)); in fm10k_macvlan_task()
850 clear_bit(__FM10K_MACVLAN_SCHED, interface->state); in fm10k_macvlan_task()
853 * re-schedule. However, there is no reason to re-schedule if there is in fm10k_macvlan_task()
856 if (test_bit(__FM10K_MACVLAN_REQUEST, interface->state)) in fm10k_macvlan_task()
861 * fm10k_configure_tx_ring - Configure Tx ring after Reset
870 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_tx_ring()
871 u64 tdba = ring->dma; in fm10k_configure_tx_ring()
872 u32 size = ring->count * sizeof(struct fm10k_tx_desc); in fm10k_configure_tx_ring()
875 u8 reg_idx = ring->reg_idx; in fm10k_configure_tx_ring()
893 ring->tail = &interface->uc_addr[FM10K_TDT(reg_idx)]; in fm10k_configure_tx_ring()
896 ring->next_to_clean = 0; in fm10k_configure_tx_ring()
897 ring->next_to_use = 0; in fm10k_configure_tx_ring()
900 if (ring->q_vector) { in fm10k_configure_tx_ring()
901 txint = ring->q_vector->v_idx + NON_Q_VECTORS; in fm10k_configure_tx_ring()
912 if (!test_and_set_bit(__FM10K_TX_XPS_INIT_DONE, ring->state) && in fm10k_configure_tx_ring()
913 ring->q_vector) in fm10k_configure_tx_ring()
914 netif_set_xps_queue(ring->netdev, in fm10k_configure_tx_ring()
915 &ring->q_vector->affinity_mask, in fm10k_configure_tx_ring()
916 ring->queue_index); in fm10k_configure_tx_ring()
923 * fm10k_enable_tx_ring - Verify Tx ring is enabled after configuration
932 struct fm10k_hw *hw = &interface->hw; in fm10k_enable_tx_ring()
935 u8 reg_idx = ring->reg_idx; in fm10k_enable_tx_ring()
945 } while (!(txdctl & FM10K_TXDCTL_ENABLE) && --wait_loop); in fm10k_enable_tx_ring()
947 netif_err(interface, drv, interface->netdev, in fm10k_enable_tx_ring()
952 * fm10k_configure_tx - Configure Transmit Unit after Reset
962 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_configure_tx()
963 fm10k_configure_tx_ring(interface, interface->tx_ring[i]); in fm10k_configure_tx()
966 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_configure_tx()
967 fm10k_enable_tx_ring(interface, interface->tx_ring[i]); in fm10k_configure_tx()
971 * fm10k_configure_rx_ring - Configure Rx ring after Reset
980 u64 rdba = ring->dma; in fm10k_configure_rx_ring()
981 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_rx_ring()
982 u32 size = ring->count * sizeof(union fm10k_rx_desc); in fm10k_configure_rx_ring()
986 u8 rx_pause = interface->rx_pause; in fm10k_configure_rx_ring()
987 u8 reg_idx = ring->reg_idx; in fm10k_configure_rx_ring()
1007 ring->tail = &interface->uc_addr[FM10K_RDT(reg_idx)]; in fm10k_configure_rx_ring()
1010 ring->next_to_clean = 0; in fm10k_configure_rx_ring()
1011 ring->next_to_use = 0; in fm10k_configure_rx_ring()
1012 ring->next_to_alloc = 0; in fm10k_configure_rx_ring()
1023 if (interface->pfc_en) in fm10k_configure_rx_ring()
1024 rx_pause = interface->pfc_en; in fm10k_configure_rx_ring()
1026 if (!(rx_pause & BIT(ring->qos_pc))) in fm10k_configure_rx_ring()
1032 ring->vid = hw->mac.default_vid; in fm10k_configure_rx_ring()
1035 if (test_bit(hw->mac.default_vid, interface->active_vlans)) in fm10k_configure_rx_ring()
1036 ring->vid |= FM10K_VLAN_CLEAR; in fm10k_configure_rx_ring()
1039 if (ring->q_vector) { in fm10k_configure_rx_ring()
1040 rxint = ring->q_vector->v_idx + NON_Q_VECTORS; in fm10k_configure_rx_ring()
1056 * fm10k_update_rx_drop_en - Configures the drop enable bits for Rx rings
1063 struct fm10k_hw *hw = &interface->hw; in fm10k_update_rx_drop_en()
1064 u8 rx_pause = interface->rx_pause; in fm10k_update_rx_drop_en()
1068 if (interface->pfc_en) in fm10k_update_rx_drop_en()
1069 rx_pause = interface->pfc_en; in fm10k_update_rx_drop_en()
1072 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_update_rx_drop_en()
1073 struct fm10k_ring *ring = interface->rx_ring[i]; in fm10k_update_rx_drop_en()
1075 u8 reg_idx = ring->reg_idx; in fm10k_update_rx_drop_en()
1077 if (!(rx_pause & BIT(ring->qos_pc))) in fm10k_update_rx_drop_en()
1085 * fm10k_configure_dglort - Configure Receive DGLORT after reset
1093 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_dglort()
1099 fm10k_write_reg(hw, FM10K_RSSRK(0, i), interface->rssrk[i]); in fm10k_configure_dglort()
1103 fm10k_write_reg(hw, FM10K_RETA(0, i), interface->reta[i]); in fm10k_configure_dglort()
1113 if (test_bit(FM10K_FLAG_RSS_FIELD_IPV4_UDP, interface->flags)) in fm10k_configure_dglort()
1115 if (test_bit(FM10K_FLAG_RSS_FIELD_IPV6_UDP, interface->flags)) in fm10k_configure_dglort()
1122 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_configure_dglort()
1123 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_configure_dglort()
1124 hw->mac.ops.configure_dglort_map(hw, &dglort); in fm10k_configure_dglort()
1127 if (interface->glort_count > 64) { in fm10k_configure_dglort()
1130 dglort.glort = interface->glort + 64; in fm10k_configure_dglort()
1132 dglort.queue_l = fls(interface->num_rx_queues - 1); in fm10k_configure_dglort()
1133 hw->mac.ops.configure_dglort_map(hw, &dglort); in fm10k_configure_dglort()
1139 dglort.glort = interface->glort; in fm10k_configure_dglort()
1140 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_configure_dglort()
1141 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_configure_dglort()
1144 if (interface->l2_accel) in fm10k_configure_dglort()
1145 dglort.shared_l = fls(interface->l2_accel->size); in fm10k_configure_dglort()
1146 hw->mac.ops.configure_dglort_map(hw, &dglort); in fm10k_configure_dglort()
1150 * fm10k_configure_rx - Configure Receive Unit after Reset
1166 for (i = 0; i < interface->num_rx_queues; i++) in fm10k_configure_rx()
1167 fm10k_configure_rx_ring(interface, interface->rx_ring[i]); in fm10k_configure_rx()
1177 for (q_idx = 0; q_idx < interface->num_q_vectors; q_idx++) { in fm10k_napi_enable_all()
1178 q_vector = interface->q_vector[q_idx]; in fm10k_napi_enable_all()
1179 napi_enable(&q_vector->napi); in fm10k_napi_enable_all()
1187 if (q_vector->rx.count || q_vector->tx.count) in fm10k_msix_clean_rings()
1188 napi_schedule_irqoff(&q_vector->napi); in fm10k_msix_clean_rings()
1196 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_vf()
1197 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_msix_mbx_vf()
1199 /* re-enable mailbox interrupt and indicate 20us delay */ in fm10k_msix_mbx_vf()
1201 (FM10K_MBX_INT_DELAY >> hw->mac.itr_scale) | in fm10k_msix_mbx_vf()
1206 mbx->ops.process(hw, mbx); in fm10k_msix_mbx_vf()
1210 hw->mac.get_host_state = true; in fm10k_msix_mbx_vf()
1220 struct pci_dev *pdev = interface->pdev; in fm10k_handle_fault()
1221 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_fault()
1222 struct fm10k_iov_data *iov_data = interface->iov_data; in fm10k_handle_fault()
1227 switch (fault->type) { in fm10k_handle_fault()
1241 switch (fault->type) { in fm10k_handle_fault()
1250 switch (fault->type) { in fm10k_handle_fault()
1272 dev_warn(&pdev->dev, in fm10k_handle_fault()
1274 error, fault->address, fault->specinfo, in fm10k_handle_fault()
1275 PCI_SLOT(fault->func), PCI_FUNC(fault->func)); in fm10k_handle_fault()
1280 * the result of non-malicious behavior this will log the fault and in fm10k_handle_fault()
1286 if (fault->func && iov_data) { in fm10k_handle_fault()
1287 int vf = fault->func - 1; in fm10k_handle_fault()
1288 struct fm10k_vf_info *vf_info = &iov_data->vf_info[vf]; in fm10k_handle_fault()
1290 hw->iov.ops.reset_lport(hw, vf_info); in fm10k_handle_fault()
1291 hw->iov.ops.reset_resources(hw, vf_info); in fm10k_handle_fault()
1293 /* reset_lport disables the VF, so re-enable it */ in fm10k_handle_fault()
1294 hw->iov.ops.set_lport(hw, vf_info, vf, in fm10k_handle_fault()
1298 vf_info->mbx.ops.connect(hw, &vf_info->mbx); in fm10k_handle_fault()
1304 struct fm10k_hw *hw = &interface->hw; in fm10k_report_fault()
1316 err = hw->mac.ops.get_fault(hw, type, &fault); in fm10k_report_fault()
1318 dev_err(&interface->pdev->dev, in fm10k_report_fault()
1329 struct fm10k_hw *hw = &interface->hw; in fm10k_reset_drop_on_empty()
1343 interface->rx_overrun_pf++; in fm10k_reset_drop_on_empty()
1346 interface->rx_overrun_vf++; in fm10k_reset_drop_on_empty()
1352 q &= ~(32 - 1); in fm10k_reset_drop_on_empty()
1357 if (q-- % 32) in fm10k_reset_drop_on_empty()
1369 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_pf()
1370 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_msix_mbx_pf()
1387 s32 err = mbx->ops.process(hw, mbx); in fm10k_msix_mbx_pf()
1390 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_msix_mbx_pf()
1400 interface->link_down_event = jiffies + (4 * HZ); in fm10k_msix_mbx_pf()
1401 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_msix_mbx_pf()
1404 hw->mac.dglort_map = FM10K_DGLORTMAP_NONE; in fm10k_msix_mbx_pf()
1408 hw->mac.get_host_state = true; in fm10k_msix_mbx_pf()
1413 /* re-enable mailbox interrupt and indicate 20us delay */ in fm10k_msix_mbx_pf()
1415 (FM10K_MBX_INT_DELAY >> hw->mac.itr_scale) | in fm10k_msix_mbx_pf()
1423 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_free_irq()
1427 /* no mailbox IRQ to free if MSI-X is not enabled */ in fm10k_mbx_free_irq()
1428 if (!interface->msix_entries) in fm10k_mbx_free_irq()
1431 entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_free_irq()
1434 hw->mbx.ops.disconnect(hw, &hw->mbx); in fm10k_mbx_free_irq()
1437 if (hw->mac.type == fm10k_mac_pf) { in fm10k_mbx_free_irq()
1454 free_irq(entry->vector, interface); in fm10k_mbx_free_irq()
1460 bool vlan_override = hw->mac.vlan_override; in fm10k_mbx_mac_addr()
1461 u16 default_vid = hw->mac.default_vid; in fm10k_mbx_mac_addr()
1472 if (is_valid_ether_addr(hw->mac.perm_addr) && in fm10k_mbx_mac_addr()
1473 !ether_addr_equal(hw->mac.perm_addr, hw->mac.addr)) in fm10k_mbx_mac_addr()
1474 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1477 if ((vlan_override != hw->mac.vlan_override) || in fm10k_mbx_mac_addr()
1478 (default_vid != hw->mac.default_vid)) in fm10k_mbx_mac_addr()
1479 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1492 pdev = interface->pdev; in fm10k_mbx_error()
1494 dev_err(&pdev->dev, "Unknown message ID %u\n", in fm10k_mbx_error()
1509 struct msix_entry *entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_request_irq_vf()
1510 struct net_device *dev = interface->netdev; in fm10k_mbx_request_irq_vf()
1511 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq_vf()
1515 u32 itr = entry->entry | FM10K_INT_MAP_TIMER0; in fm10k_mbx_request_irq_vf()
1518 err = hw->mbx.ops.register_handlers(&hw->mbx, vf_mbx_data); in fm10k_mbx_request_irq_vf()
1523 err = request_irq(entry->vector, fm10k_msix_mbx_vf, 0, in fm10k_mbx_request_irq_vf()
1524 dev->name, interface); in fm10k_mbx_request_irq_vf()
1531 /* map all of the interrupt sources */ in fm10k_mbx_request_irq_vf()
1535 fm10k_write_reg(hw, FM10K_VFITR(entry->entry), FM10K_ITR_ENABLE); in fm10k_mbx_request_irq_vf()
1544 u32 dglort_map = hw->mac.dglort_map; in fm10k_lport_map()
1550 if (!err && hw->swapi.status) { in fm10k_lport_map()
1552 interface->link_down_event = jiffies + (2 * HZ); in fm10k_lport_map()
1553 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_lport_map()
1556 hw->mac.dglort_map = FM10K_DGLORTMAP_NONE; in fm10k_lport_map()
1561 if (interface->lport_map_failed) in fm10k_lport_map()
1564 interface->lport_map_failed = true; in fm10k_lport_map()
1566 if (hw->swapi.status == FM10K_MSG_ERR_PEP_NOT_SCHEDULED) in fm10k_lport_map()
1567 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1569 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1571 hw->swapi.status); in fm10k_lport_map()
1580 interface->lport_map_failed = false; in fm10k_lport_map()
1583 if (dglort_map != hw->mac.dglort_map) in fm10k_lport_map()
1584 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_lport_map()
1622 if (pvid != hw->mac.default_vid) in fm10k_update_pvid()
1623 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_update_pvid()
1625 hw->mac.default_vid = pvid; in fm10k_update_pvid()
1642 struct msix_entry *entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_request_irq_pf()
1643 struct net_device *dev = interface->netdev; in fm10k_mbx_request_irq_pf()
1644 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq_pf()
1648 u32 mbx_itr = entry->entry | FM10K_INT_MAP_TIMER0; in fm10k_mbx_request_irq_pf()
1649 u32 other_itr = entry->entry | FM10K_INT_MAP_IMMEDIATE; in fm10k_mbx_request_irq_pf()
1652 err = hw->mbx.ops.register_handlers(&hw->mbx, pf_mbx_data); in fm10k_mbx_request_irq_pf()
1657 err = request_irq(entry->vector, fm10k_msix_mbx_pf, 0, in fm10k_mbx_request_irq_pf()
1658 dev->name, interface); in fm10k_mbx_request_irq_pf()
1686 fm10k_write_reg(hw, FM10K_ITR(entry->entry), FM10K_ITR_ENABLE); in fm10k_mbx_request_irq_pf()
1693 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq()
1697 if (hw->mac.type == fm10k_mac_pf) in fm10k_mbx_request_irq()
1705 err = hw->mbx.ops.connect(hw, &hw->mbx); in fm10k_mbx_request_irq()
1715 * fm10k_qv_free_irq - release interrupts associated with queue vectors
1722 int vector = interface->num_q_vectors; in fm10k_qv_free_irq()
1725 entry = &interface->msix_entries[NON_Q_VECTORS + vector]; in fm10k_qv_free_irq()
1730 vector--; in fm10k_qv_free_irq()
1731 entry--; in fm10k_qv_free_irq()
1732 q_vector = interface->q_vector[vector]; in fm10k_qv_free_irq()
1734 if (!q_vector->tx.count && !q_vector->rx.count) in fm10k_qv_free_irq()
1738 irq_set_affinity_hint(entry->vector, NULL); in fm10k_qv_free_irq()
1741 writel(FM10K_ITR_MASK_SET, q_vector->itr); in fm10k_qv_free_irq()
1743 free_irq(entry->vector, q_vector); in fm10k_qv_free_irq()
1748 * fm10k_qv_request_irq - initialize interrupts for queue vectors
1756 struct net_device *dev = interface->netdev; in fm10k_qv_request_irq()
1757 struct fm10k_hw *hw = &interface->hw; in fm10k_qv_request_irq()
1762 entry = &interface->msix_entries[NON_Q_VECTORS]; in fm10k_qv_request_irq()
1764 for (vector = 0; vector < interface->num_q_vectors; vector++) { in fm10k_qv_request_irq()
1765 struct fm10k_q_vector *q_vector = interface->q_vector[vector]; in fm10k_qv_request_irq()
1768 if (q_vector->tx.count && q_vector->rx.count) { in fm10k_qv_request_irq()
1769 snprintf(q_vector->name, sizeof(q_vector->name), in fm10k_qv_request_irq()
1770 "%s-TxRx-%u", dev->name, ri++); in fm10k_qv_request_irq()
1772 } else if (q_vector->rx.count) { in fm10k_qv_request_irq()
1773 snprintf(q_vector->name, sizeof(q_vector->name), in fm10k_qv_request_irq()
1774 "%s-rx-%u", dev->name, ri++); in fm10k_qv_request_irq()
1775 } else if (q_vector->tx.count) { in fm10k_qv_request_irq()
1776 snprintf(q_vector->name, sizeof(q_vector->name), in fm10k_qv_request_irq()
1777 "%s-tx-%u", dev->name, ti++); in fm10k_qv_request_irq()
1784 q_vector->itr = (hw->mac.type == fm10k_mac_pf) ? in fm10k_qv_request_irq()
1785 &interface->uc_addr[FM10K_ITR(entry->entry)] : in fm10k_qv_request_irq()
1786 &interface->uc_addr[FM10K_VFITR(entry->entry)]; in fm10k_qv_request_irq()
1789 err = request_irq(entry->vector, &fm10k_msix_clean_rings, 0, in fm10k_qv_request_irq()
1790 q_vector->name, q_vector); in fm10k_qv_request_irq()
1799 irq_set_affinity_hint(entry->vector, &q_vector->affinity_mask); in fm10k_qv_request_irq()
1802 writel(FM10K_ITR_ENABLE, q_vector->itr); in fm10k_qv_request_irq()
1814 entry--; in fm10k_qv_request_irq()
1815 vector--; in fm10k_qv_request_irq()
1816 q_vector = interface->q_vector[vector]; in fm10k_qv_request_irq()
1818 if (!q_vector->tx.count && !q_vector->rx.count) in fm10k_qv_request_irq()
1822 irq_set_affinity_hint(entry->vector, NULL); in fm10k_qv_request_irq()
1825 writel(FM10K_ITR_MASK_SET, q_vector->itr); in fm10k_qv_request_irq()
1827 free_irq(entry->vector, q_vector); in fm10k_qv_request_irq()
1835 struct fm10k_hw *hw = &interface->hw; in fm10k_up()
1838 hw->mac.ops.start_hw(hw); in fm10k_up()
1847 hw->mac.ops.update_int_moderator(hw); in fm10k_up()
1850 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_up()
1853 clear_bit(__FM10K_DOWN, interface->state); in fm10k_up()
1858 /* re-establish Rx filters */ in fm10k_up()
1862 netif_tx_start_all_queues(interface->netdev); in fm10k_up()
1865 hw->mac.get_host_state = true; in fm10k_up()
1866 mod_timer(&interface->service_timer, jiffies); in fm10k_up()
1874 for (q_idx = 0; q_idx < interface->num_q_vectors; q_idx++) { in fm10k_napi_disable_all()
1875 q_vector = interface->q_vector[q_idx]; in fm10k_napi_disable_all()
1876 napi_disable(&q_vector->napi); in fm10k_napi_disable_all()
1882 struct net_device *netdev = interface->netdev; in fm10k_down()
1883 struct fm10k_hw *hw = &interface->hw; in fm10k_down()
1886 /* signal that we are down to the interrupt handler and service task */ in fm10k_down()
1887 if (test_and_set_bit(__FM10K_DOWN, interface->state)) in fm10k_down()
1907 while (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state)) in fm10k_down()
1911 if (FM10K_REMOVED(hw->hw_addr)) in fm10k_down()
1922 err = hw->mac.ops.stop_hw(hw); in fm10k_down()
1931 for (; i < interface->num_tx_queues; i++) in fm10k_down()
1932 if (fm10k_get_tx_pending(interface->tx_ring[i], false)) in fm10k_down()
1936 if (i == interface->num_tx_queues) in fm10k_down()
1941 dev_err(&interface->pdev->dev, in fm10k_down()
1946 err = hw->mac.ops.stop_hw(hw); in fm10k_down()
1948 dev_err(&interface->pdev->dev, in fm10k_down()
1951 dev_err(&interface->pdev->dev, "stop_hw failed: %d\n", err); in fm10k_down()
1959 * fm10k_sw_init - Initialize general software structures
1970 const struct fm10k_info *fi = fm10k_info_tbl[ent->driver_data]; in fm10k_sw_init()
1971 struct fm10k_hw *hw = &interface->hw; in fm10k_sw_init()
1972 struct pci_dev *pdev = interface->pdev; in fm10k_sw_init()
1973 struct net_device *netdev = interface->netdev; in fm10k_sw_init()
1979 hw->back = interface; in fm10k_sw_init()
1980 hw->hw_addr = interface->uc_addr; in fm10k_sw_init()
1983 hw->vendor_id = pdev->vendor; in fm10k_sw_init()
1984 hw->device_id = pdev->device; in fm10k_sw_init()
1985 hw->revision_id = pdev->revision; in fm10k_sw_init()
1986 hw->subsystem_vendor_id = pdev->subsystem_vendor; in fm10k_sw_init()
1987 hw->subsystem_device_id = pdev->subsystem_device; in fm10k_sw_init()
1990 memcpy(&hw->mac.ops, fi->mac_ops, sizeof(hw->mac.ops)); in fm10k_sw_init()
1991 hw->mac.type = fi->mac; in fm10k_sw_init()
1994 if (fi->iov_ops) in fm10k_sw_init()
1995 memcpy(&hw->iov.ops, fi->iov_ops, sizeof(hw->iov.ops)); in fm10k_sw_init()
1999 interface->ring_feature[RING_F_RSS].limit = rss; in fm10k_sw_init()
2000 fi->get_invariants(hw); in fm10k_sw_init()
2003 if (hw->mac.ops.get_bus_info) in fm10k_sw_init()
2004 hw->mac.ops.get_bus_info(hw); in fm10k_sw_init()
2007 if (hw->mac.ops.set_dma_mask) in fm10k_sw_init()
2008 hw->mac.ops.set_dma_mask(hw, dma_get_mask(&pdev->dev)); in fm10k_sw_init()
2011 if (dma_get_mask(&pdev->dev) > DMA_BIT_MASK(32)) { in fm10k_sw_init()
2012 netdev->features |= NETIF_F_HIGHDMA; in fm10k_sw_init()
2013 netdev->vlan_features |= NETIF_F_HIGHDMA; in fm10k_sw_init()
2017 err = hw->mac.ops.reset_hw(hw); in fm10k_sw_init()
2019 dev_err(&pdev->dev, "reset_hw failed: %d\n", err); in fm10k_sw_init()
2023 err = hw->mac.ops.init_hw(hw); in fm10k_sw_init()
2025 dev_err(&pdev->dev, "init_hw failed: %d\n", err); in fm10k_sw_init()
2030 hw->mac.ops.update_hw_stats(hw, &interface->stats); in fm10k_sw_init()
2033 pci_sriov_set_totalvfs(pdev, hw->iov.total_vfs); in fm10k_sw_init()
2036 eth_random_addr(hw->mac.addr); in fm10k_sw_init()
2039 err = hw->mac.ops.read_mac_addr(hw); in fm10k_sw_init()
2041 dev_warn(&pdev->dev, in fm10k_sw_init()
2044 netdev->addr_assign_type |= NET_ADDR_RANDOM; in fm10k_sw_init()
2047 eth_hw_addr_set(netdev, hw->mac.addr); in fm10k_sw_init()
2048 ether_addr_copy(netdev->perm_addr, hw->mac.addr); in fm10k_sw_init()
2050 if (!is_valid_ether_addr(netdev->perm_addr)) { in fm10k_sw_init()
2051 dev_err(&pdev->dev, "Invalid MAC Address\n"); in fm10k_sw_init()
2052 return -EIO; in fm10k_sw_init()
2059 interface->tx_ring_count = FM10K_DEFAULT_TXD; in fm10k_sw_init()
2060 interface->rx_ring_count = FM10K_DEFAULT_RXD; in fm10k_sw_init()
2063 interface->tx_itr = FM10K_TX_ITR_DEFAULT; in fm10k_sw_init()
2064 interface->rx_itr = FM10K_ITR_ADAPTIVE | FM10K_RX_ITR_DEFAULT; in fm10k_sw_init()
2067 INIT_LIST_HEAD(&interface->macvlan_requests); in fm10k_sw_init()
2070 memcpy(interface->rssrk, rss_key, sizeof(rss_key)); in fm10k_sw_init()
2073 spin_lock_init(&interface->mbx_lock); in fm10k_sw_init()
2074 spin_lock_init(&interface->macvlan_lock); in fm10k_sw_init()
2077 set_bit(__FM10K_DOWN, interface->state); in fm10k_sw_init()
2078 set_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_sw_init()
2084 * fm10k_probe - Device Initialization Routine
2100 if (pdev->error_state != pci_channel_io_normal) { in fm10k_probe()
2101 dev_err(&pdev->dev, in fm10k_probe()
2103 return -EIO; in fm10k_probe()
2108 dev_err(&pdev->dev, in fm10k_probe()
2113 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48)); in fm10k_probe()
2115 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in fm10k_probe()
2117 dev_err(&pdev->dev, in fm10k_probe()
2124 dev_err(&pdev->dev, in fm10k_probe()
2132 netdev = fm10k_alloc_netdev(fm10k_info_tbl[ent->driver_data]); in fm10k_probe()
2134 err = -ENOMEM; in fm10k_probe()
2138 SET_NETDEV_DEV(netdev, &pdev->dev); in fm10k_probe()
2143 interface->netdev = netdev; in fm10k_probe()
2144 interface->pdev = pdev; in fm10k_probe()
2146 interface->uc_addr = ioremap(pci_resource_start(pdev, 0), in fm10k_probe()
2148 if (!interface->uc_addr) { in fm10k_probe()
2149 err = -EIO; in fm10k_probe()
2168 set_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2192 timer_setup(&interface->service_timer, fm10k_service_timer, 0); in fm10k_probe()
2193 INIT_WORK(&interface->service_task, fm10k_service_task); in fm10k_probe()
2196 INIT_DELAYED_WORK(&interface->macvlan_task, fm10k_macvlan_task); in fm10k_probe()
2199 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_probe()
2201 /* print warning for non-optimal configurations */ in fm10k_probe()
2202 pcie_print_link_status(interface->pdev); in fm10k_probe()
2205 dev_info(&pdev->dev, "%pM\n", netdev->dev_addr); in fm10k_probe()
2207 /* enable SR-IOV after registering netdev to enforce PF/VF ordering */ in fm10k_probe()
2211 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2221 if (interface->sw_addr) in fm10k_probe()
2222 iounmap(interface->sw_addr); in fm10k_probe()
2223 iounmap(interface->uc_addr); in fm10k_probe()
2235 * fm10k_remove - Device Removal Routine
2240 * Hot-Plug event, or because the driver is going to be removed from
2246 struct net_device *netdev = interface->netdev; in fm10k_remove()
2248 del_timer_sync(&interface->service_timer); in fm10k_remove()
2254 fm10k_clear_macvlan_queue(interface, interface->glort, true); in fm10k_remove()
2257 if (netdev->reg_state == NETREG_REGISTERED) in fm10k_remove()
2272 if (interface->sw_addr) in fm10k_remove()
2273 iounmap(interface->sw_addr); in fm10k_remove()
2274 iounmap(interface->uc_addr); in fm10k_remove()
2288 * activity. in fm10k_prepare_suspend()
2296 set_bit(__FM10K_RESET_SUSPENDED, interface->state); in fm10k_prepare_suspend()
2301 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_resume()
2307 if (!test_and_clear_bit(__FM10K_RESET_SUSPENDED, interface->state)) in fm10k_handle_resume()
2308 dev_warn(&interface->pdev->dev, in fm10k_handle_resume()
2312 hw->mac.ops.rebind_hw_stats(hw, &interface->stats); in fm10k_handle_resume()
2321 interface->host_ready = false; in fm10k_handle_resume()
2325 interface->link_down_event = jiffies + (HZ); in fm10k_handle_resume()
2326 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_handle_resume()
2331 /* Restart the MAC/VLAN request queue in-case of outstanding events */ in fm10k_handle_resume()
2338 * fm10k_resume - Generic PM resume hook
2348 struct net_device *netdev = interface->netdev; in fm10k_resume()
2349 struct fm10k_hw *hw = &interface->hw; in fm10k_resume()
2353 hw->hw_addr = interface->uc_addr; in fm10k_resume()
2365 * fm10k_suspend - Generic PM suspend hook
2375 struct net_device *netdev = interface->netdev; in fm10k_suspend()
2385 * fm10k_io_error_detected - called when PCI error is detected
2396 struct net_device *netdev = interface->netdev; in fm10k_io_error_detected()
2410 * fm10k_io_slot_reset - called after the pci bus has been reset.
2413 * Restart the card from scratch, as if from a cold-boot.
2420 dev_err(&pdev->dev, in fm10k_io_slot_reset()
2421 "Cannot re-enable PCI device after reset.\n"); in fm10k_io_slot_reset()
2427 /* After second error pci->state_saved is false, this in fm10k_io_slot_reset()
2441 * fm10k_io_resume - called when traffic can start flowing again.
2450 struct net_device *netdev = interface->netdev; in fm10k_io_resume()
2456 dev_warn(&pdev->dev, in fm10k_io_resume()
2463 * fm10k_io_reset_prepare - called when PCI function is about to be reset
2473 dev_warn(&pdev->dev, in fm10k_io_reset_prepare()
2479 * fm10k_io_reset_done - called when PCI function has finished resetting
2491 dev_warn(&pdev->dev, in fm10k_io_reset_done()
2493 netif_device_detach(interface->netdev); in fm10k_io_reset_done()
2518 * fm10k_register_pci_driver - register driver interface
2528 * fm10k_unregister_pci_driver - unregister driver interface