drivers/wlan: Merge the ratectl change commit from FreeBSD.
This is a relatively minor change that mostly just shuffles structs around, so presumably it will not break any of these drivers.
This commit is contained in:
parent
6d0f2b487a
commit
bf3654699e
@ -3329,7 +3329,6 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
|
||||
struct bwi_txbuf *tb;
|
||||
int ring_idx, buf_idx;
|
||||
struct ieee80211_node *ni;
|
||||
struct ieee80211vap *vap;
|
||||
|
||||
if (tx_id == 0) {
|
||||
device_printf(sc->sc_dev, "%s: zero tx id\n", __func__);
|
||||
@ -3356,7 +3355,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
|
||||
if ((ni = tb->tb_ni) != NULL) {
|
||||
const struct bwi_txbuf_hdr *hdr =
|
||||
mtod(tb->tb_mbuf, const struct bwi_txbuf_hdr *);
|
||||
vap = ni->ni_vap;
|
||||
struct ieee80211_ratectl_tx_status txs;
|
||||
|
||||
/* NB: update rate control only for unicast frames */
|
||||
if (hdr->txh_mac_ctrl & htole32(BWI_TXH_MAC_C_ACK)) {
|
||||
@ -3367,9 +3366,15 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
|
||||
* well so to avoid over-aggressive downshifting we
|
||||
* treat any number of retries as "1".
|
||||
*/
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
(data_txcnt > 1) ? IEEE80211_RATECTL_TX_SUCCESS :
|
||||
IEEE80211_RATECTL_TX_FAILURE, &acked, NULL);
|
||||
txs.flags = IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
txs.long_retries = acked;
|
||||
if (data_txcnt > 1)
|
||||
txs.status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
else {
|
||||
txs.status =
|
||||
IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED;
|
||||
}
|
||||
ieee80211_ratectl_tx_complete(ni, &txs);
|
||||
}
|
||||
ieee80211_tx_complete(ni, tb->tb_mbuf, !acked);
|
||||
tb->tb_ni = NULL;
|
||||
|
@ -3263,8 +3263,10 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
}
|
||||
|
||||
/* rssi is in 1/2db units */
|
||||
rxs.rssi = rssi * 2;
|
||||
rxs.nf = sc->sc_noise;
|
||||
rxs.c_rssi = rssi * 2;
|
||||
rxs.c_nf = sc->sc_noise;
|
||||
if (ieee80211_add_rx_params(m, &rxs) == 0)
|
||||
goto fail;
|
||||
|
||||
if (ieee80211_radiotap_active_vap(vap)) {
|
||||
struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap;
|
||||
@ -3301,11 +3303,11 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
IWM_UNLOCK(sc);
|
||||
if (ni != NULL) {
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m);
|
||||
ieee80211_input_mimo(ni, m, &rxs);
|
||||
ieee80211_input_mimo(ni, m);
|
||||
ieee80211_free_node(ni);
|
||||
} else {
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m);
|
||||
ieee80211_input_mimo_all(ic, m, &rxs);
|
||||
ieee80211_input_mimo_all(ic, m);
|
||||
}
|
||||
IWM_LOCK(sc);
|
||||
|
||||
@ -3320,10 +3322,9 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
|
||||
struct iwm_node *in)
|
||||
{
|
||||
struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data;
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct ieee80211_node *ni = &in->in_ni;
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK;
|
||||
int failack = tx_resp->failure_frame;
|
||||
|
||||
KASSERT(tx_resp->frame_count == 1, ("too many frames"));
|
||||
|
||||
@ -3339,16 +3340,32 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
|
||||
le32toh(tx_resp->initial_rate),
|
||||
(int) le16toh(tx_resp->wireless_media_time));
|
||||
|
||||
txs->flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY |
|
||||
IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
txs->short_retries = tx_resp->failure_rts;
|
||||
txs->long_retries = tx_resp->failure_frame;
|
||||
if (status != IWM_TX_STATUS_SUCCESS &&
|
||||
status != IWM_TX_STATUS_DIRECT_DONE) {
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE, &failack, NULL);
|
||||
return (1);
|
||||
switch (status) {
|
||||
case IWM_TX_STATUS_FAIL_SHORT_LIMIT:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_SHORT;
|
||||
break;
|
||||
case IWM_TX_STATUS_FAIL_LONG_LIMIT:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_LONG;
|
||||
break;
|
||||
case IWM_TX_STATUS_FAIL_LIFE_EXPIRE:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_EXPIRED;
|
||||
break;
|
||||
default:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS, &failack, NULL);
|
||||
return (0);
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
}
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
|
||||
return (txs->status != IEEE80211_RATECTL_TX_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -427,6 +427,7 @@ struct iwm_softc {
|
||||
struct mtx sc_mtx;
|
||||
struct mbufq sc_snd;
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
|
||||
int sc_flags;
|
||||
#define IWM_FLAG_USE_ICT (1 << 0)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_amrr.h>
|
||||
#include <net80211/ieee80211_ratectl.h>
|
||||
|
||||
#include <dev/iwm/if_iwmreg.h>
|
||||
#include <dev/iwm/if_iwmvar.h>
|
||||
|
@ -525,6 +525,10 @@ wpi_attach(device_t dev)
|
||||
|
||||
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->scan_timeout, &sc->rxon_mtx, 0);
|
||||
callout_init_mtx(&sc->tx_timeout, &sc->txq_state_mtx, 0);
|
||||
@ -2051,14 +2055,13 @@ wpi_rx_statistics(struct wpi_softc *sc, struct wpi_rx_desc *desc,
|
||||
static void
|
||||
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_data *data = &ring->data[desc->idx];
|
||||
struct wpi_tx_stat *stat = (struct wpi_tx_stat *)(desc + 1);
|
||||
struct mbuf *m;
|
||||
struct ieee80211_node *ni;
|
||||
struct ieee80211vap *vap;
|
||||
uint32_t status = le32toh(stat->status);
|
||||
int ackfailcnt = stat->ackfailcnt / WPI_NTRIES_DEFAULT;
|
||||
|
||||
KASSERT(data->ni != NULL, ("no node"));
|
||||
KASSERT(data->m != NULL, ("no mbuf"));
|
||||
@ -2075,18 +2078,32 @@ wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc)
|
||||
bus_dmamap_unload(ring->data_dmat, data->map);
|
||||
m = data->m, data->m = NULL;
|
||||
ni = data->ni, data->ni = NULL;
|
||||
vap = ni->ni_vap;
|
||||
|
||||
/*
|
||||
* Update rate control statistics for the node.
|
||||
*/
|
||||
if (status & WPI_TX_STATUS_FAIL) {
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL);
|
||||
} else
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL);
|
||||
txs->short_retries = stat->rtsfailcnt;
|
||||
txs->long_retries = stat->ackfailcnt / WPI_NTRIES_DEFAULT;
|
||||
if (!(status & WPI_TX_STATUS_FAIL))
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
else {
|
||||
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);
|
||||
|
||||
WPI_TXQ_STATE_LOCK(sc);
|
||||
|
@ -170,6 +170,7 @@ struct wpi_softc {
|
||||
|
||||
struct mtx sc_mtx;
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
|
||||
struct mtx tx_mtx;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_ratectl.h>
|
||||
|
||||
#include <dev/wpi/if_wpireg.h>
|
||||
#include <dev/wpi/if_wpivar.h>
|
||||
|
@ -207,9 +207,10 @@ static void iwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
|
||||
struct iwn_rx_data *);
|
||||
static void iwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
|
||||
struct iwn_rx_data *);
|
||||
static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int,
|
||||
static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, int,
|
||||
uint8_t);
|
||||
static void iwn_ampdu_tx_done(struct iwn_softc *, int, int, int, int, void *);
|
||||
static void iwn_ampdu_tx_done(struct iwn_softc *, int, int, int, int, int,
|
||||
void *);
|
||||
static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
|
||||
static void iwn_notif_intr(struct iwn_softc *);
|
||||
static void iwn_wakeup_intr(struct iwn_softc *);
|
||||
@ -3163,6 +3164,7 @@ static void
|
||||
iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
struct iwn_rx_data *data)
|
||||
{
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct iwn_ops *ops = &sc->ops;
|
||||
struct iwn_node *wn;
|
||||
struct ieee80211_node *ni;
|
||||
@ -3174,7 +3176,7 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
uint64_t bitmap;
|
||||
uint16_t ssn;
|
||||
uint8_t tid;
|
||||
int ackfailcnt = 0, i, lastidx, qid, *res, shift;
|
||||
int i, lastidx, qid, *res, shift;
|
||||
int tx_ok = 0, tx_err = 0;
|
||||
|
||||
DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT, "->%s begin\n", __func__);
|
||||
@ -3243,15 +3245,15 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
ni = tap->txa_ni;
|
||||
bitmap = (le64toh(ba->bitmap) >> shift) & wn->agg[tid].bitmap;
|
||||
for (i = 0; bitmap; i++) {
|
||||
txs->flags = 0; /* XXX TODO */
|
||||
if ((bitmap & 1) == 0) {
|
||||
tx_err ++;
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL);
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED;
|
||||
} else {
|
||||
tx_ok ++;
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL);
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
}
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
bitmap >>= 1;
|
||||
}
|
||||
|
||||
@ -3517,9 +3519,9 @@ iwn4965_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
|
||||
if (qid >= sc->firstaggqueue) {
|
||||
iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes,
|
||||
stat->ackfailcnt, &stat->status);
|
||||
stat->rtsfailcnt, stat->ackfailcnt, &stat->status);
|
||||
} else {
|
||||
iwn_tx_done(sc, desc, stat->ackfailcnt,
|
||||
iwn_tx_done(sc, desc, stat->rtsfailcnt, stat->ackfailcnt,
|
||||
le32toh(stat->status) & 0xff);
|
||||
}
|
||||
}
|
||||
@ -3552,9 +3554,9 @@ iwn5000_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
|
||||
if (qid >= sc->firstaggqueue) {
|
||||
iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes,
|
||||
stat->ackfailcnt, &stat->status);
|
||||
stat->rtsfailcnt, stat->ackfailcnt, &stat->status);
|
||||
} else {
|
||||
iwn_tx_done(sc, desc, stat->ackfailcnt,
|
||||
iwn_tx_done(sc, desc, stat->rtsfailcnt, stat->ackfailcnt,
|
||||
le16toh(stat->status) & 0xff);
|
||||
}
|
||||
}
|
||||
@ -3563,14 +3565,14 @@ iwn5000_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
* Adapter-independent backend for TX_DONE firmware notifications.
|
||||
*/
|
||||
static void
|
||||
iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt,
|
||||
uint8_t status)
|
||||
iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int rtsfailcnt,
|
||||
int ackfailcnt, uint8_t status)
|
||||
{
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf];
|
||||
struct iwn_tx_data *data = &ring->data[desc->idx];
|
||||
struct mbuf *m;
|
||||
struct ieee80211_node *ni;
|
||||
struct ieee80211vap *vap;
|
||||
|
||||
KASSERT(data->ni != NULL, ("no node"));
|
||||
|
||||
@ -3581,17 +3583,33 @@ iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt,
|
||||
bus_dmamap_unload(ring->data_dmat, data->map);
|
||||
m = data->m, data->m = NULL;
|
||||
ni = data->ni, data->ni = NULL;
|
||||
vap = ni->ni_vap;
|
||||
|
||||
/*
|
||||
* Update rate control statistics for the node.
|
||||
*/
|
||||
if (status & IWN_TX_FAIL)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL);
|
||||
else
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL);
|
||||
txs->flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY |
|
||||
IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
txs->short_retries = rtsfailcnt;
|
||||
txs->long_retries = ackfailcnt;
|
||||
if (!(status & IWN_TX_FAIL))
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
else {
|
||||
switch (status) {
|
||||
case IWN_TX_FAIL_SHORT_LIMIT:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_SHORT;
|
||||
break;
|
||||
case IWN_TX_FAIL_LONG_LIMIT:
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_LONG;
|
||||
break;
|
||||
case IWN_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);
|
||||
|
||||
/*
|
||||
* Channels marked for "radar" require traffic to be received
|
||||
@ -3656,10 +3674,11 @@ iwn_cmd_done(struct iwn_softc *sc, struct iwn_rx_desc *desc)
|
||||
|
||||
static void
|
||||
iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
|
||||
int ackfailcnt, void *stat)
|
||||
int rtsfailcnt, int ackfailcnt, void *stat)
|
||||
{
|
||||
struct iwn_ops *ops = &sc->ops;
|
||||
struct iwn_tx_ring *ring = &sc->txq[qid];
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct iwn_tx_data *data;
|
||||
struct mbuf *m;
|
||||
struct iwn_node *wn;
|
||||
@ -3698,6 +3717,10 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
|
||||
* handled differently.
|
||||
*/
|
||||
if (nframes == 1) {
|
||||
txs->flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY |
|
||||
IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
txs->short_retries = rtsfailcnt;
|
||||
txs->long_retries = ackfailcnt;
|
||||
if ((*status & 0xff) != 1 && (*status & 0xff) != 2) {
|
||||
#ifdef NOT_YET
|
||||
printf("ieee80211_send_bar()\n");
|
||||
@ -3707,11 +3730,8 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
|
||||
* notification is pushed up to the rate control
|
||||
* layer.
|
||||
*/
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap,
|
||||
ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE,
|
||||
&ackfailcnt,
|
||||
NULL);
|
||||
/* XXX */
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED;
|
||||
} else {
|
||||
/*
|
||||
* If nframes=1, then we won't be getting a BA for
|
||||
@ -3719,12 +3739,9 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
|
||||
* rate control code with how many retries were
|
||||
* needed to send it.
|
||||
*/
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap,
|
||||
ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS,
|
||||
&ackfailcnt,
|
||||
NULL);
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
}
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
}
|
||||
|
||||
bitmap = 0;
|
||||
|
@ -238,6 +238,7 @@ struct iwn_softc {
|
||||
struct cdev *sc_cdev;
|
||||
struct mtx sc_mtx;
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
|
||||
u_int sc_flags;
|
||||
#define IWN_FLAG_HAS_OTPROM (1 << 1)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_amrr.h>
|
||||
#include <net80211/ieee80211_ratectl.h>
|
||||
|
||||
#include <dev/iwn/if_iwnreg.h>
|
||||
#include <dev/iwn/if_iwnvar.h>
|
||||
|
@ -2437,13 +2437,13 @@ mwl_node_getmimoinfo(const struct ieee80211_node *ni,
|
||||
if (mn->mn_ai.rssi_c > rssi_max)
|
||||
rssi_max = mn->mn_ai.rssi_c;
|
||||
|
||||
CVT(mi->rssi[0], mn->mn_ai.rssi_a);
|
||||
CVT(mi->rssi[1], mn->mn_ai.rssi_b);
|
||||
CVT(mi->rssi[2], mn->mn_ai.rssi_c);
|
||||
CVT(mi->ch[0].rssi[0], mn->mn_ai.rssi_a);
|
||||
CVT(mi->ch[1].rssi[0], mn->mn_ai.rssi_b);
|
||||
CVT(mi->ch[2].rssi[0], mn->mn_ai.rssi_c);
|
||||
|
||||
mi->noise[0] = mn->mn_ai.nf_a;
|
||||
mi->noise[1] = mn->mn_ai.nf_b;
|
||||
mi->noise[2] = mn->mn_ai.nf_c;
|
||||
mi->ch[0].noise[0] = mn->mn_ai.nf_a;
|
||||
mi->ch[1].noise[0] = mn->mn_ai.nf_b;
|
||||
mi->ch[2].noise[0] = mn->mn_ai.nf_c;
|
||||
#undef CVT
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: releng/11.1/sys/dev/ral/if_ral_pci.c 287197 2015-08-27 08:56
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_radiotap.h>
|
||||
#include <net80211/ieee80211_ratectl.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
@ -911,17 +911,18 @@ rt2560_encryption_intr(struct rt2560_softc *sc)
|
||||
static void
|
||||
rt2560_tx_intr(struct rt2560_softc *sc)
|
||||
{
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct rt2560_tx_desc *desc;
|
||||
struct rt2560_tx_data *data;
|
||||
struct mbuf *m;
|
||||
struct ieee80211vap *vap;
|
||||
struct ieee80211_node *ni;
|
||||
uint32_t flags;
|
||||
int retrycnt, status;
|
||||
int status;
|
||||
|
||||
bus_dmamap_sync(sc->txq.desc_dmat, sc->txq.desc_map,
|
||||
BUS_DMASYNC_POSTREAD);
|
||||
|
||||
txs->flags = IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
for (;;) {
|
||||
desc = &sc->txq.desc[sc->txq.next];
|
||||
data = &sc->txq.data[sc->txq.next];
|
||||
@ -934,41 +935,37 @@ rt2560_tx_intr(struct rt2560_softc *sc)
|
||||
|
||||
m = data->m;
|
||||
ni = data->ni;
|
||||
vap = ni->ni_vap;
|
||||
|
||||
switch (flags & RT2560_TX_RESULT_MASK) {
|
||||
case RT2560_TX_SUCCESS:
|
||||
retrycnt = 0;
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
txs->long_retries = 0;
|
||||
|
||||
DPRINTFN(sc, 10, "%s\n", "data frame sent successfully");
|
||||
if (data->rix != IEEE80211_FIXED_RATE_NONE)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS,
|
||||
&retrycnt, NULL);
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
status = 0;
|
||||
break;
|
||||
|
||||
case RT2560_TX_SUCCESS_RETRY:
|
||||
retrycnt = RT2560_TX_RETRYCNT(flags);
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
txs->long_retries = RT2560_TX_RETRYCNT(flags);
|
||||
|
||||
DPRINTFN(sc, 9, "data frame sent after %u retries\n",
|
||||
retrycnt);
|
||||
txs->long_retries);
|
||||
if (data->rix != IEEE80211_FIXED_RATE_NONE)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS,
|
||||
&retrycnt, NULL);
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
status = 0;
|
||||
break;
|
||||
|
||||
case RT2560_TX_FAIL_RETRY:
|
||||
retrycnt = RT2560_TX_RETRYCNT(flags);
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_LONG;
|
||||
txs->long_retries = RT2560_TX_RETRYCNT(flags);
|
||||
|
||||
DPRINTFN(sc, 9, "data frame failed after %d retries\n",
|
||||
retrycnt);
|
||||
txs->long_retries);
|
||||
if (data->rix != IEEE80211_FIXED_RATE_NONE)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE,
|
||||
&retrycnt, NULL);
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
status = 1;
|
||||
break;
|
||||
|
||||
|
@ -105,6 +105,7 @@ struct rt2560_vap {
|
||||
|
||||
struct rt2560_softc {
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
struct mtx sc_mtx;
|
||||
struct mbufq sc_snd;
|
||||
device_t sc_dev;
|
||||
|
@ -851,12 +851,13 @@ rt2661_eeprom_read(struct rt2661_softc *sc, uint8_t addr)
|
||||
static void
|
||||
rt2661_tx_intr(struct rt2661_softc *sc)
|
||||
{
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct rt2661_tx_ring *txq;
|
||||
struct rt2661_tx_data *data;
|
||||
uint32_t val;
|
||||
int error, qid, retrycnt;
|
||||
struct ieee80211vap *vap;
|
||||
int error, qid;
|
||||
|
||||
txs->flags = IEEE80211_RATECTL_TX_FAIL_LONG;
|
||||
for (;;) {
|
||||
struct ieee80211_node *ni;
|
||||
struct mbuf *m;
|
||||
@ -879,31 +880,27 @@ rt2661_tx_intr(struct rt2661_softc *sc)
|
||||
/* if no frame has been sent, ignore */
|
||||
if (ni == NULL)
|
||||
continue;
|
||||
else
|
||||
vap = ni->ni_vap;
|
||||
|
||||
switch (RT2661_TX_RESULT(val)) {
|
||||
case RT2661_TX_SUCCESS:
|
||||
retrycnt = RT2661_TX_RETRYCNT(val);
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
txs->long_retries = RT2661_TX_RETRYCNT(val);
|
||||
|
||||
DPRINTFN(sc, 10, "data frame sent successfully after "
|
||||
"%d retries\n", retrycnt);
|
||||
"%d retries\n", txs->long_retries);
|
||||
if (data->rix != IEEE80211_FIXED_RATE_NONE)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS,
|
||||
&retrycnt, NULL);
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
error = 0;
|
||||
break;
|
||||
|
||||
case RT2661_TX_RETRY_FAIL:
|
||||
retrycnt = RT2661_TX_RETRYCNT(val);
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_LONG;
|
||||
txs->long_retries = RT2661_TX_RETRYCNT(val);
|
||||
|
||||
DPRINTFN(sc, 9, "%s\n",
|
||||
"sending data frame failed (too much retries)");
|
||||
if (data->rix != IEEE80211_FIXED_RATE_NONE)
|
||||
ieee80211_ratectl_tx_complete(vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE,
|
||||
&retrycnt, NULL);
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
error = 1;
|
||||
break;
|
||||
|
||||
|
@ -98,6 +98,7 @@ struct rt2661_vap {
|
||||
|
||||
struct rt2661_softc {
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
struct mtx sc_mtx;
|
||||
struct mbufq sc_snd;
|
||||
device_t sc_dev;
|
||||
|
@ -1083,12 +1083,13 @@ rt2860_intr_coherent(struct rt2860_softc *sc)
|
||||
static void
|
||||
rt2860_drain_stats_fifo(struct rt2860_softc *sc)
|
||||
{
|
||||
struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs;
|
||||
struct ieee80211_node *ni;
|
||||
uint32_t stat;
|
||||
int retrycnt;
|
||||
uint8_t wcid, mcs, pid;
|
||||
|
||||
/* drain Tx status FIFO (maxsize = 16) */
|
||||
txs->flags = IEEE80211_RATECTL_STATUS_LONG_RETRY;
|
||||
while ((stat = RAL_READ(sc, RT2860_TX_STAT_FIFO)) & RT2860_TXQ_VLD) {
|
||||
DPRINTFN(4, ("tx stat 0x%08x\n", stat));
|
||||
|
||||
@ -1110,14 +1111,15 @@ rt2860_drain_stats_fifo(struct rt2860_softc *sc)
|
||||
mcs = (stat >> RT2860_TXQ_MCS_SHIFT) & 0x7f;
|
||||
pid = (stat >> RT2860_TXQ_PID_SHIFT) & 0xf;
|
||||
if (mcs + 1 != pid)
|
||||
retrycnt = 1;
|
||||
txs->long_retries = 1;
|
||||
else
|
||||
retrycnt = 0;
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap, ni,
|
||||
IEEE80211_RATECTL_TX_SUCCESS, &retrycnt, NULL);
|
||||
txs->long_retries = 0;
|
||||
txs->status = IEEE80211_RATECTL_TX_SUCCESS;
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
} else {
|
||||
ieee80211_ratectl_tx_complete(ni->ni_vap, ni,
|
||||
IEEE80211_RATECTL_TX_FAILURE, &retrycnt, NULL);
|
||||
txs->status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED;
|
||||
txs->long_retries = 1; /* XXX */
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
if_inc_counter(ni->ni_vap->iv_ifp,
|
||||
IFCOUNTER_OERRORS, 1);
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ struct rt2860_vap {
|
||||
|
||||
struct rt2860_softc {
|
||||
struct ieee80211com sc_ic;
|
||||
struct ieee80211_ratectl_tx_status sc_txs;
|
||||
struct mbufq sc_snd;
|
||||
struct mtx sc_mtx;
|
||||
device_t sc_dev;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_amrr.h>
|
||||
#include <net80211/ieee80211_ratectl.h>
|
||||
|
||||
#include <dev/ral/rt2560reg.h>
|
||||
#include <dev/ral/rt2560var.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user