lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52BD9512.5040105@cogentembedded.com>
Date:	Fri, 27 Dec 2013 18:56:18 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Ding Tianhong <dingtianhong@...wei.com>,
	Ariel Elior <ariele@...adcom.com>,
	"David S. Miller" <davem@...emloft.net>,
	Netdev <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 02/20] net: bnx2x: slight optimization of addr
 compare

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@...adcom.com>
> Signed-off-by: Ding Tianhong <dingtianhong@...wei.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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ