public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Amir Vadai <amirv@mellanox.com>
To: Ding Tianhong <dingtianhong@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: net: mlx4: slight optimization of addr compare
Date: Sun, 29 Dec 2013 15:29:56 +0200	[thread overview]
Message-ID: <20131229132944.GA2944@mtl-eit-vdi-22.mtl.labs.mlnx> (raw)
In-Reply-To: <52BD22C3.9070908@huawei.com>

On 27/12/13 14:48 +0800, Ding Tianhong wrote:
> Use possibly more efficient ether_addr_equal
> to instead of memcmp.
> 
> Cc: Amir Vadai <amirv@mellanox.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c        | 4 ++--
>  drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index 6f92090..7e43858 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -782,7 +782,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
>  	list_for_each_entry(dst_tmp, dst, list) {
>  		found = false;
>  		list_for_each_entry(src_tmp, src, list) {
> -			if (!memcmp(dst_tmp->addr, src_tmp->addr, ETH_ALEN)) {
> +			if (ether_addr_equal(dst_tmp->addr, src_tmp->addr)) {
>  				found = true;
>  				break;
>  			}
> @@ -797,7 +797,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
>  	list_for_each_entry(src_tmp, src, list) {
>  		found = false;
>  		list_for_each_entry(dst_tmp, dst, list) {
> -			if (!memcmp(dst_tmp->addr, src_tmp->addr, ETH_ALEN)) {
> +			if (ether_addr_equal(dst_tmp->addr, src_tmp->addr)) {
>  				dst_tmp->action = MCLIST_NONE;
>  				found = true;
>  				break;
> diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> index 2f3f2bc..2e3232c 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> @@ -3634,7 +3634,7 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header,
>  	    !is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
>  		list_for_each_entry_safe(res, tmp, rlist, list) {
>  			be_mac = cpu_to_be64(res->mac << 16);
> -			if (!memcmp(&be_mac, eth_header->eth.dst_mac, ETH_ALEN))
> +			if (ether_addr_equal((u8 *)&be_mac, eth_header->eth.dst_mac))
>  				return 0;
>  		}
>  		pr_err("MAC %pM doesn't belong to VF %d, Steering rule rejected\n",
> -- 
> 1.8.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-By: Amir Vadai <amirv@mellanox.com>

      reply	other threads:[~2013-12-29 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27  6:48 [PATCH net-next 08/20] net: mlx4: slight optimization of addr compare Ding Tianhong
2013-12-29 13:29 ` Amir Vadai [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=20131229132944.GA2944@mtl-eit-vdi-22.mtl.labs.mlnx \
    --to=amirv@mellanox.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