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

Log Message

Bug[#5716] handle rx error status in bfin mac driver.

Modified Paths

Diff

Modified: branches/2009R1/drivers/net/bfin_mac.c (7877 => 7878)


--- branches/2009R1/drivers/net/bfin_mac.c	2009-11-25 10:37:28 UTC (rev 7877)
+++ branches/2009R1/drivers/net/bfin_mac.c	2009-11-25 10:39:05 UTC (rev 7878)
@@ -681,6 +681,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)
 {
@@ -690,6 +692,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;
@@ -743,10 +754,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