Skip to content

Commit

Permalink
7154 arn(7D) walks out of bounds when byteswapping the 4K eeprom
Browse files Browse the repository at this point in the history
7152 weird condition in arn(7D) needs clarification
7153 delete unused code in arn(7D)
7155 arn(7D) should include the mac fields in the eeprom enumeration
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
  • Loading branch information
richlowe committed Jul 6, 2016
1 parent 970db7b commit fd7c598
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 150 deletions.
2 changes: 1 addition & 1 deletion usr/src/uts/common/io/arn/arn_ani.c
Expand Up @@ -134,7 +134,7 @@ ath9k_hw_ani_control(struct ath_hal *ah, enum ath9k_ani_cmd cmd, int param)
REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);

if (!on != aniState->ofdmWeakSigDetectOff) {
if ((!on) != aniState->ofdmWeakSigDetectOff) {
if (on)
ahp->ah_stats.ast_ani_ofdmon++;
else
Expand Down
40 changes: 1 addition & 39 deletions usr/src/uts/common/io/arn/arn_beacon.c
Expand Up @@ -28,42 +28,6 @@

#include "arn_core.h"

/*
* This function will modify certain transmit queue properties depending on
* the operating mode of the station (AP or AdHoc). Parameters are AIFS
* settings and channel width min/max
*/

static int
/* LINTED E_STATIC_UNUSED */
arn_beaconq_config(struct arn_softc *sc)
{
struct ath_hal *ah = sc->sc_ah;
struct ath9k_tx_queue_info qi;

(void) ath9k_hw_get_txq_props(ah, sc->sc_beaconq, &qi);
if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) {
/* Always burst out beacon and CAB traffic. */
qi.tqi_aifs = 1;
qi.tqi_cwmin = 0;
qi.tqi_cwmax = 0;
} else {
/* Adhoc mode; important thing is to use 2x cwmin. */
qi.tqi_aifs = sc->sc_beacon_qi.tqi_aifs;
qi.tqi_cwmin = 2*sc->sc_beacon_qi.tqi_cwmin;
qi.tqi_cwmax = sc->sc_beacon_qi.tqi_cwmax;
}

if (!ath9k_hw_set_txq_props(ah, sc->sc_beaconq, &qi)) {
arn_problem("unable to update h/w beacon queue parameters\n");
return (0);
} else {
/* push to h/w */
(void) ath9k_hw_resettxqueue(ah, sc->sc_beaconq);
return (1);
}
}

/*
* Associates the beacon frame buffer with a transmit descriptor. Will set
* up all required antenna switch parameters, rate codes, and channel flags.
Expand Down Expand Up @@ -152,7 +116,6 @@ arn_beacon_setup(struct arn_softc *sc, struct ath_buf *bf)
#ifdef ARN_IBSS
static void
arn_beacon_start_adhoc(struct arn_softc *sc)

{
struct ath_buf *bf = list_head(&sc->sc_bcbuf_list);
struct ieee80211_node *in = bf->bf_in;
Expand Down Expand Up @@ -257,7 +220,6 @@ arn_beacon_return(struct arn_softc *sc)

void
arn_beacon_config(struct arn_softc *sc)

{
struct ath_beacon_config conf;
ieee80211com_t *ic = (ieee80211com_t *)sc;
Expand Down Expand Up @@ -333,7 +295,7 @@ arn_beacon_config(struct arn_softc *sc)
*/
if (sleepduration > intval) {
bs.bs_bmissthreshold = conf.listen_interval *
ATH_DEFAULT_BMISS_LIMIT / 2;
ATH_DEFAULT_BMISS_LIMIT / 2;
} else {
bs.bs_bmissthreshold = DIV_ROUND_UP(conf.bmiss_timeout, intval);
if (bs.bs_bmissthreshold > 15)
Expand Down
7 changes: 0 additions & 7 deletions usr/src/uts/common/io/arn/arn_calib.c
Expand Up @@ -724,13 +724,6 @@ ath9k_hw_getnf(struct ath_hal *ah, struct ath9k_channel *chan)
int16_t nf, nfThresh;
int16_t nfarray[NUM_NF_READINGS] = { 0 };
struct ath9k_nfcal_hist *h;
/* LINTED E_FUNC_SET_NOT_USED */
uint8_t chainmask;

if (AR_SREV_9280(ah))
chainmask = 0x1B;
else
chainmask = 0x3F;

chan->channelFlags &= (~CHANNEL_CW_INT);
if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
Expand Down
2 changes: 1 addition & 1 deletion usr/src/uts/common/io/arn/arn_eeprom.c
Expand Up @@ -471,7 +471,7 @@ ath9k_hw_check_4k_eeprom(struct ath_hal *ah)
integer = swab32(eep->modalHeader.antCtrlCommon);
eep->modalHeader.antCtrlCommon = integer;

for (i = 0; i < AR5416_MAX_CHAINS; i++) {
for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
integer = swab32(eep->modalHeader.antCtrlChain[i]);
eep->modalHeader.antCtrlChain[i] = integer;
}
Expand Down
7 changes: 5 additions & 2 deletions usr/src/uts/common/io/arn/arn_hw.h
Expand Up @@ -472,7 +472,7 @@ struct ar5416Stats {
#define AR5416_EEP4K_MAX_CHAINS 1

enum eeprom_param {
EEP_NFTHRESH_5,
EEP_NFTHRESH_5 = 0,
EEP_NFTHRESH_2,
EEP_MAC_MSW,
EEP_MAC_MID,
Expand All @@ -494,7 +494,10 @@ enum eeprom_param {
EEP_OL_PWRCTRL,
EEP_RC_CHAIN_MASK,
EEP_DAC_HPWR_5G,
EEP_FRAC_N_5G
EEP_FRAC_N_5G,
EEP_MAC_0 = AR_EEPROM_MAC(0),
EEP_MAC_1 = AR_EEPROM_MAC(1),
EEP_MAC_2 = AR_EEPROM_MAC(2)
};

enum ar5416_rates {
Expand Down
54 changes: 2 additions & 52 deletions usr/src/uts/common/io/arn/arn_main.c
Expand Up @@ -502,52 +502,6 @@ arn_desc_alloc(dev_info_t *devinfo, struct arn_softc *sc)
return (DDI_SUCCESS);
}

static struct ath_rate_table *
/* LINTED E_STATIC_UNUSED */
arn_get_ratetable(struct arn_softc *sc, uint32_t mode)
{
struct ath_rate_table *rate_table = NULL;

switch (mode) {
case IEEE80211_MODE_11A:
rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
break;
case IEEE80211_MODE_11B:
rate_table = sc->hw_rate_table[ATH9K_MODE_11B];
break;
case IEEE80211_MODE_11G:
rate_table = sc->hw_rate_table[ATH9K_MODE_11G];
break;
#ifdef ARB_11N
case IEEE80211_MODE_11NA_HT20:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
break;
case IEEE80211_MODE_11NG_HT20:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
break;
case IEEE80211_MODE_11NA_HT40PLUS:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS];
break;
case IEEE80211_MODE_11NA_HT40MINUS:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
break;
case IEEE80211_MODE_11NG_HT40PLUS:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
break;
case IEEE80211_MODE_11NG_HT40MINUS:
rate_table = sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS];
break;
#endif
default:
ARN_DBG((ARN_DBG_FATAL, "arn: arn_get_ratetable(): "
"invalid mode %u\n", mode));
return (NULL);
}

return (rate_table);

}

static void
arn_setcurmode(struct arn_softc *sc, enum wireless_mode mode)
{
Expand Down Expand Up @@ -976,7 +930,6 @@ arn_set_channel(struct arn_softc *sc, struct ath9k_channel *hchan)
*/
static void
arn_ani_calibrate(void *arg)

{
ieee80211com_t *ic = (ieee80211com_t *)arg;
struct arn_softc *sc = (struct arn_softc *)ic;
Expand Down Expand Up @@ -1017,7 +970,7 @@ arn_ani_calibrate(void *arg)
if ((timestamp - sc->sc_ani.sc_resetcal_timer) >=
ATH_RESTART_CALINTERVAL) {
ath9k_hw_reset_calvalid(ah, ah->ah_curchan,
&sc->sc_ani.sc_caldone);
&sc->sc_ani.sc_caldone);
if (sc->sc_ani.sc_caldone)
sc->sc_ani.sc_resetcal_timer = timestamp;
}
Expand Down Expand Up @@ -2628,8 +2581,6 @@ arn_setup_ht_cap(struct arn_softc *sc)
#define ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3 /* 2 ^ 16 */
#define ATH9K_HT_CAP_MPDUDENSITY_8 0x6 /* 8 usec */

/* LINTED E_FUNC_SET_NOT_USED */
uint8_t tx_streams;
uint8_t rx_streams;

arn_ht_conf *ht_info = &sc->sc_ht_conf;
Expand All @@ -2646,7 +2597,6 @@ arn_setup_ht_cap(struct arn_softc *sc)

/* set up supported mcs set */
(void) memset(&ht_info->rx_mcs_mask, 0, sizeof (ht_info->rx_mcs_mask));
tx_streams = ISP2(sc->sc_ah->ah_caps.tx_chainmask) ? 1 : 2;
rx_streams = ISP2(sc->sc_ah->ah_caps.rx_chainmask) ? 1 : 2;

ht_info->rx_mcs_mask[0] = 0xff;
Expand Down Expand Up @@ -3501,7 +3451,7 @@ DDI_DEFINE_STREAM_OPS(arn_dev_ops, nulldev, nulldev, arn_attach, arn_detach,

static struct modldrv arn_modldrv = {
&mod_driverops, /* Type of module. This one is a driver */
"arn-Atheros 9000 series driver:2.0", /* short description */
"Atheros 9000 series driver", /* short description */
&arn_dev_ops /* driver specific ops */
};

Expand Down
48 changes: 2 additions & 46 deletions usr/src/uts/common/io/arn/arn_xmit.c
Expand Up @@ -289,7 +289,6 @@ static void
arn_tid_drain(struct arn_softc *sc,
struct ath_txq *txq,
struct ath_atx_tid *tid)

{
struct ath_buf *bf;

Expand Down Expand Up @@ -1147,49 +1146,6 @@ arn_tx_txqaddbuf(struct arn_softc *sc,
}
#endif /* ARN_TX_AGGREGATION */

/*
* ath_pkt_dur - compute packet duration (NB: not NAV)
* rix - rate index
* pktlen - total bytes (delims + data + fcs + pads + pad delims)
* width - 0 for 20 MHz, 1 for 40 MHz
* half_gi - to use 4us v/s 3.6 us for symbol time
*/

static uint32_t
/* LINTED E_STATIC_UNUSED */
arn_pkt_duration(struct arn_softc *sc, uint8_t rix, struct ath_buf *bf,
int width, int half_gi, boolean_t shortPreamble)
{
struct ath_rate_table *rate_table = sc->sc_currates;
uint32_t nbits, nsymbits, duration, nsymbols;
uint8_t rc;
int streams, pktlen;

pktlen = bf_isaggr(bf) ? bf->bf_al : bf->bf_frmlen;
rc = rate_table->info[rix].ratecode;

/* for legacy rates, use old function to compute packet duration */
if (!IS_HT_RATE(rc))
return (ath9k_hw_computetxtime(sc->sc_ah, rate_table, pktlen,
rix, shortPreamble));

/* find number of symbols: PLCP + data */
nbits = (pktlen << 3) + OFDM_PLCP_BITS;
nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width];
nsymbols = (nbits + nsymbits - 1) / nsymbits;

if (!half_gi)
duration = SYMBOL_TIME(nsymbols);
else
duration = SYMBOL_TIME_HALFGI(nsymbols);

/* addup duration for legacy/ht training and signal fields */
streams = HT_RC_2_STREAMS(rc);
duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);

return (duration);
}

static struct ath_buf *
arn_tx_get_buffer(struct arn_softc *sc)
{
Expand Down Expand Up @@ -1332,8 +1288,8 @@ ath_pkt_duration(struct arn_softc *sc, uint8_t rix, struct ath_buf *bf,
/* Rate module function to set rate related fields in tx descriptor */
static void
ath_buf_set_rate(struct arn_softc *sc,
struct ath_buf *bf,
struct ieee80211_frame *wh)
struct ath_buf *bf,
struct ieee80211_frame *wh)
{
struct ath_hal *ah = sc->sc_ah;
struct ath_rate_table *rt;
Expand Down
2 changes: 0 additions & 2 deletions usr/src/uts/intel/arn/Makefile
Expand Up @@ -62,10 +62,8 @@ LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211
LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN

CERRWARN += -_gcc=-Wno-unused-variable
CERRWARN += -_gcc=-Wno-unused-function
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-char-subscripts
CERRWARN += -_gcc=-Wno-empty-body

#
# Default build targets.
Expand Down

0 comments on commit fd7c598

Please sign in to comment.