DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Lijun Ou <oulijun@huawei.com>
Cc: dev@dpdk.org, linuxarm@huawei.com
Subject: Re: [dpdk-dev] [PATCH 3/4] net/hns3: adjust printing MAC addresses in log
Date: Fri, 20 Nov 2020 14:25:18 +0000
Message-ID: <75b3e888-e930-6141-0ee6-3f4662a476be@intel.com> (raw)
In-Reply-To: <1605871656-51819-4-git-send-email-oulijun@huawei.com>

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));


  reply	other threads:[~2020-11-20 14:25 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 [this message]
2020-12-07 14:52     ` oulijun
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=75b3e888-e930-6141-0ee6-3f4662a476be@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=linuxarm@huawei.com \
    --cc=oulijun@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git