Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/marvell Fix udpcsum-rx bug on fragmented case this t...
details: https://anonhg.NetBSD.org/src/rev/19d32f743c7e
branches: trunk
changeset: 781863:19d32f743c7e
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Oct 04 14:21:00 2012 +0000
description:
Fix udpcsum-rx bug on fragmented case this time.
- Fix the usage of a local variable for csum_flags.
- It seemd that sometimes MVGBE_RX_L4_CHECKSUM_OK bit were set to 0
even if the checksum is correct and the packet was not fragmented.
So we don't set M_CSUM_TCP_UDP_BAD even if csum bit is 0.
diffstat:
sys/dev/marvell/if_mvgbe.c | 37 +++++++++++++++++++++----------------
sys/dev/marvell/mvgbereg.h | 4 ++--
2 files changed, 23 insertions(+), 18 deletions(-)
diffs (81 lines):
diff -r 91cf0fb23e95 -r 19d32f743c7e sys/dev/marvell/if_mvgbe.c
--- a/sys/dev/marvell/if_mvgbe.c Thu Oct 04 10:35:54 2012 +0000
+++ b/sys/dev/marvell/if_mvgbe.c Thu Oct 04 14:21:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $ */
+/* $NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $ */
/*
* Copyright (c) 2007, 2008 KIYOHARA Takashi
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -1748,26 +1748,31 @@
int flgs = 0;
/* Check IPv4 header checksum */
- m->m_pkthdr.csum_flags |= M_CSUM_IPv4;
+ flgs |= M_CSUM_IPv4;
if (!(rxstat & MVGBE_RX_IP_HEADER_OK))
flgs |= M_CSUM_IPv4_BAD;
+ else if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR)
+ == 0) {
+ /*
+ * Check TCPv4/UDPv4 checksum for
+ * non-fragmented packet only.
+ *
+ * It seemd that sometimes
+ * MVGBE_RX_L4_CHECKSUM_OK bit was set to 0
+ * even if the checksum is correct and the
+ * packet was not fragmented. So we don't set
+ * M_CSUM_TCP_UDP_BAD even if csum bit is 0.
+ */
- /* Check TCPv4/UDPv4 checksum */
- if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR) == 0) {
- /* Not fragmented */
-
- if ((rxstat & MVGBE_RX_L4_TYPE_MASK) ==
- MVGBE_RX_L4_TYPE_TCP)
+ if (((rxstat & MVGBE_RX_L4_TYPE_MASK) ==
+ MVGBE_RX_L4_TYPE_TCP) &&
+ ((rxstat & MVGBE_RX_L4_CHECKSUM_OK) != 0))
flgs |= M_CSUM_TCPv4;
- else if ((rxstat & MVGBE_RX_L4_TYPE_MASK) ==
- MVGBE_RX_L4_TYPE_UDP)
+ else if (((rxstat & MVGBE_RX_L4_TYPE_MASK) ==
+ MVGBE_RX_L4_TYPE_UDP) &&
+ ((rxstat & MVGBE_RX_L4_CHECKSUM_OK) != 0))
flgs |= M_CSUM_UDPv4;
-
- if (((flgs & (M_CSUM_TCPv4|M_CSUM_UDPv4)) != 0)
- && !(rxstat & MVGBE_RX_L4_CHECKSUM))
- flgs |= M_CSUM_TCP_UDP_BAD;
}
-
m->m_pkthdr.csum_flags = flgs;
}
sw_csum:
diff -r 91cf0fb23e95 -r 19d32f743c7e sys/dev/marvell/mvgbereg.h
--- a/sys/dev/marvell/mvgbereg.h Thu Oct 04 10:35:54 2012 +0000
+++ b/sys/dev/marvell/mvgbereg.h Thu Oct 04 14:21:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvgbereg.h,v 1.3 2011/02/01 23:40:12 jakllsch Exp $ */
+/* $NetBSD: mvgbereg.h,v 1.4 2012/10/04 14:21:00 msaitoh Exp $ */
/*
* Copyright (c) 2007 KIYOHARA Takashi
* All rights reserved.
@@ -429,6 +429,6 @@
#define MVGBE_RX_FIRST_DESC (1 << 27)
#define MVGBE_RX_UNKNOWN_DA (1 << 28)
#define MVGBE_RX_ENABLE_INTERRUPT (1 << 29)
-#define MVGBE_RX_L4_CHECKSUM (1 << 30)
+#define MVGBE_RX_L4_CHECKSUM_OK (1 << 30)
#endif /* _MVGEREG_H_ */
Home |
Main Index |
Thread Index |
Old Index