|
1 | | -/* $NetBSD: if_urtwn.c,v 1.105.4.3 2025/07/30 10:54:30 martin Exp $ */ |
| 1 | +/* $NetBSD: if_urtwn.c,v 1.105.4.4 2025/09/23 12:42:24 martin Exp $ */ |
2 | 2 | /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ |
3 | 3 |
|
4 | 4 | /*- |
|
25 | 25 | */ |
26 | 26 |
|
27 | 27 | #include <sys/cdefs.h> |
28 | | -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.105.4.3 2025/07/30 10:54:30 martin Exp $"); |
| 28 | +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.105.4.4 2025/09/23 12:42:24 martin Exp $"); |
29 | 29 |
|
30 | 30 | #ifdef _KERNEL_OPT |
31 | 31 | #include "opt_inet.h" |
@@ -753,6 +753,7 @@ urtwn_alloc_rx_list(struct urtwn_softc *sc) |
753 | 753 | data = &sc->rx_data[j][i]; |
754 | 754 |
|
755 | 755 | data->sc = sc; /* Backpointer for callbacks. */ |
| 756 | + data->pidx = j; |
756 | 757 |
|
757 | 758 | error = usbd_create_xfer(sc->rx_pipe[j], URTWN_RXBUFSZ, |
758 | 759 | 0, 0, &data->xfer); |
@@ -2546,7 +2547,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) |
2546 | 2547 | size_t pidx = data->pidx; |
2547 | 2548 | uint32_t rxdw0; |
2548 | 2549 | uint8_t *buf; |
2549 | | - int len, totlen, pktlen, infosz, npkts; |
| 2550 | + int len, totlen, pktlen, infosz, npkts, pktspacing; |
2550 | 2551 |
|
2551 | 2552 | URTWNHIST_FUNC(); URTWNHIST_CALLED(); |
2552 | 2553 | DPRINTFN(DBG_RX, "status=%jd", status, 0, 0, 0); |
@@ -2583,8 +2584,13 @@ urtwn_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) |
2583 | 2584 | if (npkts != 0) |
2584 | 2585 | rnd_add_uint32(&sc->rnd_source, npkts); |
2585 | 2586 |
|
| 2587 | + if (ISSET(sc->chip, URTWN_CHIP_92EU)) |
| 2588 | + pktspacing = 8; |
| 2589 | + else |
| 2590 | + pktspacing = 128; |
| 2591 | + |
2586 | 2592 | /* Process all of them. */ |
2587 | | - while (npkts-- > 0) { |
| 2593 | + while (npkts-- > 0 && len > 0) { |
2588 | 2594 | if (__predict_false(len < (int)sizeof(*stat))) { |
2589 | 2595 | DPRINTFN(DBG_RX, "len(%jd) is short than header", |
2590 | 2596 | len, 0, 0, 0); |
@@ -2612,8 +2618,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) |
2612 | 2618 | /* Process 802.11 frame. */ |
2613 | 2619 | urtwn_rx_frame(sc, buf, pktlen); |
2614 | 2620 |
|
2615 | | - /* Next chunk is 128-byte aligned. */ |
2616 | | - totlen = roundup2(totlen, 128); |
| 2621 | + totlen = roundup2(totlen, pktspacing); |
2617 | 2622 | buf += totlen; |
2618 | 2623 | len -= totlen; |
2619 | 2624 | } |
@@ -2994,6 +2999,7 @@ urtwn_start(struct ifnet *ifp) |
2994 | 2999 | device_printf(sc->sc_dev, |
2995 | 3000 | "unable to transmit packet\n"); |
2996 | 3001 | if_statinc(ifp, if_oerrors); |
| 3002 | + urtwn_put_tx_data(sc, data); |
2997 | 3003 | continue; |
2998 | 3004 | } |
2999 | 3005 | m_freem(m); |
@@ -3359,7 +3365,7 @@ urtwn_llt_init(struct urtwn_softc *sc) |
3359 | 3365 | if (sc->chip & URTWN_CHIP_88E) |
3360 | 3366 | pktbuf_count = R88E_TXPKTBUF_COUNT; |
3361 | 3367 | else if (sc->chip & URTWN_CHIP_92EU) |
3362 | | - pktbuf_count = R88E_TXPKTBUF_COUNT; |
| 3368 | + pktbuf_count = R92E_TXPKTBUF_COUNT; |
3363 | 3369 | else |
3364 | 3370 | pktbuf_count = R92C_TXPKTBUF_COUNT; |
3365 | 3371 |
|
|
0 commit comments