summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@FreeBSD.org>2005-11-24 21:31:39 +0000
committerdamien <damien@FreeBSD.org>2005-11-24 21:31:39 +0000
commit3f8ead2fdf54ffaba29f0b1c6599cebf46191ba5 (patch)
treedf807966131383ae78cec1cd164c6911825284e8
parentfd2f0452fd92ba735cd646e5b1a20def1a72d622 (diff)
downloadFreeBSD-src-3f8ead2fdf54ffaba29f0b1c6599cebf46191ba5.zip
FreeBSD-src-3f8ead2fdf54ffaba29f0b1c6599cebf46191ba5.tar.gz
o Force the sending of an extra URB if there is less than 2 bytes left
at the end of the last URB (URB = USB Request Block = 64 bytes). o Free the AMRR reserved xfer in detach. o Minor tweaks. MFC after: 1 week
-rw-r--r--sys/dev/usb/if_ural.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index 5723003..1623de2 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -527,6 +527,11 @@ USB_DETACH(ural)
callout_stop(&sc->scan_ch);
callout_stop(&sc->amrr_ch);
+ if (sc->amrr_xfer != NULL) {
+ usbd_free_xfer(sc->amrr_xfer);
+ sc->amrr_xfer = NULL;
+ }
+
if (sc->sc_rx_pipeh != NULL) {
usbd_abort_pipe(sc->sc_rx_pipeh);
usbd_close_pipe(sc->sc_rx_pipeh);
@@ -876,7 +881,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
- if (len < RAL_RX_DESC_SIZE) {
+ if (len < RAL_RX_DESC_SIZE + IEEE80211_MIN_LEN) {
printf("%s: xfer too short %d\n", USBDEVNAME(sc->sc_dev), len);
ifp->if_ierrors++;
goto skip;
@@ -1036,7 +1041,7 @@ ural_setup_tx_desc(struct ural_softc *sc, struct ural_tx_desc *desc,
*/
desc->plcp_service = 4;
- len += 4; /* account for FCS */
+ len += IEEE80211_CRC_LEN;
if (RAL_RATE_IS_OFDM(rate)) {
/*
* PLCP length field (LENGTH).
@@ -1172,9 +1177,16 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RAL_TX_DESC_SIZE);
ural_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate);
- /* xfer length needs to be a multiple of two! */
+ /* align end on a 2-bytes boundary */
xferlen = (RAL_TX_DESC_SIZE + m0->m_pkthdr.len + 1) & ~1;
+ /*
+ * No space left in the last URB to store the extra 2 bytes, force
+ * sending of another URB.
+ */
+ if ((xferlen % 64) == 0)
+ xferlen += 2;
+
DPRINTFN(10, ("sending mgt frame len=%u rate=%u xfer len=%u\n",
m0->m_pkthdr.len, rate, xferlen));
@@ -1254,9 +1266,16 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RAL_TX_DESC_SIZE);
ural_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate);
- /* xfer length needs to be a multiple of two! */
+ /* align end on a 2-bytes boundary */
xferlen = (RAL_TX_DESC_SIZE + m0->m_pkthdr.len + 1) & ~1;
+ /*
+ * No space left in the last URB to store the extra 2 bytes, force
+ * sending of another URB.
+ */
+ if ((xferlen % 64) == 0)
+ xferlen += 2;
+
DPRINTFN(10, ("sending data frame len=%u rate=%u xfer len=%u\n",
m0->m_pkthdr.len, rate, xferlen));
@@ -1487,7 +1506,6 @@ ural_read_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len)
if (error != 0) {
printf("%s: could not read MAC register: %s\n",
USBDEVNAME(sc->sc_dev), usbd_errstr(error));
- return;
}
}
OpenPOWER on IntegriCloud