diff options
author | Ayaz Abdulla <aabdulla@nvidia.com> | 2008-08-06 12:11:03 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-08-07 02:10:59 -0400 |
commit | 1ef6841b4c4d9cc26e53271016c1d432ea65ed24 (patch) | |
tree | 6b1b016f9632ecb621d2cc3605a95d3a00a2f187 /drivers/net/forcedeth.c | |
parent | 8bad4afe1257585967a1b38cd3f21324b260812b (diff) |
forcedeth: fix rx error policy
This patch enforces a stricter policy on rx errors. The driver needs to
verify whether there are multiple rx errors versus a single error.
Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r-- | drivers/net/forcedeth.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 01b38b092c76..a39ed1365d61 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -402,6 +402,7 @@ union ring_type { | |||
402 | #define NV_RX_FRAMINGERR (1<<29) | 402 | #define NV_RX_FRAMINGERR (1<<29) |
403 | #define NV_RX_ERROR (1<<30) | 403 | #define NV_RX_ERROR (1<<30) |
404 | #define NV_RX_AVAIL (1<<31) | 404 | #define NV_RX_AVAIL (1<<31) |
405 | #define NV_RX_ERROR_MASK (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3|NV_RX_ERROR4|NV_RX_CRCERR|NV_RX_OVERFLOW|NV_RX_FRAMINGERR) | ||
405 | 406 | ||
406 | #define NV_RX2_CHECKSUMMASK (0x1C000000) | 407 | #define NV_RX2_CHECKSUMMASK (0x1C000000) |
407 | #define NV_RX2_CHECKSUM_IP (0x10000000) | 408 | #define NV_RX2_CHECKSUM_IP (0x10000000) |
@@ -419,6 +420,7 @@ union ring_type { | |||
419 | /* error and avail are the same for both */ | 420 | /* error and avail are the same for both */ |
420 | #define NV_RX2_ERROR (1<<30) | 421 | #define NV_RX2_ERROR (1<<30) |
421 | #define NV_RX2_AVAIL (1<<31) | 422 | #define NV_RX2_AVAIL (1<<31) |
423 | #define NV_RX2_ERROR_MASK (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3|NV_RX2_ERROR4|NV_RX2_CRCERR|NV_RX2_OVERFLOW|NV_RX2_FRAMINGERR) | ||
422 | 424 | ||
423 | #define NV_RX3_VLAN_TAG_PRESENT (1<<16) | 425 | #define NV_RX3_VLAN_TAG_PRESENT (1<<16) |
424 | #define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) | 426 | #define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) |
@@ -2632,7 +2634,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2632 | if (likely(flags & NV_RX_DESCRIPTORVALID)) { | 2634 | if (likely(flags & NV_RX_DESCRIPTORVALID)) { |
2633 | len = flags & LEN_MASK_V1; | 2635 | len = flags & LEN_MASK_V1; |
2634 | if (unlikely(flags & NV_RX_ERROR)) { | 2636 | if (unlikely(flags & NV_RX_ERROR)) { |
2635 | if (flags & NV_RX_ERROR4) { | 2637 | if ((flags & NV_RX_ERROR_MASK) == NV_RX_ERROR4) { |
2636 | len = nv_getlen(dev, skb->data, len); | 2638 | len = nv_getlen(dev, skb->data, len); |
2637 | if (len < 0) { | 2639 | if (len < 0) { |
2638 | dev->stats.rx_errors++; | 2640 | dev->stats.rx_errors++; |
@@ -2641,7 +2643,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2641 | } | 2643 | } |
2642 | } | 2644 | } |
2643 | /* framing errors are soft errors */ | 2645 | /* framing errors are soft errors */ |
2644 | else if (flags & NV_RX_FRAMINGERR) { | 2646 | else if ((flags & NV_RX_ERROR_MASK) == NV_RX_FRAMINGERR) { |
2645 | if (flags & NV_RX_SUBSTRACT1) { | 2647 | if (flags & NV_RX_SUBSTRACT1) { |
2646 | len--; | 2648 | len--; |
2647 | } | 2649 | } |
@@ -2667,7 +2669,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2667 | if (likely(flags & NV_RX2_DESCRIPTORVALID)) { | 2669 | if (likely(flags & NV_RX2_DESCRIPTORVALID)) { |
2668 | len = flags & LEN_MASK_V2; | 2670 | len = flags & LEN_MASK_V2; |
2669 | if (unlikely(flags & NV_RX2_ERROR)) { | 2671 | if (unlikely(flags & NV_RX2_ERROR)) { |
2670 | if (flags & NV_RX2_ERROR4) { | 2672 | if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) { |
2671 | len = nv_getlen(dev, skb->data, len); | 2673 | len = nv_getlen(dev, skb->data, len); |
2672 | if (len < 0) { | 2674 | if (len < 0) { |
2673 | dev->stats.rx_errors++; | 2675 | dev->stats.rx_errors++; |
@@ -2676,7 +2678,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2676 | } | 2678 | } |
2677 | } | 2679 | } |
2678 | /* framing errors are soft errors */ | 2680 | /* framing errors are soft errors */ |
2679 | else if (flags & NV_RX2_FRAMINGERR) { | 2681 | else if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_FRAMINGERR) { |
2680 | if (flags & NV_RX2_SUBSTRACT1) { | 2682 | if (flags & NV_RX2_SUBSTRACT1) { |
2681 | len--; | 2683 | len--; |
2682 | } | 2684 | } |
@@ -2766,7 +2768,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2766 | if (likely(flags & NV_RX2_DESCRIPTORVALID)) { | 2768 | if (likely(flags & NV_RX2_DESCRIPTORVALID)) { |
2767 | len = flags & LEN_MASK_V2; | 2769 | len = flags & LEN_MASK_V2; |
2768 | if (unlikely(flags & NV_RX2_ERROR)) { | 2770 | if (unlikely(flags & NV_RX2_ERROR)) { |
2769 | if (flags & NV_RX2_ERROR4) { | 2771 | if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) { |
2770 | len = nv_getlen(dev, skb->data, len); | 2772 | len = nv_getlen(dev, skb->data, len); |
2771 | if (len < 0) { | 2773 | if (len < 0) { |
2772 | dev_kfree_skb(skb); | 2774 | dev_kfree_skb(skb); |
@@ -2774,7 +2776,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2774 | } | 2776 | } |
2775 | } | 2777 | } |
2776 | /* framing errors are soft errors */ | 2778 | /* framing errors are soft errors */ |
2777 | else if (flags & NV_RX2_FRAMINGERR) { | 2779 | else if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_FRAMINGERR) { |
2778 | if (flags & NV_RX2_SUBSTRACT1) { | 2780 | if (flags & NV_RX2_SUBSTRACT1) { |
2779 | len--; | 2781 | len--; |
2780 | } | 2782 | } |