aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_pathtbl.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-03-01 09:22:09 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-05 15:38:31 -0500
commit888d04dfbe7e09f930fdaafb257cce2c54c9c3f3 (patch)
treecdf0c4d4008860fd91db31bcc620a8ecd3d95bc1 /net/mac80211/mesh_pathtbl.c
parent4d196e4b2ffd734393b54f351507462f19d737b5 (diff)
mac80211: use compare_ether_addr on MAC addresses instead of memcmp
Because of the constant size and guaranteed 16 bit alignment, the inline compare_ether_addr function is much cheaper than calling memcmp. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
-rw-r--r--net/mac80211/mesh_pathtbl.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index dc51669e67d8..157642f780b9 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -348,7 +348,7 @@ static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst,
348 hlist_for_each_entry_rcu(node, n, bucket, list) { 348 hlist_for_each_entry_rcu(node, n, bucket, list) {
349 mpath = node->mpath; 349 mpath = node->mpath;
350 if (mpath->sdata == sdata && 350 if (mpath->sdata == sdata &&
351 memcmp(dst, mpath->dst, ETH_ALEN) == 0) { 351 compare_ether_addr(dst, mpath->dst) == 0) {
352 if (MPATH_EXPIRED(mpath)) { 352 if (MPATH_EXPIRED(mpath)) {
353 spin_lock_bh(&mpath->state_lock); 353 spin_lock_bh(&mpath->state_lock);
354 mpath->flags &= ~MESH_PATH_ACTIVE; 354 mpath->flags &= ~MESH_PATH_ACTIVE;
@@ -523,7 +523,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
523 int err = 0; 523 int err = 0;
524 u32 hash_idx; 524 u32 hash_idx;
525 525
526 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 526 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
527 /* never add ourselves as neighbours */ 527 /* never add ourselves as neighbours */
528 return -ENOTSUPP; 528 return -ENOTSUPP;
529 529
@@ -564,7 +564,8 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
564 err = -EEXIST; 564 err = -EEXIST;
565 hlist_for_each_entry(node, n, bucket, list) { 565 hlist_for_each_entry(node, n, bucket, list) {
566 mpath = node->mpath; 566 mpath = node->mpath;
567 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 567 if (mpath->sdata == sdata &&
568 compare_ether_addr(dst, mpath->dst) == 0)
568 goto err_exists; 569 goto err_exists;
569 } 570 }
570 571
@@ -655,7 +656,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
655 int err = 0; 656 int err = 0;
656 u32 hash_idx; 657 u32 hash_idx;
657 658
658 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 659 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
659 /* never add ourselves as neighbours */ 660 /* never add ourselves as neighbours */
660 return -ENOTSUPP; 661 return -ENOTSUPP;
661 662
@@ -692,7 +693,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
692 err = -EEXIST; 693 err = -EEXIST;
693 hlist_for_each_entry(node, n, bucket, list) { 694 hlist_for_each_entry(node, n, bucket, list) {
694 mpath = node->mpath; 695 mpath = node->mpath;
695 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 696 if (mpath->sdata == sdata &&
697 compare_ether_addr(dst, mpath->dst) == 0)
696 goto err_exists; 698 goto err_exists;
697 } 699 }
698 700
@@ -886,7 +888,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
886 hlist_for_each_entry(node, n, bucket, list) { 888 hlist_for_each_entry(node, n, bucket, list) {
887 mpath = node->mpath; 889 mpath = node->mpath;
888 if (mpath->sdata == sdata && 890 if (mpath->sdata == sdata &&
889 memcmp(addr, mpath->dst, ETH_ALEN) == 0) { 891 compare_ether_addr(addr, mpath->dst) == 0) {
890 __mesh_path_del(tbl, node); 892 __mesh_path_del(tbl, node);
891 goto enddel; 893 goto enddel;
892 } 894 }