提交 ec497b32 编写于 作者: P Peter Meerwald 提交者: David S. Miller

netdev: bfin_mac: handler RX status errors

Signed-off-by: NPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: NGraf Yang <graf.yang@analog.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fe92afed
...@@ -980,12 +980,25 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb, ...@@ -980,12 +980,25 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
#define RX_ERROR_MASK (RX_LONG | RX_ALIGN | RX_CRC | RX_LEN | \
RX_FRAG | RX_ADDR | RX_DMAO | RX_PHY | RX_LATE | RX_RANGE)
static void bfin_mac_rx(struct net_device *dev) static void bfin_mac_rx(struct net_device *dev)
{ {
struct sk_buff *skb, *new_skb; struct sk_buff *skb, *new_skb;
unsigned short len; unsigned short len;
struct bfin_mac_local *lp __maybe_unused = netdev_priv(dev); struct bfin_mac_local *lp __maybe_unused = netdev_priv(dev);
/* check if frame status word reports an error condition
* we which case we simply drop the packet
*/
if (current_rx_ptr->status.status_word & RX_ERROR_MASK) {
printk(KERN_NOTICE DRV_NAME
": rx: receive error - packet dropped\n");
dev->stats.rx_dropped++;
goto out;
}
/* allocate a new skb for next time receive */ /* allocate a new skb for next time receive */
skb = current_rx_ptr->skb; skb = current_rx_ptr->skb;
...@@ -1024,11 +1037,9 @@ static void bfin_mac_rx(struct net_device *dev) ...@@ -1024,11 +1037,9 @@ static void bfin_mac_rx(struct net_device *dev)
netif_rx(skb); netif_rx(skb);
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += len; dev->stats.rx_bytes += len;
out:
current_rx_ptr->status.status_word = 0x00000000; current_rx_ptr->status.status_word = 0x00000000;
current_rx_ptr = current_rx_ptr->next; current_rx_ptr = current_rx_ptr->next;
out:
return;
} }
/* interrupt routine to handle rx and error signal */ /* interrupt routine to handle rx and error signal */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册