Commit 3a8e87ec authored by dingtianhong's avatar dingtianhong Committed by David S. Miller

net: packetengines: slight optimization of addr

Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f75d191b
...@@ -1053,7 +1053,7 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1053,7 +1053,7 @@ static int yellowfin_rx(struct net_device *dev)
struct sk_buff *rx_skb = yp->rx_skbuff[entry]; struct sk_buff *rx_skb = yp->rx_skbuff[entry];
s16 frame_status; s16 frame_status;
u16 desc_status; u16 desc_status;
int data_size; int data_size, yf_size;
u8 *buf_addr; u8 *buf_addr;
if(!desc->result_status) if(!desc->result_status)
...@@ -1070,6 +1070,9 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1070,6 +1070,9 @@ static int yellowfin_rx(struct net_device *dev)
__func__, frame_status); __func__, frame_status);
if (--boguscnt < 0) if (--boguscnt < 0)
break; break;
yf_size = sizeof(struct yellowfin_desc);
if ( ! (desc_status & RX_EOP)) { if ( ! (desc_status & RX_EOP)) {
if (data_size != 0) if (data_size != 0)
netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %04x, data_size %d!\n", netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %04x, data_size %d!\n",
...@@ -1096,12 +1099,12 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1096,12 +1099,12 @@ static int yellowfin_rx(struct net_device *dev)
if (status2 & 0x80) dev->stats.rx_dropped++; if (status2 & 0x80) dev->stats.rx_dropped++;
#ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */
} else if ((yp->flags & HasMACAddrBug) && } else if ((yp->flags & HasMACAddrBug) &&
memcmp(le32_to_cpu(yp->rx_ring_dma + !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
entry*sizeof(struct yellowfin_desc)), entry * yf_size),
dev->dev_addr, 6) != 0 && dev->dev_addr) &&
memcmp(le32_to_cpu(yp->rx_ring_dma + !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
entry*sizeof(struct yellowfin_desc)), entry * yf_size),
"\377\377\377\377\377\377", 6) != 0) { "\377\377\377\377\377\377")) {
if (bogus_rx++ == 0) if (bogus_rx++ == 0)
netdev_warn(dev, "Bad frame to %pM\n", netdev_warn(dev, "Bad frame to %pM\n",
buf_addr); buf_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment