Lines Matching refs:vf

43 			mv_list[i].vf = -1;
121 * ixgbe_get_vfs - Find and take references to all vf devices
129 int vf = 0;
144 if (vf >= adapter->num_vfs)
147 adapter->vfinfo[vf].vfdev = vfdev;
148 ++vf;
208 unsigned int num_vfs = adapter->num_vfs, vf;
217 /* put the reference to all of the vf devices */
218 for (vf = 0; vf < num_vfs; ++vf) {
219 struct pci_dev *vfdev = adapter->vfinfo[vf].vfdev;
223 adapter->vfinfo[vf].vfdev = NULL;
364 u32 *msgbuf, u32 vf)
368 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
374 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
402 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
442 u32 vf)
458 err = hw->mac.ops.set_vfta(hw, vid, vf, !!add, false);
474 static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf)
503 switch (adapter->vfinfo[vf].vf_api) {
527 vf_shift = vf % 32;
528 reg_offset = vf / 32;
559 static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe)
561 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
567 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
570 static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf)
574 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), 0);
577 static void ixgbe_clear_vf_vlans(struct ixgbe_adapter *adapter, u32 vf)
584 vlvfb_mask = BIT(vf % 32);
589 u32 word = i * 2 + vf / 32;
639 int vf, int index, unsigned char *mac_addr)
647 if (entry->vf == vf) {
648 entry->vf = -1;
652 entry->vf_macvlan, vf);
682 retval = ixgbe_add_mac_filter(adapter, mac_addr, vf);
688 entry->vf = vf;
694 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
698 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
705 ixgbe_clear_vf_vlans(adapter, vf);
708 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf);
711 ixgbe_set_vmolr(hw, vf, !vfinfo->pf_vlan);
715 ixgbe_clear_vmvir(adapter, vf);
719 vfinfo->pf_qos, vf);
722 adapter->default_up, vf);
725 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
726 hw->mac.ops.set_mac_anti_spoofing(hw, true, vf);
730 /* reset multicast table array for vf */
731 adapter->vfinfo[vf].num_vf_mc_hashes = 0;
734 ixgbe_ipsec_vf_clear(adapter, vf);
739 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf);
740 ixgbe_set_vf_macvlan(adapter, vf, 0, NULL);
743 adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10;
747 unsigned int reg_idx = (vf * q_per_pool) + queue;
763 static void ixgbe_vf_clear_mbx(struct ixgbe_adapter *adapter, u32 vf)
770 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf), word, 0);
776 int vf, unsigned char *mac_addr)
780 ixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf);
781 retval = ixgbe_add_mac_filter(adapter, mac_addr, vf);
783 memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr,
786 eth_zero_addr(adapter->vfinfo[vf].vf_mac_addresses);
804 static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf,
812 for (i = vf * q_per_pool; i < ((vf + 1) * q_per_pool); i++) {
828 * @vf: VF identifier
830 * Set or reset correct transmit and receive for vf
832 static void ixgbe_set_vf_rx_tx(struct ixgbe_adapter *adapter, int vf)
838 vf_shift = vf % 32;
839 reg_offset = vf / 32;
844 if (adapter->vfinfo[vf].link_enable) {
876 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
880 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
887 e_info(probe, "VF Reset msg received from vf %d\n", vf);
890 ixgbe_vf_reset_event(adapter, vf);
892 ixgbe_vf_clear_mbx(adapter, vf);
894 /* set vf mac address */
896 ixgbe_set_vf_mac(adapter, vf, vf_mac);
898 vf_shift = vf % 32;
899 reg_offset = vf / 32;
903 if (adapter->vfinfo[vf].pf_vlan)
906 ixgbe_write_qde(adapter, vf, reg);
908 ixgbe_set_vf_rx_tx(adapter, vf);
911 adapter->vfinfo[vf].clear_to_send = true;
923 IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBAHn(q_per_pool, vf, i), 0);
924 IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBALn(q_per_pool, vf, i), 0);
927 /* reply to reset with ack and vf mac address */
929 if (!is_zero_ether_addr(vf_mac) && adapter->vfinfo[vf].pf_set_mac) {
941 ixgbe_write_mbx(hw, msgbuf, IXGBE_VF_PERMADDR_MSG_LEN, vf);
947 u32 *msgbuf, u32 vf)
952 e_warn(drv, "VF %d attempted to set invalid mac\n", vf);
956 if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted &&
957 !ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) {
961 vf);
965 return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0;
969 u32 *msgbuf, u32 vf)
975 if (adapter->vfinfo[vf].pf_vlan || tcs) {
979 vf);
987 return ixgbe_set_vf_vlan(adapter, add, vid, vf);
991 u32 *msgbuf, u32 vf)
997 if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted &&
1001 vf);
1008 e_warn(drv, "VF %d attempted to set invalid mac\n", vf);
1016 if (adapter->vfinfo[vf].spoofchk_enabled) {
1019 hw->mac.ops.set_mac_anti_spoofing(hw, false, vf);
1020 hw->mac.ops.set_vlan_anti_spoofing(hw, false, vf);
1024 err = ixgbe_set_vf_macvlan(adapter, vf, index, new_mac);
1028 vf);
1034 u32 *msgbuf, u32 vf)
1044 adapter->vfinfo[vf].vf_api = api;
1050 e_info(drv, "VF %d requested invalid api version %u\n", vf, api);
1056 u32 *msgbuf, u32 vf)
1064 switch (adapter->vfinfo[vf].vf_api) {
1086 else if (adapter->vfinfo[vf].pf_vlan || adapter->vfinfo[vf].pf_qos)
1097 static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
1105 if (!adapter->vfinfo[vf].rss_query_enabled)
1109 switch (adapter->vfinfo[vf].vf_api) {
1133 u32 *msgbuf, u32 vf)
1138 if (!adapter->vfinfo[vf].rss_query_enabled)
1142 switch (adapter->vfinfo[vf].vf_api) {
1157 u32 *msgbuf, u32 vf)
1164 switch (adapter->vfinfo[vf].vf_api) {
1178 !adapter->vfinfo[vf].trusted) {
1182 if (adapter->vfinfo[vf].xcast_mode == xcast_mode)
1219 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
1222 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
1224 adapter->vfinfo[vf].xcast_mode = xcast_mode;
1233 u32 *msgbuf, u32 vf)
1238 switch (adapter->vfinfo[vf].vf_api) {
1247 *link_state = adapter->vfinfo[vf].link_enable;
1252 static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
1259 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
1274 return ixgbe_vf_reset_msg(adapter, vf);
1277 * until the vf completes a virtual function reset it should not be
1280 if (!adapter->vfinfo[vf].clear_to_send) {
1282 ixgbe_write_mbx(hw, msgbuf, 1, vf);
1288 retval = ixgbe_set_vf_mac_addr(adapter, msgbuf, vf);
1291 retval = ixgbe_set_vf_multicasts(adapter, msgbuf, vf);
1294 retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf);
1297 retval = ixgbe_set_vf_lpe(adapter, msgbuf[1], vf);
1300 retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf);
1303 retval = ixgbe_negotiate_vf_api(adapter, msgbuf, vf);
1306 retval = ixgbe_get_vf_queues(adapter, msgbuf, vf);
1309 retval = ixgbe_get_vf_reta(adapter, msgbuf, vf);
1312 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf);
1315 retval = ixgbe_update_vf_xcast_mode(adapter, msgbuf, vf);
1318 retval = ixgbe_get_vf_link_state(adapter, msgbuf, vf);
1321 retval = ixgbe_ipsec_vf_add_sa(adapter, msgbuf, vf);
1324 retval = ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf);
1340 ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);
1345 static void ixgbe_rcv_ack_from_vf(struct ixgbe_adapter *adapter, u32 vf)
1351 if (!adapter->vfinfo[vf].clear_to_send)
1352 ixgbe_write_mbx(hw, &msg, 1, vf);
1359 u32 vf;
1362 for (vf = 0; vf < adapter->num_vfs; vf++) {
1364 if (!ixgbe_check_for_rst(hw, vf))
1365 ixgbe_vf_reset_event(adapter, vf);
1368 if (!ixgbe_check_for_msg(hw, vf))
1369 ixgbe_rcv_msg_from_vf(adapter, vf);
1372 if (!ixgbe_check_for_ack(hw, vf))
1373 ixgbe_rcv_ack_from_vf(adapter, vf);
1378 static inline void ixgbe_ping_vf(struct ixgbe_adapter *adapter, int vf)
1384 if (adapter->vfinfo[vf].clear_to_send)
1386 ixgbe_write_mbx(hw, &ping, 1, vf);
1418 int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
1423 if (vf >= adapter->num_vfs)
1428 mac, vf);
1431 retval = ixgbe_set_vf_mac(adapter, vf, mac);
1433 adapter->vfinfo[vf].pf_set_mac = true;
1444 adapter->vfinfo[vf].vf_mac_addresses;
1450 dev_info(&adapter->pdev->dev, "removing MAC on VF %d\n", vf);
1452 retval = ixgbe_del_mac_filter(adapter, vf_mac_addr, vf);
1454 adapter->vfinfo[vf].pf_set_mac = false;
1466 static int ixgbe_enable_port_vlan(struct ixgbe_adapter *adapter, int vf,
1472 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf);
1477 ixgbe_set_vf_vlan(adapter, false, 0, vf);
1479 ixgbe_set_vmvir(adapter, vlan, qos, vf);
1480 ixgbe_set_vmolr(hw, vf, false);
1484 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE |
1487 adapter->vfinfo[vf].pf_vlan = vlan;
1488 adapter->vfinfo[vf].pf_qos = qos;
1490 "Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
1502 static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf)
1508 adapter->vfinfo[vf].pf_vlan, vf);
1510 ixgbe_set_vf_vlan(adapter, true, 0, vf);
1511 ixgbe_clear_vmvir(adapter, vf);
1512 ixgbe_set_vmolr(hw, vf, true);
1516 ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE);
1518 adapter->vfinfo[vf].pf_vlan = 0;
1519 adapter->vfinfo[vf].pf_qos = 0;
1524 int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
1530 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
1542 if (adapter->vfinfo[vf].pf_vlan)
1543 err = ixgbe_disable_port_vlan(adapter, vf);
1546 err = ixgbe_enable_port_vlan(adapter, vf, vlan, qos);
1548 err = ixgbe_disable_port_vlan(adapter, vf);
1569 static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf)
1575 u16 tx_rate = adapter->vfinfo[vf].tx_rate;
1614 unsigned int reg_idx = (vf * queues_per_pool) + queue;
1643 int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
1650 if (vf >= adapter->num_vfs)
1671 adapter->vfinfo[vf].tx_rate = max_tx_rate;
1674 ixgbe_set_vf_rate_limit(adapter, vf);
1679 int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
1684 if (vf >= adapter->num_vfs)
1687 adapter->vfinfo[vf].spoofchk_enabled = setting;
1690 hw->mac.ops.set_mac_anti_spoofing(hw, setting, vf);
1693 hw->mac.ops.set_vlan_anti_spoofing(hw, setting, vf);
1709 hw->mac.ops.set_ethertype_anti_spoofing(hw, setting, vf);
1718 * @vf: VF identifier
1721 * Set a link force state on/off a single vf
1723 void ixgbe_set_vf_link_state(struct ixgbe_adapter *adapter, int vf, int state)
1725 adapter->vfinfo[vf].link_state = state;
1730 adapter->vfinfo[vf].link_enable = false;
1732 adapter->vfinfo[vf].link_enable = true;
1735 adapter->vfinfo[vf].link_enable = true;
1738 adapter->vfinfo[vf].link_enable = false;
1742 ixgbe_set_vf_rx_tx(adapter, vf);
1745 adapter->vfinfo[vf].clear_to_send = false;
1746 ixgbe_ping_vf(adapter, vf);
1752 * @vf: VF identifier
1757 int ixgbe_ndo_set_vf_link_state(struct net_device *netdev, int vf, int state)
1762 if (vf < 0 || vf >= adapter->num_vfs) {
1764 "NDO set VF link - invalid VF identifier %d\n", vf);
1772 vf, state);
1776 "NDO set VF %d link state disable\n", vf);
1777 ixgbe_set_vf_link_state(adapter, vf, state);
1781 "NDO set VF %d link state auto\n", vf);
1782 ixgbe_set_vf_link_state(adapter, vf, state);
1786 "NDO set VF %d - invalid link state %d\n", vf, state);
1793 int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
1805 if (vf >= adapter->num_vfs)
1808 adapter->vfinfo[vf].rss_query_enabled = setting;
1813 int ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
1817 if (vf >= adapter->num_vfs)
1821 if (adapter->vfinfo[vf].trusted == setting)
1824 adapter->vfinfo[vf].trusted = setting;
1827 adapter->vfinfo[vf].clear_to_send = false;
1828 ixgbe_ping_vf(adapter, vf);
1830 e_info(drv, "VF %u is %strusted\n", vf, setting ? "" : "not ");
1836 int vf, struct ifla_vf_info *ivi)
1839 if (vf >= adapter->num_vfs)
1841 ivi->vf = vf;
1842 memcpy(&ivi->mac, adapter->vfinfo[vf].vf_mac_addresses, ETH_ALEN);
1843 ivi->max_tx_rate = adapter->vfinfo[vf].tx_rate;
1845 ivi->vlan = adapter->vfinfo[vf].pf_vlan;
1846 ivi->qos = adapter->vfinfo[vf].pf_qos;
1847 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled;
1848 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled;
1849 ivi->trusted = adapter->vfinfo[vf].trusted;
1850 ivi->linkstate = adapter->vfinfo[vf].link_state;