Lines Matching full:adapter

25 static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter,  in ixgbe_alloc_vf_macvlans()  argument
28 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_alloc_vf_macvlans()
33 INIT_LIST_HEAD(&adapter->vf_mvs.l); in ixgbe_alloc_vf_macvlans()
46 list_add(&mv_list[i].l, &adapter->vf_mvs.l); in ixgbe_alloc_vf_macvlans()
48 adapter->mv_list = mv_list; in ixgbe_alloc_vf_macvlans()
52 static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter, in __ixgbe_enable_sriov() argument
55 struct ixgbe_hw *hw = &adapter->hw; in __ixgbe_enable_sriov()
58 if (adapter->xdp_prog) { in __ixgbe_enable_sriov()
64 adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED | in __ixgbe_enable_sriov()
68 adapter->vfinfo = kcalloc(num_vfs, sizeof(struct vf_data_storage), in __ixgbe_enable_sriov()
70 if (!adapter->vfinfo) in __ixgbe_enable_sriov()
73 adapter->num_vfs = num_vfs; in __ixgbe_enable_sriov()
75 ixgbe_alloc_vf_macvlans(adapter, num_vfs); in __ixgbe_enable_sriov()
76 adapter->ring_feature[RING_F_VMDQ].offset = num_vfs; in __ixgbe_enable_sriov()
80 adapter->bridge_mode = BRIDGE_MODE_VEB; in __ixgbe_enable_sriov()
83 if ((adapter->hw.mac.type == ixgbe_mac_82599EB) && (num_vfs < 16)) { in __ixgbe_enable_sriov()
84 adapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS; in __ixgbe_enable_sriov()
85 adapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS; in __ixgbe_enable_sriov()
87 adapter->dcb_cfg.num_tcs.pg_tcs = 4; in __ixgbe_enable_sriov()
88 adapter->dcb_cfg.num_tcs.pfc_tcs = 4; in __ixgbe_enable_sriov()
90 adapter->dcb_cfg.num_tcs.pg_tcs = 1; in __ixgbe_enable_sriov()
91 adapter->dcb_cfg.num_tcs.pfc_tcs = 1; in __ixgbe_enable_sriov()
95 adapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE | in __ixgbe_enable_sriov()
100 adapter->vfinfo[i].spoofchk_enabled = true; in __ixgbe_enable_sriov()
101 adapter->vfinfo[i].link_enable = true; in __ixgbe_enable_sriov()
108 adapter->vfinfo[i].rss_query_enabled = false; in __ixgbe_enable_sriov()
111 adapter->vfinfo[i].trusted = false; in __ixgbe_enable_sriov()
114 adapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE; in __ixgbe_enable_sriov()
123 * @adapter: Pointer to adapter struct
125 static void ixgbe_get_vfs(struct ixgbe_adapter *adapter) in ixgbe_get_vfs() argument
127 struct pci_dev *pdev = adapter->pdev; in ixgbe_get_vfs()
145 if (vf >= adapter->num_vfs) in ixgbe_get_vfs()
148 adapter->vfinfo[vf].vfdev = vfdev; in ixgbe_get_vfs()
156 void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs) in ixgbe_enable_sriov() argument
161 pre_existing_vfs = pci_num_vf(adapter->pdev); in ixgbe_enable_sriov()
173 dev_warn(&adapter->pdev->dev, in ixgbe_enable_sriov()
186 err = pci_enable_sriov(adapter->pdev, num_vfs); in ixgbe_enable_sriov()
193 if (!__ixgbe_enable_sriov(adapter, num_vfs)) { in ixgbe_enable_sriov()
194 ixgbe_get_vfs(adapter); in ixgbe_enable_sriov()
203 ixgbe_disable_sriov(adapter); in ixgbe_enable_sriov()
207 int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) in ixgbe_disable_sriov() argument
209 unsigned int num_vfs = adapter->num_vfs, vf; in ixgbe_disable_sriov()
210 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_sriov()
214 spin_lock_irqsave(&adapter->vfs_lock, flags); in ixgbe_disable_sriov()
216 adapter->num_vfs = 0; in ixgbe_disable_sriov()
217 spin_unlock_irqrestore(&adapter->vfs_lock, flags); in ixgbe_disable_sriov()
221 struct pci_dev *vfdev = adapter->vfinfo[vf].vfdev; in ixgbe_disable_sriov()
225 adapter->vfinfo[vf].vfdev = NULL; in ixgbe_disable_sriov()
230 kfree(adapter->vfinfo); in ixgbe_disable_sriov()
231 adapter->vfinfo = NULL; in ixgbe_disable_sriov()
234 kfree(adapter->mv_list); in ixgbe_disable_sriov()
235 adapter->mv_list = NULL; in ixgbe_disable_sriov()
238 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_disable_sriov()
250 if (pci_vfs_assigned(adapter->pdev)) { in ixgbe_disable_sriov()
255 pci_disable_sriov(adapter->pdev); in ixgbe_disable_sriov()
259 if (bitmap_weight(adapter->fwd_bitmask, adapter->num_rx_pools) == 1) { in ixgbe_disable_sriov()
260 adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED; in ixgbe_disable_sriov()
261 adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; in ixgbe_disable_sriov()
262 rss = min_t(int, ixgbe_max_rss_indices(adapter), in ixgbe_disable_sriov()
268 adapter->ring_feature[RING_F_VMDQ].offset = 0; in ixgbe_disable_sriov()
269 adapter->ring_feature[RING_F_RSS].limit = rss; in ixgbe_disable_sriov()
279 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_enable() local
285 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_enable()
304 num_tc = adapter->hw_tcs; in ixgbe_pci_sriov_enable()
305 num_rx_pools = bitmap_weight(adapter->fwd_bitmask, in ixgbe_pci_sriov_enable()
306 adapter->num_rx_pools); in ixgbe_pci_sriov_enable()
316 err = __ixgbe_enable_sriov(adapter, num_vfs); in ixgbe_pci_sriov_enable()
324 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_enable()
331 ixgbe_get_vfs(adapter); in ixgbe_pci_sriov_enable()
341 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_disable() local
344 u32 current_flags = adapter->flags; in ixgbe_pci_sriov_disable()
348 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_disable()
352 if (!err && (current_flags != adapter->flags || in ixgbe_pci_sriov_disable()
354 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_disable()
368 static int ixgbe_set_vf_multicasts(struct ixgbe_adapter *adapter, in ixgbe_set_vf_multicasts() argument
373 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_set_vf_multicasts()
374 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_multicasts()
413 void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) in ixgbe_restore_vf_multicasts() argument
415 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_restore_vf_multicasts()
422 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_restore_vf_multicasts()
424 vfinfo = &adapter->vfinfo[i]; in ixgbe_restore_vf_multicasts()
442 ixgbe_full_sync_mac_table(adapter); in ixgbe_restore_vf_multicasts()
446 static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, in ixgbe_set_vf_vlan() argument
449 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_vlan()
457 if (add && test_bit(vid, adapter->active_vlans)) { in ixgbe_set_vf_vlan()
472 if (test_bit(vid, adapter->active_vlans) || in ixgbe_set_vf_vlan()
473 (adapter->flags2 & IXGBE_FLAG2_VLAN_PROMISC)) in ixgbe_set_vf_vlan()
474 ixgbe_update_pf_promisc_vlvf(adapter, vid); in ixgbe_set_vf_vlan()
479 static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf) in ixgbe_set_vf_lpe() argument
481 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_lpe()
496 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_vf_lpe()
497 struct net_device *dev = adapter->netdev; in ixgbe_set_vf_lpe()
508 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_set_vf_lpe()
577 static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_clear_vmvir() argument
579 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_clear_vmvir()
584 static void ixgbe_clear_vf_vlans(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_clear_vf_vlans() argument
586 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_clear_vf_vlans()
637 if (!(adapter->flags2 & IXGBE_FLAG2_VLAN_PROMISC)) in ixgbe_clear_vf_vlans()
645 static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan() argument
653 list_for_each_entry(entry, &adapter->vf_mvs.l, l) { in ixgbe_set_vf_macvlan()
658 ixgbe_del_mac_filter(adapter, in ixgbe_set_vf_macvlan()
671 list_for_each_entry(entry, &adapter->vf_mvs.l, l) { in ixgbe_set_vf_macvlan()
681 * for the &adapter->vf_mvs.l list to be empty because the original in ixgbe_set_vf_macvlan()
689 retval = ixgbe_add_mac_filter(adapter, mac_addr, vf); in ixgbe_set_vf_macvlan()
701 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_event() argument
703 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_event()
704 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_vf_reset_event()
705 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_vf_reset_event()
707 u8 num_tcs = adapter->hw_tcs; in ixgbe_vf_reset_event()
712 ixgbe_clear_vf_vlans(adapter, vf); in ixgbe_vf_reset_event()
715 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf); in ixgbe_vf_reset_event()
722 ixgbe_clear_vmvir(adapter, vf); in ixgbe_vf_reset_event()
725 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
728 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
729 adapter->default_up, vf); in ixgbe_vf_reset_event()
738 adapter->vfinfo[vf].num_vf_mc_hashes = 0; in ixgbe_vf_reset_event()
741 ixgbe_ipsec_vf_clear(adapter, vf); in ixgbe_vf_reset_event()
744 ixgbe_set_rx_mode(adapter->netdev); in ixgbe_vf_reset_event()
746 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_vf_reset_event()
747 ixgbe_set_vf_macvlan(adapter, vf, 0, NULL); in ixgbe_vf_reset_event()
750 adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10; in ixgbe_vf_reset_event()
770 static void ixgbe_vf_clear_mbx(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_clear_mbx() argument
772 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_clear_mbx()
782 static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac() argument
787 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_set_vf_mac()
788 retval = ixgbe_add_mac_filter(adapter, mac_addr, vf); in ixgbe_set_vf_mac()
790 memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, in ixgbe_set_vf_mac()
793 eth_zero_addr(adapter->vfinfo[vf].vf_mac_addresses); in ixgbe_set_vf_mac()
800 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_vf_configuration() local
806 eth_zero_addr(adapter->vfinfo[vfn].vf_mac_addresses); in ixgbe_vf_configuration()
811 static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf, in ixgbe_write_qde() argument
814 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_write_qde()
815 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_write_qde()
834 * @adapter: Pointer to adapter struct
839 static void ixgbe_set_vf_rx_tx(struct ixgbe_adapter *adapter, int vf) in ixgbe_set_vf_rx_tx() argument
842 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_rx_tx()
851 if (adapter->vfinfo[vf].link_enable) { in ixgbe_set_vf_rx_tx()
862 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_vf_rx_tx()
863 struct net_device *dev = adapter->netdev; in ixgbe_set_vf_rx_tx()
883 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_msg() argument
885 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_vf_reset_msg()
886 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_msg()
887 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; in ixgbe_vf_reset_msg()
897 ixgbe_vf_reset_event(adapter, vf); in ixgbe_vf_reset_msg()
899 ixgbe_vf_clear_mbx(adapter, vf); in ixgbe_vf_reset_msg()
903 ixgbe_set_vf_mac(adapter, vf, vf_mac); in ixgbe_vf_reset_msg()
910 if (adapter->vfinfo[vf].pf_vlan) in ixgbe_vf_reset_msg()
913 ixgbe_write_qde(adapter, vf, reg); in ixgbe_vf_reset_msg()
915 ixgbe_set_vf_rx_tx(adapter, vf); in ixgbe_vf_reset_msg()
918 adapter->vfinfo[vf].clear_to_send = true; in ixgbe_vf_reset_msg()
936 if (!is_zero_ether_addr(vf_mac) && adapter->vfinfo[vf].pf_set_mac) { in ixgbe_vf_reset_msg()
953 static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac_addr() argument
963 if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted && in ixgbe_set_vf_mac_addr()
964 !ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) { in ixgbe_set_vf_mac_addr()
972 return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0; in ixgbe_set_vf_mac_addr()
975 static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_vlan_msg() argument
980 u8 tcs = adapter->hw_tcs; in ixgbe_set_vf_vlan_msg()
982 if (adapter->vfinfo[vf].pf_vlan || tcs) { in ixgbe_set_vf_vlan_msg()
994 return ixgbe_set_vf_vlan(adapter, add, vid, vf); in ixgbe_set_vf_vlan_msg()
997 static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan_msg() argument
1004 if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted && in ixgbe_set_vf_macvlan_msg()
1023 if (adapter->vfinfo[vf].spoofchk_enabled) { in ixgbe_set_vf_macvlan_msg()
1024 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_macvlan_msg()
1031 err = ixgbe_set_vf_macvlan(adapter, vf, index, new_mac); in ixgbe_set_vf_macvlan_msg()
1040 static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter, in ixgbe_negotiate_vf_api() argument
1053 adapter->vfinfo[vf].vf_api = api; in ixgbe_negotiate_vf_api()
1064 static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter, in ixgbe_get_vf_queues() argument
1067 struct net_device *dev = adapter->netdev; in ixgbe_get_vf_queues()
1068 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_get_vf_queues()
1070 u8 num_tcs = adapter->hw_tcs; in ixgbe_get_vf_queues()
1073 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_queues()
1092 default_tc = netdev_get_prio_tc_map(dev, adapter->default_up); in ixgbe_get_vf_queues()
1097 else if (adapter->vfinfo[vf].pf_vlan || adapter->vfinfo[vf].pf_qos) in ixgbe_get_vf_queues()
1108 static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) in ixgbe_get_vf_reta() argument
1112 const u8 *reta = adapter->rss_indir_tbl; in ixgbe_get_vf_reta()
1113 u32 reta_size = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_get_vf_reta()
1116 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_reta()
1120 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_reta()
1145 static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter, in ixgbe_get_vf_rss_key() argument
1151 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_rss_key()
1155 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_rss_key()
1166 memcpy(rss_key, adapter->rss_key, IXGBE_RSS_KEY_SIZE); in ixgbe_get_vf_rss_key()
1171 static int ixgbe_update_vf_xcast_mode(struct ixgbe_adapter *adapter, in ixgbe_update_vf_xcast_mode() argument
1174 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_vf_xcast_mode()
1179 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_update_vf_xcast_mode()
1195 !adapter->vfinfo[vf].trusted) { in ixgbe_update_vf_xcast_mode()
1199 if (adapter->vfinfo[vf].xcast_mode == xcast_mode) in ixgbe_update_vf_xcast_mode()
1241 adapter->vfinfo[vf].xcast_mode = xcast_mode; in ixgbe_update_vf_xcast_mode()
1249 static int ixgbe_get_vf_link_state(struct ixgbe_adapter *adapter, in ixgbe_get_vf_link_state() argument
1255 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_link_state()
1266 *link_state = adapter->vfinfo[vf].link_enable; in ixgbe_get_vf_link_state()
1273 * @adapter: pointer to adapter struct
1281 static int ixgbe_send_vf_link_status(struct ixgbe_adapter *adapter, in ixgbe_send_vf_link_status() argument
1284 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_send_vf_link_status()
1286 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_send_vf_link_status()
1298 msgbuf[1] = adapter->link_speed; in ixgbe_send_vf_link_status()
1299 msgbuf[2] = adapter->link_up; in ixgbe_send_vf_link_status()
1306 * @adapter: pointer to adapter struct
1312 static int ixgbe_negotiate_vf_features(struct ixgbe_adapter *adapter, in ixgbe_negotiate_vf_features() argument
1317 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_negotiate_vf_features()
1330 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_msg_from_vf() argument
1334 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_msg_from_vf()
1352 return ixgbe_vf_reset_msg(adapter, vf); in ixgbe_rcv_msg_from_vf()
1358 if (!adapter->vfinfo[vf].clear_to_send) { in ixgbe_rcv_msg_from_vf()
1366 retval = ixgbe_set_vf_mac_addr(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1369 retval = ixgbe_set_vf_multicasts(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1372 retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1375 retval = ixgbe_set_vf_lpe(adapter, msgbuf[1], vf); in ixgbe_rcv_msg_from_vf()
1378 retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1381 retval = ixgbe_negotiate_vf_api(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1384 retval = ixgbe_get_vf_queues(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1387 retval = ixgbe_get_vf_reta(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1390 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1393 retval = ixgbe_update_vf_xcast_mode(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1396 retval = ixgbe_get_vf_link_state(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1399 retval = ixgbe_ipsec_vf_add_sa(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1402 retval = ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1405 retval = ixgbe_send_vf_link_status(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1408 retval = ixgbe_negotiate_vf_features(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1429 static void ixgbe_rcv_ack_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_ack_from_vf() argument
1431 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_ack_from_vf()
1435 if (!adapter->vfinfo[vf].clear_to_send) in ixgbe_rcv_ack_from_vf()
1441 * @adapter: pointer to ixgbe adapter
1445 bool ixgbe_check_mdd_event(struct ixgbe_adapter *adapter) in ixgbe_check_mdd_event() argument
1447 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_check_mdd_event()
1461 dev_warn(&adapter->pdev->dev, in ixgbe_check_mdd_event()
1472 adapter->vfinfo[i].clear_to_send = 0; in ixgbe_check_mdd_event()
1484 void ixgbe_msg_task(struct ixgbe_adapter *adapter) in ixgbe_msg_task() argument
1486 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_msg_task()
1490 ixgbe_check_mdd_event(adapter); in ixgbe_msg_task()
1492 spin_lock_irqsave(&adapter->vfs_lock, flags); in ixgbe_msg_task()
1493 for (vf = 0; vf < adapter->num_vfs; vf++) { in ixgbe_msg_task()
1496 ixgbe_vf_reset_event(adapter, vf); in ixgbe_msg_task()
1500 ixgbe_rcv_msg_from_vf(adapter, vf); in ixgbe_msg_task()
1504 ixgbe_rcv_ack_from_vf(adapter, vf); in ixgbe_msg_task()
1506 spin_unlock_irqrestore(&adapter->vfs_lock, flags); in ixgbe_msg_task()
1509 static inline void ixgbe_ping_vf(struct ixgbe_adapter *adapter, int vf) in ixgbe_ping_vf() argument
1511 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ping_vf()
1515 if (adapter->vfinfo[vf].clear_to_send) in ixgbe_ping_vf()
1520 void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter) in ixgbe_ping_all_vfs() argument
1522 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ping_all_vfs()
1526 for (i = 0 ; i < adapter->num_vfs; i++) { in ixgbe_ping_all_vfs()
1528 if (adapter->vfinfo[i].clear_to_send) in ixgbe_ping_all_vfs()
1536 * @adapter: Pointer to adapter struct
1540 void ixgbe_set_all_vfs(struct ixgbe_adapter *adapter) in ixgbe_set_all_vfs() argument
1544 for (i = 0 ; i < adapter->num_vfs; i++) in ixgbe_set_all_vfs()
1545 ixgbe_set_vf_link_state(adapter, i, in ixgbe_set_all_vfs()
1546 adapter->vfinfo[i].link_state); in ixgbe_set_all_vfs()
1551 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_mac() local
1554 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_mac()
1558 dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", in ixgbe_ndo_set_vf_mac()
1560 dev_info(&adapter->pdev->dev, "Reload the VF driver to make this change effective."); in ixgbe_ndo_set_vf_mac()
1562 retval = ixgbe_set_vf_mac(adapter, vf, mac); in ixgbe_ndo_set_vf_mac()
1564 adapter->vfinfo[vf].pf_set_mac = true; in ixgbe_ndo_set_vf_mac()
1566 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_ndo_set_vf_mac()
1567 … dev_warn(&adapter->pdev->dev, "The VF MAC address has been set, but the PF device is not up.\n"); in ixgbe_ndo_set_vf_mac()
1568 … dev_warn(&adapter->pdev->dev, "Bring the PF device up before attempting to use the VF device.\n"); in ixgbe_ndo_set_vf_mac()
1571 …dev_warn(&adapter->pdev->dev, "The VF MAC address was NOT set due to invalid or duplicate MAC addr… in ixgbe_ndo_set_vf_mac()
1575 adapter->vfinfo[vf].vf_mac_addresses; in ixgbe_ndo_set_vf_mac()
1581 dev_info(&adapter->pdev->dev, "removing MAC on VF %d\n", vf); in ixgbe_ndo_set_vf_mac()
1583 retval = ixgbe_del_mac_filter(adapter, vf_mac_addr, vf); in ixgbe_ndo_set_vf_mac()
1585 adapter->vfinfo[vf].pf_set_mac = false; in ixgbe_ndo_set_vf_mac()
1588 dev_warn(&adapter->pdev->dev, "Could NOT remove the VF MAC address.\n"); in ixgbe_ndo_set_vf_mac()
1597 static int ixgbe_enable_port_vlan(struct ixgbe_adapter *adapter, int vf, in ixgbe_enable_port_vlan() argument
1600 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_enable_port_vlan()
1603 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); in ixgbe_enable_port_vlan()
1608 ixgbe_set_vf_vlan(adapter, false, 0, vf); in ixgbe_enable_port_vlan()
1610 ixgbe_set_vmvir(adapter, vlan, qos, vf); in ixgbe_enable_port_vlan()
1615 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE | in ixgbe_enable_port_vlan()
1618 adapter->vfinfo[vf].pf_vlan = vlan; in ixgbe_enable_port_vlan()
1619 adapter->vfinfo[vf].pf_qos = qos; in ixgbe_enable_port_vlan()
1620 dev_info(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1622 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_enable_port_vlan()
1623 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1625 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1633 static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf) in ixgbe_disable_port_vlan() argument
1635 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_port_vlan()
1638 err = ixgbe_set_vf_vlan(adapter, false, in ixgbe_disable_port_vlan()
1639 adapter->vfinfo[vf].pf_vlan, vf); in ixgbe_disable_port_vlan()
1641 ixgbe_set_vf_vlan(adapter, true, 0, vf); in ixgbe_disable_port_vlan()
1642 ixgbe_clear_vmvir(adapter, vf); in ixgbe_disable_port_vlan()
1647 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_disable_port_vlan()
1649 adapter->vfinfo[vf].pf_vlan = 0; in ixgbe_disable_port_vlan()
1650 adapter->vfinfo[vf].pf_qos = 0; in ixgbe_disable_port_vlan()
1659 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_vlan() local
1661 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) in ixgbe_ndo_set_vf_vlan()
1673 if (adapter->vfinfo[vf].pf_vlan) in ixgbe_ndo_set_vf_vlan()
1674 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1677 err = ixgbe_enable_port_vlan(adapter, vf, vlan, qos); in ixgbe_ndo_set_vf_vlan()
1679 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1686 int ixgbe_link_mbps(struct ixgbe_adapter *adapter) in ixgbe_link_mbps() argument
1688 switch (adapter->link_speed) { in ixgbe_link_mbps()
1700 static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf) in ixgbe_set_vf_rate_limit() argument
1702 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_set_vf_rate_limit()
1703 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_rate_limit()
1706 u16 tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_set_vf_rate_limit()
1710 bcnrc_val = adapter->vf_rate_link_speed; in ixgbe_set_vf_rate_limit()
1752 void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter) in ixgbe_check_vf_rate_limit() argument
1757 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1760 if (ixgbe_link_mbps(adapter) != adapter->vf_rate_link_speed) { in ixgbe_check_vf_rate_limit()
1761 adapter->vf_rate_link_speed = 0; in ixgbe_check_vf_rate_limit()
1762 dev_info(&adapter->pdev->dev, in ixgbe_check_vf_rate_limit()
1766 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_check_vf_rate_limit()
1767 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1768 adapter->vfinfo[i].tx_rate = 0; in ixgbe_check_vf_rate_limit()
1770 ixgbe_set_vf_rate_limit(adapter, i); in ixgbe_check_vf_rate_limit()
1777 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_bw() local
1781 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_bw()
1785 if (!adapter->link_up) in ixgbe_ndo_set_vf_bw()
1789 link_speed = ixgbe_link_mbps(adapter); in ixgbe_ndo_set_vf_bw()
1801 adapter->vf_rate_link_speed = link_speed; in ixgbe_ndo_set_vf_bw()
1802 adapter->vfinfo[vf].tx_rate = max_tx_rate; in ixgbe_ndo_set_vf_bw()
1805 ixgbe_set_vf_rate_limit(adapter, vf); in ixgbe_ndo_set_vf_bw()
1812 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_spoofchk() local
1813 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ndo_set_vf_spoofchk()
1815 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_spoofchk()
1818 adapter->vfinfo[vf].spoofchk_enabled = setting; in ixgbe_ndo_set_vf_spoofchk()
1848 * @adapter: Pointer to adapter struct
1854 void ixgbe_set_vf_link_state(struct ixgbe_adapter *adapter, int vf, int state) in ixgbe_set_vf_link_state() argument
1856 adapter->vfinfo[vf].link_state = state; in ixgbe_set_vf_link_state()
1860 if (test_bit(__IXGBE_DOWN, &adapter->state)) in ixgbe_set_vf_link_state()
1861 adapter->vfinfo[vf].link_enable = false; in ixgbe_set_vf_link_state()
1863 adapter->vfinfo[vf].link_enable = true; in ixgbe_set_vf_link_state()
1866 adapter->vfinfo[vf].link_enable = true; in ixgbe_set_vf_link_state()
1869 adapter->vfinfo[vf].link_enable = false; in ixgbe_set_vf_link_state()
1873 ixgbe_set_vf_rx_tx(adapter, vf); in ixgbe_set_vf_link_state()
1876 adapter->vfinfo[vf].clear_to_send = false; in ixgbe_set_vf_link_state()
1877 ixgbe_ping_vf(adapter, vf); in ixgbe_set_vf_link_state()
1890 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_link_state() local
1893 if (vf < 0 || vf >= adapter->num_vfs) { in ixgbe_ndo_set_vf_link_state()
1894 dev_err(&adapter->pdev->dev, in ixgbe_ndo_set_vf_link_state()
1901 dev_info(&adapter->pdev->dev, in ixgbe_ndo_set_vf_link_state()
1906 dev_info(&adapter->pdev->dev, in ixgbe_ndo_set_vf_link_state()
1908 ixgbe_set_vf_link_state(adapter, vf, state); in ixgbe_ndo_set_vf_link_state()
1911 dev_info(&adapter->pdev->dev, in ixgbe_ndo_set_vf_link_state()
1913 ixgbe_set_vf_link_state(adapter, vf, state); in ixgbe_ndo_set_vf_link_state()
1916 dev_err(&adapter->pdev->dev, in ixgbe_ndo_set_vf_link_state()
1927 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_rss_query_en() local
1932 if (adapter->hw.mac.type < ixgbe_mac_82599EB || in ixgbe_ndo_set_vf_rss_query_en()
1933 adapter->hw.mac.type >= ixgbe_mac_X550) in ixgbe_ndo_set_vf_rss_query_en()
1936 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_rss_query_en()
1939 adapter->vfinfo[vf].rss_query_enabled = setting; in ixgbe_ndo_set_vf_rss_query_en()
1946 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_set_vf_trust() local
1948 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_trust()
1952 if (adapter->vfinfo[vf].trusted == setting) in ixgbe_ndo_set_vf_trust()
1955 adapter->vfinfo[vf].trusted = setting; in ixgbe_ndo_set_vf_trust()
1958 adapter->vfinfo[vf].clear_to_send = false; in ixgbe_ndo_set_vf_trust()
1959 ixgbe_ping_vf(adapter, vf); in ixgbe_ndo_set_vf_trust()
1969 struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); in ixgbe_ndo_get_vf_config() local
1970 if (vf >= adapter->num_vfs) in ixgbe_ndo_get_vf_config()
1973 memcpy(&ivi->mac, adapter->vfinfo[vf].vf_mac_addresses, ETH_ALEN); in ixgbe_ndo_get_vf_config()
1974 ivi->max_tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_ndo_get_vf_config()
1976 ivi->vlan = adapter->vfinfo[vf].pf_vlan; in ixgbe_ndo_get_vf_config()
1977 ivi->qos = adapter->vfinfo[vf].pf_qos; in ixgbe_ndo_get_vf_config()
1978 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; in ixgbe_ndo_get_vf_config()
1979 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; in ixgbe_ndo_get_vf_config()
1980 ivi->trusted = adapter->vfinfo[vf].trusted; in ixgbe_ndo_get_vf_config()
1981 ivi->linkstate = adapter->vfinfo[vf].link_state; in ixgbe_ndo_get_vf_config()