Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/wpi/if_wpi.c
Show First 20 Lines • Show All 520 Lines • ▼ Show 20 Lines | #endif | ||||
ic->ic_getradiocaps = wpi_getradiocaps; | ic->ic_getradiocaps = wpi_getradiocaps; | ||||
ic->ic_setregdomain = wpi_setregdomain; | ic->ic_setregdomain = wpi_setregdomain; | ||||
sc->sc_update_rx_ring = wpi_update_rx_ring; | sc->sc_update_rx_ring = wpi_update_rx_ring; | ||||
sc->sc_update_tx_ring = wpi_update_tx_ring; | sc->sc_update_tx_ring = wpi_update_tx_ring; | ||||
wpi_radiotap_attach(sc); | wpi_radiotap_attach(sc); | ||||
/* Setup Tx status flags (constant). */ | |||||
sc->sc_txs.flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY | | |||||
IEEE80211_RATECTL_STATUS_LONG_RETRY; | |||||
callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0); | callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0); | ||||
callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0); | callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0); | ||||
callout_init_mtx(&sc->tx_timeout, &sc->txq_state_mtx, 0); | callout_init_mtx(&sc->tx_timeout, &sc->txq_state_mtx, 0); | ||||
callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0); | callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0); | ||||
TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc); | TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc); | ||||
TASK_INIT(&sc->sc_radioon_task, 0, wpi_radio_on, sc); | TASK_INIT(&sc->sc_radioon_task, 0, wpi_radio_on, sc); | ||||
wpi_sysctlattach(sc); | wpi_sysctlattach(sc); | ||||
▲ Show 20 Lines • Show All 1,509 Lines • ▼ Show 20 Lines | wpi_rx_statistics(struct wpi_softc *sc, struct wpi_rx_desc *desc, | ||||
struct wpi_rx_data *data) | struct wpi_rx_data *data) | ||||
{ | { | ||||
/* Ignore */ | /* Ignore */ | ||||
} | } | ||||
static void | static void | ||||
wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc) | wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc) | ||||
{ | { | ||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; | |||||
struct wpi_tx_ring *ring = &sc->txq[desc->qid & 0x3]; | struct wpi_tx_ring *ring = &sc->txq[desc->qid & 0x3]; | ||||
struct wpi_tx_data *data = &ring->data[desc->idx]; | struct wpi_tx_data *data = &ring->data[desc->idx]; | ||||
struct wpi_tx_stat *stat = (struct wpi_tx_stat *)(desc + 1); | struct wpi_tx_stat *stat = (struct wpi_tx_stat *)(desc + 1); | ||||
struct mbuf *m; | struct mbuf *m; | ||||
struct ieee80211_node *ni; | struct ieee80211_node *ni; | ||||
struct ieee80211vap *vap; | |||||
uint32_t status = le32toh(stat->status); | uint32_t status = le32toh(stat->status); | ||||
int ackfailcnt = stat->ackfailcnt / WPI_NTRIES_DEFAULT; | |||||
KASSERT(data->ni != NULL, ("no node")); | KASSERT(data->ni != NULL, ("no node")); | ||||
KASSERT(data->m != NULL, ("no mbuf")); | KASSERT(data->m != NULL, ("no mbuf")); | ||||
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); | DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); | ||||
DPRINTF(sc, WPI_DEBUG_XMIT, "%s: " | DPRINTF(sc, WPI_DEBUG_XMIT, "%s: " | ||||
"qid %d idx %d retries %d btkillcnt %d rate %x duration %d " | "qid %d idx %d retries %d btkillcnt %d rate %x duration %d " | ||||
"status %x\n", __func__, desc->qid, desc->idx, stat->ackfailcnt, | "status %x\n", __func__, desc->qid, desc->idx, stat->ackfailcnt, | ||||
stat->btkillcnt, stat->rate, le32toh(stat->duration), status); | stat->btkillcnt, stat->rate, le32toh(stat->duration), status); | ||||
/* Unmap and free mbuf. */ | /* Unmap and free mbuf. */ | ||||
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTWRITE); | bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTWRITE); | ||||
bus_dmamap_unload(ring->data_dmat, data->map); | bus_dmamap_unload(ring->data_dmat, data->map); | ||||
m = data->m, data->m = NULL; | m = data->m, data->m = NULL; | ||||
ni = data->ni, data->ni = NULL; | ni = data->ni, data->ni = NULL; | ||||
vap = ni->ni_vap; | |||||
/* | /* | ||||
* Update rate control statistics for the node. | * Update rate control statistics for the node. | ||||
*/ | */ | ||||
if (status & WPI_TX_STATUS_FAIL) { | txs->short_retries = stat->rtsfailcnt; | ||||
ieee80211_ratectl_tx_complete(vap, ni, | txs->long_retries = stat->ackfailcnt / WPI_NTRIES_DEFAULT; | ||||
IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL); | if (!(status & WPI_TX_STATUS_FAIL)) | ||||
} else | txs->status = IEEE80211_RATECTL_TX_SUCCESS; | ||||
ieee80211_ratectl_tx_complete(vap, ni, | else { | ||||
IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL); | switch (status & 0xff) { | ||||
case WPI_TX_STATUS_FAIL_SHORT_LIMIT: | |||||
txs->status = IEEE80211_RATECTL_TX_FAIL_SHORT; | |||||
break; | |||||
case WPI_TX_STATUS_FAIL_LONG_LIMIT: | |||||
txs->status = IEEE80211_RATECTL_TX_FAIL_LONG; | |||||
break; | |||||
case WPI_TX_STATUS_FAIL_LIFE_EXPIRE: | |||||
txs->status = IEEE80211_RATECTL_TX_FAIL_EXPIRED; | |||||
break; | |||||
default: | |||||
txs->status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED; | |||||
break; | |||||
} | |||||
} | |||||
ieee80211_ratectl_tx_complete(ni, txs); | |||||
ieee80211_tx_complete(ni, m, (status & WPI_TX_STATUS_FAIL) != 0); | ieee80211_tx_complete(ni, m, (status & WPI_TX_STATUS_FAIL) != 0); | ||||
WPI_TXQ_STATE_LOCK(sc); | WPI_TXQ_STATE_LOCK(sc); | ||||
if (--ring->queued > 0) | if (--ring->queued > 0) | ||||
callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc); | callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc); | ||||
else | else | ||||
callout_stop(&sc->tx_timeout); | callout_stop(&sc->tx_timeout); | ||||
WPI_TXQ_STATE_UNLOCK(sc); | WPI_TXQ_STATE_UNLOCK(sc); | ||||
▲ Show 20 Lines • Show All 3,531 Lines • Show Last 20 Lines |