Skip to contentSkip to conversation

net: packetengines: slight optimization of addr

PATCH Superseded Ding Tianhong 1 participant 1 message Dec 27, 2013

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 11/20 net: packetengines: slight optimization of addr

Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc "David S. Miller" <[email protected]>
---
 drivers/net/ethernet/packetengines/yellowfin.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/packetengines/yellowfin.c +6 -6
index d28593b..b83ac0e 100644
@@ -1097,12 +1097,12 @@ static int yellowfin_rx(struct net_device *dev)
 			if (status2 & 0x80) dev->stats.rx_dropped++;
 #ifdef YF_PROTOTYPE		/* Support for prototype hardware errata. */
 		} else if ((yp->flags & HasMACAddrBug)  &&
-			memcmp(le32_to_cpu(yp->rx_ring_dma +
-				entry*sizeof(struct yellowfin_desc)),
-				dev->dev_addr, 6) != 0 &&
-			memcmp(le32_to_cpu(yp->rx_ring_dma +
-				entry*sizeof(struct yellowfin_desc)),
-				"\377\377\377\377\377\377", 6) != 0) {
+			!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
+						      entry * sizeof(struct yellowfin_desc)),
+							  dev->dev_addr) &&
+			!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
+							  entry * sizeof(struct yellowfin_desc)),
+							  "\377\377\377\377\377\377")) {
 			if (bogus_rx++ == 0)
 				netdev_warn(dev, "Bad frame to %pM\n",
 					    buf_addr);
Signature · 1 line
1.7.1