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()
121 adapter->vfinfo[i].trusted = false; in __ixgbe_enable_sriov()
124 adapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE; in __ixgbe_enable_sriov()
136 void ixgbe_enable_sriov(struct ixgbe_adapter *adapter) in ixgbe_enable_sriov() argument
140 pre_existing_vfs = pci_num_vf(adapter->pdev); in ixgbe_enable_sriov()
141 if (!pre_existing_vfs && !adapter->num_vfs) in ixgbe_enable_sriov()
151 adapter->num_vfs = pre_existing_vfs; in ixgbe_enable_sriov()
152 dev_warn(&adapter->pdev->dev, in ixgbe_enable_sriov()
163 adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, IXGBE_MAX_VFS_DRV_LIMIT); in ixgbe_enable_sriov()
165 err = pci_enable_sriov(adapter->pdev, adapter->num_vfs); in ixgbe_enable_sriov()
168 adapter->num_vfs = 0; in ixgbe_enable_sriov()
173 if (!__ixgbe_enable_sriov(adapter)) in ixgbe_enable_sriov()
181 ixgbe_disable_sriov(adapter); in ixgbe_enable_sriov()
185 int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) in ixgbe_disable_sriov() argument
187 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_sriov()
193 adapter->num_vfs = 0; in ixgbe_disable_sriov()
196 kfree(adapter->vfinfo); in ixgbe_disable_sriov()
197 adapter->vfinfo = NULL; in ixgbe_disable_sriov()
200 kfree(adapter->mv_list); in ixgbe_disable_sriov()
201 adapter->mv_list = NULL; in ixgbe_disable_sriov()
204 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_disable_sriov()
213 if (pci_vfs_assigned(adapter->pdev)) { in ixgbe_disable_sriov()
218 pci_disable_sriov(adapter->pdev); in ixgbe_disable_sriov()
234 if (adapter->ring_feature[RING_F_VMDQ].limit == 1) { in ixgbe_disable_sriov()
235 adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED; in ixgbe_disable_sriov()
236 adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; in ixgbe_disable_sriov()
237 rss = min_t(int, ixgbe_max_rss_indices(adapter), in ixgbe_disable_sriov()
243 adapter->ring_feature[RING_F_VMDQ].offset = 0; in ixgbe_disable_sriov()
244 adapter->ring_feature[RING_F_RSS].limit = rss; in ixgbe_disable_sriov()
254 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_enable() local
260 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_enable()
275 if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VF_FUNCTIONS) in ixgbe_pci_sriov_enable()
278 adapter->num_vfs = num_vfs; in ixgbe_pci_sriov_enable()
280 err = __ixgbe_enable_sriov(adapter); in ixgbe_pci_sriov_enable()
284 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_pci_sriov_enable()
292 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_enable()
302 struct ixgbe_adapter *adapter = pci_get_drvdata(dev); in ixgbe_pci_sriov_disable() local
305 u32 current_flags = adapter->flags; in ixgbe_pci_sriov_disable()
308 err = ixgbe_disable_sriov(adapter); in ixgbe_pci_sriov_disable()
312 if (!err && current_flags != adapter->flags) in ixgbe_pci_sriov_disable()
313 ixgbe_sriov_reinit(adapter); in ixgbe_pci_sriov_disable()
327 static int ixgbe_set_vf_multicasts(struct ixgbe_adapter *adapter, in ixgbe_set_vf_multicasts() argument
333 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_set_vf_multicasts()
334 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_multicasts()
373 void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) in ixgbe_restore_vf_multicasts() argument
375 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_restore_vf_multicasts()
382 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_restore_vf_multicasts()
384 vfinfo = &adapter->vfinfo[i]; in ixgbe_restore_vf_multicasts()
402 ixgbe_full_sync_mac_table(adapter); in ixgbe_restore_vf_multicasts()
406 static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, in ixgbe_set_vf_vlan() argument
413 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); in ixgbe_set_vf_vlan()
416 static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) in ixgbe_set_vf_lpe() argument
418 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_lpe()
429 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_vf_lpe()
430 struct net_device *dev = adapter->netdev; in ixgbe_set_vf_lpe()
441 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_set_vf_lpe()
513 static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_clear_vmvir() argument
515 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_clear_vmvir()
519 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_event() argument
521 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_event()
522 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_vf_reset_event()
523 u8 num_tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_vf_reset_event()
526 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf); in ixgbe_vf_reset_event()
533 ixgbe_clear_vmvir(adapter, vf); in ixgbe_vf_reset_event()
536 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
539 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, in ixgbe_vf_reset_event()
540 adapter->default_up, vf); in ixgbe_vf_reset_event()
547 adapter->vfinfo[vf].num_vf_mc_hashes = 0; in ixgbe_vf_reset_event()
550 ixgbe_set_rx_mode(adapter->netdev); in ixgbe_vf_reset_event()
552 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_vf_reset_event()
555 adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10; in ixgbe_vf_reset_event()
558 static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac() argument
561 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_set_vf_mac()
562 memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN); in ixgbe_set_vf_mac()
563 ixgbe_add_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf); in ixgbe_set_vf_mac()
568 static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan() argument
575 list_for_each(pos, &adapter->vf_mvs.l) { in ixgbe_set_vf_macvlan()
581 ixgbe_del_mac_filter(adapter, in ixgbe_set_vf_macvlan()
596 list_for_each(pos, &adapter->vf_mvs.l) { in ixgbe_set_vf_macvlan()
618 ixgbe_add_mac_filter(adapter, mac_addr, vf); in ixgbe_set_vf_macvlan()
625 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); in ixgbe_vf_configuration() local
631 eth_zero_addr(adapter->vfinfo[vfn].vf_mac_addresses); in ixgbe_vf_configuration()
636 static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf, in ixgbe_write_qde() argument
639 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_write_qde()
640 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_write_qde()
657 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_msg() argument
659 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_vf_reset_msg()
660 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_vf_reset_msg()
661 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; in ixgbe_vf_reset_msg()
671 ixgbe_vf_reset_event(adapter, vf); in ixgbe_vf_reset_msg()
675 ixgbe_set_vf_mac(adapter, vf, vf_mac); in ixgbe_vf_reset_msg()
686 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_vf_reset_msg()
695 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_vf_reset_msg()
696 struct net_device *dev = adapter->netdev; in ixgbe_vf_reset_msg()
711 adapter->vfinfo[vf].clear_to_send = true; in ixgbe_vf_reset_msg()
734 dev_warn(&adapter->pdev->dev, in ixgbe_vf_reset_msg()
749 static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter *adapter, in ixgbe_set_vf_mac_addr() argument
759 if (adapter->vfinfo[vf].pf_set_mac && in ixgbe_set_vf_mac_addr()
760 !ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) { in ixgbe_set_vf_mac_addr()
768 return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0; in ixgbe_set_vf_mac_addr()
794 static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_vlan_msg() argument
797 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_vlan_msg()
804 u8 tcs = netdev_get_num_tc(adapter->netdev); in ixgbe_set_vf_vlan_msg()
806 if (adapter->vfinfo[vf].pf_vlan || tcs) { in ixgbe_set_vf_vlan_msg()
815 adapter->vfinfo[vf].vlan_count++; in ixgbe_set_vf_vlan_msg()
816 else if (adapter->vfinfo[vf].vlan_count) in ixgbe_set_vf_vlan_msg()
817 adapter->vfinfo[vf].vlan_count--; in ixgbe_set_vf_vlan_msg()
822 if (add && adapter->netdev->flags & IFF_PROMISC) in ixgbe_set_vf_vlan_msg()
823 err = ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0)); in ixgbe_set_vf_vlan_msg()
825 err = ixgbe_set_vf_vlan(adapter, add, vid, vf); in ixgbe_set_vf_vlan_msg()
826 if (!err && adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_set_vf_vlan_msg()
832 if (!add && adapter->netdev->flags & IFF_PROMISC) { in ixgbe_set_vf_vlan_msg()
857 !test_bit(vid, adapter->active_vlans) && !bits) in ixgbe_set_vf_vlan_msg()
858 ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0)); in ixgbe_set_vf_vlan_msg()
864 static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter, in ixgbe_set_vf_macvlan_msg() argument
872 if (adapter->vfinfo[vf].pf_set_mac && index > 0) { in ixgbe_set_vf_macvlan_msg()
890 if (adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_set_vf_macvlan_msg()
891 ixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false); in ixgbe_set_vf_macvlan_msg()
894 err = ixgbe_set_vf_macvlan(adapter, vf, index, new_mac); in ixgbe_set_vf_macvlan_msg()
903 static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter, in ixgbe_negotiate_vf_api() argument
912 adapter->vfinfo[vf].vf_api = api; in ixgbe_negotiate_vf_api()
923 static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter, in ixgbe_get_vf_queues() argument
926 struct net_device *dev = adapter->netdev; in ixgbe_get_vf_queues()
927 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_get_vf_queues()
932 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_get_vf_queues()
947 default_tc = netdev_get_prio_tc_map(dev, adapter->default_up); in ixgbe_get_vf_queues()
952 else if (adapter->vfinfo[vf].pf_vlan || adapter->vfinfo[vf].pf_qos) in ixgbe_get_vf_queues()
963 static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) in ixgbe_get_vf_reta() argument
967 const u8 *reta = adapter->rss_indir_tbl; in ixgbe_get_vf_reta()
968 u32 reta_size = ixgbe_rss_indir_tbl_entries(adapter); in ixgbe_get_vf_reta()
971 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_reta()
975 if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12) in ixgbe_get_vf_reta()
992 static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter, in ixgbe_get_vf_rss_key() argument
998 if (!adapter->vfinfo[vf].rss_query_enabled) in ixgbe_get_vf_rss_key()
1002 if (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12) in ixgbe_get_vf_rss_key()
1005 memcpy(rss_key, adapter->rss_key, sizeof(adapter->rss_key)); in ixgbe_get_vf_rss_key()
1010 static int ixgbe_update_vf_xcast_mode(struct ixgbe_adapter *adapter, in ixgbe_update_vf_xcast_mode() argument
1013 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_vf_xcast_mode()
1018 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_update_vf_xcast_mode()
1026 !adapter->vfinfo[vf].trusted) { in ixgbe_update_vf_xcast_mode()
1030 if (adapter->vfinfo[vf].xcast_mode == xcast_mode) in ixgbe_update_vf_xcast_mode()
1055 adapter->vfinfo[vf].xcast_mode = xcast_mode; in ixgbe_update_vf_xcast_mode()
1063 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_msg_from_vf() argument
1067 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_msg_from_vf()
1085 return ixgbe_vf_reset_msg(adapter, vf); in ixgbe_rcv_msg_from_vf()
1091 if (!adapter->vfinfo[vf].clear_to_send) { in ixgbe_rcv_msg_from_vf()
1099 retval = ixgbe_set_vf_mac_addr(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1102 retval = ixgbe_set_vf_multicasts(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1105 retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1108 retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1111 retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1114 retval = ixgbe_negotiate_vf_api(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1117 retval = ixgbe_get_vf_queues(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1120 retval = ixgbe_get_vf_reta(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1123 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1126 retval = ixgbe_update_vf_xcast_mode(adapter, msgbuf, vf); in ixgbe_rcv_msg_from_vf()
1147 static void ixgbe_rcv_ack_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_ack_from_vf() argument
1149 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_rcv_ack_from_vf()
1153 if (!adapter->vfinfo[vf].clear_to_send) in ixgbe_rcv_ack_from_vf()
1157 void ixgbe_msg_task(struct ixgbe_adapter *adapter) in ixgbe_msg_task() argument
1159 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_msg_task()
1162 for (vf = 0; vf < adapter->num_vfs; vf++) { in ixgbe_msg_task()
1165 ixgbe_vf_reset_event(adapter, vf); in ixgbe_msg_task()
1169 ixgbe_rcv_msg_from_vf(adapter, vf); in ixgbe_msg_task()
1173 ixgbe_rcv_ack_from_vf(adapter, vf); in ixgbe_msg_task()
1177 void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter) in ixgbe_disable_tx_rx() argument
1179 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_tx_rx()
1189 static inline void ixgbe_ping_vf(struct ixgbe_adapter *adapter, int vf) in ixgbe_ping_vf() argument
1191 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ping_vf()
1195 if (adapter->vfinfo[vf].clear_to_send) in ixgbe_ping_vf()
1200 void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter) in ixgbe_ping_all_vfs() argument
1202 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ping_all_vfs()
1206 for (i = 0 ; i < adapter->num_vfs; i++) { in ixgbe_ping_all_vfs()
1208 if (adapter->vfinfo[i].clear_to_send) in ixgbe_ping_all_vfs()
1216 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_mac() local
1217 if (!is_valid_ether_addr(mac) || (vf >= adapter->num_vfs)) in ixgbe_ndo_set_vf_mac()
1219 adapter->vfinfo[vf].pf_set_mac = true; in ixgbe_ndo_set_vf_mac()
1220 dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf); in ixgbe_ndo_set_vf_mac()
1221 dev_info(&adapter->pdev->dev, "Reload the VF driver to make this" in ixgbe_ndo_set_vf_mac()
1223 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_ndo_set_vf_mac()
1224 dev_warn(&adapter->pdev->dev, "The VF MAC address has been set," in ixgbe_ndo_set_vf_mac()
1226 dev_warn(&adapter->pdev->dev, "Bring the PF device up before" in ixgbe_ndo_set_vf_mac()
1229 return ixgbe_set_vf_mac(adapter, vf, mac); in ixgbe_ndo_set_vf_mac()
1232 static int ixgbe_enable_port_vlan(struct ixgbe_adapter *adapter, int vf, in ixgbe_enable_port_vlan() argument
1235 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_enable_port_vlan()
1238 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); in ixgbe_enable_port_vlan()
1242 ixgbe_set_vmvir(adapter, vlan, qos, vf); in ixgbe_enable_port_vlan()
1244 if (adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_enable_port_vlan()
1246 adapter->vfinfo[vf].vlan_count++; in ixgbe_enable_port_vlan()
1250 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE | in ixgbe_enable_port_vlan()
1253 adapter->vfinfo[vf].pf_vlan = vlan; in ixgbe_enable_port_vlan()
1254 adapter->vfinfo[vf].pf_qos = qos; in ixgbe_enable_port_vlan()
1255 dev_info(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1257 if (test_bit(__IXGBE_DOWN, &adapter->state)) { in ixgbe_enable_port_vlan()
1258 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1260 dev_warn(&adapter->pdev->dev, in ixgbe_enable_port_vlan()
1268 static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf) in ixgbe_disable_port_vlan() argument
1270 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_disable_port_vlan()
1273 err = ixgbe_set_vf_vlan(adapter, false, in ixgbe_disable_port_vlan()
1274 adapter->vfinfo[vf].pf_vlan, vf); in ixgbe_disable_port_vlan()
1275 ixgbe_clear_vmvir(adapter, vf); in ixgbe_disable_port_vlan()
1278 if (adapter->vfinfo[vf].vlan_count) in ixgbe_disable_port_vlan()
1279 adapter->vfinfo[vf].vlan_count--; in ixgbe_disable_port_vlan()
1283 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_disable_port_vlan()
1285 adapter->vfinfo[vf].pf_vlan = 0; in ixgbe_disable_port_vlan()
1286 adapter->vfinfo[vf].pf_qos = 0; in ixgbe_disable_port_vlan()
1294 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_vlan() local
1296 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) in ixgbe_ndo_set_vf_vlan()
1306 if (adapter->vfinfo[vf].pf_vlan) in ixgbe_ndo_set_vf_vlan()
1307 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1310 err = ixgbe_enable_port_vlan(adapter, vf, vlan, qos); in ixgbe_ndo_set_vf_vlan()
1312 err = ixgbe_disable_port_vlan(adapter, vf); in ixgbe_ndo_set_vf_vlan()
1319 static int ixgbe_link_mbps(struct ixgbe_adapter *adapter) in ixgbe_link_mbps() argument
1321 switch (adapter->link_speed) { in ixgbe_link_mbps()
1333 static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf) in ixgbe_set_vf_rate_limit() argument
1335 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ]; in ixgbe_set_vf_rate_limit()
1336 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_vf_rate_limit()
1339 u16 tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_set_vf_rate_limit()
1343 bcnrc_val = adapter->vf_rate_link_speed; in ixgbe_set_vf_rate_limit()
1385 void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter) in ixgbe_check_vf_rate_limit() argument
1390 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1393 if (ixgbe_link_mbps(adapter) != adapter->vf_rate_link_speed) { in ixgbe_check_vf_rate_limit()
1394 adapter->vf_rate_link_speed = 0; in ixgbe_check_vf_rate_limit()
1395 dev_info(&adapter->pdev->dev, in ixgbe_check_vf_rate_limit()
1399 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_check_vf_rate_limit()
1400 if (!adapter->vf_rate_link_speed) in ixgbe_check_vf_rate_limit()
1401 adapter->vfinfo[i].tx_rate = 0; in ixgbe_check_vf_rate_limit()
1403 ixgbe_set_vf_rate_limit(adapter, i); in ixgbe_check_vf_rate_limit()
1410 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_bw() local
1414 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_bw()
1418 if (!adapter->link_up) in ixgbe_ndo_set_vf_bw()
1422 link_speed = ixgbe_link_mbps(adapter); in ixgbe_ndo_set_vf_bw()
1434 adapter->vf_rate_link_speed = link_speed; in ixgbe_ndo_set_vf_bw()
1435 adapter->vfinfo[vf].tx_rate = max_tx_rate; in ixgbe_ndo_set_vf_bw()
1438 ixgbe_set_vf_rate_limit(adapter, vf); in ixgbe_ndo_set_vf_bw()
1445 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_spoofchk() local
1448 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ndo_set_vf_spoofchk()
1451 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_spoofchk()
1454 adapter->vfinfo[vf].spoofchk_enabled = setting; in ixgbe_ndo_set_vf_spoofchk()
1461 if (adapter->vfinfo[vf].vlan_count) { in ixgbe_ndo_set_vf_spoofchk()
1475 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_rss_query_en() local
1480 if (adapter->hw.mac.type < ixgbe_mac_82599EB || in ixgbe_ndo_set_vf_rss_query_en()
1481 adapter->hw.mac.type >= ixgbe_mac_X550) in ixgbe_ndo_set_vf_rss_query_en()
1484 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_rss_query_en()
1487 adapter->vfinfo[vf].rss_query_enabled = setting; in ixgbe_ndo_set_vf_rss_query_en()
1494 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_set_vf_trust() local
1496 if (vf >= adapter->num_vfs) in ixgbe_ndo_set_vf_trust()
1500 if (adapter->vfinfo[vf].trusted == setting) in ixgbe_ndo_set_vf_trust()
1503 adapter->vfinfo[vf].trusted = setting; in ixgbe_ndo_set_vf_trust()
1506 adapter->vfinfo[vf].clear_to_send = false; in ixgbe_ndo_set_vf_trust()
1507 ixgbe_ping_vf(adapter, vf); in ixgbe_ndo_set_vf_trust()
1517 struct ixgbe_adapter *adapter = netdev_priv(netdev); in ixgbe_ndo_get_vf_config() local
1518 if (vf >= adapter->num_vfs) in ixgbe_ndo_get_vf_config()
1521 memcpy(&ivi->mac, adapter->vfinfo[vf].vf_mac_addresses, ETH_ALEN); in ixgbe_ndo_get_vf_config()
1522 ivi->max_tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_ndo_get_vf_config()
1524 ivi->vlan = adapter->vfinfo[vf].pf_vlan; in ixgbe_ndo_get_vf_config()
1525 ivi->qos = adapter->vfinfo[vf].pf_qos; in ixgbe_ndo_get_vf_config()
1526 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; in ixgbe_ndo_get_vf_config()
1527 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; in ixgbe_ndo_get_vf_config()
1528 ivi->trusted = adapter->vfinfo[vf].trusted; in ixgbe_ndo_get_vf_config()