提交 c0623e58 编写于 作者: D dingtianhong 提交者: David S. Miller

net: mlx4: slight optimization of addr compare

Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Amir Vadai <amirv@mellanox.com>
Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
Acked-By: NAmir Vadai <amirv@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4012dda3
...@@ -841,7 +841,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv, ...@@ -841,7 +841,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
list_for_each_entry(dst_tmp, dst, list) { list_for_each_entry(dst_tmp, dst, list) {
found = false; found = false;
list_for_each_entry(src_tmp, src, list) { 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; found = true;
break; break;
} }
...@@ -856,7 +856,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv, ...@@ -856,7 +856,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
list_for_each_entry(src_tmp, src, list) { list_for_each_entry(src_tmp, src, list) {
found = false; found = false;
list_for_each_entry(dst_tmp, dst, list) { 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; dst_tmp->action = MCLIST_NONE;
found = true; found = true;
break; break;
......
...@@ -3634,7 +3634,7 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header, ...@@ -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)) { !is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
list_for_each_entry_safe(res, tmp, rlist, list) { list_for_each_entry_safe(res, tmp, rlist, list) {
be_mac = cpu_to_be64(res->mac << 16); 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; return 0;
} }
pr_err("MAC %pM doesn't belong to VF %d, Steering rule rejected\n", pr_err("MAC %pM doesn't belong to VF %d, Steering rule rejected\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册