diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2010-05-17 20:20:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-17 20:20:50 -0400 |
commit | ec497b32c311b1e1aac22a76d294d24285d06331 (patch) | |
tree | 5a7bac0a8019ba3433f0a8ebaf68e60f53783e26 /drivers/net/bfin_mac.c | |
parent | fe92afedee23e1d91f0133360a24d2bf48270739 (diff) |
netdev: bfin_mac: handler RX status errors
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bfin_mac.c')
-rw-r--r-- | drivers/net/bfin_mac.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index a173d8a4048..16f2a37c733 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -980,12 +980,25 @@ out: | |||
980 | return NETDEV_TX_OK; | 980 | return NETDEV_TX_OK; |
981 | } | 981 | } |
982 | 982 | ||
983 | #define RX_ERROR_MASK (RX_LONG | RX_ALIGN | RX_CRC | RX_LEN | \ | ||
984 | RX_FRAG | RX_ADDR | RX_DMAO | RX_PHY | RX_LATE | RX_RANGE) | ||
985 | |||
983 | static void bfin_mac_rx(struct net_device *dev) | 986 | static void bfin_mac_rx(struct net_device *dev) |
984 | { | 987 | { |
985 | struct sk_buff *skb, *new_skb; | 988 | struct sk_buff *skb, *new_skb; |
986 | unsigned short len; | 989 | unsigned short len; |
987 | struct bfin_mac_local *lp __maybe_unused = netdev_priv(dev); | 990 | struct bfin_mac_local *lp __maybe_unused = netdev_priv(dev); |
988 | 991 | ||
992 | /* check if frame status word reports an error condition | ||
993 | * we which case we simply drop the packet | ||
994 | */ | ||
995 | if (current_rx_ptr->status.status_word & RX_ERROR_MASK) { | ||
996 | printk(KERN_NOTICE DRV_NAME | ||
997 | ": rx: receive error - packet dropped\n"); | ||
998 | dev->stats.rx_dropped++; | ||
999 | goto out; | ||
1000 | } | ||
1001 | |||
989 | /* allocate a new skb for next time receive */ | 1002 | /* allocate a new skb for next time receive */ |
990 | skb = current_rx_ptr->skb; | 1003 | skb = current_rx_ptr->skb; |
991 | 1004 | ||
@@ -1024,11 +1037,9 @@ static void bfin_mac_rx(struct net_device *dev) | |||
1024 | netif_rx(skb); | 1037 | netif_rx(skb); |
1025 | dev->stats.rx_packets++; | 1038 | dev->stats.rx_packets++; |
1026 | dev->stats.rx_bytes += len; | 1039 | dev->stats.rx_bytes += len; |
1040 | out: | ||
1027 | current_rx_ptr->status.status_word = 0x00000000; | 1041 | current_rx_ptr->status.status_word = 0x00000000; |
1028 | current_rx_ptr = current_rx_ptr->next; | 1042 | current_rx_ptr = current_rx_ptr->next; |
1029 | |||
1030 | out: | ||
1031 | return; | ||
1032 | } | 1043 | } |
1033 | 1044 | ||
1034 | /* interrupt routine to handle rx and error signal */ | 1045 | /* interrupt routine to handle rx and error signal */ |