From patchwork Tue Mar 8 06:42:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Helin" X-Patchwork-Id: 11158 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 3D15A2C72; Tue, 8 Mar 2016 07:42:22 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 850D52C67 for ; Tue, 8 Mar 2016 07:42:19 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 07 Mar 2016 22:42:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,555,1449561600"; d="scan'208";a="665630890" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 07 Mar 2016 22:42:17 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u286gFc0024028; Tue, 8 Mar 2016 14:42:15 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u286gCwJ011956; Tue, 8 Mar 2016 14:42:14 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u286gCdC011952; Tue, 8 Mar 2016 14:42:12 +0800 From: Helin Zhang To: dev@dpdk.org Date: Tue, 8 Mar 2016 14:42:08 +0800 Message-Id: <1457419329-11915-2-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1457419329-11915-1-git-send-email-helin.zhang@intel.com> References: <1453970423-15234-1-git-send-email-helin.zhang@intel.com> <1457419329-11915-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 1/2] i40e: generate MAC address for VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" It generates a MAC address for each VFs during PF host initialization. Signed-off-by: Helin Zhang --- 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(+) v2: - It just generates a MAC address for each VFs during PF host initialization, and removes configuring from users. - Reworded the release notes. diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 73494f9..1b9061d 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -137,6 +137,11 @@ Drivers * **vmxnet3: add TSO support.** +* **i40e: Generates 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. + Libraries ~~~~~~~~~ diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index db6173a..9109cd9 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 cbf4e5b..5790377 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 */