net: mlx4: slight optimization of addr compare
authordingtianhong <dingtianhong@huawei.com>
Mon, 30 Dec 2013 07:40:55 +0000 (15:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Dec 2013 21:48:31 +0000 (16:48 -0500)
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>
Acked-By: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

index b68dde09bf4b8111ba0ac01a6bed57b6513822a8..60b927eab2b1b0ee94f706f5f7f1e41732623fc3 100644 (file)
@@ -841,7 +841,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;
                        }
@@ -856,7 +856,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;
index 2f3f2bc7f2837e2d7eef7c42ced3a2ffad8f0e56..2e3232cad0ae27573d7679936933492206939c49 100644 (file)
@@ -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",