I connect to a lot of different networks with an axen(4) driven USB
network dongle. I often get spammed with "invalid buffer..." messages in
my dmesg.

This mail thread on bugs@ happened a while back but no patch was
submitted: https://marc.info/?l=openbsd-bugs&m=149138214725080&w=2

I now changed the printfs do DPRINTFs and increment the error count for
each packet. I didn't see a reason why to add the specific package
number.


diff --git sys/dev/usb/if_axen.c sys/dev/usb/if_axen.c
index 325ae548e7f..fc375d3cea9 100644
--- sys/dev/usb/if_axen.c
+++ sys/dev/usb/if_axen.c
@@ -901,8 +901,8 @@ axen_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status 
status)
                if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
                        return;
                if (usbd_ratecheck(&sc->axen_rx_notice)) {
-                       printf("%s: usb errors on rx: %s\n",
-                           sc->axen_dev.dv_xname, usbd_errstr(status));
+                       DPRINTF(("%s: usb errors on rx: %s\n",
+                           sc->axen_dev.dv_xname, usbd_errstr(status)));
                }
                if (status == USBD_STALLED)
                        
usbd_clear_endpoint_stall_async(sc->axen_ep[AXEN_ENDPT_RX]);
@@ -927,7 +927,7 @@ axen_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status 
status)
        pkt_count  = (u_int16_t)(rx_hdr & 0xffff);
 
        if (total_len > sc->axen_bufsz) {
-               printf("rxeof: too large transfer\n");
+               DPRINTF(("rxeof: too large transfer\n"));
                goto done;
        }
 
@@ -957,8 +957,8 @@ axen_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status 
status)
 
        do {
                if ((buf[0] != 0xee) || (buf[1] != 0xee)){
-                       printf("invalid buffer(pkt#%d), continue\n", pkt_count);
-                       ifp->if_ierrors += pkt_count;
+                       DPRINTF(("invalid buffer(pkt#%d), continue\n", 
pkt_count));
+                       ifp->if_ierrors++;
                        goto done;
                }
 
@@ -991,7 +991,7 @@ axen_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status 
status)
                /* cheksum err */
                if ((pkt_hdr & AXEN_RXHDR_L3CSUM_ERR) || 
                    (pkt_hdr & AXEN_RXHDR_L4CSUM_ERR)) {
-                       printf("checksum err (pkt#%d)\n", pkt_count);
+                       DPRINTF(("checksum err (pkt#%d)\n", pkt_count));
                        goto nextpkt;
                } else {
                        m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
@@ -1069,8 +1069,8 @@ axen_txeof(struct usbd_xfer *xfer, void *priv, 
usbd_status status)
                        return;
                }
                ifp->if_oerrors++;
-               printf("axen%d: usb error on tx: %s\n", sc->axen_unit,
-                   usbd_errstr(status));
+               DPRINTF(("axen%d: usb error on tx: %s\n", sc->axen_unit,
+                   usbd_errstr(status)));
                if (status == USBD_STALLED)
                        
usbd_clear_endpoint_stall_async(sc->axen_ep[AXEN_ENDPT_TX]);
                splx(s);

Reply via email to