aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/network-coding.c
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 /net/batman-adv/network-coding.c
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>
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r--net/batman-adv/network-coding.c24
1 files changed, 12 insertions, 12 deletions
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);