From 488ecf62714f8946ea436d961086cb8c7b50dbda Mon Sep 17 00:00:00 2001 From: Helin Zhang Date: Tue, 8 Mar 2016 14:42:08 +0800 Subject: [PATCH] i40e: generate MAC address for VF Generate a MAC address for each VF during PF host initialization. Signed-off-by: Helin Zhang Acked-by: Zhe Tao --- doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_pf.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 9851dcce06..25f4042a09 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -219,6 +219,11 @@ Drivers The driver now set the MDIO clock speed prior to initializing PHY ops and again after the MAC reset. +* **i40e: Generated MAC address for each VFs.** + + It generates a MAC address for each VFs during PF host initialization, + and keeps the VF MAC address the same among different VF launch. + * **aesni_mb: Fixed wrong return value when creating a device.** cryptodev_aesni_mb_init() was returning the device id of the device created, diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index db6173aada..9109cd9ffe 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -312,6 +312,7 @@ struct i40e_pf_vf { uint16_t vf_idx; /* VF index in pf->vfs */ uint16_t lan_nb_qps; /* Actual queues allocated */ uint16_t reset_cnt; /* Total vf reset times */ + struct ether_addr mac_addr; /* Default MAC address */ }; /* diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index cbf4e5bbc9..57903771d6 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -315,6 +315,8 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf) /* As assume Vf only has single VSI now, always return 0 */ vf_res->vsi_res[0].vsi_id = 0; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; + ether_addr_copy(&vf->mac_addr, + (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_VF_RESOURCES, @@ -1045,6 +1047,7 @@ i40e_pf_host_init(struct rte_eth_dev *dev) ret = i40e_pf_host_vf_reset(&pf->vfs[i], 0); if (ret != I40E_SUCCESS) goto fail; + eth_random_addr(pf->vfs[i].mac_addr.addr_bytes); } /* restore irq0 */ -- 2.20.1