Lines Matching refs:vf
74 mv_list->vf = -1; in __ixgbe_enable_sriov()
322 u32 *msgbuf, u32 vf) in ixgbe_set_vf_multicasts() argument
327 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_set_vf_multicasts()
333 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); in ixgbe_set_vf_multicasts()
361 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr); in ixgbe_set_vf_multicasts()
401 u32 vf) 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
435 switch (adapter->vfinfo[vf].vf_api) { in ixgbe_set_vf_lpe()
458 vf_shift = vf % 32; in ixgbe_set_vf_lpe()
459 reg_offset = vf / 32; in ixgbe_set_vf_lpe()
496 static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe) in ixgbe_set_vmolr() argument
498 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); in ixgbe_set_vmolr()
504 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr); in ixgbe_set_vmolr()
507 static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_clear_vmvir() argument
511 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), 0); in ixgbe_clear_vmvir()
513 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_event() argument
516 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; in ixgbe_vf_reset_event()
520 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf); in ixgbe_vf_reset_event()
523 ixgbe_set_vmolr(hw, vf, !vfinfo->pf_vlan); in ixgbe_vf_reset_event()
527 ixgbe_clear_vmvir(adapter, vf); in ixgbe_vf_reset_event()
531 vfinfo->pf_qos, vf); in ixgbe_vf_reset_event()
534 adapter->default_up, vf); in ixgbe_vf_reset_event()
537 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); in ixgbe_vf_reset_event()
541 adapter->vfinfo[vf].num_vf_mc_hashes = 0; 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()
553 int vf, unsigned char *mac_addr) 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()
563 int vf, int index, unsigned char *mac_addr) in ixgbe_set_vf_macvlan() argument
571 if (entry->vf == vf) { in ixgbe_set_vf_macvlan()
572 entry->vf = -1; in ixgbe_set_vf_macvlan()
576 entry->vf_macvlan, vf); in ixgbe_set_vf_macvlan()
609 entry->vf = vf; in ixgbe_set_vf_macvlan()
612 ixgbe_add_mac_filter(adapter, mac_addr, vf); in ixgbe_set_vf_macvlan()
630 static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf, in ixgbe_write_qde() argument
638 for (i = vf * q_per_pool; i < ((vf + 1) * q_per_pool); i++) { in ixgbe_write_qde()
651 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_vf_reset_msg() argument
655 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; in ixgbe_vf_reset_msg()
662 e_info(probe, "VF Reset msg received from vf %d\n", vf); 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()
671 vf_shift = vf % 32; in ixgbe_vf_reset_msg()
672 reg_offset = vf / 32; in ixgbe_vf_reset_msg()
680 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE); in ixgbe_vf_reset_msg()
705 adapter->vfinfo[vf].clear_to_send = true; in ixgbe_vf_reset_msg()
717 IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBAHn(q_per_pool, vf, i), 0); in ixgbe_vf_reset_msg()
718 IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBALn(q_per_pool, vf, i), 0); in ixgbe_vf_reset_msg()
730 vf); in ixgbe_vf_reset_msg()
738 ixgbe_write_mbx(hw, msgbuf, IXGBE_VF_PERMADDR_MSG_LEN, vf); in ixgbe_vf_reset_msg()
744 u32 *msgbuf, u32 vf) in ixgbe_set_vf_mac_addr() argument
749 e_warn(drv, "VF %d attempted to set invalid mac\n", vf); in ixgbe_set_vf_mac_addr()
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()
758 vf); in ixgbe_set_vf_mac_addr()
762 return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0; in ixgbe_set_vf_mac_addr()
789 u32 *msgbuf, u32 vf) in ixgbe_set_vf_vlan_msg() argument
800 if (adapter->vfinfo[vf].pf_vlan || tcs) { in ixgbe_set_vf_vlan_msg()
804 vf); 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()
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()
821 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); in ixgbe_set_vf_vlan_msg()
859 u32 *msgbuf, u32 vf) in ixgbe_set_vf_macvlan_msg() argument
866 if (adapter->vfinfo[vf].pf_set_mac && index > 0) { in ixgbe_set_vf_macvlan_msg()
869 vf); in ixgbe_set_vf_macvlan_msg()
876 e_warn(drv, "VF %d attempted to set invalid mac\n", vf); 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()
892 vf); in ixgbe_set_vf_macvlan_msg()
898 u32 *msgbuf, u32 vf) in ixgbe_negotiate_vf_api() argument
906 adapter->vfinfo[vf].vf_api = api; in ixgbe_negotiate_vf_api()
912 e_info(drv, "VF %d requested invalid api version %u\n", vf, api); in ixgbe_negotiate_vf_api()
918 u32 *msgbuf, u32 vf) in ixgbe_get_vf_queues() argument
926 switch (adapter->vfinfo[vf].vf_api) { 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
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()
987 u32 *msgbuf, u32 vf) 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()
1004 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) in ixgbe_rcv_msg_from_vf() argument
1011 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); 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()
1034 ixgbe_write_mbx(hw, msgbuf, 1, vf); 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()
1080 ixgbe_write_mbx(hw, msgbuf, mbx_size, 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
1091 if (!adapter->vfinfo[vf].clear_to_send) in ixgbe_rcv_ack_from_vf()
1092 ixgbe_write_mbx(hw, &msg, 1, vf); in ixgbe_rcv_ack_from_vf()
1098 u32 vf; in ixgbe_msg_task() local
1100 for (vf = 0; vf < adapter->num_vfs; vf++) { in ixgbe_msg_task()
1102 if (!ixgbe_check_for_rst(hw, vf)) in ixgbe_msg_task()
1103 ixgbe_vf_reset_event(adapter, vf); in ixgbe_msg_task()
1106 if (!ixgbe_check_for_msg(hw, vf)) in ixgbe_msg_task()
1107 ixgbe_rcv_msg_from_vf(adapter, vf); in ixgbe_msg_task()
1110 if (!ixgbe_check_for_ack(hw, vf)) in ixgbe_msg_task()
1111 ixgbe_rcv_ack_from_vf(adapter, vf); in ixgbe_msg_task()
1141 int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) in ixgbe_ndo_set_vf_mac() argument
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()
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
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()
1170 ixgbe_set_vmolr(hw, vf, false); in ixgbe_enable_port_vlan()
1171 if (adapter->vfinfo[vf].spoofchk_enabled) in ixgbe_enable_port_vlan()
1172 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); 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()
1183 "Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf); in ixgbe_enable_port_vlan()
1195 static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf) in ixgbe_disable_port_vlan() argument
1201 adapter->vfinfo[vf].pf_vlan, vf); in ixgbe_disable_port_vlan()
1202 ixgbe_clear_vmvir(adapter, vf); in ixgbe_disable_port_vlan()
1203 ixgbe_set_vmolr(hw, vf, true); in ixgbe_disable_port_vlan()
1204 hw->mac.ops.set_vlan_anti_spoofing(hw, false, 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()
1218 int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) in ixgbe_ndo_set_vf_vlan() argument
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()
1260 static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf) in ixgbe_set_vf_rate_limit() argument
1266 u16 tx_rate = adapter->vfinfo[vf].tx_rate; in ixgbe_set_vf_rate_limit()
1305 unsigned int reg_idx = (vf * queues_per_pool) + queue; in ixgbe_set_vf_rate_limit()
1334 int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate, in ixgbe_ndo_set_vf_bw() argument
1341 if (vf >= adapter->num_vfs) 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()
1370 int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting) in ixgbe_ndo_set_vf_spoofchk() argument
1373 int vf_target_reg = vf >> 3; in ixgbe_ndo_set_vf_spoofchk()
1374 int vf_target_shift = vf % 8; 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()
1399 int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf, in ixgbe_ndo_set_vf_rss_query_en() argument
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()
1420 int vf, struct ifla_vf_info *ivi) in ixgbe_ndo_get_vf_config() argument
1423 if (vf >= adapter->num_vfs) in ixgbe_ndo_get_vf_config()
1425 ivi->vf = vf; 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()