From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60FDBA04F0; Mon, 13 Jan 2020 09:06:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 383A11D5EF; Mon, 13 Jan 2020 09:06:02 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6D89C1D5E9 for ; Mon, 13 Jan 2020 09:06:00 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 00:05:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,428,1571727600"; d="scan'208";a="217337812" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga008.jf.intel.com with ESMTP; 13 Jan 2020 00:05:57 -0800 Date: Mon, 13 Jan 2020 16:05:56 +0800 From: Ye Xiaolong To: Haiyue Wang Cc: dev@dpdk.org, stephen@networkplumber.org, qi.z.zhang@intel.com, qiming.yang@intel.com Message-ID: <20200113080556.GB59121@intel.com> References: <20200102071457.106137-1-haiyue.wang@intel.com> <20200103025845.12609-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200103025845.12609-1-haiyue.wang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v3] net/ice: use the copy API to do MAC 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, haiyue On 01/03, Haiyue Wang wrote: >Use the API rte_ether_addr_copy to do MAC assignment, instead of >calling rte_memcpy function directly. Please add Fix tags and cc stable. Thanks, Xiaolong > >Signed-off-by: Haiyue Wang >--- >v3: Update the commit message > >v2: Update the commit title and message, use the rte_ether_addr_copy API > instead of just changing the length definition to make code style clean. > > drivers/net/ice/ice_ethdev.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > >diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c >index 2cbd82c94..d104df26f 100644 >--- a/drivers/net/ice/ice_ethdev.c >+++ b/drivers/net/ice/ice_ethdev.c >@@ -873,7 +873,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) > ret = -ENOMEM; > goto DONE; > } >- rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN); >+ rte_ether_addr_copy(mac_addr, &f->mac_info.mac_addr); > TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); > vsi->mac_num++; > >@@ -1660,16 +1660,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) > > if (type == ICE_VSI_PF) { > /* MAC configuration */ >- rte_memcpy(pf->dev_addr.addr_bytes, >- hw->port_info->mac.perm_addr, >- ETH_ADDR_LEN); >+ rte_ether_addr_copy((struct rte_ether_addr *) >+ hw->port_info->mac.perm_addr, >+ &pf->dev_addr); > >- rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); >+ rte_ether_addr_copy(&pf->dev_addr, &mac_addr); > ret = ice_add_mac_filter(vsi, &mac_addr); > if (ret != ICE_SUCCESS) > PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter"); > >- rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); >+ rte_ether_addr_copy(&broadcast, &mac_addr); > ret = ice_add_mac_filter(vsi, &mac_addr); > if (ret != ICE_SUCCESS) > PMD_INIT_LOG(ERR, "Failed to add MAC filter"); >@@ -3267,7 +3267,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, > PMD_DRV_LOG(ERR, "Failed to add mac filter"); > return -EIO; > } >- memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN); >+ rte_ether_addr_copy(mac_addr, &pf->dev_addr); > > flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; > ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL); >-- >2.17.1 >