summaryrefslogtreecommitdiff
path: root/drivers/net/i40e/rte_pmd_i40e.c
diff options
context:
space:
mode:
authorRory Sexton <rory.sexton@intel.com>2017-10-11 17:18:47 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2017-10-12 00:40:39 +0100
commita399ed9ae4df3a6e76d1bd9b7960520d125e66ef (patch)
treedbc4af5d3f00634f0bee31cffca37c31196ce98a /drivers/net/i40e/rte_pmd_i40e.c
parent63bdef1827f5a98ab375877cb994ef92c33a0b8a (diff)
downloaddpdk-a399ed9ae4df3a6e76d1bd9b7960520d125e66ef.zip
dpdk-a399ed9ae4df3a6e76d1bd9b7960520d125e66ef.tar.gz
dpdk-a399ed9ae4df3a6e76d1bd9b7960520d125e66ef.tar.xz
net/i40e: support converting VF MAC to VF id
Need a way to convert a VF id to a PF id on the host so as to query the PF for relevant statistics which are used for the frequency changes in the vm_power_manager app. Used when profiles are passed down from the guest to the host, allowing the host to map the VFs to PFs. Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com> Signed-off-by: Rory Sexton <rory.sexton@intel.com> Signed-off-by: David Hunt <david.hunt@intel.com> Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'drivers/net/i40e/rte_pmd_i40e.c')
-rw-r--r--drivers/net/i40e/rte_pmd_i40e.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 0988023..103e161 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2430,3 +2430,33 @@ rte_pmd_i40e_flow_type_mapping_update(
return 0;
}
+
+int
+rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac)
+{
+ struct rte_eth_dev *dev;
+ struct ether_addr *mac;
+ struct i40e_pf *pf;
+ int vf_id;
+ struct i40e_pf_vf *vf;
+ uint16_t vf_num;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+ dev = &rte_eth_devices[port];
+
+ if (!is_i40e_supported(dev))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ vf_num = pf->vf_num;
+
+ for (vf_id = 0; vf_id < vf_num; vf_id++) {
+ vf = &pf->vfs[vf_id];
+ mac = &vf->mac_addr;
+
+ if (is_same_ether_addr(mac, vf_mac))
+ return vf_id;
+ }
+
+ return -EINVAL;
+}