* [PATCH 1/7] 8021q: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-22 2:13 ` David Miller
2014-01-20 17:52 ` [PATCH 2/7] appletalk: " Joe Perches
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: Patrick McHardy, David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/8021q/vlan.c | 2 +-
net/8021q/vlan_dev.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index b3d17d1..ec99099 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -301,7 +301,7 @@ static void vlan_sync_address(struct net_device *dev,
!ether_addr_equal(vlandev->dev_addr, dev->dev_addr))
dev_uc_add(dev, vlandev->dev_addr);
- memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(vlan->real_dev_addr, dev->dev_addr);
}
static void vlan_transfer_features(struct net_device *dev,
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 47c908f..de51c48 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -61,7 +61,7 @@ static int vlan_dev_rebuild_header(struct sk_buff *skb)
pr_debug("%s: unable to resolve type %X addresses\n",
dev->name, ntohs(veth->h_vlan_encapsulated_proto));
- memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(veth->h_source, dev->dev_addr);
break;
}
@@ -303,7 +303,7 @@ static int vlan_dev_open(struct net_device *dev)
goto clear_allmulti;
}
- memcpy(vlan->real_dev_addr, real_dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(vlan->real_dev_addr, real_dev->dev_addr);
if (vlan->flags & VLAN_FLAG_GVRP)
vlan_gvrp_request_join(dev);
@@ -367,7 +367,7 @@ static int vlan_dev_set_mac_address(struct net_device *dev, void *p)
dev_uc_del(real_dev, dev->dev_addr);
out:
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ ether_addr_copy(dev->dev_addr, addr->sa_data);
return 0;
}
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/7] appletalk: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
2014-01-20 17:52 ` [PATCH 1/7] 8021q: Use ether_addr_copy Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-20 17:52 ` [PATCH 3/7] atm: " Joe Perches
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller
Cc: Arnaldo Carvalho de Melo, David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Convert struct aarp_entry.hwaddr[6] to hwaddr[ETH_ALEN].
Signed-off-by: Joe Perches <joe@perches.com>
---
net/appletalk/aarp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 690356f..d0b7be1 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -67,7 +67,7 @@ struct aarp_entry {
unsigned long expires_at;
struct atalk_addr target_addr;
struct net_device *dev;
- char hwaddr[6];
+ char hwaddr[ETH_ALEN];
unsigned short xmit_count;
struct aarp_entry *next;
};
@@ -134,7 +134,7 @@ static void __aarp_send_query(struct aarp_entry *a)
eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REQUEST);
- memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(eah->hw_src, dev->dev_addr);
eah->pa_src_zero = 0;
eah->pa_src_net = sat->s_net;
@@ -181,7 +181,7 @@ static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us,
eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REPLY);
- memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(eah->hw_src, dev->dev_addr);
eah->pa_src_zero = 0;
eah->pa_src_net = us->s_net;
@@ -190,7 +190,7 @@ static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us,
if (!sha)
memset(eah->hw_dst, '\0', ETH_ALEN);
else
- memcpy(eah->hw_dst, sha, ETH_ALEN);
+ ether_addr_copy(eah->hw_dst, sha);
eah->pa_dst_zero = 0;
eah->pa_dst_net = them->s_net;
@@ -232,7 +232,7 @@ static void aarp_send_probe(struct net_device *dev, struct atalk_addr *us)
eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_PROBE);
- memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(eah->hw_src, dev->dev_addr);
eah->pa_src_zero = 0;
eah->pa_src_net = us->s_net;
@@ -790,7 +790,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
break;
/* We can fill one in - this is good. */
- memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
+ ether_addr_copy(a->hwaddr, ea->hw_src);
__aarp_resolved(&unresolved[hash], a, hash);
if (!unresolved_count)
mod_timer(&aarp_timer,
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] atm: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
2014-01-20 17:52 ` [PATCH 1/7] 8021q: Use ether_addr_copy Joe Perches
2014-01-20 17:52 ` [PATCH 2/7] appletalk: " Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-20 17:52 ` [PATCH 4/7] caif_usb: " Joe Perches
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/atm/lec.c | 9 +++++----
net/atm/mpc.c | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/atm/lec.c b/net/atm/lec.c
index f23916b..0b73ae9 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -521,7 +521,7 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
if (data != NULL)
mesg->sizeoftlvs = data->len;
if (mac_addr)
- memcpy(&mesg->content.normal.mac_addr, mac_addr, ETH_ALEN);
+ ether_addr_copy(&mesg->content.normal.mac_addr, mac_addr);
else
mesg->content.normal.targetless_le_arp = 1;
if (atm_addr)
@@ -1565,7 +1565,7 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
pr_info("LEC: Arp entry kmalloc failed\n");
return NULL;
}
- memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
+ ether_addr_copy(to_return->mac_addr, mac_addr);
INIT_HLIST_NODE(&to_return->next);
setup_timer(&to_return->timer, lec_arp_expire_arp,
(unsigned long)to_return);
@@ -1887,7 +1887,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
entry = tmp;
} else {
entry->status = ESI_FORWARD_DIRECT;
- memcpy(entry->mac_addr, mac_addr, ETH_ALEN);
+ ether_addr_copy(entry->mac_addr,
+ mac_addr);
entry->last_used = jiffies;
lec_arp_add(priv, entry);
}
@@ -2263,7 +2264,7 @@ lec_arp_check_empties(struct lec_priv *priv,
&priv->lec_arp_empty_ones, next) {
if (vcc == entry->vcc) {
del_timer(&entry->timer);
- memcpy(entry->mac_addr, src, ETH_ALEN);
+ ether_addr_copy(entry->mac_addr, src);
entry->status = ESI_FORWARD_DIRECT;
entry->last_used = jiffies;
/* We might have got an entry */
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 3af1275..b71ff6b 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -478,7 +478,7 @@ static const uint8_t *copy_macs(struct mpoa_client *mpc,
return NULL;
}
}
- memcpy(mpc->mps_macs, router_mac, ETH_ALEN);
+ ether_addr_copy(mpc->mps_macs, router_mac);
tlvs += 20; if (device_type == MPS_AND_MPC) tlvs += 20;
if (mps_macs > 0)
memcpy(mpc->mps_macs, tlvs, mps_macs*ETH_ALEN);
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/7] caif_usb: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
` (2 preceding siblings ...)
2014-01-20 17:52 ` [PATCH 3/7] atm: " Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-20 17:52 ` [PATCH 5/7] netpoll: " Joe Perches
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: Dmitry Tarnyagin, David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/caif/caif_usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/caif/caif_usb.c b/net/caif/caif_usb.c
index 75ed04b..dda589c 100644
--- a/net/caif/caif_usb.c
+++ b/net/caif/caif_usb.c
@@ -105,8 +105,8 @@ static struct cflayer *cfusbl_create(int phyid, u8 ethaddr[ETH_ALEN],
* 5-11 source address
* 12-13 protocol type
*/
- memcpy(&this->tx_eth_hdr[ETH_ALEN], braddr, ETH_ALEN);
- memcpy(&this->tx_eth_hdr[ETH_ALEN], ethaddr, ETH_ALEN);
+ ether_addr_copy(&this->tx_eth_hdr[ETH_ALEN], braddr);
+ ether_addr_copy(&this->tx_eth_hdr[ETH_ALEN], ethaddr);
this->tx_eth_hdr[12] = cpu_to_be16(ETH_P_802_EX1) & 0xff;
this->tx_eth_hdr[13] = (cpu_to_be16(ETH_P_802_EX1) >> 8) & 0xff;
pr_debug("caif ethernet TX-header dst:%pM src:%pM type:%02x%02x\n",
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] netpoll: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
` (3 preceding siblings ...)
2014-01-20 17:52 ` [PATCH 4/7] caif_usb: " Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-20 17:52 ` [PATCH 6/7] pktgen: " Joe Perches
2014-01-20 17:52 ` [PATCH 7/7] dsa: " Joe Perches
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/core/netpoll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 19fe9c7..c03f3de 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -520,8 +520,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
skb->protocol = eth->h_proto = htons(ETH_P_IP);
}
- memcpy(eth->h_source, np->dev->dev_addr, ETH_ALEN);
- memcpy(eth->h_dest, np->remote_mac, ETH_ALEN);
+ ether_addr_copy(eth->h_source, np->dev->dev_addr);
+ ether_addr_copy(eth->h_dest, np->remote_mac);
skb->dev = np->dev;
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/7] pktgen: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
` (4 preceding siblings ...)
2014-01-20 17:52 ` [PATCH 5/7] netpoll: " Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
2014-01-20 17:52 ` [PATCH 7/7] dsa: " Joe Perches
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/core/pktgen.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fa3e128..fdac61c 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1440,7 +1440,7 @@ static ssize_t pktgen_if_write(struct file *file,
if (!mac_pton(valstr, pkt_dev->dst_mac))
return -EINVAL;
/* Set up Dest MAC */
- memcpy(&pkt_dev->hh[0], pkt_dev->dst_mac, ETH_ALEN);
+ ether_addr_copy(&pkt_dev->hh[0], pkt_dev->dst_mac);
sprintf(pg_result, "OK: dstmac %pM", pkt_dev->dst_mac);
return count;
@@ -1457,7 +1457,7 @@ static ssize_t pktgen_if_write(struct file *file,
if (!mac_pton(valstr, pkt_dev->src_mac))
return -EINVAL;
/* Set up Src MAC */
- memcpy(&pkt_dev->hh[6], pkt_dev->src_mac, ETH_ALEN);
+ ether_addr_copy(&pkt_dev->hh[6], pkt_dev->src_mac);
sprintf(pg_result, "OK: srcmac %pM", pkt_dev->src_mac);
return count;
@@ -2060,10 +2060,10 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
/* Default to the interface's mac if not explicitly set. */
if (is_zero_ether_addr(pkt_dev->src_mac))
- memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN);
+ ether_addr_copy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr);
/* Set up Dest MAC */
- memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
+ ether_addr_copy(&(pkt_dev->hh[0]), pkt_dev->dst_mac);
if (pkt_dev->flags & F_IPV6) {
int i, set = 0, err = 1;
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] dsa: Use ether_addr_copy
2014-01-20 17:52 ` [PATCH 0/7] net: Convert aligned memcpy to ether_addr_copy Joe Perches
` (5 preceding siblings ...)
2014-01-20 17:52 ` [PATCH 6/7] pktgen: " Joe Perches
@ 2014-01-20 17:52 ` Joe Perches
6 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2014-01-20 17:52 UTC (permalink / raw)
To: David Miller; +Cc: David S. Miller, netdev, linux-kernel
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN) to
save some cycles on arm and powerpc.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/dsa/slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 29d684e..02c0e17 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -156,7 +156,7 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
dev_uc_del(master, dev->dev_addr);
out:
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ ether_addr_copy(dev->dev_addr, addr->sa_data);
return 0;
}
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread