From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 245D6A04DD;
	Fri, 20 Nov 2020 15:25:27 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id AFE1E4C90;
	Fri, 20 Nov 2020 15:25:24 +0100 (CET)
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 21EC3DED
 for <dev@dpdk.org>; Fri, 20 Nov 2020 15:25:21 +0100 (CET)
IronPort-SDR: DXntvx8U5tS6EQYgBIr5W0tqrJ07GMBQFcd751YLCj8Qdx/Fgb43XFGyfi91Mi7WBZlWbN3I8f
 ZmiMcb4HKd5A==
X-IronPort-AV: E=McAfee;i="6000,8403,9810"; a="256187577"
X-IronPort-AV: E=Sophos;i="5.78,356,1599548400"; d="scan'208";a="256187577"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 20 Nov 2020 06:25:21 -0800
IronPort-SDR: YZYRyvPxQaf0Lg+3OzsZkZedQqcftXVbDB4Watd75j9xj0CVYU4LcEUdyQV8wIbY+ppsf/9W3d
 97B1a5sZaYnA==
X-IronPort-AV: E=Sophos;i="5.78,356,1599548400"; d="scan'208";a="331332342"
Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.243.199])
 ([10.213.243.199])
 by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 20 Nov 2020 06:25:20 -0800
To: Lijun Ou <oulijun@huawei.com>
Cc: dev@dpdk.org, linuxarm@huawei.com
References: <1605871656-51819-1-git-send-email-oulijun@huawei.com>
 <1605871656-51819-4-git-send-email-oulijun@huawei.com>
From: Ferruh Yigit <ferruh.yigit@intel.com>
Message-ID: <75b3e888-e930-6141-0ee6-3f4662a476be@intel.com>
Date: Fri, 20 Nov 2020 14:25:18 +0000
MIME-Version: 1.0
In-Reply-To: <1605871656-51819-4-git-send-email-oulijun@huawei.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Subject: Re: [dpdk-dev] [PATCH 3/4] net/hns3: adjust printing MAC addresses
	in log
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On 11/20/2020 11:27 AM, Lijun Ou wrote:
> Here the printing of MAC addresses is adjusted. After the
> modification, only some bytes of the MAC address are
> displayed.
> 

Why logging only some bytes of the MAC address?

> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
> ---
>   drivers/net/hns3/hns3_ethdev.c    | 53 +++++++++++++++++++++++----------------
>   drivers/net/hns3/hns3_ethdev.h    |  2 ++
>   drivers/net/hns3/hns3_ethdev_vf.c | 32 +++++++++++------------
>   3 files changed, 49 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
> index 2011378..d6d3f03 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -102,6 +102,15 @@ static int hns3_remove_mc_addr(struct hns3_hw *hw,
>   static int hns3_restore_fec(struct hns3_hw *hw);
>   static int hns3_query_dev_fec_info(struct rte_eth_dev *dev);
>   
> +void hns3_ether_format_addr(char *buf, uint16_t size,
> +			    const struct rte_ether_addr *ether_addr)
> +{
> +	snprintf(buf, size, "%02X:**:**:**:%02X:%02X",
> +		ether_addr->addr_bytes[0],
> +		ether_addr->addr_bytes[4],
> +		ether_addr->addr_bytes[5]);
> +}
> +
>   static void
>   hns3_pf_disable_irq0(struct hns3_hw *hw)
>   {
> @@ -1449,7 +1458,7 @@ hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
>   
>   	/* check if mac addr is valid */
>   	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
> -		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
> +		hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
>   				      mac_addr);

Is all these interim variable only to log the mac address? If so why not use 
macros insted, something like:

#define FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]

hns3_err(fw, "Add unicast mac addr err! addr(" FMT ") invalid", MAC(mac_addr));