diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2011-01-08 15:18:02 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2011-01-08 15:18:02 +0000 |
commit | 36f14486ea394cd56938caae3641b13f676212eb (patch) | |
tree | 0da987aef1acf997848913e14328df48813f1c56 /sys | |
parent | 8e595f17bd41aad0af9e0b0add23386f18ea47a1 (diff) |
reserve one xfer for beacons during init.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_athn_usb.c | 16 | ||||
-rw-r--r-- | sys/dev/usb/if_athn_usb.h | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index 7d48cb21173..cdd0cd841c9 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.5 2011/01/08 15:05:24 damien Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.6 2011/01/08 15:18:01 damien Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -1410,7 +1410,7 @@ athn_usb_bcneof(usbd_xfer_handle xfer, usbd_private_handle priv, if (__predict_false(status == USBD_STALLED)) usbd_clear_endpoint_stall_async(usc->tx_data_pipe); - usc->bcndata = data; + usc->tx_bcn = data; } /* @@ -1435,9 +1435,9 @@ athn_usb_swba(struct athn_usb_softc *usc) ic->ic_dtim_count--; /* Make sure previous beacon has been sent. */ - if (usc->bcndata == NULL) + if (usc->tx_bcn == NULL) return; - data = usc->bcndata; + data = usc->tx_bcn; /* Get new beacon. */ m = ieee80211_beacon_alloc(ic, ic->ic_bss); @@ -1470,10 +1470,10 @@ athn_usb_swba(struct athn_usb_softc *usc) athn_usb_bcneof); m_freem(m); - usc->bcndata = NULL; + usc->tx_bcn = NULL; error = usbd_transfer(data->xfer); if (__predict_false(error != USBD_IN_PROGRESS && error != 0)) - usc->bcndata = data; + usc->tx_bcn = data; } #endif @@ -2149,7 +2149,9 @@ athn_usb_init(struct ifnet *ifp) error = athn_usb_alloc_tx_list(usc); if (error != 0) goto fail; - /* XXX Steal one buffer for beacons. */ + /* Steal one buffer for beacons. */ + usc->tx_bcn = TAILQ_FIRST(&usc->tx_free_list); + TAILQ_REMOVE(&usc->tx_free_list, usc->tx_bcn, next); c = ic->ic_bss->ni_chan = ic->ic_ibss_chan; extc = NULL; diff --git a/sys/dev/usb/if_athn_usb.h b/sys/dev/usb/if_athn_usb.h index c2a79d4bbb0..99f7212d034 100644 --- a/sys/dev/usb/if_athn_usb.h +++ b/sys/dev/usb/if_athn_usb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.h,v 1.1 2011/01/06 07:27:15 damien Exp $ */ +/* $OpenBSD: if_athn_usb.h,v 1.2 2011/01/08 15:18:01 damien Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -351,7 +351,7 @@ struct ar_rx_status { * Driver definitions. */ #define ATHN_USB_RX_LIST_COUNT 1 -#define ATHN_USB_TX_LIST_COUNT 8 +#define ATHN_USB_TX_LIST_COUNT (8 + 1) /* NB: +1 for beacons. */ #define ATHN_USB_HOST_CMD_RING_COUNT 32 @@ -449,7 +449,7 @@ struct athn_usb_softc { struct athn_usb_tx_data tx_data[ATHN_USB_TX_LIST_COUNT]; TAILQ_HEAD(, athn_usb_tx_data) tx_free_list; struct athn_usb_tx_data tx_cmd; - struct athn_usb_tx_data *bcndata; + struct athn_usb_tx_data *tx_bcn; uint8_t ep_ctrl; uint8_t ep_bcn; |