mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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>
This commit is contained in:
parent
4d196e4b2f
commit
888d04dfbe
10 changed files with 53 additions and 42 deletions
|
@ -348,7 +348,7 @@ static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst,
|
|||
hlist_for_each_entry_rcu(node, n, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
memcmp(dst, mpath->dst, ETH_ALEN) == 0) {
|
||||
compare_ether_addr(dst, mpath->dst) == 0) {
|
||||
if (MPATH_EXPIRED(mpath)) {
|
||||
spin_lock_bh(&mpath->state_lock);
|
||||
mpath->flags &= ~MESH_PATH_ACTIVE;
|
||||
|
@ -523,7 +523,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
|
|||
int err = 0;
|
||||
u32 hash_idx;
|
||||
|
||||
if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
|
||||
if (compare_ether_addr(dst, sdata->vif.addr) == 0)
|
||||
/* never add ourselves as neighbours */
|
||||
return -ENOTSUPP;
|
||||
|
||||
|
@ -564,7 +564,8 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
|
|||
err = -EEXIST;
|
||||
hlist_for_each_entry(node, n, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
|
||||
if (mpath->sdata == sdata &&
|
||||
compare_ether_addr(dst, mpath->dst) == 0)
|
||||
goto err_exists;
|
||||
}
|
||||
|
||||
|
@ -655,7 +656,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
|
|||
int err = 0;
|
||||
u32 hash_idx;
|
||||
|
||||
if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
|
||||
if (compare_ether_addr(dst, sdata->vif.addr) == 0)
|
||||
/* never add ourselves as neighbours */
|
||||
return -ENOTSUPP;
|
||||
|
||||
|
@ -692,7 +693,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
|
|||
err = -EEXIST;
|
||||
hlist_for_each_entry(node, n, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
|
||||
if (mpath->sdata == sdata &&
|
||||
compare_ether_addr(dst, mpath->dst) == 0)
|
||||
goto err_exists;
|
||||
}
|
||||
|
||||
|
@ -886,7 +888,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
|
|||
hlist_for_each_entry(node, n, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
memcmp(addr, mpath->dst, ETH_ALEN) == 0) {
|
||||
compare_ether_addr(addr, mpath->dst) == 0) {
|
||||
__mesh_path_del(tbl, node);
|
||||
goto enddel;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue