aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@meshcoding.com>2014-01-21 18:42:11 -0500
committerAntonio Quartulli <antonio@meshcoding.com>2014-03-22 03:50:26 -0400
commit8fdd01530cda849ba531e7e9d8674fbc81ab5782 (patch)
treed2a19df1128530d694d7dce1c04d6f24515beb26
parente88b617d84b53170f0781cc0756019c5b1855890 (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>
-rw-r--r--net/batman-adv/bat_iv_ogm.c10
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c30
-rw-r--r--net/batman-adv/distributed-arp-table.c4
-rw-r--r--net/batman-adv/fragmentation.c4
-rw-r--r--net/batman-adv/gateway_client.c2
-rw-r--r--net/batman-adv/icmp_socket.c11
-rw-r--r--net/batman-adv/main.c4
-rw-r--r--net/batman-adv/network-coding.c24
-rw-r--r--net/batman-adv/originator.c4
-rw-r--r--net/batman-adv/routing.c17
-rw-r--r--net/batman-adv/send.c8
-rw-r--r--net/batman-adv/soft-interface.c8
-rw-r--r--net/batman-adv/translation-table.c15
13 files changed, 70 insertions, 71 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 8323bced8e5b..b3bd4ec3fd94 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -347,10 +347,10 @@ static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface)
347 unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff; 347 unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff;
348 348
349 batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; 349 batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff;
350 memcpy(batadv_ogm_packet->orig, 350 ether_addr_copy(batadv_ogm_packet->orig,
351 hard_iface->net_dev->dev_addr, ETH_ALEN); 351 hard_iface->net_dev->dev_addr);
352 memcpy(batadv_ogm_packet->prev_sender, 352 ether_addr_copy(batadv_ogm_packet->prev_sender,
353 hard_iface->net_dev->dev_addr, ETH_ALEN); 353 hard_iface->net_dev->dev_addr);
354} 354}
355 355
356static void 356static void
@@ -830,7 +830,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node,
830 tvlv_len = ntohs(batadv_ogm_packet->tvlv_len); 830 tvlv_len = ntohs(batadv_ogm_packet->tvlv_len);
831 831
832 batadv_ogm_packet->ttl--; 832 batadv_ogm_packet->ttl--;
833 memcpy(batadv_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN); 833 ether_addr_copy(batadv_ogm_packet->prev_sender, ethhdr->h_source);
834 834
835 /* apply hop penalty */ 835 /* apply hop penalty */
836 batadv_ogm_packet->tq = batadv_hop_penalty(batadv_ogm_packet->tq, 836 batadv_ogm_packet->tq = batadv_hop_penalty(batadv_ogm_packet->tq,
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 70d781a362be..6f0d9ec37950 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -191,7 +191,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
191 if (!hash) 191 if (!hash)
192 return NULL; 192 return NULL;
193 193
194 memcpy(search_entry.orig, addr, ETH_ALEN); 194 ether_addr_copy(search_entry.orig, addr);
195 search_entry.vid = vid; 195 search_entry.vid = vid;
196 196
197 index = batadv_choose_backbone_gw(&search_entry, hash->size); 197 index = batadv_choose_backbone_gw(&search_entry, hash->size);
@@ -305,7 +305,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
305 /* normal claim frame 305 /* normal claim frame
306 * set Ethernet SRC to the clients mac 306 * set Ethernet SRC to the clients mac
307 */ 307 */
308 memcpy(ethhdr->h_source, mac, ETH_ALEN); 308 ether_addr_copy(ethhdr->h_source, mac);
309 batadv_dbg(BATADV_DBG_BLA, bat_priv, 309 batadv_dbg(BATADV_DBG_BLA, bat_priv,
310 "bla_send_claim(): CLAIM %pM on vid %d\n", mac, 310 "bla_send_claim(): CLAIM %pM on vid %d\n", mac,
311 BATADV_PRINT_VID(vid)); 311 BATADV_PRINT_VID(vid));
@@ -314,7 +314,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
314 /* unclaim frame 314 /* unclaim frame
315 * set HW SRC to the clients mac 315 * set HW SRC to the clients mac
316 */ 316 */
317 memcpy(hw_src, mac, ETH_ALEN); 317 ether_addr_copy(hw_src, mac);
318 batadv_dbg(BATADV_DBG_BLA, bat_priv, 318 batadv_dbg(BATADV_DBG_BLA, bat_priv,
319 "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, 319 "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac,
320 BATADV_PRINT_VID(vid)); 320 BATADV_PRINT_VID(vid));
@@ -323,7 +323,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
323 /* announcement frame 323 /* announcement frame
324 * set HW SRC to the special mac containg the crc 324 * set HW SRC to the special mac containg the crc
325 */ 325 */
326 memcpy(hw_src, mac, ETH_ALEN); 326 ether_addr_copy(hw_src, mac);
327 batadv_dbg(BATADV_DBG_BLA, bat_priv, 327 batadv_dbg(BATADV_DBG_BLA, bat_priv,
328 "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", 328 "bla_send_claim(): ANNOUNCE of %pM on vid %d\n",
329 ethhdr->h_source, BATADV_PRINT_VID(vid)); 329 ethhdr->h_source, BATADV_PRINT_VID(vid));
@@ -333,8 +333,8 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
333 * set HW SRC and header destination to the receiving backbone 333 * set HW SRC and header destination to the receiving backbone
334 * gws mac 334 * gws mac
335 */ 335 */
336 memcpy(hw_src, mac, ETH_ALEN); 336 ether_addr_copy(hw_src, mac);
337 memcpy(ethhdr->h_dest, mac, ETH_ALEN); 337 ether_addr_copy(ethhdr->h_dest, mac);
338 batadv_dbg(BATADV_DBG_BLA, bat_priv, 338 batadv_dbg(BATADV_DBG_BLA, bat_priv,
339 "bla_send_claim(): REQUEST of %pM to %pM on vid %d\n", 339 "bla_send_claim(): REQUEST of %pM to %pM on vid %d\n",
340 ethhdr->h_source, ethhdr->h_dest, 340 ethhdr->h_source, ethhdr->h_dest,
@@ -395,7 +395,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
395 entry->bat_priv = bat_priv; 395 entry->bat_priv = bat_priv;
396 atomic_set(&entry->request_sent, 0); 396 atomic_set(&entry->request_sent, 0);
397 atomic_set(&entry->wait_periods, 0); 397 atomic_set(&entry->wait_periods, 0);
398 memcpy(entry->orig, orig, ETH_ALEN); 398 ether_addr_copy(entry->orig, orig);
399 399
400 /* one for the hash, one for returning */ 400 /* one for the hash, one for returning */
401 atomic_set(&entry->refcount, 2); 401 atomic_set(&entry->refcount, 2);
@@ -563,7 +563,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
563 struct batadv_bla_claim search_claim; 563 struct batadv_bla_claim search_claim;
564 int hash_added; 564 int hash_added;
565 565
566 memcpy(search_claim.addr, mac, ETH_ALEN); 566 ether_addr_copy(search_claim.addr, mac);
567 search_claim.vid = vid; 567 search_claim.vid = vid;
568 claim = batadv_claim_hash_find(bat_priv, &search_claim); 568 claim = batadv_claim_hash_find(bat_priv, &search_claim);
569 569
@@ -573,7 +573,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
573 if (!claim) 573 if (!claim)
574 return; 574 return;
575 575
576 memcpy(claim->addr, mac, ETH_ALEN); 576 ether_addr_copy(claim->addr, mac);
577 claim->vid = vid; 577 claim->vid = vid;
578 claim->lasttime = jiffies; 578 claim->lasttime = jiffies;
579 claim->backbone_gw = backbone_gw; 579 claim->backbone_gw = backbone_gw;
@@ -624,7 +624,7 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
624{ 624{
625 struct batadv_bla_claim search_claim, *claim; 625 struct batadv_bla_claim search_claim, *claim;
626 626
627 memcpy(search_claim.addr, mac, ETH_ALEN); 627 ether_addr_copy(search_claim.addr, mac);
628 search_claim.vid = vid; 628 search_claim.vid = vid;
629 claim = batadv_claim_hash_find(bat_priv, &search_claim); 629 claim = batadv_claim_hash_find(bat_priv, &search_claim);
630 if (!claim) 630 if (!claim)
@@ -1103,8 +1103,8 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
1103 oldif->net_dev->dev_addr)) 1103 oldif->net_dev->dev_addr))
1104 continue; 1104 continue;
1105 1105
1106 memcpy(backbone_gw->orig, 1106 ether_addr_copy(backbone_gw->orig,
1107 primary_if->net_dev->dev_addr, ETH_ALEN); 1107 primary_if->net_dev->dev_addr);
1108 /* send an announce frame so others will ask for our 1108 /* send an announce frame so others will ask for our
1109 * claims and update their tables. 1109 * claims and update their tables.
1110 */ 1110 */
@@ -1310,7 +1310,7 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
1310 entry = &bat_priv->bla.bcast_duplist[curr]; 1310 entry = &bat_priv->bla.bcast_duplist[curr];
1311 entry->crc = crc; 1311 entry->crc = crc;
1312 entry->entrytime = jiffies; 1312 entry->entrytime = jiffies;
1313 memcpy(entry->orig, bcast_packet->orig, ETH_ALEN); 1313 ether_addr_copy(entry->orig, bcast_packet->orig);
1314 bat_priv->bla.bcast_duplist_curr = curr; 1314 bat_priv->bla.bcast_duplist_curr = curr;
1315 1315
1316out: 1316out:
@@ -1458,7 +1458,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
1458 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) 1458 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
1459 goto handled; 1459 goto handled;
1460 1460
1461 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); 1461 ether_addr_copy(search_claim.addr, ethhdr->h_source);
1462 search_claim.vid = vid; 1462 search_claim.vid = vid;
1463 claim = batadv_claim_hash_find(bat_priv, &search_claim); 1463 claim = batadv_claim_hash_find(bat_priv, &search_claim);
1464 1464
@@ -1557,7 +1557,7 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
1557 if (is_multicast_ether_addr(ethhdr->h_dest)) 1557 if (is_multicast_ether_addr(ethhdr->h_dest))
1558 goto handled; 1558 goto handled;
1559 1559
1560 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); 1560 ether_addr_copy(search_claim.addr, ethhdr->h_source);
1561 search_claim.vid = vid; 1561 search_claim.vid = vid;
1562 1562
1563 claim = batadv_claim_hash_find(bat_priv, &search_claim); 1563 claim = batadv_claim_hash_find(bat_priv, &search_claim);
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 5bb37a8353dd..b25fd64d727b 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -277,7 +277,7 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip,
277 /* if this entry is already known, just update it */ 277 /* if this entry is already known, just update it */
278 if (dat_entry) { 278 if (dat_entry) {
279 if (!batadv_compare_eth(dat_entry->mac_addr, mac_addr)) 279 if (!batadv_compare_eth(dat_entry->mac_addr, mac_addr))
280 memcpy(dat_entry->mac_addr, mac_addr, ETH_ALEN); 280 ether_addr_copy(dat_entry->mac_addr, mac_addr);
281 dat_entry->last_update = jiffies; 281 dat_entry->last_update = jiffies;
282 batadv_dbg(BATADV_DBG_DAT, bat_priv, 282 batadv_dbg(BATADV_DBG_DAT, bat_priv,
283 "Entry updated: %pI4 %pM (vid: %d)\n", 283 "Entry updated: %pI4 %pM (vid: %d)\n",
@@ -292,7 +292,7 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip,
292 292
293 dat_entry->ip = ip; 293 dat_entry->ip = ip;
294 dat_entry->vid = vid; 294 dat_entry->vid = vid;
295 memcpy(dat_entry->mac_addr, mac_addr, ETH_ALEN); 295 ether_addr_copy(dat_entry->mac_addr, mac_addr);
296 dat_entry->last_update = jiffies; 296 dat_entry->last_update = jiffies;
297 atomic_set(&dat_entry->refcount, 2); 297 atomic_set(&dat_entry->refcount, 2);
298 298
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 88df9b1d552d..bcc4bea632fa 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -449,8 +449,8 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
449 frag_header.reserved = 0; 449 frag_header.reserved = 0;
450 frag_header.no = 0; 450 frag_header.no = 0;
451 frag_header.total_size = htons(skb->len); 451 frag_header.total_size = htons(skb->len);
452 memcpy(frag_header.orig, primary_if->net_dev->dev_addr, ETH_ALEN); 452 ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr);
453 memcpy(frag_header.dest, orig_node->orig, ETH_ALEN); 453 ether_addr_copy(frag_header.dest, orig_node->orig);
454 454
455 /* Eat and send fragments from the tail of skb */ 455 /* Eat and send fragments from the tail of skb */
456 while (skb->len > max_fragment_size) { 456 while (skb->len > max_fragment_size) {
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 07c7f2177648..c835e137423b 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -763,7 +763,7 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
763 if (*p != ETH_ALEN) 763 if (*p != ETH_ALEN)
764 return BATADV_DHCP_NO; 764 return BATADV_DHCP_NO;
765 765
766 memcpy(chaddr, skb->data + chaddr_offset, ETH_ALEN); 766 ether_addr_copy(chaddr, skb->data + chaddr_offset);
767 } 767 }
768 768
769 return ret; 769 return ret;
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index abb9d6e0388b..161ef8f17d2e 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -158,6 +158,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
158 struct batadv_orig_node *orig_node = NULL; 158 struct batadv_orig_node *orig_node = NULL;
159 struct batadv_neigh_node *neigh_node = NULL; 159 struct batadv_neigh_node *neigh_node = NULL;
160 size_t packet_len = sizeof(struct batadv_icmp_packet); 160 size_t packet_len = sizeof(struct batadv_icmp_packet);
161 uint8_t *addr;
161 162
162 if (len < sizeof(struct batadv_icmp_header)) { 163 if (len < sizeof(struct batadv_icmp_header)) {
163 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, 164 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
@@ -227,10 +228,10 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
227 goto dst_unreach; 228 goto dst_unreach;
228 229
229 icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmp_header; 230 icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmp_header;
230 if (packet_len == sizeof(*icmp_packet_rr)) 231 if (packet_len == sizeof(*icmp_packet_rr)) {
231 memcpy(icmp_packet_rr->rr, 232 addr = neigh_node->if_incoming->net_dev->dev_addr;
232 neigh_node->if_incoming->net_dev->dev_addr, 233 ether_addr_copy(icmp_packet_rr->rr[0], addr);
233 ETH_ALEN); 234 }
234 235
235 break; 236 break;
236 default: 237 default:
@@ -250,7 +251,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
250 goto free_skb; 251 goto free_skb;
251 } 252 }
252 253
253 memcpy(icmp_header->orig, primary_if->net_dev->dev_addr, ETH_ALEN); 254 ether_addr_copy(icmp_header->orig, primary_if->net_dev->dev_addr);
254 255
255 batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr); 256 batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
256 goto out; 257 goto out;
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 66ae135b9f27..fbeaebde080d 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -1133,8 +1133,8 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
1133 unicast_tvlv_packet->reserved = 0; 1133 unicast_tvlv_packet->reserved = 0;
1134 unicast_tvlv_packet->tvlv_len = htons(tvlv_len); 1134 unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
1135 unicast_tvlv_packet->align = 0; 1135 unicast_tvlv_packet->align = 0;
1136 memcpy(unicast_tvlv_packet->src, src, ETH_ALEN); 1136 ether_addr_copy(unicast_tvlv_packet->src, src);
1137 memcpy(unicast_tvlv_packet->dst, dst, ETH_ALEN); 1137 ether_addr_copy(unicast_tvlv_packet->dst, dst);
1138 1138
1139 tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1); 1139 tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1);
1140 tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff; 1140 tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff;
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 801ece699d7f..a9546fe541eb 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -819,7 +819,7 @@ static struct batadv_nc_node
819 819
820 /* Initialize nc_node */ 820 /* Initialize nc_node */
821 INIT_LIST_HEAD(&nc_node->list); 821 INIT_LIST_HEAD(&nc_node->list);
822 memcpy(nc_node->addr, orig_node->orig, ETH_ALEN); 822 ether_addr_copy(nc_node->addr, orig_node->orig);
823 nc_node->orig_node = orig_neigh_node; 823 nc_node->orig_node = orig_neigh_node;
824 atomic_set(&nc_node->refcount, 2); 824 atomic_set(&nc_node->refcount, 2);
825 825
@@ -941,8 +941,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
941 spin_lock_init(&nc_path->packet_list_lock); 941 spin_lock_init(&nc_path->packet_list_lock);
942 atomic_set(&nc_path->refcount, 2); 942 atomic_set(&nc_path->refcount, 2);
943 nc_path->last_valid = jiffies; 943 nc_path->last_valid = jiffies;
944 memcpy(nc_path->next_hop, dst, ETH_ALEN); 944 ether_addr_copy(nc_path->next_hop, dst);
945 memcpy(nc_path->prev_hop, src, ETH_ALEN); 945 ether_addr_copy(nc_path->prev_hop, src);
946 946
947 batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_path %pM -> %pM\n", 947 batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_path %pM -> %pM\n",
948 nc_path->prev_hop, 948 nc_path->prev_hop,
@@ -1114,15 +1114,15 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
1114 coded_packet->ttl = packet1->ttl; 1114 coded_packet->ttl = packet1->ttl;
1115 1115
1116 /* Info about first unicast packet */ 1116 /* Info about first unicast packet */
1117 memcpy(coded_packet->first_source, first_source, ETH_ALEN); 1117 ether_addr_copy(coded_packet->first_source, first_source);
1118 memcpy(coded_packet->first_orig_dest, packet1->dest, ETH_ALEN); 1118 ether_addr_copy(coded_packet->first_orig_dest, packet1->dest);
1119 coded_packet->first_crc = packet_id1; 1119 coded_packet->first_crc = packet_id1;
1120 coded_packet->first_ttvn = packet1->ttvn; 1120 coded_packet->first_ttvn = packet1->ttvn;
1121 1121
1122 /* Info about second unicast packet */ 1122 /* Info about second unicast packet */
1123 memcpy(coded_packet->second_dest, second_dest, ETH_ALEN); 1123 ether_addr_copy(coded_packet->second_dest, second_dest);
1124 memcpy(coded_packet->second_source, second_source, ETH_ALEN); 1124 ether_addr_copy(coded_packet->second_source, second_source);
1125 memcpy(coded_packet->second_orig_dest, packet2->dest, ETH_ALEN); 1125 ether_addr_copy(coded_packet->second_orig_dest, packet2->dest);
1126 coded_packet->second_crc = packet_id2; 1126 coded_packet->second_crc = packet_id2;
1127 coded_packet->second_ttl = packet2->ttl; 1127 coded_packet->second_ttl = packet2->ttl;
1128 coded_packet->second_ttvn = packet2->ttvn; 1128 coded_packet->second_ttvn = packet2->ttvn;
@@ -1349,8 +1349,8 @@ static void batadv_nc_skb_store_before_coding(struct batadv_priv *bat_priv,
1349 1349
1350 /* Set the mac header as if we actually sent the packet uncoded */ 1350 /* Set the mac header as if we actually sent the packet uncoded */
1351 ethhdr = eth_hdr(skb); 1351 ethhdr = eth_hdr(skb);
1352 memcpy(ethhdr->h_source, ethhdr->h_dest, ETH_ALEN); 1352 ether_addr_copy(ethhdr->h_source, ethhdr->h_dest);
1353 memcpy(ethhdr->h_dest, eth_dst_new, ETH_ALEN); 1353 ether_addr_copy(ethhdr->h_dest, eth_dst_new);
1354 1354
1355 /* Set data pointer to MAC header to mimic packets from our tx path */ 1355 /* Set data pointer to MAC header to mimic packets from our tx path */
1356 skb_push(skb, ETH_HLEN); 1356 skb_push(skb, ETH_HLEN);
@@ -1646,7 +1646,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
1646 * so the Ethernet address must be copied to h_dest and 1646 * so the Ethernet address must be copied to h_dest and
1647 * pkt_type changed from PACKET_OTHERHOST to PACKET_HOST 1647 * pkt_type changed from PACKET_OTHERHOST to PACKET_HOST
1648 */ 1648 */
1649 memcpy(ethhdr->h_dest, coded_packet_tmp.second_dest, ETH_ALEN); 1649 ether_addr_copy(ethhdr->h_dest, coded_packet_tmp.second_dest);
1650 skb->pkt_type = PACKET_HOST; 1650 skb->pkt_type = PACKET_HOST;
1651 1651
1652 orig_dest = coded_packet_tmp.second_orig_dest; 1652 orig_dest = coded_packet_tmp.second_orig_dest;
@@ -1682,7 +1682,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
1682 unicast_packet->packet_type = BATADV_UNICAST; 1682 unicast_packet->packet_type = BATADV_UNICAST;
1683 unicast_packet->version = BATADV_COMPAT_VERSION; 1683 unicast_packet->version = BATADV_COMPAT_VERSION;
1684 unicast_packet->ttl = ttl; 1684 unicast_packet->ttl = ttl;
1685 memcpy(unicast_packet->dest, orig_dest, ETH_ALEN); 1685 ether_addr_copy(unicast_packet->dest, orig_dest);
1686 unicast_packet->ttvn = ttvn; 1686 unicast_packet->ttvn = ttvn;
1687 1687
1688 batadv_nc_packet_free(nc_packet); 1688 batadv_nc_packet_free(nc_packet);
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 853941629dc1..9f2da37d0210 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -446,7 +446,7 @@ batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
446 INIT_HLIST_HEAD(&neigh_node->ifinfo_list); 446 INIT_HLIST_HEAD(&neigh_node->ifinfo_list);
447 spin_lock_init(&neigh_node->ifinfo_lock); 447 spin_lock_init(&neigh_node->ifinfo_lock);
448 448
449 memcpy(neigh_node->addr, neigh_addr, ETH_ALEN); 449 ether_addr_copy(neigh_node->addr, neigh_addr);
450 neigh_node->if_incoming = hard_iface; 450 neigh_node->if_incoming = hard_iface;
451 neigh_node->orig_node = orig_node; 451 neigh_node->orig_node = orig_node;
452 452
@@ -666,7 +666,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
666 666
667 orig_node->tt_initialised = false; 667 orig_node->tt_initialised = false;
668 orig_node->bat_priv = bat_priv; 668 orig_node->bat_priv = bat_priv;
669 memcpy(orig_node->orig, addr, ETH_ALEN); 669 ether_addr_copy(orig_node->orig, addr);
670 batadv_dat_init_orig_node_addr(orig_node); 670 batadv_dat_init_orig_node_addr(orig_node);
671 atomic_set(&orig_node->last_ttvn, 0); 671 atomic_set(&orig_node->last_ttvn, 0);
672 orig_node->tt_buff = NULL; 672 orig_node->tt_buff = NULL;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index a953d5b196a3..35141534938e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -222,8 +222,8 @@ static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv,
222 222
223 icmph = (struct batadv_icmp_header *)skb->data; 223 icmph = (struct batadv_icmp_header *)skb->data;
224 224
225 memcpy(icmph->dst, icmph->orig, ETH_ALEN); 225 ether_addr_copy(icmph->dst, icmph->orig);
226 memcpy(icmph->orig, primary_if->net_dev->dev_addr, ETH_ALEN); 226 ether_addr_copy(icmph->orig, primary_if->net_dev->dev_addr);
227 icmph->msg_type = BATADV_ECHO_REPLY; 227 icmph->msg_type = BATADV_ECHO_REPLY;
228 icmph->ttl = BATADV_TTL; 228 icmph->ttl = BATADV_TTL;
229 229
@@ -276,9 +276,8 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv,
276 276
277 icmp_packet = (struct batadv_icmp_packet *)skb->data; 277 icmp_packet = (struct batadv_icmp_packet *)skb->data;
278 278
279 memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); 279 ether_addr_copy(icmp_packet->dst, icmp_packet->orig);
280 memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, 280 ether_addr_copy(icmp_packet->orig, primary_if->net_dev->dev_addr);
281 ETH_ALEN);
282 icmp_packet->msg_type = BATADV_TTL_EXCEEDED; 281 icmp_packet->msg_type = BATADV_TTL_EXCEEDED;
283 icmp_packet->ttl = BATADV_TTL; 282 icmp_packet->ttl = BATADV_TTL;
284 283
@@ -341,8 +340,8 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
341 if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN) 340 if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN)
342 goto out; 341 goto out;
343 342
344 memcpy(&(icmp_packet_rr->rr[icmp_packet_rr->rr_cur]), 343 ether_addr_copy(icmp_packet_rr->rr[icmp_packet_rr->rr_cur],
345 ethhdr->h_dest, ETH_ALEN); 344 ethhdr->h_dest);
346 icmp_packet_rr->rr_cur++; 345 icmp_packet_rr->rr_cur++;
347 } 346 }
348 347
@@ -664,7 +663,7 @@ batadv_reroute_unicast_packet(struct batadv_priv *bat_priv,
664 } 663 }
665 664
666 /* update the packet header */ 665 /* update the packet header */
667 memcpy(unicast_packet->dest, orig_addr, ETH_ALEN); 666 ether_addr_copy(unicast_packet->dest, orig_addr);
668 unicast_packet->ttvn = orig_ttvn; 667 unicast_packet->ttvn = orig_ttvn;
669 668
670 ret = true; 669 ret = true;
@@ -774,7 +773,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
774 if (!primary_if) 773 if (!primary_if)
775 return 0; 774 return 0;
776 775
777 memcpy(unicast_packet->dest, primary_if->net_dev->dev_addr, ETH_ALEN); 776 ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr);
778 777
779 batadv_hardif_free_ref(primary_if); 778 batadv_hardif_free_ref(primary_if);
780 779
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 1703a2ef72a9..0e4831f624fb 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -59,8 +59,8 @@ int batadv_send_skb_packet(struct sk_buff *skb,
59 skb_reset_mac_header(skb); 59 skb_reset_mac_header(skb);
60 60
61 ethhdr = eth_hdr(skb); 61 ethhdr = eth_hdr(skb);
62 memcpy(ethhdr->h_source, hard_iface->net_dev->dev_addr, ETH_ALEN); 62 ether_addr_copy(ethhdr->h_source, hard_iface->net_dev->dev_addr);
63 memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN); 63 ether_addr_copy(ethhdr->h_dest, dst_addr);
64 ethhdr->h_proto = htons(ETH_P_BATMAN); 64 ethhdr->h_proto = htons(ETH_P_BATMAN);
65 65
66 skb_set_network_header(skb, ETH_HLEN); 66 skb_set_network_header(skb, ETH_HLEN);
@@ -165,7 +165,7 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size,
165 /* set unicast ttl */ 165 /* set unicast ttl */
166 unicast_packet->ttl = BATADV_TTL; 166 unicast_packet->ttl = BATADV_TTL;
167 /* copy the destination for faster routing */ 167 /* copy the destination for faster routing */
168 memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); 168 ether_addr_copy(unicast_packet->dest, orig_node->orig);
169 /* set the destination tt version number */ 169 /* set the destination tt version number */
170 unicast_packet->ttvn = ttvn; 170 unicast_packet->ttvn = ttvn;
171 171
@@ -220,7 +220,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
220 220
221 uc_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; 221 uc_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
222 uc_4addr_packet->u.packet_type = BATADV_UNICAST_4ADDR; 222 uc_4addr_packet->u.packet_type = BATADV_UNICAST_4ADDR;
223 memcpy(uc_4addr_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN); 223 ether_addr_copy(uc_4addr_packet->src, primary_if->net_dev->dev_addr);
224 uc_4addr_packet->subtype = packet_subtype; 224 uc_4addr_packet->subtype = packet_subtype;
225 uc_4addr_packet->reserved = 0; 225 uc_4addr_packet->reserved = 0;
226 226
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index c4392fcd4eb0..db3e46783c6b 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -111,8 +111,8 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
111 if (!is_valid_ether_addr(addr->sa_data)) 111 if (!is_valid_ether_addr(addr->sa_data))
112 return -EADDRNOTAVAIL; 112 return -EADDRNOTAVAIL;
113 113
114 memcpy(old_addr, dev->dev_addr, ETH_ALEN); 114 ether_addr_copy(old_addr, dev->dev_addr);
115 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 115 ether_addr_copy(dev->dev_addr, addr->sa_data);
116 116
117 /* only modify transtable if it has been initialized before */ 117 /* only modify transtable if it has been initialized before */
118 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { 118 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
@@ -279,8 +279,8 @@ send:
279 /* hw address of first interface is the orig mac because only 279 /* hw address of first interface is the orig mac because only
280 * this mac is known throughout the mesh 280 * this mac is known throughout the mesh
281 */ 281 */
282 memcpy(bcast_packet->orig, 282 ether_addr_copy(bcast_packet->orig,
283 primary_if->net_dev->dev_addr, ETH_ALEN); 283 primary_if->net_dev->dev_addr);
284 284
285 /* set broadcast sequence number */ 285 /* set broadcast sequence number */
286 seqno = atomic_inc_return(&bat_priv->bcast_seqno); 286 seqno = atomic_inc_return(&bat_priv->bcast_seqno);
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;