ath5k cleanups and fixes
cover ath5k cleanups and fixes
Hello,
Here are a few cleanups from myself and Nick, and a couple of minor filter fixes, for 2.6.37.
Bob Copeland (4):
ath5k: clean up some comments
ath5k: remove monitor check in receive_frame_ok filter
ath5k: remove all mention of monitor iftype
ath5k: don't enable probe request rx for STAs
Nick Kossifidis (2):
ath5k: rename ath5k_hw_set_associd to _set_bssid
ath5k: remove own (wrong) IEEE80211_MAX_LEN
drivers/net/wireless/ath/ath5k/ani.c | 6 +- drivers/net/wireless/ath/ath5k/ath5k.h | 7 +-- drivers/net/wireless/ath/ath5k/attach.c | 8 ++-- drivers/net/wireless/ath/ath5k/base.c | 81 +++++++++++++---------------- drivers/net/wireless/ath/ath5k/dma.c | 4 +- drivers/net/wireless/ath/ath5k/eeprom.c | 4 +- drivers/net/wireless/ath/ath5k/pcu.c | 13 ++--- drivers/net/wireless/ath/ath5k/phy.c | 15 ++--- drivers/net/wireless/ath/ath5k/reg.h | 2 +- drivers/net/wireless/ath/ath5k/reset.c | 24 ++++---- drivers/net/wireless/ath/ath5k/rfbuffer.h | 4 +- 11 files changed, 77 insertions(+), 91 deletions(-)
PATCH 1/6 ath5k: rename ath5k_hw_set_associd to _set_bssid
From: Nick Kossifidis <[email protected]>
Although the named function also sets the aid, its main purpose is configuring the bssid and we use that everywhere else.
--- drivers/net/wireless/ath/ath5k/ath5k.h | 2 +- drivers/net/wireless/ath/ath5k/attach.c | 2 +- drivers/net/wireless/ath/ath5k/base.c | 4 ++-- drivers/net/wireless/ath/ath5k/pcu.c | 13 ++++++------- drivers/net/wireless/ath/ath5k/reset.c | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -1
@@ -1190,7 +1190,7 @@ extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode);void ath5k_hw_set_coverage_class (struct ath5k_hw *ah,u8 coverage_class);/* BSSID Functions */ int ath5k_hw_set_lladdr (struct ath5k_hw *ah,const u8 *mac); -void ath5k_hw_set_associd (struct ath5k_hw *ah); +void ath5k_hw_set_bssid (struct ath5k_hw *ah);void ath5k_hw_set_bssid_mask (struct ath5k_hw *ah,const u8 *mask);/* Receive start/stop functions */ void ath5k_hw_start_rx_pcu (struct ath5k_hw *ah);
drivers/net/wireless/ath/ath5k/attach.c +1 -1
@@ -329,7 +329,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ memcpy (common->curbssid, ath_bcast_mac,ETH_ALEN ); -ath5k_hw_set_associd (ah); +ath5k_hw_set_bssid (ah);ath5k_hw_set_opmode (ah, sc->opmode);ath5k_hw_rfgain_opt_init (ah);
drivers/net/wireless/ath/ath5k/base.c +2 -2
@@ -3475,7 +3475,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,/* Cache for later use during resets */ memcpy (common->curbssid, bss_conf->bssid,ETH_ALEN ); common->curaid =0 ; -ath5k_hw_set_associd (ah); +ath5k_hw_set_bssid (ah);mmiowb (); }
@@ -3493,7 +3493,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,"Bss Info ASSOC %d, bssid: %pM\n" , bss_conf->aid, common->curbssid); common->curaid = bss_conf->aid; -ath5k_hw_set_associd (ah); +ath5k_hw_set_bssid (ah);/* Once ANI is available you would start it here */ } }
drivers/net/wireless/ath/ath5k/pcu.c +6 -7
@@ -308,27 +308,26 @@ int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) }/** -* ath5k_hw_set_associd - Set BSSID for association +* ath5k_hw_set_bssid - Set current BSSID on hw * * @ah: The &struct ath5k_hw -* @bssid: BSSID -* @assoc_id: Assoc id * -* Sets the BSSID which trigers the "SME Join" operation +* Sets the current BSSID and BSSID mask we have from the +* common struct into the hardware */ -void ath5k_hw_set_associd (struct ath5k_hw *ah) +void ath5k_hw_set_bssid (struct ath5k_hw *ah) {struct ath_common *common =ath5k_hw_common (ah);u16 tim_offset =0 ;/* -* Set simple BSSID mask on 5212 +* Set BSSID mask on 5212 */ if (ah->ah_version ==AR5K_AR5212 )ath_hw_setbssidmask (common);/* -* Set BSSID which triggers the "SME Join" operation +* Set BSSID */ ath5k_hw_reg_write(ah, get_unaligned_le32(common->curbssid),
drivers/net/wireless/ath/ath5k/reset.c +1 -1
@@ -1160,7 +1160,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,*/ /* Restore bssid and bssid mask */ -ath5k_hw_set_associd (ah); +ath5k_hw_set_bssid (ah);/* Set PCU config */ ath5k_hw_set_opmode (ah, op_mode);
Signature · 1 line
1.7.1.1
PATCH 2/6 ath5k: remove own (wrong) IEEE80211_MAX_LEN
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
Use the version already supplied in include/linux/ieee80211.h.
--- drivers/net/wireless/ath/ath5k/ath5k.h | 5 +---- drivers/net/wireless/ath/ath5k/base.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -4
@@ -175,7 +175,7 @@#define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF 0#define AR5K_TUNE_RADAR_ALERT false#define AR5K_TUNE_MIN_TX_FIFO_THRES 1 -#define AR5K_TUNE_MAX_TX_FIFO_THRES ((IEEE80211_MAX_LEN / 64) + 1) +#define AR5K_TUNE_MAX_TX_FIFO_THRES ((IEEE80211_MAX_FRAME_LEN / 64) + 1)#define AR5K_TUNE_REGISTER_TIMEOUT 20000/* Register for RSSI threshold has a mask of 0xff, so 255 seems to * be the max value. */
@@ -343,9 +343,6 @@ struct ath5k_srev_name {#define AR5K_SREV_PHY_5413 0x61#define AR5K_SREV_PHY_2425 0x70 -/* IEEE defs */ -#define IEEE80211_MAX_LEN 2500 -/* TODO add support to mac80211 for vendor-specific rates and modes */ /*
drivers/net/wireless/ath/ath5k/base.c +1 -1
@@ -1709,7 +1709,7 @@ ath5k_rx_start(struct ath5k_softc *sc)struct ath5k_buf *bf;int ret; - common->rx_bufsize =roundup (IEEE80211_MAX_LEN , common->cachelsz); + common->rx_bufsize =roundup (IEEE80211_MAX_FRAME_LEN , common->cachelsz);ATH5K_DBG (sc,ATH5K_DEBUG_RESET ,"cachelsz %u rx_bufsize %u\n" , common->cachelsz, common->rx_bufsize);
Signature · 1 line
1.7.1.1
PATCH 3/6 ath5k: clean up some comments
In reply to Bob CopelandThis fixes a few misspellings, word repetitions, and some grammar nits in ath5k comments. No code changes.
--- drivers/net/wireless/ath/ath5k/ani.c | 6 +- drivers/net/wireless/ath/ath5k/attach.c | 6 +- drivers/net/wireless/ath/ath5k/base.c | 58 ++++++++++++++-------------- drivers/net/wireless/ath/ath5k/dma.c | 4 +- drivers/net/wireless/ath/ath5k/eeprom.c | 4 +- drivers/net/wireless/ath/ath5k/phy.c | 15 +++---- drivers/net/wireless/ath/ath5k/reg.h | 2 +- drivers/net/wireless/ath/ath5k/reset.c | 22 +++++----- drivers/net/wireless/ath/ath5k/rfbuffer.h | 4 +- 9 files changed, 59 insertions(+), 62 deletions(-)
drivers/net/wireless/ath/ath5k/ani.c +3 -3
@@ -552,9 +552,9 @@ ath5k_ani_mib_intr(struct ath5k_hw *ah)if (ah->ah_sc->ani_state.ani_mode !=ATH5K_ANI_MODE_AUTO )return ; -/* if one of the errors triggered, we can get a superfluous second -* interrupt, even though we have already reset the register. the -* function detects that so we can return early */ +/* If one of the errors triggered, we can get a superfluous second +* interrupt, even though we have already reset the register. The +* function detects that so we can return early. */ if (ath5k_ani_save_and_clear_phy_errors (ah, as) ==0 )return ;
drivers/net/wireless/ath/ath5k/attach.c +3 -3
@@ -139,12 +139,12 @@ int ath5k_hw_attach(struct ath5k_softc *sc)else ah->ah_version =AR5K_AR5212 ; -/*Fill the ath5k_hw struct with the needed functions*/ +/* Fill the ath5k_hw struct with the needed functions */ ret =ath5k_hw_init_desc_functions (ah);if (ret) goto err_free; -/* Bring device out of sleep and reset it's units */ +/* Bring device out of sleep and reset its units */ ret =ath5k_hw_nic_wakeup (ah,0 , true);if (ret) goto err_free;
@@ -158,7 +158,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) CHANNEL_5GHZ); ah->ah_phy =AR5K_PHY (0 ); -/* Try to identify radio chip based on it's srev */ +/* Try to identify radio chip based on its srev */ switch (ah->ah_radio_5ghz_revision &0xf0 ) {case AR5K_SREV_RAD_5111 : ah->ah_radio =AR5K_RF5111 ;
drivers/net/wireless/ath/ath5k/base.c +29 -29
138 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/dma.c +2 -2
@@ -377,11 +377,11 @@ int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, u32 phys_addr)* * This function increases/decreases the tx trigger level for the tx fifo * buffer (aka FIFO threshold) that is used to indicate when PCU flushes -* the buffer and transmits it's data. Lowering this results sending small +* the buffer and transmits its data. Lowering this results sending small * frames more quickly but can lead to tx underruns, raising it a lot can * result other problems (i think bmiss is related). Right now we start with * the lowest possible (64Bytes) and if we get tx underrun we increase it using -* the increase flag. Returns -EIO if we have have reached maximum/minimum. +* the increase flag. Returns -EIO if we have reached maximum/minimum. * * XXX: Link this with tx DMA size ? * XXX: Use it to save interrupts ?
drivers/net/wireless/ath/ath5k/eeprom.c +2 -2
@@ -661,7 +661,7 @@ ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)* (eeprom versions < 4). For RF5111 we have 11 pre-defined PCDAC * steps that match with the power values we read from eeprom. On * older eeprom versions (< 3.2) these steps are equaly spaced at -* 10% of the pcdac curve -until the curve reaches it's maximum- +* 10% of the pcdac curve -until the curve reaches its maximum- * (11 steps from 0 to 100%) but on newer eeprom versions (>= 3.2) * these 11 steps are spaced in a different way. This function returns * the pcdac steps based on eeprom version and curve min/max so that we
@@ -1113,7 +1113,7 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)*/ /* For RF2413 power calibration data doesn't start on a fixed location and -* if a mode is not supported, it's section is missing -not zeroed-. +* if a mode is not supported, its section is missing -not zeroed-. * So we need to calculate the starting offset for each section by using * these two functions */
drivers/net/wireless/ath/ath5k/phy.c +6 -9
@@ -115,7 +115,7 @@ static unsigned int ath5k_hw_rfb_op(struct ath5k_hw *ah,\**********************/ /* -* This code is used to optimize rf gain on different environments +* This code is used to optimize RF gain on different environments * (temperature mostly) based on feedback from a power detector. * * It's only used on RF5111 and RF5112, later RF chips seem to have
@@ -302,7 +302,7 @@ static bool ath5k_hw_rf_check_gainf_readback(struct ath5k_hw *ah) }/* Perform gain_F adjustment by choosing the right set -* of parameters from rf gain optimization ladder */ +* of parameters from RF gain optimization ladder */ static s8 ath5k_hw_rf_gainf_adjust (struct ath5k_hw *ah) {const struct ath5k_gain_opt *go;
@@ -367,7 +367,7 @@ done:return ret; } -/* Main callback for thermal rf gain calibration engine +/* Main callback for thermal RF gain calibration engine * Check for a new gain reading and schedule an adjustment * if needed. *
@@ -433,7 +433,7 @@ done:return ah->ah_gain.g_state; } -/* Write initial rf gain table to set the RF sensitivity +/* Write initial RF gain table to set the RF sensitivity * this one works on all RF chips and has nothing to do * with gain_F calibration */ int ath5k_hw_rfgain_init (struct ath5k_hw *ah,unsigned int freq)
@@ -496,7 +496,7 @@ int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)/* -* Setup RF registers by writing rf buffer on hw +* Setup RF registers by writing RF buffer on hw */ int ath5k_hw_rfregs_init (struct ath5k_hw *ah,struct ieee80211_channel *channel,unsigned int mode)
@@ -571,7 +571,7 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,return -EINVAL ; } -/* If it's the first time we set rf buffer, allocate +/* If it's the first time we set RF buffer, allocate * ah->ah_rf_banks based on ah->ah_rf_banks_size * we set above */ if (ah->ah_rf_banks ==NULL ) {
@@ -3035,9 +3035,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,/* Limit max power if we have a CTL available */ ath5k_get_max_ctl_power (ah, channel); -/* FIXME: Tx power limit for this regdomain -* XXX: Mac80211/CRDA will do that anyway ? */ -/* FIXME: Antenna reduction stuff */ /* FIXME: Limit power on turbo modes */
drivers/net/wireless/ath/ath5k/reg.h +1 -1
@@ -1911,7 +1911,7 @@#define AR5K_PHY_TURBO 0x9804/* Register Address */ #define AR5K_PHY_TURBO_MODE 0x00000001/* Enable turbo mode */ #define AR5K_PHY_TURBO_SHORT 0x00000002/* Set short symbols to turbo mode */ -#define AR5K_PHY_TURBO_MIMO 0x00000004/* Set turbo for mimo mimo */ +#define AR5K_PHY_TURBO_MIMO 0x00000004/* Set turbo for mimo */ /* * PHY agility command register
drivers/net/wireless/ath/ath5k/reset.c +11 -11
@@ -959,7 +959,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, AR5K_QUEUE_DCU_SEQNUM(0)); } -/* TSF accelerates on AR5211 durring reset +/* TSF accelerates on AR5211 during reset * As a workaround save it here and restore * it later so that it's back in time after * reset. This way it'll get re-synced on the
@@ -1080,7 +1080,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,return ret;/* Spur info is available only from EEPROM versions -* bigger than 5.3 but but the EEPOM routines will use +* greater than 5.3, but the EEPROM routines will use * static values for older versions */ if (ah->ah_mac_srev >=AR5K_SREV_AR5424 ) ath5k_hw_set_spur_mitigation_filter(ah,
@@ -1173,11 +1173,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,/* Set RSSI/BRSSI thresholds * * Note: If we decide to set this value -* dynamicaly, have in mind that when AR5K_RSSI_THR -* register is read it might return 0x40 if we haven't -* wrote anything to it plus BMISS RSSI threshold is zeroed. +* dynamically, keep in mind that when AR5K_RSSI_THR +* register is read, it might return 0x40 if we haven't +* written anything to it. Also, BMISS RSSI threshold is zeroed. * So doing a save/restore procedure here isn't the right -* choice. Instead store it on ath5k_hw */ +* choice. Instead, store it in ath5k_hw */ ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES | AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S),
@@ -1235,7 +1235,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,/* * Perform ADC test to see if baseband is ready -* Set tx hold and check adc test register +* Set TX hold and check ADC test register */ phy_tst1 =ath5k_hw_reg_read (ah,AR5K_PHY_TST1 );ath5k_hw_reg_write (ah,AR5K_PHY_TST1_TXHOLD ,AR5K_PHY_TST1 );
@@ -1254,15 +1254,15 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,* * This method is used to calibrate some static offsets * used together with on-the fly I/Q calibration (the -* one performed via ath5k_hw_phy_calibrate), that doesn't +* one performed via ath5k_hw_phy_calibrate), which doesn't * interrupt rx path. * * While rx path is re-routed to the power detector we also -* start a noise floor calibration, to measure the +* start a noise floor calibration to measure the * card's noise floor (the noise we measure when we are not -* transmiting or receiving anything). +* transmitting or receiving anything). * -* If we are in a noisy environment AGC calibration may time +* If we are in a noisy environment, AGC calibration may time * out and/or noise floor calibration might timeout. */ AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
drivers/net/wireless/ath/ath5k/rfbuffer.h +2 -2
@@ -25,10 +25,10 @@* * We don't write on those registers directly but * we send a data packet on the chip, using a special register, -* that holds all the settings we need. After we 've sent the +* that holds all the settings we need. After we've sent the * data packet, we write on another special register to notify hw * to apply the settings. This is done so that control registers -* can be dynamicaly programmed during operation and the settings +* can be dynamically programmed during operation and the settings * are applied faster on the hw. * * We call each data packet an "RF Bank" and all the data we write
Signature · 1 line
1.7.1.1
PATCH 4/6 ath5k: remove monitor check in receive_frame_ok filter
In reply to Bob CopelandMonitor interfaces are never seen by the driver, so tests based on that opmode don't make sense. Also, we already pass all mic failure packets.
Consequently this code is actually accepting any frames with just crypto errors and rejecting those with CRC, FIFO, and PHY errors for all interface types. Adjust the code and comment accordingly.
--- drivers/net/wireless/ath/ath5k/base.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -3
@@ -2035,9 +2035,8 @@ ath5k_receive_frame_ok(struct ath5k_softc *sc, struct ath5k_rx_status *rs)return true; } -/* let crypto-error packets fall through in MNTR */ -if ((rs->rs_status & ~(AR5K_RXERR_DECRYPT |AR5K_RXERR_MIC )) || - sc->opmode !=NL80211_IFTYPE_MONITOR ) +/* reject any frames with non-crypto errors */ +if (rs->rs_status & ~(AR5K_RXERR_DECRYPT ))return false; }
Signature · 1 line
1.7.1.1
PATCH 5/6 ath5k: remove all mention of monitor iftype
In reply to Bob CopelandMonitor interfaces are never seen by the driver so these cases are never reached.
--- drivers/net/wireless/ath/ath5k/base.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +1 -7
@@ -2325,8 +2325,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)ATH5K_DBG_UNLIMIT (sc,ATH5K_DEBUG_BEACON ,"in beacon_send\n" ); -if (unlikely (bf->skb ==NULL || sc->opmode ==NL80211_IFTYPE_STATION || - sc->opmode ==NL80211_IFTYPE_MONITOR )) { +if (unlikely (bf->skb ==NULL || sc->opmode ==NL80211_IFTYPE_STATION )) {ATH5K_WARN (sc,"bf=%p bf_skb=%p\n" , bf, bf ? bf->skb :NULL );return ; }
@@ -2900,9 +2899,6 @@ static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,ath5k_debug_dump_skb (sc, skb,"TX " ,1 ); -if (sc->opmode ==NL80211_IFTYPE_MONITOR ) -ATH5K_DBG (sc,ATH5K_DEBUG_XMIT ,"tx in monitor (scan?)\n" ); -/* * The hardware expects the header padded to 4 byte boundaries. * If this is not the case, we add the padding after the header.
@@ -3048,7 +3044,6 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,case NL80211_IFTYPE_STATION :case NL80211_IFTYPE_ADHOC :case NL80211_IFTYPE_MESH_POINT : -case NL80211_IFTYPE_MONITOR : sc->opmode = vif->type;break ;default :
@@ -3250,7 +3245,6 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,switch (sc->opmode) {case NL80211_IFTYPE_MESH_POINT : -case NL80211_IFTYPE_MONITOR : rfilt |=AR5K_RX_FILTER_CONTROL |AR5K_RX_FILTER_BEACON | AR5K_RX_FILTER_PROBEREQ |
Signature · 1 line
1.7.1.1
PATCH 6/6 ath5k: don't enable probe request rx for STAs
In reply to Bob CopelandAR5K_RX_FILTER_PROBEREQ enables reception of probe requests, but the filter flag FIF_BCN_PRBRESP_PROMISC is actually about receiving beacons and probe _responses_, so we shouldn't turn on the filter when scanning.
--- drivers/net/wireless/ath/ath5k/base.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -2
@@ -3227,9 +3227,9 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, rfilt |=AR5K_RX_FILTER_PHYERR ;/* FIF_BCN_PRBRESP_PROMISC really means to enable beacons -* and probes for any BSSID, this needs testing */ +* and probes for any BSSID */ if (*new_flags &FIF_BCN_PRBRESP_PROMISC ) - rfilt |=AR5K_RX_FILTER_BEACON |AR5K_RX_FILTER_PROBEREQ ; + rfilt |=AR5K_RX_FILTER_BEACON ;/* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not * set we should only pass on control frames for this
Signature · 1 line
1.7.1.1