Lines Matching refs:interface

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