Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/usb Pull up following revision(s) (requested by r...
details: https://anonhg.NetBSD.org/src/rev/37573fd82dea
branches: netbsd-8
changeset: 449027:37573fd82dea
user: martin <martin%NetBSD.org@localhost>
date: Tue Feb 19 15:09:51 2019 +0000
description:
Pull up following revision(s) (requested by rin in ticket #1192):
sys/dev/usb/if_axen.c: revision 1.27
sys/dev/usb/if_axenreg.h: revision 1.6
sys/dev/usb/if_axen.c: revision 1.32
sys/dev/usb/if_axen.c: revision 1.35
sys/dev/usb/if_axen.c: revision 1.37
sys/dev/usb/if_axenreg.h: revision 1.10
sys/dev/usb/if_axenreg.h: revision 1.11
sys/dev/usb/if_axen.c: revision 1.24
Correct error bits in RX packet header:
- Drop error is bit 31.
- CRC error is bit 29.
- Distinguish the two errors in debug printf.
Cosmetic changes; no functional changes.
Add couple of error printf.
XXX We should not to use aprint_xxx() for non-autoconf staffs.
Add ratecheck for TX errors for axen(4) and mue(4).
Remove unused.
diffstat:
sys/dev/usb/if_axen.c | 40 ++++++++++++++++++++++------------------
sys/dev/usb/if_axenreg.h | 15 ++++++---------
2 files changed, 28 insertions(+), 27 deletions(-)
diffs (183 lines):
diff -r db9c489c16ba -r 37573fd82dea sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c Tue Feb 19 15:05:52 2019 +0000
+++ b/sys/dev/usb/if_axen.c Tue Feb 19 15:09:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axen.c,v 1.11.8.5 2019/02/19 15:05:52 martin Exp $ */
+/* $NetBSD: if_axen.c,v 1.11.8.6 2019/02/19 15:09:51 martin 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.11.8.5 2019/02/19 15:05:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.11.8.6 2019/02/19 15:09:51 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -950,7 +950,6 @@
for (i = 0; i < AXEN_RX_LIST_CNT; i++) {
c = &cd->axen_rx_chain[i];
c->axen_sc = sc;
- c->axen_idx = i;
if (c->axen_xfer == NULL) {
int err = usbd_create_xfer(sc->axen_ep[AXEN_ENDPT_RX],
sc->axen_rx_bufsz, 0, 0, &c->axen_xfer);
@@ -976,7 +975,6 @@
for (i = 0; i < AXEN_TX_LIST_CNT; i++) {
c = &cd->axen_tx_chain[i];
c->axen_sc = sc;
- c->axen_idx = i;
if (c->axen_xfer == NULL) {
int err = usbd_create_xfer(sc->axen_ep[AXEN_ENDPT_TX],
sc->axen_tx_bufsz, USBD_FORCE_SHORT_XFER, 0,
@@ -1021,10 +1019,9 @@
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
return;
- if (usbd_ratecheck(&sc->axen_rx_notice)) {
+ if (usbd_ratecheck(&sc->axen_rx_notice))
aprint_error_dev(sc->axen_dev, "usb errors on rx: %s\n",
usbd_errstr(status));
- }
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->axen_ep[AXEN_ENDPT_RX]);
goto done;
@@ -1033,6 +1030,7 @@
usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
if (total_len < sizeof(pkt_hdr)) {
+ aprint_error_dev(sc->axen_dev, "rxeof: too short transfer\n");
ifp->if_ierrors++;
goto done;
}
@@ -1054,6 +1052,7 @@
/* sanity check */
if (hdr_offset > total_len) {
+ aprint_error_dev(sc->axen_dev, "rxeof: invalid hdr offset\n");
ifp->if_ierrors++;
usbd_delay_ms(sc->axen_udev, 100);
goto done;
@@ -1090,12 +1089,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;
}
@@ -1208,8 +1208,9 @@
return;
}
ifp->if_oerrors++;
- aprint_error_dev(sc->axen_dev, "usb error on tx: %s\n",
- usbd_errstr(status));
+ if (usbd_ratecheck(&sc->axen_tx_notice))
+ aprint_error_dev(sc->axen_dev, "usb error on tx: %s\n",
+ usbd_errstr(status));
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->axen_ep[AXEN_ENDPT_TX]);
splx(s);
@@ -1547,6 +1548,7 @@
axen_stop(struct ifnet *ifp, int disable)
{
struct axen_softc *sc = ifp->if_softc;
+ struct axen_chain *c;
usbd_status err;
int i;
uint16_t rxmode, wval;
@@ -1595,17 +1597,19 @@
/* Free RX resources. */
for (i = 0; i < AXEN_RX_LIST_CNT; i++) {
- if (sc->axen_cdata.axen_rx_chain[i].axen_xfer != NULL) {
- usbd_destroy_xfer(sc->axen_cdata.axen_rx_chain[i].axen_xfer);
- sc->axen_cdata.axen_rx_chain[i].axen_xfer = NULL;
+ c = &sc->axen_cdata.axen_rx_chain[i];
+ if (c->axen_xfer != NULL) {
+ usbd_destroy_xfer(c->axen_xfer);
+ c->axen_xfer = NULL;
}
}
/* Free TX resources. */
for (i = 0; i < AXEN_TX_LIST_CNT; i++) {
- if (sc->axen_cdata.axen_tx_chain[i].axen_xfer != NULL) {
- usbd_destroy_xfer(sc->axen_cdata.axen_tx_chain[i].axen_xfer);
- sc->axen_cdata.axen_tx_chain[i].axen_xfer = NULL;
+ c = &sc->axen_cdata.axen_tx_chain[i];
+ if (c->axen_xfer != NULL) {
+ usbd_destroy_xfer(c->axen_xfer);
+ c->axen_xfer = NULL;
}
}
diff -r db9c489c16ba -r 37573fd82dea sys/dev/usb/if_axenreg.h
--- a/sys/dev/usb/if_axenreg.h Tue Feb 19 15:05:52 2019 +0000
+++ b/sys/dev/usb/if_axenreg.h Tue Feb 19 15:09:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axenreg.h,v 1.3.10.1 2019/02/19 15:05:52 martin Exp $ */
+/* $NetBSD: if_axenreg.h,v 1.3.10.2 2019/02/19 15:09:51 martin 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)
@@ -239,17 +239,13 @@
struct axen_softc *axen_sc;
struct usbd_xfer *axen_xfer;
uint8_t *axen_buf;
- int axen_accum;
- int axen_idx;
};
struct axen_cdata {
struct axen_chain axen_tx_chain[AXEN_TX_LIST_CNT];
struct axen_chain axen_rx_chain[AXEN_RX_LIST_CNT];
int axen_tx_prod;
- int axen_tx_cons;
int axen_tx_cnt;
- int axen_rx_prod;
};
struct axen_qctrl {
@@ -296,6 +292,7 @@
uint8_t axen_ipgs[3];
int axen_phyno;
struct timeval axen_rx_notice;
+ struct timeval axen_tx_notice;
u_int axen_rx_bufsz;
u_int axen_tx_bufsz;
int axen_rev;
Home |
Main Index |
Thread Index |
Old Index