netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ding Tianhong <dingtianhong@huawei.com>,
	Ariel Elior <ariele@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 02/20] net: bnx2x: slight optimization of addr compare
Date: Fri, 27 Dec 2013 18:56:18 +0400	[thread overview]
Message-ID: <52BD9512.5040105@cogentembedded.com> (raw)
In-Reply-To: <52BD22AD.3090702@huawei.com>

Hello.

On 27-12-2013 10:48, Ding Tianhong wrote:

> Use the possibly more efficient ether_addr_equal or
> ether_addr_equal_unaligned to instead of memcmp.

> Cc: Ariel Elior <ariele@broadcom.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>   drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c    | 10 ++++------
>   drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |  2 +-
>   drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c  |  2 +-
>   3 files changed, 6 insertions(+), 8 deletions(-)

> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
> index 32c92ab..a83c67c 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
[...]
> @@ -696,8 +696,7 @@ static int bnx2x_check_vlan_mac_add(struct bnx2x *bp,
>
>   	list_for_each_entry(pos, &o->head, link)
>   		if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
> -		    (!memcmp(data->vlan_mac.mac, pos->u.vlan_mac.mac,
> -				  ETH_ALEN)) &&
> +		    (ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac)) &&

    Pointless parens around function call again.

> @@ -716,7 +715,7 @@ static struct bnx2x_vlan_mac_registry_elem *
>   	DP(BNX2X_MSG_SP, "Checking MAC %pM for DEL command\n", data->mac.mac);
>
>   	list_for_each_entry(pos, &o->head, link)
> -		if ((!memcmp(data->mac.mac, pos->u.mac.mac, ETH_ALEN)) &&
> +		if ((ether_addr_equal(data->mac.mac, pos->u.mac.mac)) &&

    ... and again.

> @@ -751,8 +750,7 @@ static struct bnx2x_vlan_mac_registry_elem *
>
>   	list_for_each_entry(pos, &o->head, link)
>   		if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
> -		    (!memcmp(data->vlan_mac.mac, pos->u.vlan_mac.mac,
> -			     ETH_ALEN)) &&
> +		    (ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac)) &&

    ... and again.

WBR, Sergei

      reply	other threads:[~2013-12-27 14:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27  6:48 [PATCH net-next 02/20] net: bnx2x: slight optimization of addr compare Ding Tianhong
2013-12-27 14:56 ` Sergei Shtylyov [this message]

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=52BD9512.5040105@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=ariele@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=dingtianhong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).