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>
This commit is contained in:
@@ -222,8 +222,8 @@ static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv,
|
||||
|
||||
icmph = (struct batadv_icmp_header *)skb->data;
|
||||
|
||||
memcpy(icmph->dst, icmph->orig, ETH_ALEN);
|
||||
memcpy(icmph->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
|
||||
ether_addr_copy(icmph->dst, icmph->orig);
|
||||
ether_addr_copy(icmph->orig, primary_if->net_dev->dev_addr);
|
||||
icmph->msg_type = BATADV_ECHO_REPLY;
|
||||
icmph->ttl = BATADV_TTL;
|
||||
|
||||
@@ -276,9 +276,8 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv,
|
||||
|
||||
icmp_packet = (struct batadv_icmp_packet *)skb->data;
|
||||
|
||||
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
|
||||
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr,
|
||||
ETH_ALEN);
|
||||
ether_addr_copy(icmp_packet->dst, icmp_packet->orig);
|
||||
ether_addr_copy(icmp_packet->orig, primary_if->net_dev->dev_addr);
|
||||
icmp_packet->msg_type = BATADV_TTL_EXCEEDED;
|
||||
icmp_packet->ttl = BATADV_TTL;
|
||||
|
||||
@@ -341,8 +340,8 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
|
||||
if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN)
|
||||
goto out;
|
||||
|
||||
memcpy(&(icmp_packet_rr->rr[icmp_packet_rr->rr_cur]),
|
||||
ethhdr->h_dest, ETH_ALEN);
|
||||
ether_addr_copy(icmp_packet_rr->rr[icmp_packet_rr->rr_cur],
|
||||
ethhdr->h_dest);
|
||||
icmp_packet_rr->rr_cur++;
|
||||
}
|
||||
|
||||
@@ -664,7 +663,7 @@ batadv_reroute_unicast_packet(struct batadv_priv *bat_priv,
|
||||
}
|
||||
|
||||
/* update the packet header */
|
||||
memcpy(unicast_packet->dest, orig_addr, ETH_ALEN);
|
||||
ether_addr_copy(unicast_packet->dest, orig_addr);
|
||||
unicast_packet->ttvn = orig_ttvn;
|
||||
|
||||
ret = true;
|
||||
@@ -774,7 +773,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
|
||||
if (!primary_if)
|
||||
return 0;
|
||||
|
||||
memcpy(unicast_packet->dest, primary_if->net_dev->dev_addr, ETH_ALEN);
|
||||
ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr);
|
||||
|
||||
batadv_hardif_free_ref(primary_if);
|
||||
|
||||
|
Reference in New Issue
Block a user