Title: [7880] trunk/drivers/net/bfin_mac.c: Bug[#5716] handle rx error status in bfin mac driver.
Revision
7880
Author
sonicz
Date
2009-11-25 05:42:23 -0500 (Wed, 25 Nov 2009)

Log Message

Bug[#5716] handle rx error status in bfin mac driver.
Apply patch from Peter Meerwald <[email protected]>.

Modified Paths

Diff

Modified: trunk/drivers/net/bfin_mac.c (7879 => 7880)


--- trunk/drivers/net/bfin_mac.c	2009-11-25 10:41:12 UTC (rev 7879)
+++ trunk/drivers/net/bfin_mac.c	2009-11-25 10:42:23 UTC (rev 7880)
@@ -1002,6 +1002,8 @@
 }
 
 #define ETH_FCS_LENGTH 4
+#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)
 {
@@ -1012,6 +1014,15 @@
 	unsigned int i;
 	unsigned char fcs[ETH_FCS_LENGTH + 1];
 #endif
+	/* 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 */
 	skb = current_rx_ptr->skb;
@@ -1068,10 +1079,10 @@
 	netif_rx(skb);
 	dev->stats.rx_packets++;
 	dev->stats.rx_bytes += len;
+out:
 	current_rx_ptr->status.status_word = 0x00000000;
 	current_rx_ptr = current_rx_ptr->next;
 
-out:
 	return;
 }
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to