From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/7] atm: Use ether_addr_copy
Date: Mon, 20 Jan 2014 09:52:16 -0800 [thread overview]
Message-ID: <891b9869ad352a40f4e8f6dea28cf2da0ce6fde7.1390239869.git.joe@perches.com> (raw)
In-Reply-To: <cover.1390239869.git.joe@perches.com>
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
next prev parent reply other threads:[~2014-01-20 17:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140115.164540.450877805879786067.davem@davemloft.net>
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-22 2:13 ` David Miller
2014-01-20 17:52 ` [PATCH 2/7] appletalk: " Joe Perches
2014-01-20 17:52 ` Joe Perches [this message]
2014-01-20 17:52 ` [PATCH 4/7] caif_usb: " Joe Perches
2014-01-20 17:52 ` [PATCH 5/7] netpoll: " Joe Perches
2014-01-20 17:52 ` [PATCH 6/7] pktgen: " Joe Perches
2014-01-20 17:52 ` [PATCH 7/7] dsa: " Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=891b9869ad352a40f4e8f6dea28cf2da0ce6fde7.1390239869.git.joe@perches.com \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®