diff options
author | Antonio Quartulli <antonio@meshcoding.com> | 2014-01-21 18:42:11 -0500 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2014-03-22 03:50:26 -0400 |
commit | 8fdd01530cda849ba531e7e9d8674fbc81ab5782 (patch) | |
tree | d2a19df1128530d694d7dce1c04d6f24515beb26 /net/batman-adv/translation-table.c | |
parent | e88b617d84b53170f0781cc0756019c5b1855890 (diff) |
batman-adv: prefer ether_addr_copy to memcpy
On some architectures ether_addr_copy() is slightly faster
than memcpy() therefore use the former when possible.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 959dde721c46..6d0da58d755e 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -96,7 +96,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const uint8_t *addr, | |||
96 | if (!hash) | 96 | if (!hash) |
97 | return NULL; | 97 | return NULL; |
98 | 98 | ||
99 | memcpy(to_search.addr, addr, ETH_ALEN); | 99 | ether_addr_copy(to_search.addr, addr); |
100 | to_search.vid = vid; | 100 | to_search.vid = vid; |
101 | 101 | ||
102 | index = batadv_choose_tt(&to_search, hash->size); | 102 | index = batadv_choose_tt(&to_search, hash->size); |
@@ -333,7 +333,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, | |||
333 | tt_change_node->change.flags = flags; | 333 | tt_change_node->change.flags = flags; |
334 | memset(tt_change_node->change.reserved, 0, | 334 | memset(tt_change_node->change.reserved, 0, |
335 | sizeof(tt_change_node->change.reserved)); | 335 | sizeof(tt_change_node->change.reserved)); |
336 | memcpy(tt_change_node->change.addr, common->addr, ETH_ALEN); | 336 | ether_addr_copy(tt_change_node->change.addr, common->addr); |
337 | tt_change_node->change.vid = htons(common->vid); | 337 | tt_change_node->change.vid = htons(common->vid); |
338 | 338 | ||
339 | del_op_requested = flags & BATADV_TT_CLIENT_DEL; | 339 | del_op_requested = flags & BATADV_TT_CLIENT_DEL; |
@@ -549,7 +549,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
549 | addr, BATADV_PRINT_VID(vid), | 549 | addr, BATADV_PRINT_VID(vid), |
550 | (uint8_t)atomic_read(&bat_priv->tt.vn)); | 550 | (uint8_t)atomic_read(&bat_priv->tt.vn)); |
551 | 551 | ||
552 | memcpy(tt_local->common.addr, addr, ETH_ALEN); | 552 | ether_addr_copy(tt_local->common.addr, addr); |
553 | /* The local entry has to be marked as NEW to avoid to send it in | 553 | /* The local entry has to be marked as NEW to avoid to send it in |
554 | * a full table response going out before the next ttvn increment | 554 | * a full table response going out before the next ttvn increment |
555 | * (consistency check) | 555 | * (consistency check) |
@@ -1277,7 +1277,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
1277 | goto out; | 1277 | goto out; |
1278 | 1278 | ||
1279 | common = &tt_global_entry->common; | 1279 | common = &tt_global_entry->common; |
1280 | memcpy(common->addr, tt_addr, ETH_ALEN); | 1280 | ether_addr_copy(common->addr, tt_addr); |
1281 | common->vid = vid; | 1281 | common->vid = vid; |
1282 | 1282 | ||
1283 | common->flags = flags; | 1283 | common->flags = flags; |
@@ -2160,7 +2160,7 @@ batadv_new_tt_req_node(struct batadv_priv *bat_priv, | |||
2160 | if (!tt_req_node) | 2160 | if (!tt_req_node) |
2161 | goto unlock; | 2161 | goto unlock; |
2162 | 2162 | ||
2163 | memcpy(tt_req_node->addr, orig_node->orig, ETH_ALEN); | 2163 | ether_addr_copy(tt_req_node->addr, orig_node->orig); |
2164 | tt_req_node->issued_at = jiffies; | 2164 | tt_req_node->issued_at = jiffies; |
2165 | 2165 | ||
2166 | list_add(&tt_req_node->list, &bat_priv->tt.req_list); | 2166 | list_add(&tt_req_node->list, &bat_priv->tt.req_list); |
@@ -2240,8 +2240,7 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, | |||
2240 | if ((valid_cb) && (!valid_cb(tt_common_entry, cb_data))) | 2240 | if ((valid_cb) && (!valid_cb(tt_common_entry, cb_data))) |
2241 | continue; | 2241 | continue; |
2242 | 2242 | ||
2243 | memcpy(tt_change->addr, tt_common_entry->addr, | 2243 | ether_addr_copy(tt_change->addr, tt_common_entry->addr); |
2244 | ETH_ALEN); | ||
2245 | tt_change->flags = tt_common_entry->flags; | 2244 | tt_change->flags = tt_common_entry->flags; |
2246 | tt_change->vid = htons(tt_common_entry->vid); | 2245 | tt_change->vid = htons(tt_common_entry->vid); |
2247 | memset(tt_change->reserved, 0, | 2246 | memset(tt_change->reserved, 0, |
@@ -2932,7 +2931,7 @@ static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, | |||
2932 | tt_roam_node->first_time = jiffies; | 2931 | tt_roam_node->first_time = jiffies; |
2933 | atomic_set(&tt_roam_node->counter, | 2932 | atomic_set(&tt_roam_node->counter, |
2934 | BATADV_ROAMING_MAX_COUNT - 1); | 2933 | BATADV_ROAMING_MAX_COUNT - 1); |
2935 | memcpy(tt_roam_node->addr, client, ETH_ALEN); | 2934 | ether_addr_copy(tt_roam_node->addr, client); |
2936 | 2935 | ||
2937 | list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); | 2936 | list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); |
2938 | ret = true; | 2937 | ret = true; |