net: mlx4: slight optimization of addr compare
Subsystems (4)
PATCH 8/20 net: mlx4: slight optimization of addr compare
Use possibly more efficient ether_addr_equal
to instead of memcmp.
Cc Amir Vadai <[email protected]>
Signed-off-by Ding Tianhong <[email protected]>
--- 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(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 -2
@@ -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 ;
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 -1
@@ -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",
Signature · 1 line
1.8.0
Quoted 53 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal
to instead of memcmp.Cc Amir Vadai <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- 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(-)drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2
-2@@ -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 ;drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1
-1@@ -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",Signature · 7 lines
1.8.0 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Acked-by Amir Vadai <[email protected]>