Lines Matching full:interface
36 struct fm10k_intfc *interface = hw->back; in fm10k_read_pci_cfg_word() local
42 pci_read_config_word(interface->pdev, reg, &value); in fm10k_read_pci_cfg_word()
59 struct fm10k_intfc *interface = hw->back; in fm10k_read_reg() local
60 struct net_device *netdev = interface->netdev; in fm10k_read_reg()
70 static int fm10k_hw_ready(struct fm10k_intfc *interface) in fm10k_hw_ready() argument
72 struct fm10k_hw *hw = &interface->hw; in fm10k_hw_ready()
81 * @interface: fm10k private interface structure
86 void fm10k_macvlan_schedule(struct fm10k_intfc *interface) in fm10k_macvlan_schedule() argument
91 if (!test_bit(__FM10K_MACVLAN_DISABLE, interface->state) && in fm10k_macvlan_schedule()
92 !test_and_set_bit(__FM10K_MACVLAN_SCHED, interface->state)) { in fm10k_macvlan_schedule()
93 clear_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_schedule()
100 &interface->macvlan_task, 10); in fm10k_macvlan_schedule()
102 set_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_schedule()
108 * @interface: fm10k private interface structure
113 static void fm10k_stop_macvlan_task(struct fm10k_intfc *interface) in fm10k_stop_macvlan_task() argument
116 set_bit(__FM10K_MACVLAN_DISABLE, interface->state); in fm10k_stop_macvlan_task()
119 cancel_delayed_work_sync(&interface->macvlan_task); in fm10k_stop_macvlan_task()
127 clear_bit(__FM10K_MACVLAN_SCHED, interface->state); in fm10k_stop_macvlan_task()
132 * @interface: fm10k private interface structure
137 static void fm10k_resume_macvlan_task(struct fm10k_intfc *interface) in fm10k_resume_macvlan_task() argument
140 clear_bit(__FM10K_MACVLAN_DISABLE, interface->state); in fm10k_resume_macvlan_task()
145 if (test_bit(__FM10K_MACVLAN_REQUEST, interface->state)) in fm10k_resume_macvlan_task()
146 fm10k_macvlan_schedule(interface); in fm10k_resume_macvlan_task()
149 void fm10k_service_event_schedule(struct fm10k_intfc *interface) in fm10k_service_event_schedule() argument
151 if (!test_bit(__FM10K_SERVICE_DISABLE, interface->state) && in fm10k_service_event_schedule()
152 !test_and_set_bit(__FM10K_SERVICE_SCHED, interface->state)) { in fm10k_service_event_schedule()
153 clear_bit(__FM10K_SERVICE_REQUEST, interface->state); in fm10k_service_event_schedule()
154 queue_work(fm10k_workqueue, &interface->service_task); in fm10k_service_event_schedule()
156 set_bit(__FM10K_SERVICE_REQUEST, interface->state); in fm10k_service_event_schedule()
160 static void fm10k_service_event_complete(struct fm10k_intfc *interface) in fm10k_service_event_complete() argument
162 WARN_ON(!test_bit(__FM10K_SERVICE_SCHED, interface->state)); in fm10k_service_event_complete()
166 clear_bit(__FM10K_SERVICE_SCHED, interface->state); in fm10k_service_event_complete()
172 if (test_bit(__FM10K_SERVICE_REQUEST, interface->state)) in fm10k_service_event_complete()
173 fm10k_service_event_schedule(interface); in fm10k_service_event_complete()
176 static void fm10k_stop_service_event(struct fm10k_intfc *interface) in fm10k_stop_service_event() argument
178 set_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_stop_service_event()
179 cancel_work_sync(&interface->service_task); in fm10k_stop_service_event()
188 clear_bit(__FM10K_SERVICE_SCHED, interface->state); in fm10k_stop_service_event()
191 static void fm10k_start_service_event(struct fm10k_intfc *interface) in fm10k_start_service_event() argument
193 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_start_service_event()
194 fm10k_service_event_schedule(interface); in fm10k_start_service_event()
203 struct fm10k_intfc *interface = from_timer(interface, t, in fm10k_service_timer() local
207 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_service_timer()
209 fm10k_service_event_schedule(interface); in fm10k_service_timer()
214 * @interface: fm10k private data structure
220 static bool fm10k_prepare_for_reset(struct fm10k_intfc *interface) in fm10k_prepare_for_reset() argument
222 struct net_device *netdev = interface->netdev; in fm10k_prepare_for_reset()
228 if (test_and_set_bit(__FM10K_RESETTING, interface->state)) in fm10k_prepare_for_reset()
235 fm10k_stop_macvlan_task(interface); in fm10k_prepare_for_reset()
239 fm10k_iov_suspend(interface->pdev); in fm10k_prepare_for_reset()
244 fm10k_mbx_free_irq(interface); in fm10k_prepare_for_reset()
247 fm10k_clear_queueing_scheme(interface); in fm10k_prepare_for_reset()
250 interface->last_reset = jiffies + (10 * HZ); in fm10k_prepare_for_reset()
257 static int fm10k_handle_reset(struct fm10k_intfc *interface) in fm10k_handle_reset() argument
259 struct net_device *netdev = interface->netdev; in fm10k_handle_reset()
260 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_reset()
263 WARN_ON(!test_bit(__FM10K_RESETTING, interface->state)); in fm10k_handle_reset()
267 pci_set_master(interface->pdev); in fm10k_handle_reset()
272 dev_err(&interface->pdev->dev, "reset_hw failed: %d\n", err); in fm10k_handle_reset()
278 dev_err(&interface->pdev->dev, "init_hw failed: %d\n", err); in fm10k_handle_reset()
282 err = fm10k_init_queueing_scheme(interface); in fm10k_handle_reset()
284 dev_err(&interface->pdev->dev, in fm10k_handle_reset()
290 err = fm10k_mbx_request_irq(interface); in fm10k_handle_reset()
294 err = fm10k_hw_ready(interface); in fm10k_handle_reset()
317 fm10k_iov_resume(interface->pdev); in fm10k_handle_reset()
321 fm10k_resume_macvlan_task(interface); in fm10k_handle_reset()
323 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
327 fm10k_mbx_free_irq(interface); in fm10k_handle_reset()
329 fm10k_clear_queueing_scheme(interface); in fm10k_handle_reset()
335 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_handle_reset()
340 static void fm10k_detach_subtask(struct fm10k_intfc *interface) in fm10k_detach_subtask() argument
342 struct net_device *netdev = interface->netdev; in fm10k_detach_subtask()
347 if (netif_device_present(netdev) || interface->hw.hw_addr) in fm10k_detach_subtask()
355 if (fm10k_prepare_for_reset(interface)) in fm10k_detach_subtask()
356 set_bit(__FM10K_RESET_DETACHED, interface->state); in fm10k_detach_subtask()
359 hw_addr = READ_ONCE(interface->uc_addr); in fm10k_detach_subtask()
368 interface->state)) in fm10k_detach_subtask()
372 interface->hw.hw_addr = interface->uc_addr; in fm10k_detach_subtask()
377 err = fm10k_handle_reset(interface); in fm10k_detach_subtask()
380 interface->hw.hw_addr = NULL; in fm10k_detach_subtask()
391 static void fm10k_reset_subtask(struct fm10k_intfc *interface) in fm10k_reset_subtask() argument
396 interface->flags)) in fm10k_reset_subtask()
406 if (!fm10k_prepare_for_reset(interface)) in fm10k_reset_subtask()
409 netdev_err(interface->netdev, "Reset interface\n"); in fm10k_reset_subtask()
411 err = fm10k_handle_reset(interface); in fm10k_reset_subtask()
413 dev_err(&interface->pdev->dev, in fm10k_reset_subtask()
419 * @interface: board private structure
423 static void fm10k_configure_swpri_map(struct fm10k_intfc *interface) in fm10k_configure_swpri_map() argument
425 struct net_device *netdev = interface->netdev; in fm10k_configure_swpri_map()
426 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_swpri_map()
430 clear_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags); in fm10k_configure_swpri_map()
444 * @interface: board private structure
446 static void fm10k_watchdog_update_host_state(struct fm10k_intfc *interface) in fm10k_watchdog_update_host_state() argument
448 struct fm10k_hw *hw = &interface->hw; in fm10k_watchdog_update_host_state()
451 if (test_bit(__FM10K_LINK_DOWN, interface->state)) { in fm10k_watchdog_update_host_state()
452 interface->host_ready = false; in fm10k_watchdog_update_host_state()
453 if (time_is_after_jiffies(interface->link_down_event)) in fm10k_watchdog_update_host_state()
455 clear_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_watchdog_update_host_state()
458 if (test_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags)) { in fm10k_watchdog_update_host_state()
460 fm10k_configure_swpri_map(interface); in fm10k_watchdog_update_host_state()
466 fm10k_mbx_lock(interface); in fm10k_watchdog_update_host_state()
468 err = hw->mac.ops.get_host_state(hw, &interface->host_ready); in fm10k_watchdog_update_host_state()
469 if (err && time_is_before_jiffies(interface->last_reset)) in fm10k_watchdog_update_host_state()
470 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_watchdog_update_host_state()
473 fm10k_mbx_unlock(interface); in fm10k_watchdog_update_host_state()
478 * @interface: board private structure
482 static void fm10k_mbx_subtask(struct fm10k_intfc *interface) in fm10k_mbx_subtask() argument
485 if (test_bit(__FM10K_RESETTING, interface->state)) in fm10k_mbx_subtask()
489 fm10k_watchdog_update_host_state(interface); in fm10k_mbx_subtask()
492 fm10k_iov_mbx(interface); in fm10k_mbx_subtask()
497 * @interface: board private structure
499 static void fm10k_watchdog_host_is_ready(struct fm10k_intfc *interface) in fm10k_watchdog_host_is_ready() argument
501 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_is_ready()
507 netif_info(interface, drv, netdev, "NIC Link is up\n"); in fm10k_watchdog_host_is_ready()
515 * @interface: board private structure
517 static void fm10k_watchdog_host_not_ready(struct fm10k_intfc *interface) in fm10k_watchdog_host_not_ready() argument
519 struct net_device *netdev = interface->netdev; in fm10k_watchdog_host_not_ready()
525 netif_info(interface, drv, netdev, "NIC Link is down\n"); in fm10k_watchdog_host_not_ready()
533 * @interface: board private structure
535 void fm10k_update_stats(struct fm10k_intfc *interface) in fm10k_update_stats() argument
537 struct net_device_stats *net_stats = &interface->netdev->stats; in fm10k_update_stats()
538 struct fm10k_hw *hw = &interface->hw; in fm10k_update_stats()
550 if (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state)) in fm10k_update_stats()
554 interface->next_stats_update = jiffies + HZ; in fm10k_update_stats()
556 /* gather some stats to the interface struct that are per queue */ in fm10k_update_stats()
557 for (bytes = 0, pkts = 0, i = 0; i < interface->num_tx_queues; i++) { in fm10k_update_stats()
558 struct fm10k_ring *tx_ring = READ_ONCE(interface->tx_ring[i]); in fm10k_update_stats()
571 interface->restart_queue = restart_queue; in fm10k_update_stats()
572 interface->tx_busy = tx_busy; in fm10k_update_stats()
575 interface->tx_csum_errors = tx_csum_errors; in fm10k_update_stats()
576 interface->hw_csum_tx_good = hw_csum_tx_good; in fm10k_update_stats()
578 /* gather some stats to the interface struct that are per queue */ in fm10k_update_stats()
579 for (bytes = 0, pkts = 0, i = 0; i < interface->num_rx_queues; i++) { in fm10k_update_stats()
580 struct fm10k_ring *rx_ring = READ_ONCE(interface->rx_ring[i]); in fm10k_update_stats()
600 interface->alloc_failed = alloc_failed; in fm10k_update_stats()
601 interface->rx_csum_errors = rx_csum_errors; in fm10k_update_stats()
602 interface->hw_csum_rx_good = hw_csum_rx_good; in fm10k_update_stats()
603 interface->rx_switch_errors = rx_switch_errors; in fm10k_update_stats()
604 interface->rx_drops = rx_drops; in fm10k_update_stats()
605 interface->rx_pp_errors = rx_pp_errors; in fm10k_update_stats()
606 interface->rx_link_errors = rx_link_errors; in fm10k_update_stats()
607 interface->rx_length_errors = rx_length_errors; in fm10k_update_stats()
609 hw->mac.ops.update_hw_stats(hw, &interface->stats); in fm10k_update_stats()
612 struct fm10k_hw_stats_q *q = &interface->stats.q[i]; in fm10k_update_stats()
621 interface->tx_bytes_nic = tx_bytes_nic; in fm10k_update_stats()
622 interface->tx_packets_nic = tx_pkts_nic; in fm10k_update_stats()
623 interface->rx_bytes_nic = rx_bytes_nic; in fm10k_update_stats()
624 interface->rx_packets_nic = rx_pkts_nic; in fm10k_update_stats()
625 interface->rx_drops_nic = rx_drops_nic; in fm10k_update_stats()
629 net_stats->rx_dropped = interface->stats.nodesc_drop.count; in fm10k_update_stats()
632 fm10k_iov_update_stats(interface); in fm10k_update_stats()
634 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_update_stats()
639 * @interface: pointer to the device interface structure
641 static void fm10k_watchdog_flush_tx(struct fm10k_intfc *interface) in fm10k_watchdog_flush_tx() argument
647 if (netif_carrier_ok(interface->netdev)) in fm10k_watchdog_flush_tx()
650 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_watchdog_flush_tx()
651 struct fm10k_ring *tx_ring = interface->tx_ring[i]; in fm10k_watchdog_flush_tx()
664 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_watchdog_flush_tx()
669 * @interface: pointer to the device interface structure
671 static void fm10k_watchdog_subtask(struct fm10k_intfc *interface) in fm10k_watchdog_subtask() argument
673 /* if interface is down do nothing */ in fm10k_watchdog_subtask()
674 if (test_bit(__FM10K_DOWN, interface->state) || in fm10k_watchdog_subtask()
675 test_bit(__FM10K_RESETTING, interface->state)) in fm10k_watchdog_subtask()
678 if (interface->host_ready) in fm10k_watchdog_subtask()
679 fm10k_watchdog_host_is_ready(interface); in fm10k_watchdog_subtask()
681 fm10k_watchdog_host_not_ready(interface); in fm10k_watchdog_subtask()
684 if (time_is_before_jiffies(interface->next_stats_update)) in fm10k_watchdog_subtask()
685 fm10k_update_stats(interface); in fm10k_watchdog_subtask()
688 fm10k_watchdog_flush_tx(interface); in fm10k_watchdog_subtask()
693 * @interface: pointer to the device interface structure
700 static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) in fm10k_check_hang_subtask() argument
703 if (test_bit(__FM10K_DOWN, interface->state) || in fm10k_check_hang_subtask()
704 test_bit(__FM10K_RESETTING, interface->state)) in fm10k_check_hang_subtask()
708 if (time_is_after_eq_jiffies(interface->next_tx_hang_check)) in fm10k_check_hang_subtask()
710 interface->next_tx_hang_check = jiffies + (2 * HZ); in fm10k_check_hang_subtask()
712 if (netif_carrier_ok(interface->netdev)) { in fm10k_check_hang_subtask()
716 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_check_hang_subtask()
717 set_check_for_tx_hang(interface->tx_ring[i]); in fm10k_check_hang_subtask()
720 for (i = 0; i < interface->num_q_vectors; i++) { in fm10k_check_hang_subtask()
721 struct fm10k_q_vector *qv = interface->q_vector[i]; in fm10k_check_hang_subtask()
736 struct fm10k_intfc *interface; in fm10k_service_task() local
738 interface = container_of(work, struct fm10k_intfc, service_task); in fm10k_service_task()
741 fm10k_detach_subtask(interface); in fm10k_service_task()
743 /* tasks run even when interface is down */ in fm10k_service_task()
744 fm10k_mbx_subtask(interface); in fm10k_service_task()
745 fm10k_reset_subtask(interface); in fm10k_service_task()
747 /* tasks only run when interface is up */ in fm10k_service_task()
748 fm10k_watchdog_subtask(interface); in fm10k_service_task()
749 fm10k_check_hang_subtask(interface); in fm10k_service_task()
752 fm10k_service_event_complete(interface); in fm10k_service_task()
760 * the interface is up, it will attempt to queue mailbox messages to the
769 struct fm10k_intfc *interface; in fm10k_macvlan_task() local
776 interface = container_of(dwork, struct fm10k_intfc, macvlan_task); in fm10k_macvlan_task()
777 hw = &interface->hw; in fm10k_macvlan_task()
778 requests = &interface->macvlan_requests; in fm10k_macvlan_task()
782 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
789 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
795 fm10k_mbx_lock(interface); in fm10k_macvlan_task()
804 set_bit(__FM10K_MACVLAN_REQUEST, interface->state); in fm10k_macvlan_task()
805 fm10k_mbx_unlock(interface); in fm10k_macvlan_task()
808 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
810 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_macvlan_task()
840 fm10k_mbx_unlock(interface); in fm10k_macvlan_task()
847 WARN_ON(!test_bit(__FM10K_MACVLAN_SCHED, interface->state)); in fm10k_macvlan_task()
851 clear_bit(__FM10K_MACVLAN_SCHED, interface->state); in fm10k_macvlan_task()
857 if (test_bit(__FM10K_MACVLAN_REQUEST, interface->state)) in fm10k_macvlan_task()
858 fm10k_macvlan_schedule(interface); in fm10k_macvlan_task()
863 * @interface: board private structure
868 static void fm10k_configure_tx_ring(struct fm10k_intfc *interface, in fm10k_configure_tx_ring() argument
871 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_tx_ring()
894 ring->tail = &interface->uc_addr[FM10K_TDT(reg_idx)]; in fm10k_configure_tx_ring()
925 * @interface: board private structure
930 static void fm10k_enable_tx_ring(struct fm10k_intfc *interface, in fm10k_enable_tx_ring() argument
933 struct fm10k_hw *hw = &interface->hw; in fm10k_enable_tx_ring()
948 netif_err(interface, drv, interface->netdev, in fm10k_enable_tx_ring()
954 * @interface: board private structure
958 static void fm10k_configure_tx(struct fm10k_intfc *interface) in fm10k_configure_tx() argument
963 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_configure_tx()
964 fm10k_configure_tx_ring(interface, interface->tx_ring[i]); in fm10k_configure_tx()
967 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_configure_tx()
968 fm10k_enable_tx_ring(interface, interface->tx_ring[i]); in fm10k_configure_tx()
973 * @interface: board private structure
978 static void fm10k_configure_rx_ring(struct fm10k_intfc *interface, in fm10k_configure_rx_ring() argument
982 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_rx_ring()
987 u8 rx_pause = interface->rx_pause; in fm10k_configure_rx_ring()
1008 ring->tail = &interface->uc_addr[FM10K_RDT(reg_idx)]; in fm10k_configure_rx_ring()
1024 if (interface->pfc_en) in fm10k_configure_rx_ring()
1025 rx_pause = interface->pfc_en; in fm10k_configure_rx_ring()
1036 if (test_bit(hw->mac.default_vid, interface->active_vlans)) in fm10k_configure_rx_ring()
1058 * @interface: board private structure
1062 void fm10k_update_rx_drop_en(struct fm10k_intfc *interface) in fm10k_update_rx_drop_en() argument
1064 struct fm10k_hw *hw = &interface->hw; in fm10k_update_rx_drop_en()
1065 u8 rx_pause = interface->rx_pause; in fm10k_update_rx_drop_en()
1069 if (interface->pfc_en) in fm10k_update_rx_drop_en()
1070 rx_pause = interface->pfc_en; in fm10k_update_rx_drop_en()
1073 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_update_rx_drop_en()
1074 struct fm10k_ring *ring = interface->rx_ring[i]; in fm10k_update_rx_drop_en()
1087 * @interface: board private structure
1091 static void fm10k_configure_dglort(struct fm10k_intfc *interface) in fm10k_configure_dglort() argument
1094 struct fm10k_hw *hw = &interface->hw; in fm10k_configure_dglort()
1100 fm10k_write_reg(hw, FM10K_RSSRK(0, i), interface->rssrk[i]); in fm10k_configure_dglort()
1104 fm10k_write_reg(hw, FM10K_RETA(0, i), interface->reta[i]); in fm10k_configure_dglort()
1114 if (test_bit(FM10K_FLAG_RSS_FIELD_IPV4_UDP, interface->flags)) in fm10k_configure_dglort()
1116 if (test_bit(FM10K_FLAG_RSS_FIELD_IPV6_UDP, interface->flags)) in fm10k_configure_dglort()
1123 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_configure_dglort()
1124 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_configure_dglort()
1128 if (interface->glort_count > 64) { in fm10k_configure_dglort()
1131 dglort.glort = interface->glort + 64; in fm10k_configure_dglort()
1133 dglort.queue_l = fls(interface->num_rx_queues - 1); in fm10k_configure_dglort()
1137 /* assign glort value for RSS/DCB specific to this interface */ in fm10k_configure_dglort()
1140 dglort.glort = interface->glort; in fm10k_configure_dglort()
1141 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_configure_dglort()
1142 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_configure_dglort()
1145 if (interface->l2_accel) in fm10k_configure_dglort()
1146 dglort.shared_l = fls(interface->l2_accel->size); in fm10k_configure_dglort()
1152 * @interface: board private structure
1156 static void fm10k_configure_rx(struct fm10k_intfc *interface) in fm10k_configure_rx() argument
1161 fm10k_configure_swpri_map(interface); in fm10k_configure_rx()
1164 fm10k_configure_dglort(interface); in fm10k_configure_rx()
1167 for (i = 0; i < interface->num_rx_queues; i++) in fm10k_configure_rx()
1168 fm10k_configure_rx_ring(interface, interface->rx_ring[i]); in fm10k_configure_rx()
1173 static void fm10k_napi_enable_all(struct fm10k_intfc *interface) in fm10k_napi_enable_all() argument
1178 for (q_idx = 0; q_idx < interface->num_q_vectors; q_idx++) { in fm10k_napi_enable_all()
1179 q_vector = interface->q_vector[q_idx]; in fm10k_napi_enable_all()
1196 struct fm10k_intfc *interface = data; in fm10k_msix_mbx_vf() local
1197 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_vf()
1206 if (fm10k_mbx_trylock(interface)) { in fm10k_msix_mbx_vf()
1208 fm10k_mbx_unlock(interface); in fm10k_msix_mbx_vf()
1212 fm10k_service_event_schedule(interface); in fm10k_msix_mbx_vf()
1218 static void fm10k_handle_fault(struct fm10k_intfc *interface, int type, in fm10k_handle_fault() argument
1221 struct pci_dev *pdev = interface->pdev; in fm10k_handle_fault()
1222 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_fault()
1223 struct fm10k_iov_data *iov_data = interface->iov_data; in fm10k_handle_fault()
1303 static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr) in fm10k_report_fault() argument
1305 struct fm10k_hw *hw = &interface->hw; in fm10k_report_fault()
1319 dev_err(&interface->pdev->dev, in fm10k_report_fault()
1324 fm10k_handle_fault(interface, type, &fault); in fm10k_report_fault()
1328 static void fm10k_reset_drop_on_empty(struct fm10k_intfc *interface, u32 eicr) in fm10k_reset_drop_on_empty() argument
1330 struct fm10k_hw *hw = &interface->hw; in fm10k_reset_drop_on_empty()
1344 interface->rx_overrun_pf++; in fm10k_reset_drop_on_empty()
1347 interface->rx_overrun_vf++; in fm10k_reset_drop_on_empty()
1369 struct fm10k_intfc *interface = data; in fm10k_msix_mbx_pf() local
1370 struct fm10k_hw *hw = &interface->hw; in fm10k_msix_mbx_pf()
1382 fm10k_report_fault(interface, eicr); in fm10k_msix_mbx_pf()
1385 fm10k_reset_drop_on_empty(interface, eicr); in fm10k_msix_mbx_pf()
1388 if (fm10k_mbx_trylock(interface)) { in fm10k_msix_mbx_pf()
1391 fm10k_iov_event(interface); in fm10k_msix_mbx_pf()
1392 fm10k_mbx_unlock(interface); in fm10k_msix_mbx_pf()
1396 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_msix_mbx_pf()
1401 interface->link_down_event = jiffies + (4 * HZ); in fm10k_msix_mbx_pf()
1402 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_msix_mbx_pf()
1412 fm10k_service_event_schedule(interface); in fm10k_msix_mbx_pf()
1422 void fm10k_mbx_free_irq(struct fm10k_intfc *interface) in fm10k_mbx_free_irq() argument
1424 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_free_irq()
1429 if (!interface->msix_entries) in fm10k_mbx_free_irq()
1432 entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_free_irq()
1455 free_irq(entry->vector, interface); in fm10k_mbx_free_irq()
1463 struct fm10k_intfc *interface; in fm10k_mbx_mac_addr() local
1470 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_mbx_mac_addr()
1475 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1480 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_mbx_mac_addr()
1489 struct fm10k_intfc *interface; in fm10k_mbx_error() local
1492 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_mbx_error()
1493 pdev = interface->pdev; in fm10k_mbx_error()
1508 static int fm10k_mbx_request_irq_vf(struct fm10k_intfc *interface) in fm10k_mbx_request_irq_vf() argument
1510 struct msix_entry *entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_request_irq_vf()
1511 struct net_device *dev = interface->netdev; in fm10k_mbx_request_irq_vf()
1512 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq_vf()
1525 dev->name, interface); in fm10k_mbx_request_irq_vf()
1527 netif_err(interface, probe, dev, in fm10k_mbx_request_irq_vf()
1544 struct fm10k_intfc *interface; in fm10k_lport_map() local
1548 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_lport_map()
1553 interface->link_down_event = jiffies + (2 * HZ); in fm10k_lport_map()
1554 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_lport_map()
1559 fm10k_service_event_schedule(interface); in fm10k_lport_map()
1562 if (interface->lport_map_failed) in fm10k_lport_map()
1565 interface->lport_map_failed = true; in fm10k_lport_map()
1568 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1569 …"cannot obtain link because the host interface is configured for a PCIe host interface bandwidth o… in fm10k_lport_map()
1570 dev_warn(&interface->pdev->dev, in fm10k_lport_map()
1581 interface->lport_map_failed = false; in fm10k_lport_map()
1585 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_lport_map()
1593 struct fm10k_intfc *interface; in fm10k_update_pvid() local
1615 interface = container_of(hw, struct fm10k_intfc, hw); in fm10k_update_pvid()
1618 err = fm10k_iov_update_pvid(interface, glort, pvid); in fm10k_update_pvid()
1624 set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags); in fm10k_update_pvid()
1641 static int fm10k_mbx_request_irq_pf(struct fm10k_intfc *interface) in fm10k_mbx_request_irq_pf() argument
1643 struct msix_entry *entry = &interface->msix_entries[FM10K_MBX_VECTOR]; in fm10k_mbx_request_irq_pf()
1644 struct net_device *dev = interface->netdev; in fm10k_mbx_request_irq_pf()
1645 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq_pf()
1659 dev->name, interface); in fm10k_mbx_request_irq_pf()
1661 netif_err(interface, probe, dev, in fm10k_mbx_request_irq_pf()
1692 int fm10k_mbx_request_irq(struct fm10k_intfc *interface) in fm10k_mbx_request_irq() argument
1694 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_request_irq()
1699 err = fm10k_mbx_request_irq_pf(interface); in fm10k_mbx_request_irq()
1701 err = fm10k_mbx_request_irq_vf(interface); in fm10k_mbx_request_irq()
1710 fm10k_mbx_free_irq(interface); in fm10k_mbx_request_irq()
1717 * @interface: board private structure
1719 * Release all interrupts associated with this interface
1721 void fm10k_qv_free_irq(struct fm10k_intfc *interface) in fm10k_qv_free_irq() argument
1723 int vector = interface->num_q_vectors; in fm10k_qv_free_irq()
1726 entry = &interface->msix_entries[NON_Q_VECTORS + vector]; in fm10k_qv_free_irq()
1733 q_vector = interface->q_vector[vector]; in fm10k_qv_free_irq()
1750 * @interface: board private structure
1755 int fm10k_qv_request_irq(struct fm10k_intfc *interface) in fm10k_qv_request_irq() argument
1757 struct net_device *dev = interface->netdev; in fm10k_qv_request_irq()
1758 struct fm10k_hw *hw = &interface->hw; in fm10k_qv_request_irq()
1763 entry = &interface->msix_entries[NON_Q_VECTORS]; in fm10k_qv_request_irq()
1765 for (vector = 0; vector < interface->num_q_vectors; vector++) { in fm10k_qv_request_irq()
1766 struct fm10k_q_vector *q_vector = interface->q_vector[vector]; in fm10k_qv_request_irq()
1786 &interface->uc_addr[FM10K_ITR(entry->entry)] : in fm10k_qv_request_irq()
1787 &interface->uc_addr[FM10K_VFITR(entry->entry)]; in fm10k_qv_request_irq()
1793 netif_err(interface, probe, dev, in fm10k_qv_request_irq()
1817 q_vector = interface->q_vector[vector]; in fm10k_qv_request_irq()
1834 void fm10k_up(struct fm10k_intfc *interface) in fm10k_up() argument
1836 struct fm10k_hw *hw = &interface->hw; in fm10k_up()
1842 fm10k_configure_tx(interface); in fm10k_up()
1845 fm10k_configure_rx(interface); in fm10k_up()
1851 clear_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_up()
1854 clear_bit(__FM10K_DOWN, interface->state); in fm10k_up()
1857 fm10k_napi_enable_all(interface); in fm10k_up()
1860 fm10k_restore_rx_state(interface); in fm10k_up()
1863 netif_tx_start_all_queues(interface->netdev); in fm10k_up()
1867 mod_timer(&interface->service_timer, jiffies); in fm10k_up()
1870 static void fm10k_napi_disable_all(struct fm10k_intfc *interface) in fm10k_napi_disable_all() argument
1875 for (q_idx = 0; q_idx < interface->num_q_vectors; q_idx++) { in fm10k_napi_disable_all()
1876 q_vector = interface->q_vector[q_idx]; in fm10k_napi_disable_all()
1881 void fm10k_down(struct fm10k_intfc *interface) in fm10k_down() argument
1883 struct net_device *netdev = interface->netdev; in fm10k_down()
1884 struct fm10k_hw *hw = &interface->hw; in fm10k_down()
1888 if (test_and_set_bit(__FM10K_DOWN, interface->state)) in fm10k_down()
1899 fm10k_reset_rx_state(interface); in fm10k_down()
1902 fm10k_napi_disable_all(interface); in fm10k_down()
1904 /* capture stats one last time before stopping interface */ in fm10k_down()
1905 fm10k_update_stats(interface); in fm10k_down()
1908 while (test_and_set_bit(__FM10K_UPDATING_STATS, interface->state)) in fm10k_down()
1932 for (; i < interface->num_tx_queues; i++) in fm10k_down()
1933 if (fm10k_get_tx_pending(interface->tx_ring[i], false)) in fm10k_down()
1937 if (i == interface->num_tx_queues) in fm10k_down()
1942 dev_err(&interface->pdev->dev, in fm10k_down()
1949 dev_err(&interface->pdev->dev, in fm10k_down()
1952 dev_err(&interface->pdev->dev, "stop_hw failed: %d\n", err); in fm10k_down()
1955 fm10k_clean_all_tx_rings(interface); in fm10k_down()
1956 fm10k_clean_all_rx_rings(interface); in fm10k_down()
1961 * @interface: host interface private structure to initialize
1964 * fm10k_sw_init initializes the interface private data structure.
1968 static int fm10k_sw_init(struct fm10k_intfc *interface, in fm10k_sw_init() argument
1972 struct fm10k_hw *hw = &interface->hw; in fm10k_sw_init()
1973 struct pci_dev *pdev = interface->pdev; in fm10k_sw_init()
1974 struct net_device *netdev = interface->netdev; in fm10k_sw_init()
1980 hw->back = interface; in fm10k_sw_init()
1981 hw->hw_addr = interface->uc_addr; in fm10k_sw_init()
2000 interface->ring_feature[RING_F_RSS].limit = rss; in fm10k_sw_init()
2031 hw->mac.ops.update_hw_stats(hw, &interface->stats); in fm10k_sw_init()
2056 /* initialize DCBNL interface */ in fm10k_sw_init()
2060 interface->tx_ring_count = FM10K_DEFAULT_TXD; in fm10k_sw_init()
2061 interface->rx_ring_count = FM10K_DEFAULT_RXD; in fm10k_sw_init()
2064 interface->tx_itr = FM10K_TX_ITR_DEFAULT; in fm10k_sw_init()
2065 interface->rx_itr = FM10K_ITR_ADAPTIVE | FM10K_RX_ITR_DEFAULT; in fm10k_sw_init()
2068 INIT_LIST_HEAD(&interface->macvlan_requests); in fm10k_sw_init()
2071 memcpy(interface->rssrk, rss_key, sizeof(rss_key)); in fm10k_sw_init()
2074 spin_lock_init(&interface->mbx_lock); in fm10k_sw_init()
2075 spin_lock_init(&interface->macvlan_lock); in fm10k_sw_init()
2077 /* Start off interface as being down */ in fm10k_sw_init()
2078 set_bit(__FM10K_DOWN, interface->state); in fm10k_sw_init()
2079 set_bit(__FM10K_UPDATING_STATS, interface->state); in fm10k_sw_init()
2091 * fm10k_probe initializes an interface identified by a pci_dev structure.
2092 * The OS initialization, configuring of the interface private structure,
2098 struct fm10k_intfc *interface; in fm10k_probe() local
2143 interface = netdev_priv(netdev); in fm10k_probe()
2144 pci_set_drvdata(pdev, interface); in fm10k_probe()
2146 interface->netdev = netdev; in fm10k_probe()
2147 interface->pdev = pdev; in fm10k_probe()
2149 interface->uc_addr = ioremap(pci_resource_start(pdev, 0), in fm10k_probe()
2151 if (!interface->uc_addr) { in fm10k_probe()
2156 err = fm10k_sw_init(interface, ent); in fm10k_probe()
2161 fm10k_dbg_intfc_init(interface); in fm10k_probe()
2163 err = fm10k_init_queueing_scheme(interface); in fm10k_probe()
2171 set_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2173 err = fm10k_mbx_request_irq(interface); in fm10k_probe()
2177 /* final check of hardware state before registering the interface */ in fm10k_probe()
2178 err = fm10k_hw_ready(interface); in fm10k_probe()
2195 timer_setup(&interface->service_timer, fm10k_service_timer, 0); in fm10k_probe()
2196 INIT_WORK(&interface->service_task, fm10k_service_task); in fm10k_probe()
2199 INIT_DELAYED_WORK(&interface->macvlan_task, fm10k_macvlan_task); in fm10k_probe()
2201 /* kick off service timer now, even when interface is down */ in fm10k_probe()
2202 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); in fm10k_probe()
2205 pcie_print_link_status(interface->pdev); in fm10k_probe()
2214 clear_bit(__FM10K_SERVICE_DISABLE, interface->state); in fm10k_probe()
2215 fm10k_service_event_schedule(interface); in fm10k_probe()
2220 fm10k_mbx_free_irq(interface); in fm10k_probe()
2222 fm10k_clear_queueing_scheme(interface); in fm10k_probe()
2224 if (interface->sw_addr) in fm10k_probe()
2225 iounmap(interface->sw_addr); in fm10k_probe()
2226 iounmap(interface->uc_addr); in fm10k_probe()
2248 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_remove() local
2249 struct net_device *netdev = interface->netdev; in fm10k_remove()
2251 del_timer_sync(&interface->service_timer); in fm10k_remove()
2253 fm10k_stop_service_event(interface); in fm10k_remove()
2254 fm10k_stop_macvlan_task(interface); in fm10k_remove()
2257 fm10k_clear_macvlan_queue(interface, interface->glort, true); in fm10k_remove()
2267 fm10k_mbx_free_irq(interface); in fm10k_remove()
2270 fm10k_clear_queueing_scheme(interface); in fm10k_remove()
2273 fm10k_dbg_intfc_exit(interface); in fm10k_remove()
2275 if (interface->sw_addr) in fm10k_remove()
2276 iounmap(interface->sw_addr); in fm10k_remove()
2277 iounmap(interface->uc_addr); in fm10k_remove()
2288 static void fm10k_prepare_suspend(struct fm10k_intfc *interface) in fm10k_prepare_suspend() argument
2298 fm10k_stop_service_event(interface); in fm10k_prepare_suspend()
2300 if (fm10k_prepare_for_reset(interface)) in fm10k_prepare_suspend()
2301 set_bit(__FM10K_RESET_SUSPENDED, interface->state); in fm10k_prepare_suspend()
2304 static int fm10k_handle_resume(struct fm10k_intfc *interface) in fm10k_handle_resume() argument
2306 struct fm10k_hw *hw = &interface->hw; in fm10k_handle_resume()
2312 if (!test_and_clear_bit(__FM10K_RESET_SUSPENDED, interface->state)) in fm10k_handle_resume()
2313 dev_warn(&interface->pdev->dev, in fm10k_handle_resume()
2317 hw->mac.ops.rebind_hw_stats(hw, &interface->stats); in fm10k_handle_resume()
2319 err = fm10k_handle_reset(interface); in fm10k_handle_resume()
2326 interface->host_ready = false; in fm10k_handle_resume()
2327 fm10k_watchdog_host_not_ready(interface); in fm10k_handle_resume()
2330 interface->link_down_event = jiffies + (HZ); in fm10k_handle_resume()
2331 set_bit(__FM10K_LINK_DOWN, interface->state); in fm10k_handle_resume()
2334 fm10k_start_service_event(interface); in fm10k_handle_resume()
2337 fm10k_macvlan_schedule(interface); in fm10k_handle_resume()
2352 struct fm10k_intfc *interface = dev_get_drvdata(dev); in fm10k_resume() local
2353 struct net_device *netdev = interface->netdev; in fm10k_resume()
2354 struct fm10k_hw *hw = &interface->hw; in fm10k_resume()
2358 hw->hw_addr = interface->uc_addr; in fm10k_resume()
2360 err = fm10k_handle_resume(interface); in fm10k_resume()
2379 struct fm10k_intfc *interface = dev_get_drvdata(dev); in fm10k_suspend() local
2380 struct net_device *netdev = interface->netdev; in fm10k_suspend()
2384 fm10k_prepare_suspend(interface); in fm10k_suspend()
2400 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_error_detected() local
2401 struct net_device *netdev = interface->netdev; in fm10k_io_error_detected()
2408 fm10k_prepare_suspend(interface); in fm10k_io_error_detected()
2454 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_resume() local
2455 struct net_device *netdev = interface->netdev; in fm10k_io_resume()
2458 err = fm10k_handle_resume(interface); in fm10k_io_resume()
2492 struct fm10k_intfc *interface = pci_get_drvdata(pdev); in fm10k_io_reset_done() local
2493 int err = fm10k_handle_resume(interface); in fm10k_io_reset_done()
2498 netif_device_detach(interface->netdev); in fm10k_io_reset_done()
2525 * fm10k_register_pci_driver - register driver interface
2535 * fm10k_unregister_pci_driver - unregister driver interface