While tethering to my phone on a train, I'm seeing a lot of these lines
in dmesg:

urndis0: usb errors on rx: IOERROR
urndis0: usb error on tx: IOERROR

So many in fact that if I run 'dmesg' that's all I see, over and over.
However, network mostly works, and works particularly well given the right
conditions (e.g. when the train stops at a station :)

I don't think a driver should write a line to dmesg for every dropped packet.
We have error counters for that.
Moreover, this driver forgot about counting input errors.

Index: if_urndis.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
retrieving revision 1.59
diff -u -p -r1.59 if_urndis.c
--- if_urndis.c 25 Nov 2015 03:10:00 -0000      1.59
+++ if_urndis.c 16 Mar 2016 13:00:59 -0000
@@ -854,11 +854,11 @@ urndis_decap(struct urndis_softc *sc, st
 
                if (letoh32(msg->rm_datalen) < sizeof(struct ether_header)) {
                        ifp->if_ierrors++;
-                       printf("%s: urndis_decap invalid ethernet size "
+                       DPRINTF(("%s: urndis_decap invalid ethernet size "
                            "%u < %zu\n",
                            DEVNAME(sc),
                            letoh32(msg->rm_datalen),
-                           sizeof(struct ether_header));
+                           sizeof(struct ether_header)));
                        return;
                }
 
@@ -1200,12 +1200,13 @@ urndis_rxeof(struct usbd_xfer *xfer,
                if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
                        return;
                if (usbd_ratecheck(&sc->sc_rx_notice)) {
-                       printf("%s: usb errors on rx: %s\n",
-                           DEVNAME(sc), usbd_errstr(status));
+                       DPRINTF(("%s: usb errors on rx: %s\n",
+                           DEVNAME(sc), usbd_errstr(status)));
                }
                if (status == USBD_STALLED)
                        usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe);
 
+               ifp->if_ierrors++;
                goto done;
        }
 
@@ -1251,8 +1252,8 @@ urndis_txeof(struct usbd_xfer *xfer,
                        return;
                }
                ifp->if_oerrors++;
-               printf("%s: usb error on tx: %s\n", DEVNAME(sc),
-                   usbd_errstr(status));
+               DPRINTF(("%s: usb error on tx: %s\n", DEVNAME(sc),
+                   usbd_errstr(status)));
                if (status == USBD_STALLED)
                        usbd_clear_endpoint_stall_async(sc->sc_bulkout_pipe);
                splx(s);

Reply via email to