summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-12-14 22:14:05 +0000
committerhselasky <hselasky@FreeBSD.org>2011-12-14 22:14:05 +0000
commit83d1e21dd2a8af164c5792531d349adad212dee8 (patch)
tree5ed66e0bac9b07fcff1f66e963f1b0440a240c77 /sys/dev
parentffba019399f74f32307bda82da050f5c09f1ce37 (diff)
downloadFreeBSD-src-83d1e21dd2a8af164c5792531d349adad212dee8.zip
FreeBSD-src-83d1e21dd2a8af164c5792531d349adad212dee8.tar.gz
Improve fix for random USB transfer time out.
Suggested by: YougHyeon MFC after: 3 days
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/wlan/if_run.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index ae446ef..5c61da9 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -2749,7 +2749,8 @@ tr_setup:
STAILQ_REMOVE_HEAD(&pq->tx_qh, next);
m = data->m;
- if (m->m_pkthdr.len > RUN_MAX_TXSZ) {
+ if ((m->m_pkthdr.len +
+ sizeof(data->desc) + 3 + 8) > RUN_MAX_TXSZ) {
DPRINTF("data overflow, %u bytes\n",
m->m_pkthdr.len);
@@ -2764,6 +2765,14 @@ tr_setup:
size = sizeof(data->desc);
usbd_copy_in(pc, 0, &data->desc, size);
usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len);
+ size += m->m_pkthdr.len;
+ /*
+ * Align end on a 4-byte boundary, pad 8 bytes (CRC +
+ * 4-byte padding), and be sure to zero those trailing
+ * bytes:
+ */
+ usbd_frame_zero(pc, size, ((-size) & 3) + 8);
+ size += ((-size) & 3) + 8;
vap = data->ni->ni_vap;
if (ieee80211_radiotap_active_vap(vap)) {
@@ -2782,10 +2791,10 @@ tr_setup:
ieee80211_radiotap_tx(vap, m);
}
- DPRINTFN(11, "sending frame len=%u @ index %d\n",
- m->m_pkthdr.len, index);
+ DPRINTFN(11, "sending frame len=%u/%u @ index %d\n",
+ m->m_pkthdr.len, size, index);
- usbd_xfer_set_frame_len(xfer, 0, size + m->m_pkthdr.len);
+ usbd_xfer_set_frame_len(xfer, 0, size);
usbd_xfer_set_priv(xfer, data);
usbd_transfer_submit(xfer);
@@ -2874,7 +2883,6 @@ run_bulk_tx_callback5(struct usb_xfer *xfer, usb_error_t error)
static void
run_set_tx_desc(struct run_softc *sc, struct run_tx_data *data)
{
- static const uint8_t ztail[16];
struct mbuf *m = data->m;
struct ieee80211com *ic = sc->sc_ifp->if_l2com;
struct ieee80211vap *vap = data->ni->ni_vap;
@@ -2931,13 +2939,6 @@ run_set_tx_desc(struct run_softc *sc, struct run_tx_data *data)
if (vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh))
txwi->xflags |= RT2860_TX_NSEQ;
-
- /*
- * Align end on a 4-byte boundary, pad 8 bytes (CRC + 4-byte padding),
- * and be sure to zero those trailing bytes.
- */
- m_append(m, ((m->m_pkthdr.len + 3) & ~3) - m->m_pkthdr.len + 8,
- (c_caddr_t)ztail);
}
/* This function must be called locked */
OpenPOWER on IntegriCloud