aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-01-20 12:52:19 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-21 21:13:05 -0500
commit9ea08b129962d1df3a574bf0ce89af0dfac2a241 (patch)
tree8453a5a11d8eb8eab59d464bbfaf52c7a6bf73aa /net
parentc62326abac8f40b904c8daebd7c1a6c624ebddd6 (diff)
pktgen: Use ether_addr_copy
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fa3e128eb5e9..fdac61cac1bd 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1440,7 +1440,7 @@ static ssize_t pktgen_if_write(struct file *file,
1440 if (!mac_pton(valstr, pkt_dev->dst_mac)) 1440 if (!mac_pton(valstr, pkt_dev->dst_mac))
1441 return -EINVAL; 1441 return -EINVAL;
1442 /* Set up Dest MAC */ 1442 /* Set up Dest MAC */
1443 memcpy(&pkt_dev->hh[0], pkt_dev->dst_mac, ETH_ALEN); 1443 ether_addr_copy(&pkt_dev->hh[0], pkt_dev->dst_mac);
1444 1444
1445 sprintf(pg_result, "OK: dstmac %pM", pkt_dev->dst_mac); 1445 sprintf(pg_result, "OK: dstmac %pM", pkt_dev->dst_mac);
1446 return count; 1446 return count;
@@ -1457,7 +1457,7 @@ static ssize_t pktgen_if_write(struct file *file,
1457 if (!mac_pton(valstr, pkt_dev->src_mac)) 1457 if (!mac_pton(valstr, pkt_dev->src_mac))
1458 return -EINVAL; 1458 return -EINVAL;
1459 /* Set up Src MAC */ 1459 /* Set up Src MAC */
1460 memcpy(&pkt_dev->hh[6], pkt_dev->src_mac, ETH_ALEN); 1460 ether_addr_copy(&pkt_dev->hh[6], pkt_dev->src_mac);
1461 1461
1462 sprintf(pg_result, "OK: srcmac %pM", pkt_dev->src_mac); 1462 sprintf(pg_result, "OK: srcmac %pM", pkt_dev->src_mac);
1463 return count; 1463 return count;
@@ -2060,10 +2060,10 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2060 /* Default to the interface's mac if not explicitly set. */ 2060 /* Default to the interface's mac if not explicitly set. */
2061 2061
2062 if (is_zero_ether_addr(pkt_dev->src_mac)) 2062 if (is_zero_ether_addr(pkt_dev->src_mac))
2063 memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN); 2063 ether_addr_copy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr);
2064 2064
2065 /* Set up Dest MAC */ 2065 /* Set up Dest MAC */
2066 memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); 2066 ether_addr_copy(&(pkt_dev->hh[0]), pkt_dev->dst_mac);
2067 2067
2068 if (pkt_dev->flags & F_IPV6) { 2068 if (pkt_dev->flags & F_IPV6) {
2069 int i, set = 0, err = 1; 2069 int i, set = 0, err = 1;