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 BE335A04DB; Thu, 10 Dec 2020 12:54:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C78DBC8A; Thu, 10 Dec 2020 12:54:43 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id 55E82BC88 for ; Thu, 10 Dec 2020 12:54:41 +0100 (CET) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CsC4V4FXFz15ZsJ for ; Thu, 10 Dec 2020 19:54:02 +0800 (CST) Received: from [10.67.103.119] (10.67.103.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Thu, 10 Dec 2020 19:54:27 +0800 From: oulijun To: Ferruh Yigit CC: , References: <1605871656-51819-1-git-send-email-oulijun@huawei.com> <1605871656-51819-4-git-send-email-oulijun@huawei.com> <75b3e888-e930-6141-0ee6-3f4662a476be@intel.com> Message-ID: Date: Thu, 10 Dec 2020 19:54:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.119] X-CFilter-Loop: Reflected 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 在 2020/12/7 22:52, oulijun 写道: > > > 在 2020/11/20 22:25, Ferruh Yigit 写道: >> 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? > I understand that the entire MAC address information can be obtained by > printing part of the value, instead of printing all the MAC addresses. >> >>> Signed-off-by: Chengchang Tang >>> Signed-off-by: Lijun Ou >>> --- >>> 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)); > Looks like a good suggestion. I need to discuss it with the author. > Maybe it will be fixed in the new version. Hi,Ferruh Yigit We think that the effect is the same. In addition, an error occurs when you use the scheme provided by you. The definition of hns3_err needs to be modified. Thanks Lijun Ou >> >> . >>