Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Correct error bits in RX packet header:



details:   https://anonhg.NetBSD.org/src/rev/5696c05425c5
branches:  trunk
changeset: 996421:5696c05425c5
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Jan 31 15:27:57 2019 +0000

description:
Correct error bits in RX packet header:
- Drop error is bit 31.
- CRC error is bit 29.
- Distinguish the two errors in debug printf.

diffstat:

 sys/dev/usb/if_axen.c    |  13 +++++++------
 sys/dev/usb/if_axenreg.h |  10 +++++-----
 2 files changed, 12 insertions(+), 11 deletions(-)

diffs (67 lines):

diff -r 7bba95f1db2f -r 5696c05425c5 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Jan 31 15:26:24 2019 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Jan 31 15:27:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.23 2019/01/31 15:26:24 rin Exp $ */
+/*     $NetBSD: if_axen.c,v 1.24 2019/01/31 15:27:57 rin Exp $ */
 /*     $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.23 2019/01/31 15:26:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.24 2019/01/31 15:27:57 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1081,12 +1081,13 @@
                    ("%s: rxeof: packet#%d, pkt_hdr 0x%08x, pkt_len %zu\n",
                   device_xname(sc->axen_dev), pkt_count, pkt_hdr, pkt_len));
 
-               if ((pkt_hdr & AXEN_RXHDR_CRC_ERR) ||
-                   (pkt_hdr & AXEN_RXHDR_DROP_ERR)) {
+               if (pkt_hdr & (AXEN_RXHDR_CRC_ERR | AXEN_RXHDR_DROP_ERR)) {
                        ifp->if_ierrors++;
                        /* move to next pkt header */
-                       DPRINTF(("%s: crc err (pkt#%d)\n",
-                           device_xname(sc->axen_dev), pkt_count));
+                       DPRINTF(("%s: %s err (pkt#%d)\n",
+                           device_xname(sc->axen_dev),
+                           (pkt_hdr & AXEN_RXHDR_CRC_ERR) ? "crc" : "drop",
+                           pkt_count));
                        goto nextpkt;
                }
 
diff -r 7bba95f1db2f -r 5696c05425c5 sys/dev/usb/if_axenreg.h
--- a/sys/dev/usb/if_axenreg.h  Thu Jan 31 15:26:24 2019 +0000
+++ b/sys/dev/usb/if_axenreg.h  Thu Jan 31 15:27:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axenreg.h,v 1.5 2019/01/31 15:26:24 rin Exp $       */
+/*     $NetBSD: if_axenreg.h,v 1.6 2019/01/31 15:27:57 rin Exp $       */
 /*     $OpenBSD: if_axenreg.h,v 1.1 2013/10/07 05:37:41 yuo Exp $      */
 
 /*
@@ -30,8 +30,8 @@
  *                     |    |     ++-----L3_type (1:ipv4, 0/2:ipv6)
  *        pkt_len(13)  |    |     ||+ ++-L4_type(0: icmp, 1: UDP, 4: TCP)
  * |765|43210 76543210|7654 3210 7654 3210|
- *  |+-Drop_err               |+-L4_err |+-L4_CSUM_ERR
- *  +--crc_err                +--L3_err +--L3_CSUM_ERR
+ *  | +-crc_err               |+-L4_err |+-L4_CSUM_ERR
+ *  +--drop_err                +--L3_err +--L3_CSUM_ERR
  *
  * ex) pkt_hdr 0x00680820
  *      drop_err, crc_err: none
@@ -55,8 +55,8 @@
  *  0x0850: ipv6 tcp (ssh)             0000 1000 0101 0000
  */
 
-#define        AXEN_RXHDR_CRC_ERR      (1 << 31)
-#define        AXEN_RXHDR_DROP_ERR     (1 << 30)
+#define        AXEN_RXHDR_DROP_ERR     (1 << 31)
+#define        AXEN_RXHDR_CRC_ERR      (1 << 29)
 #define AXEN_RXHDR_MCAST       (1 << 15)
 #define AXEN_RXHDR_RX_OK       (1 << 11)
 #define        AXEN_RXHDR_L3_ERR       (1 << 9)



Home | Main Index | Thread Index | Old Index