From: Ding Tianhong <dingtianhong@huawei.com>
To: "David S. Miller" <davem@davemloft.net>,
Joe Perches <joe@perches.com>, Netdev <netdev@vger.kernel.org>
Subject: [PATCH net-next 3/6] fddi: slight optimization of addr compare
Date: Mon, 16 Dec 2013 15:15:33 +0800 [thread overview]
Message-ID: <52AEA895.2050001@huawei.com> (raw)
Joe Perches add ether_addr_equal_unaligned to test if
possibly unaligned to u16 Ethernet addresses are equal.
If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set, this uses
the slightly faster generic routine ether_addr_equal,
otherwise this uses memcmp, and FDDI_K_ALEN is same with
ETH_ALEN.
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
net/802/fddi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/802/fddi.c b/net/802/fddi.c
index 9cda406..d536a81 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -41,6 +41,7 @@
#include <linux/errno.h>
#include <net/arp.h>
#include <net/sock.h>
+#include <linux/etherdevice.h>
/*
* Create the FDDI MAC header for an arbitrary protocol layer
@@ -147,7 +148,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
if (*fddi->daddr & 0x01)
{
- if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0)
+ if (ether_addr_equal_unaligned(fddi->daddr, dev->broadcast))
skb->pkt_type = PACKET_BROADCAST;
else
skb->pkt_type = PACKET_MULTICAST;
@@ -155,7 +156,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
else if (dev->flags & IFF_PROMISC)
{
- if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN))
+ if (!ether_addr_equal_unaligned(fddi->daddr, dev->dev_addr))
skb->pkt_type = PACKET_OTHERHOST;
}
--
1.8.0
reply other threads:[~2013-12-16 7:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=52AEA895.2050001@huawei.com \
--to=dingtianhong@huawei.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--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;
as well as URLs for NNTP newsgroup(s).