From: oulijun <oulijun@huawei.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <linuxarm@huawei.com>
Subject: Re: [dpdk-dev] [PATCH 3/4] net/hns3: adjust printing MAC addresses in log
Date: Mon, 7 Dec 2020 22:52:32 +0800 [thread overview]
Message-ID: <b69f5325-1fac-986e-691b-a6ab5dc5753f@huawei.com> (raw)
In-Reply-To: <75b3e888-e930-6141-0ee6-3f4662a476be@intel.com>
在 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 <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));
Looks like a good suggestion. I need to discuss it with the author.
Maybe it will be fixed in the new version.
>
> .
>
next prev parent reply other threads:[~2020-12-07 14:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 11:27 [dpdk-dev] [PATCH 0/4] hns3 fixes Lijun Ou
2020-11-20 11:27 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix segment fault with the multi-TC Lijun Ou
2020-11-20 11:27 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix unused queues with not disabled Lijun Ou
2020-11-20 11:27 ` [dpdk-dev] [PATCH 3/4] net/hns3: adjust printing MAC addresses in log Lijun Ou
2020-11-20 14:25 ` Ferruh Yigit
2020-12-07 14:52 ` oulijun [this message]
2020-12-10 11:54 ` oulijun
2020-11-20 11:27 ` [dpdk-dev] [PATCH 4/4] net/hns3: fix FEC state query Lijun Ou
2020-11-20 14:33 ` Ferruh Yigit
2020-11-20 14:35 ` Ferruh Yigit
2020-12-02 12:42 ` Min Hu (Connor)
2020-12-07 14:50 ` oulijun
2020-11-20 14:38 ` [dpdk-dev] [PATCH 0/4] hns3 fixes Ferruh Yigit
2020-11-20 14:58 ` oulijun
2020-11-20 15:38 ` Ferruh Yigit
2020-11-20 17:53 ` Ferruh Yigit
2020-12-07 14:54 ` oulijun
2020-12-07 16:17 ` Ferruh Yigit
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 0/2] " Lijun Ou
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 1/2] net/hns3: adjust printing MAC addresses in log Lijun Ou
2020-12-10 12:48 ` [dpdk-dev] [PATCH V2 2/2] net/hns3: fix FEC state query Lijun Ou
2020-12-10 16:30 ` [dpdk-dev] [PATCH V2 0/2] hns3 fixes Ferruh Yigit
2020-12-11 1:44 ` oulijun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b69f5325-1fac-986e-691b-a6ab5dc5753f@huawei.com \
--to=oulijun@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=linuxarm@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).