From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2760B5582; Fri, 16 Dec 2016 15:41:36 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP; 16 Dec 2016 06:41:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,358,1477983600"; d="scan'208";a="43277735" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by fmsmga005.fm.intel.com with ESMTP; 16 Dec 2016 06:41:34 -0800 From: Ferruh Yigit To: dev@dpdk.org Cc: Jingjing Wu ; Helin Zhang , stable@dpdk.org Date: Fri, 16 Dec 2016 14:39:02 +0000 Message-Id: <20161216143919.4909-13-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com> References: <1481835919-36488-1-git-send-email-qi.z.zhang@intel.com> <20161216143919.4909-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v4 12/29] net/i40e: fix VF MAC address assignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 14:41:36 -0000 If PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set to that same value. It is possible to check if PF set a MAC address or not through the hw->mac.addr variable. hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is: In PF side i40e_pf_host_process_cmd_get_vf_resources() eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address) In VF sise i40evf_init_vf() i40evf_get_vf_resources() i40e_vf_parse_hw_config() memcpy(hw->mac.addr, vsi_res->default_mac_addr) Updated code is after i40evf_get_vf_resources() and can benefit from hw->mac.addr variable. Fixes: 89e6b86384bb ("i40evf: rework MAC address validation") CC: stable@dpdk.org Signed-off-by: Ferruh Yigit --- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 5016249..0977095 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev) int i, err, bufsz; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); - struct ether_addr *p_mac_addr; uint16_t interval = i40e_calc_itr_interval(I40E_QUEUE_ITR_INTERVAL_MAX); @@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr); - if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */ - ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr); + if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; - } else { + else eth_random_addr(hw->mac.addr); /* Generate a random one */ - } /* If the PF host is not DPDK, set the interval of ITR0 to max*/ if (vf->version_major != I40E_DPDK_VERSION_MAJOR) { -- 2.9.3