diff options
author | Michael Chan <mchan@broadcom.com> | 2006-01-23 19:09:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-01-23 19:09:51 -0500 |
commit | ade2bfe7d1f0ea804d2e63209cc6318ad8bf17ae (patch) | |
tree | 56e646813dff69ebe6afa89077df4e25e74b4610 /drivers/net/bnx2.c | |
parent | dda1e390bf9e2889a3abc48590a015b307637753 (diff) |
[BNX2]: Fix UDP checksum verification
Fix TCP/UDP checksum verification. Use status bits in the buffer
descriptor instead of the checksum value to verify rx checksum.
Using the checksum value will be incorrect if the UDP packet has
zero in the UDP checksum field.
Firmware update required for this fix.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r-- | drivers/net/bnx2.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 60ff9b6c929d..ec08f833c32d 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -1660,7 +1660,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1660 | rmb(); | 1660 | rmb(); |
1661 | while (sw_cons != hw_cons) { | 1661 | while (sw_cons != hw_cons) { |
1662 | unsigned int len; | 1662 | unsigned int len; |
1663 | u16 status; | 1663 | u32 status; |
1664 | struct sw_bd *rx_buf; | 1664 | struct sw_bd *rx_buf; |
1665 | struct sk_buff *skb; | 1665 | struct sk_buff *skb; |
1666 | 1666 | ||
@@ -1676,7 +1676,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1676 | rx_hdr = (struct l2_fhdr *) skb->data; | 1676 | rx_hdr = (struct l2_fhdr *) skb->data; |
1677 | len = rx_hdr->l2_fhdr_pkt_len - 4; | 1677 | len = rx_hdr->l2_fhdr_pkt_len - 4; |
1678 | 1678 | ||
1679 | if (rx_hdr->l2_fhdr_errors & | 1679 | if ((status = rx_hdr->l2_fhdr_status) & |
1680 | (L2_FHDR_ERRORS_BAD_CRC | | 1680 | (L2_FHDR_ERRORS_BAD_CRC | |
1681 | L2_FHDR_ERRORS_PHY_DECODE | | 1681 | L2_FHDR_ERRORS_PHY_DECODE | |
1682 | L2_FHDR_ERRORS_ALIGNMENT | | 1682 | L2_FHDR_ERRORS_ALIGNMENT | |
@@ -1735,15 +1735,13 @@ reuse_rx: | |||
1735 | 1735 | ||
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | status = rx_hdr->l2_fhdr_status; | ||
1739 | skb->ip_summed = CHECKSUM_NONE; | 1738 | skb->ip_summed = CHECKSUM_NONE; |
1740 | if (bp->rx_csum && | 1739 | if (bp->rx_csum && |
1741 | (status & (L2_FHDR_STATUS_TCP_SEGMENT | | 1740 | (status & (L2_FHDR_STATUS_TCP_SEGMENT | |
1742 | L2_FHDR_STATUS_UDP_DATAGRAM))) { | 1741 | L2_FHDR_STATUS_UDP_DATAGRAM))) { |
1743 | 1742 | ||
1744 | u16 cksum = rx_hdr->l2_fhdr_tcp_udp_xsum; | 1743 | if (likely((status & (L2_FHDR_ERRORS_TCP_XSUM | |
1745 | 1744 | L2_FHDR_ERRORS_UDP_XSUM)) == 0)) | |
1746 | if (cksum == 0xffff) | ||
1747 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1745 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1748 | } | 1746 | } |
1749 | 1747 | ||
@@ -3978,7 +3976,7 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3978 | pci_unmap_addr(rx_buf, mapping), | 3976 | pci_unmap_addr(rx_buf, mapping), |
3979 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); | 3977 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); |
3980 | 3978 | ||
3981 | if (rx_hdr->l2_fhdr_errors & | 3979 | if (rx_hdr->l2_fhdr_status & |
3982 | (L2_FHDR_ERRORS_BAD_CRC | | 3980 | (L2_FHDR_ERRORS_BAD_CRC | |
3983 | L2_FHDR_ERRORS_PHY_DECODE | | 3981 | L2_FHDR_ERRORS_PHY_DECODE | |
3984 | L2_FHDR_ERRORS_ALIGNMENT | | 3982 | L2_FHDR_ERRORS_ALIGNMENT | |