Lines Matching refs:adapter

49 static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)  in __ixgbe_enable_sriov()  argument
51 struct ixgbe_hw *hw = &adapter->hw; in __ixgbe_enable_sriov()
55 adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED; in __ixgbe_enable_sriov()
56 e_info(probe, "SR-IOV enabled with %d VFs\n", adapter->num_vfs); in __ixgbe_enable_sriov()
59 adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED; in __ixgbe_enable_sriov()
60 if (!adapter->ring_feature[RING_F_VMDQ].limit) in __ixgbe_enable_sriov()
61 adapter->ring_feature[RING_F_VMDQ].limit = 1; in __ixgbe_enable_sriov()
62 adapter->ring_feature[RING_F_VMDQ].offset = adapter->num_vfs; in __ixgbe_enable_sriov()
65 (IXGBE_MAX_PF_MACVLANS + 1 + adapter->num_vfs); in __ixgbe_enable_sriov()
67 adapter->mv_list = mv_list = kcalloc(num_vf_macvlans, in __ixgbe_enable_sriov()
72 INIT_LIST_HEAD(&adapter->vf_mvs.l); in __ixgbe_enable_sriov()
76 list_add(&mv_list->l, &adapter->vf_mvs.l); in __ixgbe_enable_sriov()
83 adapter->bridge_mode = BRIDGE_MODE_VEB; in __ixgbe_enable_sriov()
88 adapter->vfinfo = in __ixgbe_enable_sriov()
89 kcalloc(adapter->num_vfs, in __ixgbe_enable_sriov()
91 if (adapter->vfinfo) { in __ixgbe_enable_sriov()
93 if ((adapter->hw.mac.type == ixgbe_mac_82599EB) && in __ixgbe_enable_sriov()
94 (adapter->num_vfs < 16)) { in __ixgbe_enable_sriov()
95 adapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS; in __ixgbe_enable_sriov()
96 adapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS; in __ixgbe_enable_sriov()
97 } else if (adapter->num_vfs < 32) { in __ixgbe_enable_sriov()
98 adapter->dcb_cfg.num_tcs.pg_tcs = 4; in __ixgbe_enable_sriov()
99 adapter->dcb_cfg.num_tcs.pfc_tcs = 4; in __ixgbe_enable_sriov()
101 adapter->dcb_cfg.num_tcs.pg_tcs = 1; in __ixgbe_enable_sriov()
102 adapter->dcb_cfg.num_tcs.pfc_tcs = 1; in __ixgbe_enable_sriov()
106 adapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE | in __ixgbe_enable_sriov()
109 for (i = 0; i < adapter->num_vfs; i++) { in __ixgbe_enable_sriov()
111 adapter->vfinfo[i].spoofchk_enabled = true; in __ixgbe_enable_sriov()
118 adapter->vfinfo[i].rss_query_enabled = 0; in __ixgbe_enable_sriov()
130 void ixgbe_enable_sriov(struct ixgbe_adapter *adapter) in ixgbe_enable_sriov() argument
134 pre_existing_vfs = pci_num_vf(adapter->pdev); in ixgbe_enable_sriov()
135 if (!pre_existing_vfs && !adapter->num_vfs) in ixgbe_enable_sriov()
145 adapter->num_vfs = pre_existing_vfs; in ixgbe_enable_sriov()
146 dev_warn(&adapter->pdev->dev, in ixgbe_enable_sriov()
157 adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, IXGBE_MAX_VFS_DRV_LIMIT); in ixgbe_enable_sriov()
159 err = pci_enable_sriov(adapter->pdev, adapter->num_vfs); in ixgbe_enable_sriov()
162 adapter->num_vfs = 0; in ixgbe_enable_sriov()
167 if (!__ixgbe_enable_sriov(adapter)) in ixgbe_enable_sriov()
175 ixgbe_disable_sriov(adapter); in ixgbe_enable_sriov()
179 int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) in ixgbe_disable_sriov() argument
181 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_sriov()
187 adapter->num_vfs = 0; in ixgbe_disable_sriov()
190 kfree(adapter->vfinfo); in ixgbe_disable_sriov()
191 adapter->vfinfo = NULL; in ixgbe_disable_sriov()
194 kfree(adapter->mv_list); in ixgbe_disable_sriov()
195 adapter->mv_list = NULL; in ixgbe_disable_sriov()
198 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_disable_sriov()
207 if (pci_vfs_assigned(adapter->pdev)) { in ixgbe_disable_sriov()
212 pci_disable_sriov(adapter->pdev); in ixgbe_disable_sriov()
228 if (adapter->ring_feature[RING_F_VMDQ].limit == 1) { in ixgbe_disable_sriov()
229 adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED; in ixgbe_disable_sriov()
230 adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; in ixgbe_disable_sriov()
231 rss = min_t(int, ixgbe_max_rss_indices(adapter), in ixgbe_disable_sriov()
237 adapter->ring_feature[RING_F_VMDQ].offset = 0; in ixgbe_disable_sriov()
238 adapter->ring_feature[RING_F_RSS].limit = rss; in ixgbe_disable_sriov()
248 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_enable() local
254 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_enable()
269 if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VF_FUNCTIONS) in ixgbe_pci_sriov_enable()
272 adapter->num_vfs = num_vfs; in ixgbe_pci_sriov_enable()
274 err = __ixgbe_enable_sriov(adapter); in ixgbe_pci_sriov_enable()
278 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_pci_sriov_enable()
286 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_enable()
296 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_disable() local
299 u32 current_flags = adapter->flags; in ixgbe_pci_sriov_disable()
302 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_disable()
306 if (!err && current_flags != adapter->flags) in ixgbe_pci_sriov_disable()
307 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_disable()
321 static int ixgbe_set_vf_multicasts(struct ixgbe_adapter *adapter, in ixgbe_set_vf_multicasts() argument
327 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_set_vf_multicasts()
328 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_multicasts()
367 void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) in ixgbe_restore_vf_multicasts() argument
369 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_restore_vf_multicasts()
376 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_restore_vf_multicasts()
378 vfinfo = &adapter->vfinfo[i]; in ixgbe_restore_vf_multicasts()
396 ixgbe_full_sync_mac_table(adapter); in ixgbe_restore_vf_multicasts()
400 static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, in ixgbe_set_vf_vlan() argument
407 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); in ixgbe_set_vf_vlan()
410 static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) in ixgbe_set_vf_lpe() argument
412 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_lpe()
423 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_vf_lpe()
424 struct net_device *dev = adapter->netdev; in ixgbe_set_vf_lpe()
435 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_set_vf_lpe()
507 static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_clear_vmvir() argument
509 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_clear_vmvir()
513 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_event() argument
515 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_event()
516 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_vf_reset_event()
517 u8 num_tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_vf_reset_event()
520 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf); in ixgbe_vf_reset_event()
527 ixgbe_clear_vmvir(adapter, vf); in ixgbe_vf_reset_event()
530 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
533 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
534 adapter->default_up, vf); in ixgbe_vf_reset_event()
541 adapter->vfinfo[vf].num_vf_mc_hashes = 0; in ixgbe_vf_reset_event()
544 ixgbe_set_rx_mode(adapter->netdev); in ixgbe_vf_reset_event()
546 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_vf_reset_event()
549 adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10; in ixgbe_vf_reset_event()
552 static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac() argument
555 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_set_vf_mac()
556 memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN); in ixgbe_set_vf_mac()
557 ixgbe_add_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_set_vf_mac()
562 static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan() argument
569 list_for_each(pos, &adapter->vf_mvs.l) { in ixgbe_set_vf_macvlan()
575 ixgbe_del_mac_filter(adapter, in ixgbe_set_vf_macvlan()
590 list_for_each(pos, &adapter->vf_mvs.l) { in ixgbe_set_vf_macvlan()
612 ixgbe_add_mac_filter(adapter, mac_addr, vf); in ixgbe_set_vf_macvlan()
619 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_vf_configuration() local
625 eth_zero_addr(adapter->vfinfo[vfn].vf_mac_addresses); in ixgbe_vf_configuration()
630 static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf, in ixgbe_write_qde() argument
633 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_write_qde()
634 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_write_qde()
651 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_msg() argument
653 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_vf_reset_msg()
654 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_msg()
655 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; in ixgbe_vf_reset_msg()
665 ixgbe_vf_reset_event(adapter, vf); in ixgbe_vf_reset_msg()
669 ixgbe_set_vf_mac(adapter, vf, vf_mac); in ixgbe_vf_reset_msg()
680 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_vf_reset_msg()
689 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_vf_reset_msg()
690 struct net_device *dev = adapter->netdev; in ixgbe_vf_reset_msg()
705 adapter->vfinfo[vf].clear_to_send = true; in ixgbe_vf_reset_msg()
728 dev_warn(&adapter->pdev->dev, in ixgbe_vf_reset_msg()
743 static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac_addr() argument
753 if (adapter->vfinfo[vf].pf_set_mac && in ixgbe_set_vf_mac_addr()
754 !ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) { in ixgbe_set_vf_mac_addr()
762 return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0; in ixgbe_set_vf_mac_addr()
788 static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_vlan_msg() argument
791 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_vlan_msg()
798 u8 tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_set_vf_vlan_msg()
800 if (adapter->vfinfo[vf].pf_vlan || tcs) { in ixgbe_set_vf_vlan_msg()
809 adapter->vfinfo[vf].vlan_count++; in ixgbe_set_vf_vlan_msg()
810 else if (adapter->vfinfo[vf].vlan_count) in ixgbe_set_vf_vlan_msg()
811 adapter->vfinfo[vf].vlan_count--; in ixgbe_set_vf_vlan_msg()
816 if (add && adapter->netdev->flags & IFF_PROMISC) in ixgbe_set_vf_vlan_msg()
817 err = ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0)); in ixgbe_set_vf_vlan_msg()
819 err = ixgbe_set_vf_vlan(adapter, add, vid, vf); in ixgbe_set_vf_vlan_msg()
820 if (!err && adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_set_vf_vlan_msg()
826 if (!add && adapter->netdev->flags & IFF_PROMISC) { in ixgbe_set_vf_vlan_msg()
851 !test_bit(vid, adapter->active_vlans) && !bits) in ixgbe_set_vf_vlan_msg()
852 ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0)); in ixgbe_set_vf_vlan_msg()
858 static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan_msg() argument
866 if (adapter->vfinfo[vf].pf_set_mac && index > 0) { in ixgbe_set_vf_macvlan_msg()
884 if (adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_set_vf_macvlan_msg()
885 ixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false); in ixgbe_set_vf_macvlan_msg()
888 err = ixgbe_set_vf_macvlan(adapter, vf, index, new_mac); in ixgbe_set_vf_macvlan_msg()
897 static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter, in ixgbe_negotiate_vf_api() argument
906 adapter->vfinfo[vf].vf_api = api; in ixgbe_negotiate_vf_api()
917 static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter, in ixgbe_get_vf_queues() argument
920 struct net_device *dev = adapter->netdev; in ixgbe_get_vf_queues()
921 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_get_vf_queues()
926 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_queues()
941 default_tc = netdev_get_prio_tc_map(dev, adapter->default_up); in ixgbe_get_vf_queues()
946 else if (adapter->vfinfo[vf].pf_vlan || adapter->vfinfo[vf].pf_qos) in ixgbe_get_vf_queues()
957 static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) in ixgbe_get_vf_reta() argument
961 const u8 *reta = adapter->rss_indir_tbl; in ixgbe_get_vf_reta()
962 u32 reta_size = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_get_vf_reta()
965 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_reta()
969 if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12) in ixgbe_get_vf_reta()
986 static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter, in ixgbe_get_vf_rss_key() argument
992 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_rss_key()
996 if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12) in ixgbe_get_vf_rss_key()
999 memcpy(rss_key, adapter->rss_key, sizeof(adapter->rss_key)); in ixgbe_get_vf_rss_key()
1004 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_msg_from_vf() argument
1008 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_msg_from_vf()
1026 return ixgbe_vf_reset_msg(adapter, vf); in ixgbe_rcv_msg_from_vf()
1032 if (!adapter->vfinfo[vf].clear_to_send) { in ixgbe_rcv_msg_from_vf()
1040 retval = ixgbe_set_vf_mac_addr(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1043 retval = ixgbe_set_vf_multicasts(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1046 retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1049 retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1052 retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1055 retval = ixgbe_negotiate_vf_api(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1058 retval = ixgbe_get_vf_queues(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1061 retval = ixgbe_get_vf_reta(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1064 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1085 static void ixgbe_rcv_ack_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_ack_from_vf() argument
1087 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_ack_from_vf()
1091 if (!adapter->vfinfo[vf].clear_to_send) in ixgbe_rcv_ack_from_vf()
1095 void ixgbe_msg_task(struct ixgbe_adapter *adapter) in ixgbe_msg_task() argument
1097 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_msg_task()
1100 for (vf = 0; vf < adapter->num_vfs; vf++) { in ixgbe_msg_task()
1103 ixgbe_vf_reset_event(adapter, vf); in ixgbe_msg_task()
1107 ixgbe_rcv_msg_from_vf(adapter, vf); in ixgbe_msg_task()
1111 ixgbe_rcv_ack_from_vf(adapter, vf); in ixgbe_msg_task()
1115 void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter) in ixgbe_disable_tx_rx() argument
1117 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_tx_rx()
1127 void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter) in ixgbe_ping_all_vfs() argument
1129 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ping_all_vfs()
1133 for (i = 0 ; i < adapter->num_vfs; i++) { in ixgbe_ping_all_vfs()
1135 if (adapter->vfinfo[i].clear_to_send) in ixgbe_ping_all_vfs()
1143 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_mac() local
1144 if (!is_valid_ether_addr(mac) || (vf >= adapter->num_vfs)) in ixgbe_ndo_set_vf_mac()
1146 adapter->vfinfo[vf].pf_set_mac = true; in ixgbe_ndo_set_vf_mac()
1147 dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf); in ixgbe_ndo_set_vf_mac()
1148 dev_info(&adapter->pdev->dev, "Reload the VF driver to make this" in ixgbe_ndo_set_vf_mac()
1150 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_ndo_set_vf_mac()
1151 dev_warn(&adapter->pdev->dev, "The VF MAC address has been set," in ixgbe_ndo_set_vf_mac()
1153 dev_warn(&adapter->pdev->dev, "Bring the PF device up before" in ixgbe_ndo_set_vf_mac()
1156 return ixgbe_set_vf_mac(adapter, vf, mac); in ixgbe_ndo_set_vf_mac()
1159 static int ixgbe_enable_port_vlan(struct ixgbe_adapter *adapter, int vf, in ixgbe_enable_port_vlan() argument
1162 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_enable_port_vlan()
1165 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); in ixgbe_enable_port_vlan()
1169 ixgbe_set_vmvir(adapter, vlan, qos, vf); in ixgbe_enable_port_vlan()
1171 if (adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_enable_port_vlan()
1173 adapter->vfinfo[vf].vlan_count++; in ixgbe_enable_port_vlan()
1177 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE | in ixgbe_enable_port_vlan()
1180 adapter->vfinfo[vf].pf_vlan = vlan; in ixgbe_enable_port_vlan()
1181 adapter->vfinfo[vf].pf_qos = qos; in ixgbe_enable_port_vlan()
1182 dev_info(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1184 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_enable_port_vlan()
1185 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1187 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1195 static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf) in ixgbe_disable_port_vlan() argument
1197 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_port_vlan()
1200 err = ixgbe_set_vf_vlan(adapter, false, in ixgbe_disable_port_vlan()
1201 adapter->vfinfo[vf].pf_vlan, vf); in ixgbe_disable_port_vlan()
1202 ixgbe_clear_vmvir(adapter, vf); in ixgbe_disable_port_vlan()
1205 if (adapter->vfinfo[vf].vlan_count) in ixgbe_disable_port_vlan()
1206 adapter->vfinfo[vf].vlan_count--; in ixgbe_disable_port_vlan()
1210 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_disable_port_vlan()
1212 adapter->vfinfo[vf].pf_vlan = 0; in ixgbe_disable_port_vlan()
1213 adapter->vfinfo[vf].pf_qos = 0; in ixgbe_disable_port_vlan()
1221 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_vlan() local
1223 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) in ixgbe_ndo_set_vf_vlan()
1233 if (adapter->vfinfo[vf].pf_vlan) in ixgbe_ndo_set_vf_vlan()
1234 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1237 err = ixgbe_enable_port_vlan(adapter, vf, vlan, qos); in ixgbe_ndo_set_vf_vlan()
1239 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1246 static int ixgbe_link_mbps(struct ixgbe_adapter *adapter) in ixgbe_link_mbps() argument
1248 switch (adapter->link_speed) { in ixgbe_link_mbps()
1260 static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf) in ixgbe_set_vf_rate_limit() argument
1262 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_set_vf_rate_limit()
1263 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_rate_limit()
1266 u16 tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_set_vf_rate_limit()
1270 bcnrc_val = adapter->vf_rate_link_speed; in ixgbe_set_vf_rate_limit()
1312 void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter) in ixgbe_check_vf_rate_limit() argument
1317 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1320 if (ixgbe_link_mbps(adapter) != adapter->vf_rate_link_speed) { in ixgbe_check_vf_rate_limit()
1321 adapter->vf_rate_link_speed = 0; in ixgbe_check_vf_rate_limit()
1322 dev_info(&adapter->pdev->dev, in ixgbe_check_vf_rate_limit()
1326 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_check_vf_rate_limit()
1327 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1328 adapter->vfinfo[i].tx_rate = 0; in ixgbe_check_vf_rate_limit()
1330 ixgbe_set_vf_rate_limit(adapter, i); in ixgbe_check_vf_rate_limit()
1337 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_bw() local
1341 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_bw()
1345 if (!adapter->link_up) in ixgbe_ndo_set_vf_bw()
1349 link_speed = ixgbe_link_mbps(adapter); in ixgbe_ndo_set_vf_bw()
1361 adapter->vf_rate_link_speed = link_speed; in ixgbe_ndo_set_vf_bw()
1362 adapter->vfinfo[vf].tx_rate = max_tx_rate; in ixgbe_ndo_set_vf_bw()
1365 ixgbe_set_vf_rate_limit(adapter, vf); in ixgbe_ndo_set_vf_bw()
1372 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_spoofchk() local
1375 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ndo_set_vf_spoofchk()
1378 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_spoofchk()
1381 adapter->vfinfo[vf].spoofchk_enabled = setting; in ixgbe_ndo_set_vf_spoofchk()
1388 if (adapter->vfinfo[vf].vlan_count) { in ixgbe_ndo_set_vf_spoofchk()
1402 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_rss_query_en() local
1407 if (adapter->hw.mac.type < ixgbe_mac_82599EB || in ixgbe_ndo_set_vf_rss_query_en()
1408 adapter->hw.mac.type >= ixgbe_mac_X550) in ixgbe_ndo_set_vf_rss_query_en()
1411 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_rss_query_en()
1414 adapter->vfinfo[vf].rss_query_enabled = setting; in ixgbe_ndo_set_vf_rss_query_en()
1422 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_get_vf_config() local
1423 if (vf >= adapter->num_vfs) in ixgbe_ndo_get_vf_config()
1426 memcpy(&ivi->mac, adapter->vfinfo[vf].vf_mac_addresses, ETH_ALEN); in ixgbe_ndo_get_vf_config()
1427 ivi->max_tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_ndo_get_vf_config()
1429 ivi->vlan = adapter->vfinfo[vf].pf_vlan; in ixgbe_ndo_get_vf_config()
1430 ivi->qos = adapter->vfinfo[vf].pf_qos; in ixgbe_ndo_get_vf_config()
1431 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; in ixgbe_ndo_get_vf_config()
1432 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; in ixgbe_ndo_get_vf_config()