diff options
author | Michael Chan <mchan@broadcom.com> | 2009-02-12 19:54:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-12 19:54:13 -0500 |
commit | 990ec3804bb9fd37fcce3e165c95e8b79a783aa3 (patch) | |
tree | a07d5c4aec13b1078f3c7b42cb3a1b1fdf37924f /drivers/net | |
parent | 259436a505bedc59a0114f2d17fa56af71d94129 (diff) |
bnx2: Fix jumbo frames error handling.
If errors are reported on a frame descriptor, we need to
account for the buffer pages that may have been used for this
error packet and recycle them. Otherwise, we may get the wrong
pages for the next packet.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index d4a3dac21dcf..7a610b1b7737 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -2910,18 +2910,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
2910 | 2910 | ||
2911 | rx_hdr = (struct l2_fhdr *) skb->data; | 2911 | rx_hdr = (struct l2_fhdr *) skb->data; |
2912 | len = rx_hdr->l2_fhdr_pkt_len; | 2912 | len = rx_hdr->l2_fhdr_pkt_len; |
2913 | status = rx_hdr->l2_fhdr_status; | ||
2913 | 2914 | ||
2914 | if ((status = rx_hdr->l2_fhdr_status) & | ||
2915 | (L2_FHDR_ERRORS_BAD_CRC | | ||
2916 | L2_FHDR_ERRORS_PHY_DECODE | | ||
2917 | L2_FHDR_ERRORS_ALIGNMENT | | ||
2918 | L2_FHDR_ERRORS_TOO_SHORT | | ||
2919 | L2_FHDR_ERRORS_GIANT_FRAME)) { | ||
2920 | |||
2921 | bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons, | ||
2922 | sw_ring_prod); | ||
2923 | goto next_rx; | ||
2924 | } | ||
2925 | hdr_len = 0; | 2915 | hdr_len = 0; |
2926 | if (status & L2_FHDR_STATUS_SPLIT) { | 2916 | if (status & L2_FHDR_STATUS_SPLIT) { |
2927 | hdr_len = rx_hdr->l2_fhdr_ip_xsum; | 2917 | hdr_len = rx_hdr->l2_fhdr_ip_xsum; |
@@ -2931,6 +2921,24 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
2931 | pg_ring_used = 1; | 2921 | pg_ring_used = 1; |
2932 | } | 2922 | } |
2933 | 2923 | ||
2924 | if (unlikely(status & (L2_FHDR_ERRORS_BAD_CRC | | ||
2925 | L2_FHDR_ERRORS_PHY_DECODE | | ||
2926 | L2_FHDR_ERRORS_ALIGNMENT | | ||
2927 | L2_FHDR_ERRORS_TOO_SHORT | | ||
2928 | L2_FHDR_ERRORS_GIANT_FRAME))) { | ||
2929 | |||
2930 | bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons, | ||
2931 | sw_ring_prod); | ||
2932 | if (pg_ring_used) { | ||
2933 | int pages; | ||
2934 | |||
2935 | pages = PAGE_ALIGN(len - hdr_len) >> PAGE_SHIFT; | ||
2936 | |||
2937 | bnx2_reuse_rx_skb_pages(bp, rxr, NULL, pages); | ||
2938 | } | ||
2939 | goto next_rx; | ||
2940 | } | ||
2941 | |||
2934 | len -= 4; | 2942 | len -= 4; |
2935 | 2943 | ||
2936 | if (len <= bp->rx_copy_thresh) { | 2944 | if (len <= bp->rx_copy_thresh) { |