aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ah_osdep.c3
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c2
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c2
-rw-r--r--sys/dev/ath/ath_rate/amrr/amrr.c7
-rw-r--r--sys/dev/ath/ath_rate/onoe/onoe.c8
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.c27
-rw-r--r--sys/dev/ath/if_ath.c2
-rw-r--r--sys/dev/ath/if_ath_keycache.c3
-rw-r--r--sys/dev/ath/if_ath_lna_div.c6
-rw-r--r--sys/dev/ath/if_ath_pci.c5
-rw-r--r--sys/dev/ath/if_ath_spectral.c7
-rw-r--r--sys/dev/ath/if_ath_tx.c28
-rw-r--r--sys/dev/ath/if_ath_tx_ht.c44
13 files changed, 46 insertions, 98 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index b9098121629d..6278d6dbdb8f 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -42,8 +42,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/conf.h>
-
-#include <machine/stdarg.h>
+#include <sys/stdarg.h>
#include <net/ethernet.h> /* XXX for ether_sprintf */
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
index 9352c6decd82..04b75dd09662 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
@@ -324,7 +324,7 @@ ar5212GetRfgain(struct ath_hal *ah)
ahp->ah_rfgainState = HAL_RFGAIN_NEED_CHANGE;
/* for ap51 */
ahp->ah_cwCalRequire = AH_TRUE;
- /* Request IQ recalibration for temperature chang */
+ /* Request IQ recalibration for temperature change */
ahp->ah_bIQCalibration = IQ_CAL_INACTIVE;
}
}
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c b/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
index 01a224cbbfe9..fb2700771ffa 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
@@ -54,7 +54,7 @@ ar9285BTCoexAntennaDiversity(struct ath_hal *ah)
!! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE));
if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) ||
- (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) {
+ (AH5212(ah)->ah_diversity == AH_TRUE)) {
if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) &&
(AH5212(ah)->ah_antControl == HAL_ANT_VARIABLE)) {
/* Enable antenna diversity */
diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c
index 81bd03484de5..8f696eba23eb 100644
--- a/sys/dev/ath/ath_rate/amrr/amrr.c
+++ b/sys/dev/ath/ath_rate/amrr/amrr.c
@@ -245,8 +245,11 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
* lowest hardware rate.
*/
if (ni->ni_rates.rs_nrates > 0) {
- ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL;
- amn->amn_tx_rix0 = sc->sc_rixmap[ni->ni_txrate];
+ uint8_t dot11rate;
+
+ dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL;
+ amn->amn_tx_rix0 = sc->sc_rixmap[dot11rate];
+ ieee80211_node_set_txrate_dot11rate(ni, dot11rate);
amn->amn_tx_rate0 = rt->info[amn->amn_tx_rix0].rateCode;
amn->amn_tx_rate0sp = amn->amn_tx_rate0 |
rt->info[amn->amn_tx_rix0].shortPreamble;
diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c
index 8d86f13ef703..035d54b00b62 100644
--- a/sys/dev/ath/ath_rate/onoe/onoe.c
+++ b/sys/dev/ath/ath_rate/onoe/onoe.c
@@ -203,6 +203,7 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
struct ieee80211vap *vap = ni->ni_vap;
const HAL_RATE_TABLE *rt = sc->sc_currates;
u_int8_t rix;
+ uint8_t dot11rate;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
@@ -221,8 +222,9 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
if (ni->ni_rates.rs_nrates == 0)
goto done;
on->on_rix = rate;
- ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL;
- on->on_tx_rix0 = sc->sc_rixmap[ni->ni_txrate];
+ dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL;
+ ieee80211_node_set_txrate_dot11rate(ni, dot11rate);
+ on->on_tx_rix0 = sc->sc_rixmap[dot11rate];
on->on_tx_rate0 = rt->info[on->on_tx_rix0].rateCode;
on->on_tx_rate0sp = on->on_tx_rate0 |
@@ -389,7 +391,7 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni)
if (nrate != on->on_rix) {
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
"%s: %dM -> %dM (%d ok, %d err, %d retr)", __func__,
- ni->ni_txrate / 2,
+ ieee80211_node_get_txrate_kbit(ni) / 1000,
(rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2,
on->on_tx_ok, on->on_tx_err, on->on_tx_retr);
ath_rate_update(sc, ni, nrate);
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index 8e70699f708d..291d1ec64ed7 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -179,7 +179,7 @@ ath_rate_sample_find_min_pktlength(struct ath_softc *sc,
const struct txschedule *sched = &sn->sched[rix0];
int max_pkt_length = 65530; // ATH_AGGR_MAXSIZE
// Note: this may not be true in all cases; need to check?
- int is_ht40 = (an->an_node.ni_chw == 40);
+ int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
// Note: not great, but good enough..
int idx = is_ht40 ? MCS_HT40 : MCS_HT20;
@@ -397,7 +397,8 @@ pick_best_rate(struct ath_node *an, const HAL_RATE_TABLE *rt,
* be abstracted out and properly handled.
*/
if (an->an_node.ni_flags & IEEE80211_NODE_HT) {
- if (best_rate_tt == 0 || ((tt * 10) <= (best_rate_tt * 10))) {
+ if (best_rate_tt == 0 ||
+ ((tt * 9) <= (best_rate_tt * 10))) {
best_rate_tt = tt;
best_rate_rix = rix;
best_rate_pct = pct;
@@ -854,9 +855,14 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
/*
* Set the visible txrate for this node.
*/
- an->an_node.ni_txrate =
- (rt->info[best_rix].phy == IEEE80211_T_HT) ?
- MCS(best_rix) : DOT11RATE(best_rix);
+ if (rt->info[best_rix].phy == IEEE80211_T_HT)
+ ieee80211_node_set_txrate_ht_mcsrate(
+ &an->an_node,
+ MCS(best_rix) & IEEE80211_RATE_VAL);
+ else
+ ieee80211_node_set_txrate_dot11rate(
+ &an->an_node,
+ DOT11RATE(best_rix));
}
rix = sn->current_rix[size_bin];
sn->packets_since_switch[size_bin]++;
@@ -973,7 +979,7 @@ update_stats(struct ath_softc *sc, struct ath_node *an,
const int size_bin = size_to_bin(frame_size);
const int size = bin_to_size(size_bin);
int tt;
- int is_ht40 = (an->an_node.ni_chw == 40);
+ int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
int pct;
if (!IS_RATE_DEFINED(sn, rix0))
@@ -1359,7 +1365,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
continue;
printf(" %d %s/%d", dot11rate(rt, rix), dot11rate_label(rt, rix),
calc_usecs_unicast_packet(sc, 1600, rix, 0,0,
- (ni->ni_chw == 40)));
+ (ni->ni_chw == IEEE80211_STA_RX_BW_40)));
}
printf("\n");
}
@@ -1390,7 +1396,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
sn->stats[y][rix].perfect_tx_time =
calc_usecs_unicast_packet(sc, size, rix, 0, 0,
- (ni->ni_chw == 40));
+ (ni->ni_chw == IEEE80211_STA_RX_BW_40));
sn->stats[y][rix].average_tx_time =
sn->stats[y][rix].perfect_tx_time;
}
@@ -1408,9 +1414,10 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
#endif
/* set the visible bit-rate */
if (sn->static_rix != -1)
- ni->ni_txrate = DOT11RATE(sn->static_rix);
+ ieee80211_node_set_txrate_dot11rate(ni,
+ DOT11RATE(sn->static_rix));
else
- ni->ni_txrate = RATE(0);
+ ieee80211_node_set_txrate_dot11rate(ni, RATE(0));
#undef RATE
#undef DOT11RATE
}
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 094517da5689..934024ddfbcf 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2446,7 +2446,7 @@ ath_bmiss_vap(struct ieee80211vap *vap)
* against the next beacon.
*
* This handles three common beacon miss cases in STA powersave mode -
- * (a) the beacon TBTT isnt a multiple of bintval;
+ * (a) the beacon TBTT isn't a multiple of bintval;
* (b) the beacon was missed; and
* (c) the beacons are being delayed because the AP is busy and
* isn't reliably able to meet its TBTT.
diff --git a/sys/dev/ath/if_ath_keycache.c b/sys/dev/ath/if_ath_keycache.c
index bc94273bf5ce..a58625ad2803 100644
--- a/sys/dev/ath/if_ath_keycache.c
+++ b/sys/dev/ath/if_ath_keycache.c
@@ -434,8 +434,7 @@ ath_key_alloc(struct ieee80211vap *vap, struct ieee80211_key *k,
/*
* Only global keys should have key index assigned.
*/
- if (!(&vap->iv_nw_keys[0] <= k &&
- k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) {
+ if (!ieee80211_is_key_global(vap, k)) {
/* should not happen */
DPRINTF(sc, ATH_DEBUG_KEYCACHE,
"%s: bogus group key\n", __func__);
diff --git a/sys/dev/ath/if_ath_lna_div.c b/sys/dev/ath/if_ath_lna_div.c
index 1b20591fc64e..0755bb667716 100644
--- a/sys/dev/ath/if_ath_lna_div.c
+++ b/sys/dev/ath/if_ath_lna_div.c
@@ -96,12 +96,6 @@ ath_lna_div_attach(struct ath_softc *sc)
ss = malloc(sizeof(struct if_ath_ant_comb_state),
M_TEMP, M_WAITOK | M_ZERO);
- if (ss == NULL) {
- device_printf(sc->sc_dev, "%s: failed to allocate\n",
- __func__);
- /* Don't fail at this point */
- return (0);
- }
/* Fetch the hardware configuration */
OS_MEMZERO(&div_ant_conf, sizeof(div_ant_conf));
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 72f0a802aa5f..a242eab7a694 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -269,11 +269,6 @@ ath_pci_attach(device_t dev)
__func__, fw->data);
sc->sc_eepromdata =
malloc(fw->datasize, M_TEMP, M_WAITOK | M_ZERO);
- if (! sc->sc_eepromdata) {
- device_printf(dev, "%s: can't malloc eepromdata\n",
- __func__);
- goto bad4;
- }
memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
firmware_put(fw, 0);
}
diff --git a/sys/dev/ath/if_ath_spectral.c b/sys/dev/ath/if_ath_spectral.c
index 58f21b526e93..951d66605981 100644
--- a/sys/dev/ath/if_ath_spectral.c
+++ b/sys/dev/ath/if_ath_spectral.c
@@ -112,13 +112,6 @@ ath_spectral_attach(struct ath_softc *sc)
ss = malloc(sizeof(struct ath_spectral_state),
M_TEMP, M_WAITOK | M_ZERO);
-
- if (ss == NULL) {
- device_printf(sc->sc_dev, "%s: failed to alloc memory\n",
- __func__);
- return (-ENOMEM);
- }
-
sc->sc_spectral = ss;
(void) ath_hal_spectral_get_config(sc->sc_ah, &ss->spectral_state);
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index 69d0b5c00848..1559b66a7c7d 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -1133,8 +1133,7 @@ ath_tx_calc_duration(struct ath_softc *sc, struct ath_buf *bf)
* Calculate duration. This logically belongs in the 802.11
* layer but it lacks sufficient information to calculate it.
*/
- if ((flags & HAL_TXDESC_NOACK) == 0 &&
- (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) {
+ if ((flags & HAL_TXDESC_NOACK) == 0 && !IEEE80211_IS_CTL(wh)) {
u_int16_t dur;
if (shortPreamble)
dur = rt->info[rix].spAckDuration;
@@ -2051,7 +2050,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni,
*/
if (IEEE80211_QOS_HAS_SEQ(wh) &&
(! IEEE80211_IS_MULTICAST(wh->i_addr1)) &&
- (subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL)) {
+ (! IEEE80211_IS_QOS_NULL(wh))) {
bf->bf_state.bfs_dobaw = 1;
}
}
@@ -2578,25 +2577,6 @@ badbad:
*/
/*
- * XXX doesn't belong here!
- */
-static int
-ieee80211_is_action(struct ieee80211_frame *wh)
-{
- /* Type: Management frame? */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
- IEEE80211_FC0_TYPE_MGT)
- return 0;
-
- /* Subtype: Action frame? */
- if ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) !=
- IEEE80211_FC0_SUBTYPE_ACTION)
- return 0;
-
- return 1;
-}
-
-/*
* Return an alternate TID for ADDBA request frames.
*
* Yes, this likely should be done in the net80211 layer.
@@ -2612,7 +2592,7 @@ ath_tx_action_frame_override_queue(struct ath_softc *sc,
uint16_t baparamset;
/* Not action frame? Bail */
- if (! ieee80211_is_action(wh))
+ if (! IEEE80211_IS_MGMT_ACTION(wh))
return 0;
/* XXX Not needed for frames we send? */
@@ -3011,7 +2991,7 @@ ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni,
* RX side.
*/
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
- if (subtype == IEEE80211_FC0_SUBTYPE_QOS_NULL) {
+ if (IEEE80211_IS_QOS_NULL(wh)) {
/* XXX no locking for this TID? This is a bit of a problem. */
seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID];
INCR(ni->ni_txseqs[IEEE80211_NONQOS_TID], IEEE80211_SEQ_RANGE);
diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c
index ca69d4558d76..e7ee029fecf0 100644
--- a/sys/dev/ath/if_ath_tx_ht.c
+++ b/sys/dev/ath/if_ath_tx_ht.c
@@ -222,7 +222,6 @@ void
ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
{
struct ieee80211_node *ni = bf->bf_node;
- struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = ni->ni_ic;
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ath_rc_series *rc = bf->bf_state.bfs_rc;
@@ -284,7 +283,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
if (IS_HT_RATE(rate)) {
rc[i].flags |= ATH_RC_HT_FLAG;
- if (ni->ni_chw == 40)
+ if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
rc[i].flags |= ATH_RC_CW40_FLAG;
/*
@@ -296,18 +295,14 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
* and doesn't return the fractional part, so
* we are always "out" by some amount.
*/
- if (ni->ni_chw == 40 &&
- ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 &&
- ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40 &&
- vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40 &&
+ if (ni->ni_chw == IEEE80211_STA_RX_BW_40 &&
+ ieee80211_ht_check_tx_shortgi_40(ni) &&
(bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
rc[i].flags |= ATH_RC_SGI_FLAG;
}
- if (ni->ni_chw == 20 &&
- ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 &&
- ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20 &&
- vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20 &&
+ if (ni->ni_chw == IEEE80211_STA_RX_BW_20 &&
+ ieee80211_ht_check_tx_shortgi_20(ni) &&
(bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
rc[i].flags |= ATH_RC_SGI_FLAG;
}
@@ -406,7 +401,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
{
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
- struct ieee80211vap *vap = ni->ni_vap;
int ndelim, mindelim = 0;
int mpdudensity; /* in 1/100'th of a microsecond */
int peer_mpdudensity; /* net80211 value */
@@ -418,17 +412,7 @@ ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
/*
* Get the advertised density from the node.
*/
- peer_mpdudensity =
- _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
-
- /*
- * vap->iv_ampdu_density is a net80211 value, rather than the actual
- * density. Larger values are longer A-MPDU density spacing values,
- * and we want to obey larger configured / negotiated density values
- * per station if we get it.
- */
- if (vap->iv_ampdu_density > peer_mpdudensity)
- peer_mpdudensity = vap->iv_ampdu_density;
+ peer_mpdudensity = ieee80211_ht_get_node_ampdu_density(ni);
/*
* Convert the A-MPDU density net80211 value to a 1/100 microsecond
@@ -563,8 +547,6 @@ static int
ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni,
struct ath_buf *bf)
{
- struct ieee80211vap *vap = ni->ni_vap;
-
int amin = ATH_AGGR_MAXSIZE;
int i;
@@ -572,15 +554,9 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni,
if (sc->sc_aggr_limit > 0 && sc->sc_aggr_limit < ATH_AGGR_MAXSIZE)
amin = sc->sc_aggr_limit;
- /* Check the vap configured transmit limit */
- amin = MIN(amin, ath_rx_ampdu_to_byte(vap->iv_ampdu_limit));
-
- /*
- * Check the HTCAP field for the maximum size the node has
- * negotiated. If it's smaller than what we have, cap it there.
- */
- amin = MIN(amin, ath_rx_ampdu_to_byte(
- _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)));
+ /* Check the vap and node configured transmit limit */
+ amin = MIN(amin,
+ ath_rx_ampdu_to_byte(ieee80211_ht_get_node_ampdu_limit(ni)));
for (i = 0; i < ATH_RC_NUM; i++) {
if (bf->bf_state.bfs_rc[i].tries == 0)
@@ -593,7 +569,7 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni,
"peer maxrxampdu=%d, max frame len=%d\n",
__func__,
sc->sc_aggr_limit,
- vap->iv_ampdu_limit,
+ ni->ni_vap->iv_ampdu_limit,
_IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
amin);