Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/usb Use ieee80211_tx_complete() to free mbuf/n...
details: https://anonhg.NetBSD.org/src-all/rev/c026c29201e9
branches: trunk
changeset: 1027502:c026c29201e9
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Thu Feb 11 18:22:40 2021 +0100
description:
Use ieee80211_tx_complete() to free mbuf/node info.
Freeing them manually may bypass "tx complete" callbacks and break
timeout handling.
diffstat:
sys/dev/usb/if_urtwn.c | 11 +++++++++--
sys/dev/usb/if_urtwnvar.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diffs (54 lines):
diff -r 09cb27d2f25b -r c026c29201e9 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Thu Feb 11 18:20:29 2021 +0100
+++ b/sys/dev/usb/if_urtwn.c Thu Feb 11 18:22:40 2021 +0100
@@ -850,6 +850,8 @@
data->sc = sc; /* Backpointer for callbacks. */
data->pidx = j;
+ data->m = NULL;
+ data->ni = NULL;
error = usbd_create_xfer(sc->tx_pipe[j],
URTWN_TXBUFSZ, USBD_FORCE_SHORT_XFER, 0,
@@ -2997,6 +2999,11 @@
DPRINTFN(DBG_FN|DBG_TX, ("%s: %s: status=%d\n",
device_xname(sc->sc_dev), __func__, status));
+ if (data->m) {
+ ieee80211_tx_complete(data->ni, data->m, 0);
+ data->m = NULL;
+ data->ni = NULL;
+ }
urtwn_put_tx_data(sc, data);
s = splnet();
@@ -3218,6 +3225,8 @@
xferlen = txd_len + m->m_pkthdr.len + padsize;
m_copydata(m, 0, m->m_pkthdr.len, (char *)&txd[0] + txd_len + padsize);
+ data->m = m;
+ data->ni = ni;
if (data->xfer == NULL) {
/* NNN Don't crash ... but what is going on! */
@@ -3347,8 +3356,6 @@
urtwn_put_tx_data(sc, data);
continue;
}
- m_freem(m);
- ieee80211_free_node(ni);
sc->tx_timer = 5;
callout_schedule(&sc->sc_watchdog_to, hz);
}
diff -r 09cb27d2f25b -r c026c29201e9 sys/dev/usb/if_urtwnvar.h
--- a/sys/dev/usb/if_urtwnvar.h Thu Feb 11 18:20:29 2021 +0100
+++ b/sys/dev/usb/if_urtwnvar.h Thu Feb 11 18:22:40 2021 +0100
@@ -80,6 +80,8 @@
size_t pidx;
struct usbd_xfer *xfer;
uint8_t *buf;
+ struct mbuf *m;
+ struct ieee80211_node *ni;
TAILQ_ENTRY(urtwn_tx_data) next;
};
Home |
Main Index |
Thread Index |
Old Index