Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/malo/if_malo.c
Show First 20 Lines • Show All 912 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
malo_fix2rate(int fix_rate) | malo_fix2rate(int fix_rate) | ||||
{ | { | ||||
static const int rates[] = | static const int rates[] = | ||||
{ 2, 4, 11, 22, 12, 18, 24, 36, 48, 96, 108 }; | { 2, 4, 11, 22, 12, 18, 24, 36, 48, 96, 108 }; | ||||
return (fix_rate < nitems(rates) ? rates[fix_rate] : 0); | return (fix_rate < nitems(rates) ? rates[fix_rate] : 0); | ||||
} | } | ||||
/* idiomatic shorthands: MS = mask+shift, SM = shift+mask */ | |||||
#define MS(v,x) (((v) & x) >> x##_S) | |||||
#define SM(v,x) (((v) << x##_S) & x) | |||||
/* | /* | ||||
* Process completed xmit descriptors from the specified queue. | * Process completed xmit descriptors from the specified queue. | ||||
*/ | */ | ||||
static int | static int | ||||
malo_tx_processq(struct malo_softc *sc, struct malo_txq *txq) | malo_tx_processq(struct malo_softc *sc, struct malo_txq *txq) | ||||
{ | { | ||||
struct malo_txbuf *bf; | struct malo_txbuf *bf; | ||||
struct malo_txdesc *ds; | struct malo_txdesc *ds; | ||||
Show All 24 Lines | #ifdef MALO_DEBUG | ||||
if (sc->malo_debug & MALO_DEBUG_XMIT_DESC) | if (sc->malo_debug & MALO_DEBUG_XMIT_DESC) | ||||
malo_printtxbuf(bf, txq->qnum, nreaped); | malo_printtxbuf(bf, txq->qnum, nreaped); | ||||
#endif | #endif | ||||
ni = bf->bf_node; | ni = bf->bf_node; | ||||
if (ni != NULL) { | if (ni != NULL) { | ||||
status = le32toh(ds->status); | status = le32toh(ds->status); | ||||
if (status & MALO_TXD_STATUS_OK) { | if (status & MALO_TXD_STATUS_OK) { | ||||
uint16_t format = le16toh(ds->format); | uint16_t format = le16toh(ds->format); | ||||
uint8_t txant = MS(format, MALO_TXD_ANTENNA); | uint8_t txant = _IEEE80211_MASKSHIFT(format, MALO_TXD_ANTENNA); | ||||
sc->malo_stats.mst_ant_tx[txant]++; | sc->malo_stats.mst_ant_tx[txant]++; | ||||
if (status & MALO_TXD_STATUS_OK_RETRY) | if (status & MALO_TXD_STATUS_OK_RETRY) | ||||
sc->malo_stats.mst_tx_retries++; | sc->malo_stats.mst_tx_retries++; | ||||
if (status & MALO_TXD_STATUS_OK_MORE_RETRY) | if (status & MALO_TXD_STATUS_OK_MORE_RETRY) | ||||
sc->malo_stats.mst_tx_mretries++; | sc->malo_stats.mst_tx_mretries++; | ||||
malo_updatetxrate(ni, ds->datarate); | malo_updatetxrate(ni, ds->datarate); | ||||
sc->malo_stats.mst_tx_rate = ds->datarate; | sc->malo_stats.mst_tx_rate = ds->datarate; | ||||
▲ Show 20 Lines • Show All 1,191 Lines • Show Last 20 Lines |