Lines Matching full:interface
47 * @interface: board private structure
55 static int fm10k_setup_all_tx_resources(struct fm10k_intfc *interface) in fm10k_setup_all_tx_resources() argument
59 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_setup_all_tx_resources()
60 err = fm10k_setup_tx_resources(interface->tx_ring[i]); in fm10k_setup_all_tx_resources()
64 netif_err(interface, probe, interface->netdev, in fm10k_setup_all_tx_resources()
73 fm10k_free_tx_resources(interface->tx_ring[i]); in fm10k_setup_all_tx_resources()
114 * @interface: board private structure
122 static int fm10k_setup_all_rx_resources(struct fm10k_intfc *interface) in fm10k_setup_all_rx_resources() argument
126 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_setup_all_rx_resources()
127 err = fm10k_setup_rx_resources(interface->rx_ring[i]); in fm10k_setup_all_rx_resources()
131 netif_err(interface, probe, interface->netdev, in fm10k_setup_all_rx_resources()
140 fm10k_free_rx_resources(interface->rx_ring[i]); in fm10k_setup_all_rx_resources()
220 * @interface: board private structure
222 void fm10k_clean_all_tx_rings(struct fm10k_intfc *interface) in fm10k_clean_all_tx_rings() argument
226 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_clean_all_tx_rings()
227 fm10k_clean_tx_ring(interface->tx_ring[i]); in fm10k_clean_all_tx_rings()
232 * @interface: board private structure
236 static void fm10k_free_all_tx_resources(struct fm10k_intfc *interface) in fm10k_free_all_tx_resources() argument
238 int i = interface->num_tx_queues; in fm10k_free_all_tx_resources()
241 fm10k_free_tx_resources(interface->tx_ring[i]); in fm10k_free_all_tx_resources()
309 * @interface: board private structure
311 void fm10k_clean_all_rx_rings(struct fm10k_intfc *interface) in fm10k_clean_all_rx_rings() argument
315 for (i = 0; i < interface->num_rx_queues; i++) in fm10k_clean_all_rx_rings()
316 fm10k_clean_rx_ring(interface->rx_ring[i]); in fm10k_clean_all_rx_rings()
321 * @interface: board private structure
325 static void fm10k_free_all_rx_resources(struct fm10k_intfc *interface) in fm10k_free_all_rx_resources() argument
327 int i = interface->num_rx_queues; in fm10k_free_all_rx_resources()
330 fm10k_free_rx_resources(interface->rx_ring[i]); in fm10k_free_all_rx_resources()
335 * @interface: board private structure
337 * This function allocates a range of glorts for this interface to use.
339 static void fm10k_request_glort_range(struct fm10k_intfc *interface) in fm10k_request_glort_range() argument
341 struct fm10k_hw *hw = &interface->hw; in fm10k_request_glort_range()
345 interface->glort = hw->mac.dglort_map & FM10K_DGLORTMAP_NONE; in fm10k_request_glort_range()
346 interface->glort_count = 0; in fm10k_request_glort_range()
358 interface->glort_count = 1; in fm10k_request_glort_range()
359 interface->glort += mask; in fm10k_request_glort_range()
361 interface->glort_count = (mask + 1) / 2; in fm10k_request_glort_range()
362 interface->glort += interface->glort_count; in fm10k_request_glort_range()
364 interface->glort_count = mask - 63; in fm10k_request_glort_range()
365 interface->glort += 64; in fm10k_request_glort_range()
371 * @interface: board private structure
375 static void fm10k_restore_udp_port_info(struct fm10k_intfc *interface) in fm10k_restore_udp_port_info() argument
377 struct fm10k_hw *hw = &interface->hw; in fm10k_restore_udp_port_info()
385 ntohs(interface->vxlan_port) | in fm10k_restore_udp_port_info()
390 ntohs(interface->geneve_port)); in fm10k_restore_udp_port_info()
395 * @dev: network interface device structure
404 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_udp_tunnel_sync() local
409 interface->vxlan_port = ti.port; in fm10k_udp_tunnel_sync()
411 interface->geneve_port = ti.port; in fm10k_udp_tunnel_sync()
413 fm10k_restore_udp_port_info(interface); in fm10k_udp_tunnel_sync()
426 * fm10k_open - Called when a network interface is made active
427 * @netdev: network interface device structure
431 * The open entry point is called when a network interface is made
435 * and the stack is notified that the interface is ready.
439 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_open() local
443 err = fm10k_setup_all_tx_resources(interface); in fm10k_open()
448 err = fm10k_setup_all_rx_resources(interface); in fm10k_open()
453 err = fm10k_qv_request_irq(interface); in fm10k_open()
458 fm10k_request_glort_range(interface); in fm10k_open()
462 interface->num_tx_queues); in fm10k_open()
467 interface->num_rx_queues); in fm10k_open()
471 fm10k_up(interface); in fm10k_open()
476 fm10k_qv_free_irq(interface); in fm10k_open()
478 fm10k_free_all_rx_resources(interface); in fm10k_open()
480 fm10k_free_all_tx_resources(interface); in fm10k_open()
486 * fm10k_close - Disables a network interface
487 * @netdev: network interface device structure
491 * The close entry point is called when an interface is de-activated
498 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_close() local
500 fm10k_down(interface); in fm10k_close()
502 fm10k_qv_free_irq(interface); in fm10k_close()
504 fm10k_free_all_tx_resources(interface); in fm10k_close()
505 fm10k_free_all_rx_resources(interface); in fm10k_close()
512 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_xmit_frame() local
513 int num_tx_queues = READ_ONCE(interface->num_tx_queues); in fm10k_xmit_frame()
575 err = fm10k_xmit_frame_ring(skb, interface->tx_ring[r_idx]); in fm10k_xmit_frame()
582 * @netdev: network interface device structure
587 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_tx_timeout() local
591 if (txqueue >= interface->num_tx_queues) { in fm10k_tx_timeout()
596 tx_ring = interface->tx_ring[txqueue]; in fm10k_tx_timeout()
602 fm10k_tx_timeout_reset(interface); in fm10k_tx_timeout()
604 netif_info(interface, drv, netdev, in fm10k_tx_timeout()
615 * fm10k_host_mbx_ready - Check PF interface's mailbox readiness
616 * @interface: board private structure
618 * This function checks if the PF interface's mailbox is ready before queueing
624 static bool fm10k_host_mbx_ready(struct fm10k_intfc *interface) in fm10k_host_mbx_ready() argument
626 struct fm10k_hw *hw = &interface->hw; in fm10k_host_mbx_ready()
628 return (hw->mac.type == fm10k_mac_vf || interface->host_ready); in fm10k_host_mbx_ready()
633 * @interface: the fm10k interface structure
643 int fm10k_queue_vlan_request(struct fm10k_intfc *interface, in fm10k_queue_vlan_request() argument
661 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_queue_vlan_request()
662 list_add_tail(&request->list, &interface->macvlan_requests); in fm10k_queue_vlan_request()
663 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_queue_vlan_request()
665 fm10k_macvlan_schedule(interface); in fm10k_queue_vlan_request()
672 * @interface: the fm10k interface structure
682 int fm10k_queue_mac_request(struct fm10k_intfc *interface, u16 glort, in fm10k_queue_mac_request() argument
705 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_queue_mac_request()
706 list_add_tail(&request->list, &interface->macvlan_requests); in fm10k_queue_mac_request()
707 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_queue_mac_request()
709 fm10k_macvlan_schedule(interface); in fm10k_queue_mac_request()
716 * @interface: the fm10k interface structure
723 void fm10k_clear_macvlan_queue(struct fm10k_intfc *interface, in fm10k_clear_macvlan_queue() argument
730 spin_lock_irqsave(&interface->macvlan_lock, flags); in fm10k_clear_macvlan_queue()
732 /* Free any outstanding MAC/VLAN requests for this interface */ in fm10k_clear_macvlan_queue()
733 list_for_each_entry_safe(r, tmp, &interface->macvlan_requests, list) { in fm10k_clear_macvlan_queue()
750 spin_unlock_irqrestore(&interface->macvlan_lock, flags); in fm10k_clear_macvlan_queue()
756 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_uc_vlan_unsync() local
757 u16 glort = interface->glort; in fm10k_uc_vlan_unsync()
758 u16 vid = interface->vid; in fm10k_uc_vlan_unsync()
765 err = fm10k_queue_mac_request(interface, glort, uc_addr, vid, set); in fm10k_uc_vlan_unsync()
776 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_mc_vlan_unsync() local
777 u16 glort = interface->glort; in fm10k_mc_vlan_unsync()
778 u16 vid = interface->vid; in fm10k_mc_vlan_unsync()
785 err = fm10k_queue_mac_request(interface, glort, mc_addr, vid, set); in fm10k_mc_vlan_unsync()
795 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_update_vid() local
796 struct fm10k_l2_accel *l2_accel = interface->l2_accel; in fm10k_update_vid()
797 struct fm10k_hw *hw = &interface->hw; in fm10k_update_vid()
818 set_bit(vid, interface->active_vlans); in fm10k_update_vid()
820 clear_bit(vid, interface->active_vlans); in fm10k_update_vid()
823 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_update_vid()
824 struct fm10k_ring *rx_ring = interface->rx_ring[i]; in fm10k_update_vid()
827 if (test_bit(rx_vid, interface->active_vlans)) in fm10k_update_vid()
845 /* Do not throw an error if the interface is down. We will sync once in fm10k_update_vid()
848 if (test_bit(__FM10K_DOWN, interface->state)) in fm10k_update_vid()
851 fm10k_mbx_lock(interface); in fm10k_update_vid()
855 err = fm10k_queue_vlan_request(interface, vid, 0, set); in fm10k_update_vid()
861 err = fm10k_queue_mac_request(interface, interface->glort, in fm10k_update_vid()
876 fm10k_queue_mac_request(interface, glort, in fm10k_update_vid()
883 interface->vid = vid + (set ? VLAN_N_VID : 0); in fm10k_update_vid()
890 fm10k_mbx_unlock(interface); in fm10k_update_vid()
909 static u16 fm10k_find_next_vlan(struct fm10k_intfc *interface, u16 vid) in fm10k_find_next_vlan() argument
911 struct fm10k_hw *hw = &interface->hw; in fm10k_find_next_vlan()
915 vid = find_next_bit(interface->active_vlans, vid_limit, ++vid); in fm10k_find_next_vlan()
920 static void fm10k_clear_unused_vlans(struct fm10k_intfc *interface) in fm10k_clear_unused_vlans() argument
927 prev_vid = vid + 1, vid = fm10k_find_next_vlan(interface, vid)) { in fm10k_clear_unused_vlans()
933 fm10k_queue_vlan_request(interface, prev_vid, 0, false); in fm10k_clear_unused_vlans()
940 struct fm10k_intfc *interface = netdev_priv(dev); in __fm10k_uc_sync() local
941 u16 vid, glort = interface->glort; in __fm10k_uc_sync()
947 for (vid = fm10k_find_next_vlan(interface, 0); in __fm10k_uc_sync()
949 vid = fm10k_find_next_vlan(interface, vid)) { in __fm10k_uc_sync()
950 err = fm10k_queue_mac_request(interface, glort, in __fm10k_uc_sync()
973 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_set_mac() local
974 struct fm10k_hw *hw = &interface->hw; in fm10k_set_mac()
983 fm10k_mbx_lock(interface); in fm10k_set_mac()
989 fm10k_mbx_unlock(interface); in fm10k_set_mac()
1005 struct fm10k_intfc *interface = netdev_priv(dev); in __fm10k_mc_sync() local
1006 u16 vid, glort = interface->glort; in __fm10k_mc_sync()
1012 for (vid = fm10k_find_next_vlan(interface, 0); in __fm10k_mc_sync()
1014 vid = fm10k_find_next_vlan(interface, vid)) { in __fm10k_mc_sync()
1015 err = fm10k_queue_mac_request(interface, glort, in __fm10k_mc_sync()
1038 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_set_rx_mode() local
1039 struct fm10k_hw *hw = &interface->hw; in fm10k_set_rx_mode()
1052 fm10k_mbx_lock(interface); in fm10k_set_rx_mode()
1055 if (interface->xcast_mode != xcast_mode) { in fm10k_set_rx_mode()
1058 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL, in fm10k_set_rx_mode()
1062 if (interface->xcast_mode == FM10K_XCAST_MODE_PROMISC) in fm10k_set_rx_mode()
1063 fm10k_clear_unused_vlans(interface); in fm10k_set_rx_mode()
1066 if (fm10k_host_mbx_ready(interface)) in fm10k_set_rx_mode()
1067 hw->mac.ops.update_xcast_mode(hw, interface->glort, in fm10k_set_rx_mode()
1071 interface->xcast_mode = xcast_mode; in fm10k_set_rx_mode()
1078 fm10k_mbx_unlock(interface); in fm10k_set_rx_mode()
1081 void fm10k_restore_rx_state(struct fm10k_intfc *interface) in fm10k_restore_rx_state() argument
1083 struct fm10k_l2_accel *l2_accel = interface->l2_accel; in fm10k_restore_rx_state()
1084 struct net_device *netdev = interface->netdev; in fm10k_restore_rx_state()
1085 struct fm10k_hw *hw = &interface->hw; in fm10k_restore_rx_state()
1089 /* record glort for this interface */ in fm10k_restore_rx_state()
1090 glort = interface->glort; in fm10k_restore_rx_state()
1092 /* convert interface flags to xcast mode */ in fm10k_restore_rx_state()
1102 fm10k_mbx_lock(interface); in fm10k_restore_rx_state()
1105 if (fm10k_host_mbx_ready(interface)) in fm10k_restore_rx_state()
1107 interface->glort_count, true); in fm10k_restore_rx_state()
1110 fm10k_queue_vlan_request(interface, FM10K_VLAN_ALL, 0, in fm10k_restore_rx_state()
1114 for (vid = fm10k_find_next_vlan(interface, 0); in fm10k_restore_rx_state()
1116 vid = fm10k_find_next_vlan(interface, vid)) { in fm10k_restore_rx_state()
1117 fm10k_queue_vlan_request(interface, vid, 0, true); in fm10k_restore_rx_state()
1119 fm10k_queue_mac_request(interface, glort, in fm10k_restore_rx_state()
1132 fm10k_queue_mac_request(interface, glort, in fm10k_restore_rx_state()
1142 if (fm10k_host_mbx_ready(interface)) in fm10k_restore_rx_state()
1161 fm10k_queue_mac_request(interface, glort, in fm10k_restore_rx_state()
1167 fm10k_mbx_unlock(interface); in fm10k_restore_rx_state()
1170 interface->xcast_mode = xcast_mode; in fm10k_restore_rx_state()
1173 fm10k_restore_udp_port_info(interface); in fm10k_restore_rx_state()
1176 void fm10k_reset_rx_state(struct fm10k_intfc *interface) in fm10k_reset_rx_state() argument
1178 struct net_device *netdev = interface->netdev; in fm10k_reset_rx_state()
1179 struct fm10k_hw *hw = &interface->hw; in fm10k_reset_rx_state()
1182 while (test_bit(__FM10K_MACVLAN_SCHED, interface->state)) in fm10k_reset_rx_state()
1186 fm10k_clear_macvlan_queue(interface, interface->glort, true); in fm10k_reset_rx_state()
1188 fm10k_mbx_lock(interface); in fm10k_reset_rx_state()
1193 if (fm10k_host_mbx_ready(interface)) in fm10k_reset_rx_state()
1194 hw->mac.ops.update_lport_state(hw, interface->glort, in fm10k_reset_rx_state()
1195 interface->glort_count, false); in fm10k_reset_rx_state()
1197 fm10k_mbx_unlock(interface); in fm10k_reset_rx_state()
1200 interface->xcast_mode = FM10K_XCAST_MODE_NONE; in fm10k_reset_rx_state()
1209 * @netdev: network interface device structure
1218 struct fm10k_intfc *interface = netdev_priv(netdev); in fm10k_get_stats64() local
1225 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_get_stats64()
1226 ring = READ_ONCE(interface->rx_ring[i]); in fm10k_get_stats64()
1241 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_get_stats64()
1242 ring = READ_ONCE(interface->tx_ring[i]); in fm10k_get_stats64()
1265 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_setup_tc() local
1269 if (tc && (interface->hw.mac.type != fm10k_mac_pf)) in fm10k_setup_tc()
1283 fm10k_mbx_free_irq(interface); in fm10k_setup_tc()
1285 fm10k_clear_queueing_scheme(interface); in fm10k_setup_tc()
1291 err = fm10k_init_queueing_scheme(interface); in fm10k_setup_tc()
1295 err = fm10k_mbx_request_irq(interface); in fm10k_setup_tc()
1304 set_bit(FM10K_FLAG_SWPRI_CONFIG, interface->flags); in fm10k_setup_tc()
1308 fm10k_mbx_free_irq(interface); in fm10k_setup_tc()
1310 fm10k_clear_queueing_scheme(interface); in fm10k_setup_tc()
1330 static void fm10k_assign_l2_accel(struct fm10k_intfc *interface, in fm10k_assign_l2_accel() argument
1335 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_assign_l2_accel()
1336 struct fm10k_ring *ring = interface->rx_ring[i]; in fm10k_assign_l2_accel()
1341 interface->l2_accel = l2_accel; in fm10k_assign_l2_accel()
1347 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_dfwd_add_station() local
1348 struct fm10k_l2_accel *l2_accel = interface->l2_accel; in fm10k_dfwd_add_station()
1351 struct fm10k_hw *hw = &interface->hw; in fm10k_dfwd_add_station()
1365 if (interface->glort_count < 7) in fm10k_dfwd_add_station()
1374 l2_accel->dglort = interface->glort; in fm10k_dfwd_add_station()
1377 fm10k_assign_l2_accel(interface, l2_accel); in fm10k_dfwd_add_station()
1380 (l2_accel->count == (interface->glort_count - 1))) { in fm10k_dfwd_add_station()
1398 fm10k_assign_l2_accel(interface, l2_accel); in fm10k_dfwd_add_station()
1415 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_dfwd_add_station()
1416 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_dfwd_add_station()
1417 dglort.glort = interface->glort; in fm10k_dfwd_add_station()
1422 fm10k_mbx_lock(interface); in fm10k_dfwd_add_station()
1426 if (fm10k_host_mbx_ready(interface)) in fm10k_dfwd_add_station()
1430 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, in fm10k_dfwd_add_station()
1433 for (vid = fm10k_find_next_vlan(interface, 0); in fm10k_dfwd_add_station()
1435 vid = fm10k_find_next_vlan(interface, vid)) in fm10k_dfwd_add_station()
1436 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, in fm10k_dfwd_add_station()
1439 fm10k_mbx_unlock(interface); in fm10k_dfwd_add_station()
1446 struct fm10k_intfc *interface = netdev_priv(dev); in fm10k_dfwd_del_station() local
1447 struct fm10k_l2_accel *l2_accel = READ_ONCE(interface->l2_accel); in fm10k_dfwd_del_station()
1449 struct fm10k_hw *hw = &interface->hw; in fm10k_dfwd_del_station()
1457 /* search table for matching interface */ in fm10k_dfwd_del_station()
1468 fm10k_mbx_lock(interface); in fm10k_dfwd_del_station()
1472 if (fm10k_host_mbx_ready(interface)) in fm10k_dfwd_del_station()
1476 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, in fm10k_dfwd_del_station()
1479 for (vid = fm10k_find_next_vlan(interface, 0); in fm10k_dfwd_del_station()
1481 vid = fm10k_find_next_vlan(interface, vid)) in fm10k_dfwd_del_station()
1482 fm10k_queue_mac_request(interface, glort, sdev->dev_addr, in fm10k_dfwd_del_station()
1485 fm10k_mbx_unlock(interface); in fm10k_dfwd_del_station()
1494 dglort.rss_l = fls(interface->ring_feature[RING_F_RSS].mask); in fm10k_dfwd_del_station()
1495 dglort.pc_l = fls(interface->ring_feature[RING_F_QOS].mask); in fm10k_dfwd_del_station()
1496 dglort.glort = interface->glort; in fm10k_dfwd_del_station()
1502 fm10k_assign_l2_accel(interface, NULL); in fm10k_dfwd_del_station()
1544 struct fm10k_intfc *interface; in fm10k_alloc_netdev() local
1556 interface = netdev_priv(dev); in fm10k_alloc_netdev()
1557 interface->msg_enable = BIT(DEFAULT_DEBUG_LEVEL_SHIFT) - 1; in fm10k_alloc_netdev()