Lines Matching full:interface

35 	struct fm10k_intfc *interface = hw->back;  in fm10k_read_pci_cfg_word()  local
41 pci_read_config_word(interface->pdev, reg, &value); in fm10k_read_pci_cfg_word()
58 struct fm10k_intfc *interface = hw->back; in fm10k_read_reg() local
59 struct net_device *netdev = interface->netdev; in fm10k_read_reg()
69 static int fm10k_hw_ready(struct fm10k_intfc *interface) in fm10k_hw_ready() argument
71 struct fm10k_hw *hw = &interface->hw; in fm10k_hw_ready()
80 * @interface: fm10k private interface structure
85 void fm10k_macvlan_schedule(struct fm10k_intfc *interface) in fm10k_macvlan_schedule() argument
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()
107 * @interface: fm10k private interface structure
112 static void fm10k_stop_macvlan_task(struct fm10k_intfc *interface) in fm10k_stop_macvlan_task() argument
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()
131 * @interface: fm10k private interface structure
136 static void fm10k_resume_macvlan_task(struct fm10k_intfc *interface) in fm10k_resume_macvlan_task() argument
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()
145 fm10k_macvlan_schedule(interface); in fm10k_resume_macvlan_task()
148 void fm10k_service_event_schedule(struct fm10k_intfc *interface) in fm10k_service_event_schedule() argument
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()
159 static void fm10k_service_event_complete(struct fm10k_intfc *interface) in fm10k_service_event_complete() argument
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()
171 if (test_bit(__FM10K_SERVICE_REQUEST, interface->state)) in fm10k_service_event_complete()
172 fm10k_service_event_schedule(interface); in fm10k_service_event_complete()
175 static void fm10k_stop_service_event(struct fm10k_intfc *interface) in fm10k_stop_service_event() argument
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()
190 static void fm10k_start_service_event(struct fm10k_intfc *interface) in fm10k_start_service_event() argument
192 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_start_service_event()
193 fm10k_service_event_schedule(interface); in fm10k_start_service_event()
202 struct fm10k_intfc *interface = from_timer(interface, t, in fm10k_service_timer() local
206 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_service_timer()
208 fm10k_service_event_schedule(interface); in fm10k_service_timer()
213 * @interface: fm10k private data structure
219 static bool fm10k_prepare_for_reset(struct fm10k_intfc *interface) in fm10k_prepare_for_reset() argument
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()
234 fm10k_stop_macvlan_task(interface); in fm10k_prepare_for_reset()
238 fm10k_iov_suspend(interface->pdev); in fm10k_prepare_for_reset()
243 fm10k_mbx_free_irq(interface); in fm10k_prepare_for_reset()
246 fm10k_clear_queueing_scheme(interface); in fm10k_prepare_for_reset()
249 interface->last_reset = jiffies + (10 * HZ); in fm10k_prepare_for_reset()
256 static int fm10k_handle_reset(struct fm10k_intfc *interface) in fm10k_handle_reset() argument
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()
271 dev_err(&interface->pdev->dev, "reset_hw failed: %d\n", err); in fm10k_handle_reset()
277 dev_err(&interface->pdev->dev, "init_hw failed: %d\n", err); in fm10k_handle_reset()
281 err = fm10k_init_queueing_scheme(interface); in fm10k_handle_reset()
283 dev_err(&interface->pdev->dev, in fm10k_handle_reset()
289 err = fm10k_mbx_request_irq(interface); in fm10k_handle_reset()
293 err = fm10k_hw_ready(interface); in fm10k_handle_reset()
316 fm10k_iov_resume(interface->pdev); in fm10k_handle_reset()
320 fm10k_resume_macvlan_task(interface); in fm10k_handle_reset()
322 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
326 fm10k_mbx_free_irq(interface); in fm10k_handle_reset()
328 fm10k_clear_queueing_scheme(interface); in fm10k_handle_reset()
334 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
339 static void fm10k_detach_subtask(struct fm10k_intfc *interface) in fm10k_detach_subtask() argument
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()
354 if (fm10k_prepare_for_reset(interface)) 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()
376 err = fm10k_handle_reset(interface); in fm10k_detach_subtask()
379 interface->hw.hw_addr = NULL; in fm10k_detach_subtask()
390 static void fm10k_reset_subtask(struct fm10k_intfc *interface) in fm10k_reset_subtask() argument
395 interface->flags)) in fm10k_reset_subtask()
405 if (!fm10k_prepare_for_reset(interface)) in fm10k_reset_subtask()
408 netdev_err(interface->netdev, "Reset interface\n"); in fm10k_reset_subtask()
410 err = fm10k_handle_reset(interface); in fm10k_reset_subtask()
412 dev_err(&interface->pdev->dev, in fm10k_reset_subtask()
418 * @interface: board private structure
422 static void fm10k_configure_swpri_map(struct fm10k_intfc *interface) in fm10k_configure_swpri_map() argument
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()
443 * @interface: board private structure
445 static void fm10k_watchdog_update_host_state(struct fm10k_intfc *interface) in fm10k_watchdog_update_host_state() argument
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()
459 fm10k_configure_swpri_map(interface); in fm10k_watchdog_update_host_state()
465 fm10k_mbx_lock(interface); 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()
472 fm10k_mbx_unlock(interface); in fm10k_watchdog_update_host_state()
477 * @interface: board private structure
481 static void fm10k_mbx_subtask(struct fm10k_intfc *interface) in fm10k_mbx_subtask() argument
484 if (test_bit(__FM10K_RESETTING, interface->state)) in fm10k_mbx_subtask()
488 fm10k_watchdog_update_host_state(interface); in fm10k_mbx_subtask()
491 fm10k_iov_mbx(interface); in fm10k_mbx_subtask()
496 * @interface: board private structure
498 static void fm10k_watchdog_host_is_ready(struct fm10k_intfc *interface) in fm10k_watchdog_host_is_ready() argument
500 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_is_ready()
506 netif_info(interface, drv, netdev, "NIC Link is up\n"); in fm10k_watchdog_host_is_ready()
514 * @interface: board private structure
516 static void fm10k_watchdog_host_not_ready(struct fm10k_intfc *interface) in fm10k_watchdog_host_not_ready() argument
518 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_not_ready()
524 netif_info(interface, drv, netdev, "NIC Link is down\n"); in fm10k_watchdog_host_not_ready()
532 * @interface: board private structure
534 void fm10k_update_stats(struct fm10k_intfc *interface) in fm10k_update_stats() argument
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()
555 /* gather some stats to the interface struct that are per queue */ 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()
570 interface->restart_queue = restart_queue; in fm10k_update_stats()
571 interface->tx_busy = tx_busy; 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()
577 /* gather some stats to the interface struct that are per queue */ 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()
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()
611 struct fm10k_hw_stats_q *q = &interface->stats.q[i]; 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()
628 net_stats->rx_dropped = interface->stats.nodesc_drop.count; in fm10k_update_stats()
631 fm10k_iov_update_stats(interface); in fm10k_update_stats()
633 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_update_stats()
638 * @interface: pointer to the device interface structure
640 static void fm10k_watchdog_flush_tx(struct fm10k_intfc *interface) in fm10k_watchdog_flush_tx() argument
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()
663 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_watchdog_flush_tx()
668 * @interface: pointer to the device interface structure
670 static void fm10k_watchdog_subtask(struct fm10k_intfc *interface) in fm10k_watchdog_subtask() argument
672 /* if interface is down do nothing */ in fm10k_watchdog_subtask()
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()
678 fm10k_watchdog_host_is_ready(interface); in fm10k_watchdog_subtask()
680 fm10k_watchdog_host_not_ready(interface); in fm10k_watchdog_subtask()
683 if (time_is_before_jiffies(interface->next_stats_update)) in fm10k_watchdog_subtask()
684 fm10k_update_stats(interface); in fm10k_watchdog_subtask()
687 fm10k_watchdog_flush_tx(interface); in fm10k_watchdog_subtask()
692 * @interface: pointer to the device interface structure
699 static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) in fm10k_check_hang_subtask() argument
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()
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()
735 struct fm10k_intfc *interface; in fm10k_service_task() local
737 interface = container_of(work, struct fm10k_intfc, service_task); in fm10k_service_task()
740 fm10k_detach_subtask(interface); in fm10k_service_task()
742 /* tasks run even when interface is down */ in fm10k_service_task()
743 fm10k_mbx_subtask(interface); in fm10k_service_task()
744 fm10k_reset_subtask(interface); in fm10k_service_task()
746 /* tasks only run when interface is up */ in fm10k_service_task()
747 fm10k_watchdog_subtask(interface); in fm10k_service_task()
748 fm10k_check_hang_subtask(interface); in fm10k_service_task()
751 fm10k_service_event_complete(interface); in fm10k_service_task()
759 * the interface is up, it will attempt to queue mailbox messages to the
768 struct fm10k_intfc *interface; in fm10k_macvlan_task() local
775 interface = container_of(dwork, struct fm10k_intfc, macvlan_task); in fm10k_macvlan_task()
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()
788 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
794 fm10k_mbx_lock(interface); in fm10k_macvlan_task()
803 set_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_task()
804 fm10k_mbx_unlock(interface); in fm10k_macvlan_task()
807 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
809 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
839 fm10k_mbx_unlock(interface); 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()
856 if (test_bit(__FM10K_MACVLAN_REQUEST, interface->state)) in fm10k_macvlan_task()
857 fm10k_macvlan_schedule(interface); in fm10k_macvlan_task()
862 * @interface: board private structure
867 static void fm10k_configure_tx_ring(struct fm10k_intfc *interface, in fm10k_configure_tx_ring() argument
870 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_tx_ring()
893 ring->tail = &interface->uc_addr[FM10K_TDT(reg_idx)]; in fm10k_configure_tx_ring()
924 * @interface: board private structure
929 static void fm10k_enable_tx_ring(struct fm10k_intfc *interface, in fm10k_enable_tx_ring() argument
932 struct fm10k_hw *hw = &interface->hw; in fm10k_enable_tx_ring()
947 netif_err(interface, drv, interface->netdev, in fm10k_enable_tx_ring()
953 * @interface: board private structure
957 static void fm10k_configure_tx(struct fm10k_intfc *interface) in fm10k_configure_tx() argument
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()
972 * @interface: board private structure
977 static void fm10k_configure_rx_ring(struct fm10k_intfc *interface, in fm10k_configure_rx_ring() argument
981 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_rx_ring()
986 u8 rx_pause = interface->rx_pause; in fm10k_configure_rx_ring()
1007 ring->tail = &interface->uc_addr[FM10K_RDT(reg_idx)]; 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()
1035 if (test_bit(hw->mac.default_vid, interface->active_vlans)) in fm10k_configure_rx_ring()
1057 * @interface: board private structure
1061 void fm10k_update_rx_drop_en(struct fm10k_intfc *interface) in fm10k_update_rx_drop_en() argument
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()
1086 * @interface: board private structure
1090 static void fm10k_configure_dglort(struct fm10k_intfc *interface) in fm10k_configure_dglort() argument
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()
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()
1136 /* assign glort value for RSS/DCB specific to this interface */ 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()
1151 * @interface: board private structure
1155 static void fm10k_configure_rx(struct fm10k_intfc *interface) in fm10k_configure_rx() argument
1160 fm10k_configure_swpri_map(interface); in fm10k_configure_rx()
1163 fm10k_configure_dglort(interface); in fm10k_configure_rx()
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()
1172 static void fm10k_napi_enable_all(struct fm10k_intfc *interface) in fm10k_napi_enable_all() argument
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()
1195 struct fm10k_intfc *interface = data; in fm10k_msix_mbx_vf() local
1196 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_vf()
1205 if (fm10k_mbx_trylock(interface)) { in fm10k_msix_mbx_vf()
1207 fm10k_mbx_unlock(interface); in fm10k_msix_mbx_vf()
1211 fm10k_service_event_schedule(interface); in fm10k_msix_mbx_vf()
1217 static void fm10k_handle_fault(struct fm10k_intfc *interface, int type, in fm10k_handle_fault() argument
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()
1302 static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr) in fm10k_report_fault() argument
1304 struct fm10k_hw *hw = &interface->hw; in fm10k_report_fault()
1318 dev_err(&interface->pdev->dev, in fm10k_report_fault()
1323 fm10k_handle_fault(interface, type, &fault); in fm10k_report_fault()
1327 static void fm10k_reset_drop_on_empty(struct fm10k_intfc *interface, u32 eicr) in fm10k_reset_drop_on_empty() argument
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()
1368 struct fm10k_intfc *interface = data; in fm10k_msix_mbx_pf() local
1369 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_pf()
1380 fm10k_report_fault(interface, eicr); in fm10k_msix_mbx_pf()
1383 fm10k_reset_drop_on_empty(interface, eicr); in fm10k_msix_mbx_pf()
1386 if (fm10k_mbx_trylock(interface)) { in fm10k_msix_mbx_pf()
1390 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_msix_mbx_pf()
1393 fm10k_iov_event(interface); in fm10k_msix_mbx_pf()
1394 fm10k_mbx_unlock(interface); 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()
1411 fm10k_service_event_schedule(interface); in fm10k_msix_mbx_pf()
1421 void fm10k_mbx_free_irq(struct fm10k_intfc *interface) in fm10k_mbx_free_irq() argument
1423 struct fm10k_hw *hw = &interface->hw; 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()
1454 free_irq(entry->vector, interface); in fm10k_mbx_free_irq()
1462 struct fm10k_intfc *interface; in fm10k_mbx_mac_addr() local
1469 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_mbx_mac_addr()
1474 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1479 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1488 struct fm10k_intfc *interface; in fm10k_mbx_error() local
1491 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_mbx_error()
1492 pdev = interface->pdev; in fm10k_mbx_error()
1507 static int fm10k_mbx_request_irq_vf(struct fm10k_intfc *interface) in fm10k_mbx_request_irq_vf() argument
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()
1524 dev->name, interface); in fm10k_mbx_request_irq_vf()
1526 netif_err(interface, probe, dev, in fm10k_mbx_request_irq_vf()
1543 struct fm10k_intfc *interface; in fm10k_lport_map() local
1547 interface = container_of(hw, struct fm10k_intfc, hw); 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()
1558 fm10k_service_event_schedule(interface); in fm10k_lport_map()
1561 if (interface->lport_map_failed) in fm10k_lport_map()
1564 interface->lport_map_failed = true; in fm10k_lport_map()
1567 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1568 …"cannot obtain link because the host interface is configured for a PCIe host interface bandwidth o… in fm10k_lport_map()
1569 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1580 interface->lport_map_failed = false; in fm10k_lport_map()
1584 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_lport_map()
1592 struct fm10k_intfc *interface; in fm10k_update_pvid() local
1614 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_update_pvid()
1617 err = fm10k_iov_update_pvid(interface, glort, pvid); in fm10k_update_pvid()
1623 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_update_pvid()
1640 static int fm10k_mbx_request_irq_pf(struct fm10k_intfc *interface) in fm10k_mbx_request_irq_pf() argument
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()
1658 dev->name, interface); in fm10k_mbx_request_irq_pf()
1660 netif_err(interface, probe, dev, in fm10k_mbx_request_irq_pf()
1691 int fm10k_mbx_request_irq(struct fm10k_intfc *interface) in fm10k_mbx_request_irq() argument
1693 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq()
1698 err = fm10k_mbx_request_irq_pf(interface); in fm10k_mbx_request_irq()
1700 err = fm10k_mbx_request_irq_vf(interface); in fm10k_mbx_request_irq()
1709 fm10k_mbx_free_irq(interface); in fm10k_mbx_request_irq()
1716 * @interface: board private structure
1718 * Release all interrupts associated with this interface
1720 void fm10k_qv_free_irq(struct fm10k_intfc *interface) in fm10k_qv_free_irq() argument
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()
1732 q_vector = interface->q_vector[vector]; in fm10k_qv_free_irq()
1749 * @interface: board private structure
1754 int fm10k_qv_request_irq(struct fm10k_intfc *interface) in fm10k_qv_request_irq() argument
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()
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()
1792 netif_err(interface, probe, dev, in fm10k_qv_request_irq()
1816 q_vector = interface->q_vector[vector]; in fm10k_qv_request_irq()
1833 void fm10k_up(struct fm10k_intfc *interface) in fm10k_up() argument
1835 struct fm10k_hw *hw = &interface->hw; in fm10k_up()
1841 fm10k_configure_tx(interface); in fm10k_up()
1844 fm10k_configure_rx(interface); in fm10k_up()
1850 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_up()
1853 clear_bit(__FM10K_DOWN, interface->state); in fm10k_up()
1856 fm10k_napi_enable_all(interface); in fm10k_up()
1859 fm10k_restore_rx_state(interface); in fm10k_up()
1862 netif_tx_start_all_queues(interface->netdev); in fm10k_up()
1866 mod_timer(&interface->service_timer, jiffies); in fm10k_up()
1869 static void fm10k_napi_disable_all(struct fm10k_intfc *interface) in fm10k_napi_disable_all() argument
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()
1880 void fm10k_down(struct fm10k_intfc *interface) in fm10k_down() argument
1882 struct net_device *netdev = interface->netdev; in fm10k_down()
1883 struct fm10k_hw *hw = &interface->hw; in fm10k_down()
1887 if (test_and_set_bit(__FM10K_DOWN, interface->state)) in fm10k_down()
1898 fm10k_reset_rx_state(interface); in fm10k_down()
1901 fm10k_napi_disable_all(interface); in fm10k_down()
1903 /* capture stats one last time before stopping interface */ in fm10k_down()
1904 fm10k_update_stats(interface); in fm10k_down()
1907 while (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state)) 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()
1948 dev_err(&interface->pdev->dev, in fm10k_down()
1951 dev_err(&interface->pdev->dev, "stop_hw failed: %d\n", err); in fm10k_down()
1954 fm10k_clean_all_tx_rings(interface); in fm10k_down()
1955 fm10k_clean_all_rx_rings(interface); in fm10k_down()
1960 * @interface: host interface private structure to initialize
1963 * fm10k_sw_init initializes the interface private data structure.
1967 static int fm10k_sw_init(struct fm10k_intfc *interface, in fm10k_sw_init() argument
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()
1999 interface->ring_feature[RING_F_RSS].limit = rss; in fm10k_sw_init()
2030 hw->mac.ops.update_hw_stats(hw, &interface->stats); in fm10k_sw_init()
2055 /* initialize DCBNL interface */ 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()
2076 /* Start off interface as being down */ 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()
2090 * fm10k_probe initializes an interface identified by a pci_dev structure.
2091 * The OS initialization, configuring of the interface private structure,
2097 struct fm10k_intfc *interface; in fm10k_probe() local
2140 interface = netdev_priv(netdev); in fm10k_probe()
2141 pci_set_drvdata(pdev, interface); 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()
2153 err = fm10k_sw_init(interface, ent); in fm10k_probe()
2158 fm10k_dbg_intfc_init(interface); in fm10k_probe()
2160 err = fm10k_init_queueing_scheme(interface); in fm10k_probe()
2168 set_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2170 err = fm10k_mbx_request_irq(interface); in fm10k_probe()
2174 /* final check of hardware state before registering the interface */ in fm10k_probe()
2175 err = fm10k_hw_ready(interface); 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()
2198 /* kick off service timer now, even when interface is down */ in fm10k_probe()
2199 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_probe()
2202 pcie_print_link_status(interface->pdev); in fm10k_probe()
2211 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2212 fm10k_service_event_schedule(interface); in fm10k_probe()
2217 fm10k_mbx_free_irq(interface); in fm10k_probe()
2219 fm10k_clear_queueing_scheme(interface); 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()
2245 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_remove() local
2246 struct net_device *netdev = interface->netdev; in fm10k_remove()
2248 del_timer_sync(&interface->service_timer); in fm10k_remove()
2250 fm10k_stop_service_event(interface); in fm10k_remove()
2251 fm10k_stop_macvlan_task(interface); in fm10k_remove()
2254 fm10k_clear_macvlan_queue(interface, interface->glort, true); in fm10k_remove()
2264 fm10k_mbx_free_irq(interface); in fm10k_remove()
2267 fm10k_clear_queueing_scheme(interface); in fm10k_remove()
2270 fm10k_dbg_intfc_exit(interface); 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()
2283 static void fm10k_prepare_suspend(struct fm10k_intfc *interface) in fm10k_prepare_suspend() argument
2293 fm10k_stop_service_event(interface); in fm10k_prepare_suspend()
2295 if (fm10k_prepare_for_reset(interface)) in fm10k_prepare_suspend()
2296 set_bit(__FM10K_RESET_SUSPENDED, interface->state); in fm10k_prepare_suspend()
2299 static int fm10k_handle_resume(struct fm10k_intfc *interface) in fm10k_handle_resume() argument
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()
2314 err = fm10k_handle_reset(interface); in fm10k_handle_resume()
2321 interface->host_ready = false; in fm10k_handle_resume()
2322 fm10k_watchdog_host_not_ready(interface); 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()
2329 fm10k_start_service_event(interface); in fm10k_handle_resume()
2332 fm10k_macvlan_schedule(interface); in fm10k_handle_resume()
2347 struct fm10k_intfc *interface = dev_get_drvdata(dev); in fm10k_resume() local
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()
2355 err = fm10k_handle_resume(interface); in fm10k_resume()
2374 struct fm10k_intfc *interface = dev_get_drvdata(dev); in fm10k_suspend() local
2375 struct net_device *netdev = interface->netdev; in fm10k_suspend()
2379 fm10k_prepare_suspend(interface); in fm10k_suspend()
2395 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_error_detected() local
2396 struct net_device *netdev = interface->netdev; in fm10k_io_error_detected()
2403 fm10k_prepare_suspend(interface); in fm10k_io_error_detected()
2449 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_resume() local
2450 struct net_device *netdev = interface->netdev; in fm10k_io_resume()
2453 err = fm10k_handle_resume(interface); in fm10k_io_resume()
2487 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_reset_done() local
2488 int err = fm10k_handle_resume(interface); 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