aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/packetengines
diff options
context:
space:
mode:
authordingtianhong <dingtianhong@huawei.com>2013-12-30 02:41:06 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-31 16:48:32 -0500
commit3a8e87ec2376f8844af1a1b924a19e151a85d65a (patch)
tree756fc859bd06b329486b5406ab10b85ccf23f0fa /drivers/net/ethernet/packetengines
parentf75d191b36ab3606e9588848e0f8f4fec228ecad (diff)
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: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/packetengines')
-rw-r--r--drivers/net/ethernet/packetengines/yellowfin.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/ethernet/packetengines/yellowfin.c b/drivers/net/ethernet/packetengines/yellowfin.c
index 07a890eb72ad..9a6cb482dcd0 100644
--- a/drivers/net/ethernet/packetengines/yellowfin.c
+++ b/drivers/net/ethernet/packetengines/yellowfin.c
@@ -1053,7 +1053,7 @@ static int yellowfin_rx(struct net_device *dev)
1053 struct sk_buff *rx_skb = yp->rx_skbuff[entry]; 1053 struct sk_buff *rx_skb = yp->rx_skbuff[entry];
1054 s16 frame_status; 1054 s16 frame_status;
1055 u16 desc_status; 1055 u16 desc_status;
1056 int data_size; 1056 int data_size, yf_size;
1057 u8 *buf_addr; 1057 u8 *buf_addr;
1058 1058
1059 if(!desc->result_status) 1059 if(!desc->result_status)
@@ -1070,6 +1070,9 @@ static int yellowfin_rx(struct net_device *dev)
1070 __func__, frame_status); 1070 __func__, frame_status);
1071 if (--boguscnt < 0) 1071 if (--boguscnt < 0)
1072 break; 1072 break;
1073
1074 yf_size = sizeof(struct yellowfin_desc);
1075
1073 if ( ! (desc_status & RX_EOP)) { 1076 if ( ! (desc_status & RX_EOP)) {
1074 if (data_size != 0) 1077 if (data_size != 0)
1075 netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %04x, data_size %d!\n", 1078 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 if (status2 & 0x80) dev->stats.rx_dropped++; 1099 if (status2 & 0x80) dev->stats.rx_dropped++;
1097#ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ 1100#ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */
1098 } else if ((yp->flags & HasMACAddrBug) && 1101 } else if ((yp->flags & HasMACAddrBug) &&
1099 memcmp(le32_to_cpu(yp->rx_ring_dma + 1102 !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
1100 entry*sizeof(struct yellowfin_desc)), 1103 entry * yf_size),
1101 dev->dev_addr, 6) != 0 && 1104 dev->dev_addr) &&
1102 memcmp(le32_to_cpu(yp->rx_ring_dma + 1105 !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
1103 entry*sizeof(struct yellowfin_desc)), 1106 entry * yf_size),
1104 "\377\377\377\377\377\377", 6) != 0) { 1107 "\377\377\377\377\377\377")) {
1105 if (bogus_rx++ == 0) 1108 if (bogus_rx++ == 0)
1106 netdev_warn(dev, "Bad frame to %pM\n", 1109 netdev_warn(dev, "Bad frame to %pM\n",
1107 buf_addr); 1110 buf_addr);