staging: brcm80211: 4th reaction to mainline patch #2
PATCH 2/20 staging: brcm80211: cleaned up softmac types.h macro's
In reply to Roland VossenSubstituted/removed macro's.
--- drivers/staging/brcm80211/brcmsmac/alloc.c | 30 ++++++++++++++++++ drivers/staging/brcm80211/brcmsmac/ampdu.c | 2 +- drivers/staging/brcm80211/brcmsmac/channel.c | 18 +++++----- drivers/staging/brcm80211/brcmsmac/main.c | 31 ++++++++++--------- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 10 +++--- drivers/staging/brcm80211/brcmsmac/rate.c | 5 ++- drivers/staging/brcm80211/brcmsmac/types.h | 35 ---------------------- 7 files changed, 64 insertions(+), 67 deletions(-)
drivers/staging/brcm80211/brcmsmac/alloc.c +30 -0
@@ -20,6 +20,36 @@#include "main.h" #include "alloc.h" +/* Max # of entries in Tx FIFO based on 4kb page size */ +#define NTXD 256 +/* Max # of entries in Rx FIFO based on 4kb page size */ +#define NRXD 256 +/* try to keep this # rbufs posted to the chip */ +#define NRXBUFPOST 32 +/* Maximum SCBs in cache for STA */ +#define MAXSCB 32 + +/* Count of packet callback structures. either of following +* 1. Set to the number of SCBs since a STA +* can queue up a rate callback for each IBSS STA it knows about, and an AP can +* queue up an "are you there?" Null Data callback for each associated STA +* 2. controlled by tunable config file +*/ +#define MAXPKTCB MAXSCB/* Max number of packet callbacks */ + +/* Number of BSS handled in ucode bcn/prb */ +#define BRCMS_MAX_UCODE_BSS (16) +/* Number of BSS handled in sw bcn/prb */ +#define BRCMS_MAX_UCODE_BSS4 (4) + +/* data msg txq hiwat mark */ +#define BRCMS_DATAHIWAT 50 +#define BRCMS_AMPDUDATAHIWAT 255 + +/* bounded rx loops */ +#define RXBND 8/* max # frames to process in brcms_c_recv() */ +#define TXSBND 8/* max # tx status to process in wlc_txstatus() */ +static void brcms_c_tunables_init (struct brcms_tunables *tunables,uint devid) { tunables->ntxd =NTXD ;
drivers/staging/brcm80211/brcmsmac/ampdu.c +1 -1
@@ -990,7 +990,7 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,"error (0x%x)\n" , wlc->pub->unit, txs->phyerr); -if (WL_ERROR_ON ()) { +if (brcm_msg_level &LOG_ERROR_VAL ) {brcmu_prpkt ("txpkt (AMPDU)" , p);brcms_c_print_txdesc ((struct d11txh *) p->data); }
drivers/staging/brcm80211/brcmsmac/channel.c +9 -9
@@ -911,7 +911,7 @@ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)* Now that the country abbreviation is set, if the radio supports 2G, * then set channel 14 restrictions based on the new locale. */ -if (wlc->pub->_nbands >1 ||BAND_2G (wlc->band->bandtype)) +if (wlc->pub->_nbands >1 || wlc->band->bandtype ==BRCM_BAND_2G )wlc_phy_chanspec_ch14_widefilter_set (wlc->band->pi,brcms_c_japan (wlc) ? true : false);
@@ -939,11 +939,11 @@ brcms_c_channels_init(struct brcms_cm_info *wlc_cm,for (i =0 ; i < wlc->pub->_nbands; i++, band = wlc->bandstate[OTHERBANDUNIT (wlc)]) { - li =BAND_5G (band->bandtype) ? + li = (band->bandtype ==BRCM_BAND_5G ) ?brcms_c_get_locale_5g (country->locale_5G) :brcms_c_get_locale_2g (country->locale_2G); wlc_cm->bandstate[band->bandunit].locale_flags = li->flags; - li_mimo =BAND_5G (band->bandtype) ? + li_mimo = (band->bandtype ==BRCM_BAND_5G ) ?brcms_c_get_mimo_5g (country->locale_mimo_5G) :brcms_c_get_mimo_2g (country->locale_mimo_2G);
@@ -1311,11 +1311,11 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, chan =CHSPEC_CHANNEL (chanspec); band = wlc->bandstate[CHSPEC_BANDUNIT (chanspec)]; - li =BAND_5G (band->bandtype) ? + li = (band->bandtype ==BRCM_BAND_5G ) ?brcms_c_get_locale_5g (country->locale_5G) :brcms_c_get_locale_2g (country->locale_2G); - li_mimo =BAND_5G (band->bandtype) ? + li_mimo = (band->bandtype ==BRCM_BAND_5G ) ?brcms_c_get_mimo_5g (country->locale_mimo_5G) :brcms_c_get_mimo_2g (country->locale_mimo_2G);
@@ -1333,7 +1333,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, }/* CCK txpwr limits for 2.4G band */ -if (BAND_2G (band->bandtype)) { +if (band->bandtype ==BRCM_BAND_2G ) { maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_CCK (chan)]; maxpwr = maxpwr - delta;
@@ -1345,7 +1345,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, }/* OFDM txpwr limits for 2.4G or 5G bands */ -if (BAND_2G (band->bandtype)) +if (band->bandtype ==BRCM_BAND_2G ) maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_OFDM (chan)];else maxpwr = li->maxpwr[CHANNEL_POWER_IDX_5G (chan)];
@@ -1355,7 +1355,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, maxpwr =min (maxpwr, conducted_ofdm_max);/* Keep OFDM lmit below CCK limit */ -if (BAND_2G (band->bandtype)) +if (band->bandtype ==BRCM_BAND_2G ) maxpwr =min_t (int, maxpwr, txpwr->cck[0 ]);for (i =0 ; i <BRCMS_NUM_RATES_OFDM ; i++)
@@ -1385,7 +1385,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, delta = band->antgain -QDB (6 );/* Excess over 6 dB */ } -if (BAND_2G (band->bandtype)) +if (band->bandtype ==BRCM_BAND_2G ) maxpwr_idx = (chan -1 );else maxpwr_idx =CHANNEL_POWER_IDX_5G (chan);
drivers/staging/brcm80211/brcmsmac/main.c +16 -15
@@ -329,6 +329,8 @@#define NRATE_STF_STBC 2/* stf mode STBC */ #define NRATE_STF_SDM 3/* stf mode SDM */ +#define MAX_DMA_SEGS 4 +/* * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL. */
@@ -1585,9 +1587,8 @@ static void brcms_b_bsinit(struct brcms_c_info *wlc, u16 chanspec)brcms_b_set_cwmax (wlc_hw, wlc_hw->band->CWmax);brcms_b_update_slot_timing (wlc_hw, -BAND_5G (wlc_hw->band-> - bandtype) ? true : wlc_hw-> - shortslot); + wlc_hw->band->bandtype ==BRCM_BAND_5G ? + true : wlc_hw->shortslot);/* write phytype and phyvers */ brcms_b_write_shm (wlc_hw,M_PHYTYPE , (u16 ) wlc_hw->band->phytype);
@@ -3738,7 +3739,7 @@ static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot) { wlc_hw->shortslot = shortslot; -if (BAND_2G (brcms_b_bandtype (wlc_hw)) && wlc_hw->up) { +if (brcms_b_bandtype (wlc_hw) ==BRCM_BAND_2G && wlc_hw->up) {brcms_c_suspend_mac_and_wait (wlc_hw->wlc);brcms_b_update_slot_timing (wlc_hw, shortslot);brcms_c_enable_mac (wlc_hw->wlc);
@@ -4929,10 +4930,10 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) bandtype = wlc->band->bandtype;/* get antennas available */ - aa = (s8 )getintvar (vars, (BAND_5G (bandtype) ?"aa5g" :"aa2g" )); + aa = (s8 )getintvar (vars, bandtype ==BRCM_BAND_5G ?"aa5g" :"aa2g" );if (aa ==0 ) aa = (s8 )getintvar (vars, - (BAND_5G (bandtype) ?"aa1" :"aa0" )); + bandtype ==BRCM_BAND_5G ?"aa1" :"aa0" );if ((aa <1 ) || (aa >15 )) {wiphy_err (wlc->wiphy,"wl%d: %s: Invalid antennas available in" " srom (0x%x), using 3\n" , unit, __func__, aa);
@@ -4951,7 +4952,7 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)/* Compute Antenna Gain */ wlc->band->antgain = - (s8 )getintvar (vars, (BAND_5G (bandtype) ?"ag1" :"ag0" )); + (s8 )getintvar (vars, bandtype ==BRCM_BAND_5G ?"ag1" :"ag0" );brcms_c_attach_antgain_init (wlc);return true;
@@ -5169,7 +5170,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, wlc->band->CWmax =PHY_CWMAX ;/* init gmode value */ -if (BAND_2G (wlc->band->bandtype)) { +if (wlc->band->bandtype ==BRCM_BAND_2G ) { wlc->band->gmode =GMODE_AUTO ;brcms_c_protection_upd (wlc,BRCMS_PROT_G_USER , wlc->band->gmode);
@@ -6382,7 +6383,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,/* shortslot is an 11g feature, so no more work if we are * currently on the 5G band */ -if (BAND_5G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_5G )break ;if (wlc->pub->up && wlc->pub->associated) {
@@ -6965,7 +6966,7 @@ brcms_c_calc_frame_len(struct brcms_c_info *wlc, u32 ratespec,int tot_streams =MCS_TXS (mcs) +RSPEC_STC (ratespec); dur -=PREN_PREAMBLE + (tot_streams *PREN_PREAMBLE_EXT );/* payload calculation matches that of regular ofdm */ -if (BAND_2G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_2G ) dur -=DOT11_OFDM_SIGNAL_EXTENSION ;/* kNdbps = kbps * 4 */ kNdps =
@@ -7466,7 +7467,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,if (!is_multicast_ether_addr (h->addr1)) mcl |=TXC_IMMEDACK ; -if (BAND_5G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_5G ) mcl |=TXC_FREQBAND_5G ;if (CHSPEC_IS40 (wlc_phy_chanspec_get (wlc->band->pi)))
@@ -8243,7 +8244,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2) mcl =le16_to_cpu (txh->MacTxControlLow);if (txs->phyerr) { -if (WL_ERROR_ON ()) { +if (brcm_msg_level &LOG_ERROR_VAL ) {wiphy_err (wlc->wiphy,"phyerr 0x%x, rate 0x%x\n" , txs->phyerr, txh->MainRates);brcms_c_print_txdesc (txh);
@@ -8772,7 +8773,7 @@ brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec, APHY_TAIL_NBITS) * 1000, 2 * kNdps); dur +=APHY_SYMBOL_TIME * nsyms; -if (BAND_2G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_2G ) dur +=DOT11_OFDM_SIGNAL_EXTENSION ; }else if (IS_OFDM (rate)) { dur =APHY_PREAMBLE_TIME ;
@@ -8784,7 +8785,7 @@ brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec,CEIL ((APHY_SERVICE_NBITS +8 * mac_len +APHY_TAIL_NBITS ), Ndps); dur +=APHY_SYMBOL_TIME * nsyms; -if (BAND_2G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_2G ) dur +=DOT11_OFDM_SIGNAL_EXTENSION ; }else {/*
@@ -8937,7 +8938,7 @@ brcms_c_rateset_get_hwrs(struct brcms_c_info *wlc)const struct brcms_c_rateset *rs_dflt;if (BRCMS_PHY_11N_CAP (wlc->band)) { -if (BAND_5G (wlc->band->bandtype)) +if (wlc->band->bandtype ==BRCM_BAND_5G ) rs_dflt = &ofdm_mimo_rates;else rs_dflt = &cck_ofdm_mimo_rates;
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +5 -5
@@ -512,7 +512,7 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype,else sflags =ai_core_sflags (sh->sih,0 ,0 ); -if (BAND_5G (bandtype)) { +if (bandtype ==BRCM_BAND_5G ) {if ((sflags & (SISF_5G_PHY |SISF_DB_PHY )) ==0 )return NULL ; }
@@ -541,7 +541,7 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype, pi->phycal_tempdelta =0 ; -if (BAND_2G (bandtype) && (sflags &SISF_2G_PHY )) +if (bandtype ==BRCM_BAND_2G && (sflags &SISF_2G_PHY )) pi->pubpi.coreflags =SICF_GMODE ;wlapi_bmac_corereset (pi->sh->physhim, pi->pubpi.coreflags);
@@ -561,7 +561,7 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype, !pi->pubpi.phy_type == PHY_TYPE_LCN) goto err; -if (BAND_5G (bandtype)) { +if (bandtype ==BRCM_BAND_5G ) {if (!ISNPHY (pi)) goto err; }else if (!ISNPHY (pi) && !ISLCNPHY (pi)) {
@@ -585,8 +585,8 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype,wlc_set_phy_uninitted (pi); pi->bw =WL_CHANSPEC_BW_20 ; - pi->radio_chanspec = -BAND_2G (bandtype) ?CH20MHZ_CHSPEC (1 ) :CH20MHZ_CHSPEC (36 ); + pi->radio_chanspec = (bandtype ==BRCM_BAND_2G ) ? +CH20MHZ_CHSPEC (1 ) :CH20MHZ_CHSPEC (36 ); pi->rxiq_samps =PHY_NOISE_SAMPLE_LOG_NUM_NPHY ; pi->rxiq_antsel =ANT_RX_DIV_DEF ;
drivers/staging/brcm80211/brcmsmac/rate.c +3 -2
@@ -447,7 +447,7 @@ brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, (PHYTYPE_IS(phy_type, PHY_TYPE_N)) || (PHYTYPE_IS(phy_type, PHY_TYPE_LCN)) || (PHYTYPE_IS(phy_type, PHY_TYPE_SSN))) { -if (BAND_5G (bandtype)) +if (bandtype ==BRCM_BAND_5G ) rs_dflt = (bw ==BRCMS_20_MHZ ? &ofdm_mimo_rates : &ofdm_40bw_mimo_rates);else
@@ -455,7 +455,8 @@ brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, &cck_ofdm_mimo_rates : &cck_ofdm_40bw_mimo_rates); }else if (PHYTYPE_IS (phy_type,PHY_TYPE_LP )) { - rs_dflt = (BAND_5G (bandtype)) ? &ofdm_rates : &cck_ofdm_rates; + rs_dflt = (bandtype ==BRCM_BAND_5G ) ? + &ofdm_rates : &cck_ofdm_rates; }else if (PHYTYPE_IS (phy_type,PHY_TYPE_A )) { rs_dflt = &ofdm_rates; }else if (PHYTYPE_IS (phy_type,PHY_TYPE_G )) {
drivers/staging/brcm80211/brcmsmac/types.h +0 -35
@@ -25,8 +25,6 @@#define WL_CHAN_FREQ_RANGE_5GM 2#define WL_CHAN_FREQ_RANGE_5GH 3 -#define MAX_DMA_SEGS 4 -/* boardflags */ /* Board has gpio 9 controlling the PA */
@@ -257,46 +255,15 @@* *********************************************** */ -/* Max # of entries in Tx FIFO based on 4kb page size */ -#define NTXD 256 -/* Max # of entries in Rx FIFO based on 4kb page size */ -#define NRXD 256 -/* try to keep this # rbufs posted to the chip */ -#define NRXBUFPOST 32 -/* Maximum SCBs in cache for STA */ -#define MAXSCB 32 -/* max allowed number of mpdus in an ampdu (2 streams) */ #define AMPDU_NUM_MPDU 16 -/* Count of packet callback structures. either of following -* 1. Set to the number of SCBs since a STA -* can queue up a rate callback for each IBSS STA it knows about, and an AP can -* queue up an "are you there?" Null Data callback for each associated STA -* 2. controlled by tunable config file -*/ -#define MAXPKTCB MAXSCB/* Max number of packet callbacks */ -/* NetBSD also needs to keep track of this */ -/* Number of BSS handled in ucode bcn/prb */ -#define BRCMS_MAX_UCODE_BSS (16) -/* Number of BSS handled in sw bcn/prb */ -#define BRCMS_MAX_UCODE_BSS4 (4)/* max # BSS configs */ #define BRCMS_MAXBSSCFG (1)/* max # available networks */ #define MAXBSS 64 -/* data msg txq hiwat mark */ -#define BRCMS_DATAHIWAT 50 -#define BRCMS_AMPDUDATAHIWAT 255 - -/* bounded rx loops */ -#define RXBND 8/* max # frames to process in brcms_c_recv() */ -#define TXSBND 8/* max # tx status to process in wlc_txstatus() */ - -#define BAND_5G (bt) ((bt) == BRCM_BAND_5G) -#define BAND_2G (bt) ((bt) == BRCM_BAND_2G) #define BCMMSG(dev, fmt, args...) \ do { \
@@ -304,8 +271,6 @@ do { \ wiphy_err(dev, "%s: " fmt, __func__, ##args); \ }while (0 ) -#define WL_ERROR_ON() (brcm_msg_level & LOG_ERROR_VAL) -/* * Register access macros. *
Signature · 1 line
1.7.4.1
PATCH 3/20 staging: brcm80211: cleaned up brcmu_utils.h macro's
In reply to Roland VossenSubstituted/removed macro's.
--- drivers/staging/brcm80211/brcmsmac/ampdu.c | 4 + drivers/staging/brcm80211/brcmsmac/main.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 14 ++- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 7 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 17 ++- drivers/staging/brcm80211/brcmsmac/pub.h | 6 +- drivers/staging/brcm80211/brcmsmac/types.h | 2 + drivers/staging/brcm80211/include/brcmu_utils.h | 161 +++++++++++----------- 8 files changed, 115 insertions(+), 102 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +4 -0
@@ -69,6 +69,10 @@ AMPDU_DELIMITER_LEN + 3\ + DOT11_A4_HDR_LEN + DOT11_QOS_LEN + DOT11_IV_MAX_LEN) +/* modulo add/sub, bound = 2^k */ +#define MODADD_POW2 (x, y, bound) (((x) + (y)) & ((bound) - 1)) +#define MODSUB_POW2 (x, y, bound) (((x) - (y)) & ((bound) - 1)) +/* structure to hold tx fifo information and pre-loading state * counters specific to tx underflows of ampdus * some counters might be redundant with the ones in wlc or ampdu structures.
drivers/staging/brcm80211/brcmsmac/main.c +4 -2
@@ -186,6 +186,8 @@#define BRCMS_HWRXOFF 38/* chip rx buffer offset */ +#define OSL_SYSUPTIME () ((u32)jiffies * (1000 / HZ)) +/* * driver maintains internal 'tick'(wlc->pub->now) which increments in 1s * OS timer(soft watchdog) it is not a wall clock and won't increment when
@@ -7863,8 +7865,8 @@ void brcms_c_send_q(struct brcms_c_info *wlc)int prio;for (prio =MAXPRIO ; prio >=0 ; prio--) {if (brcms_c_txflowcontrol_prio_isset (wlc, qi, prio) && - (pktq_plen (q, wlc_prio2prec_map[prio]) < - wlc->pub->tunables->datahiwat /2 )) + q->q[wlc_prio2prec_map[prio]].len < + wlc->pub->tunables->datahiwat /2 )brcms_c_txflowcontrol (wlc, qi,OFF , prio); } }
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +12 -2
@@ -13,7 +13,7 @@* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - +#include <linux/kernel.h> #include <linux/delay.h> #include <brcm_hw_ids.h>
@@ -37,6 +37,16 @@ (ISNPHY(pi) ? VALID_N_RADIO(radioid) : false) || \ (ISLCNPHY(pi) ? VALID_LCN_RADIO(radioid) : false)) +/* basic mux operation - can be optimized on several architectures */ +#define MUX (pred, true, false) ((pred) ? (true) : (false)) + +/* modulo inc/dec - assumes x E [0, bound - 1] */ +#define MODINC (x, bound) MUX((x) == (bound) - 1, 0, (x) + 1) + +/* modulo inc/dec, bound = 2^k */ +#define MODDEC_POW2 (x, bound) (((x) - 1) & ((bound) - 1)) +#define MODINC_POW2 (x, bound) (((x) + 1) & ((bound) - 1)) +struct chan_info_basic {u16 chan;u16 freq;
@@ -2879,7 +2889,7 @@ u8 wlc_phy_nbits(s32 value)s32 abs_val;u8 nbits =0 ; - abs_val =ABS (value); + abs_val =abs (value);while ((abs_val >> nbits) >0 ) nbits++;
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +4 -3
@@ -14,6 +14,7 @@* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <linux/kernel.h> #include <linux/delay.h> #include <linux/cordic.h>
@@ -3378,9 +3379,9 @@ wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val, k =1 ;do { bw = phy_bw *1000 * k; - num_samps = bw /ABS (f_kHz); + num_samps = bw /abs (f_kHz); k++; - }while ((num_samps * (u32) (ABS (f_kHz))) != bw); + }while ((num_samps * (u32) (abs (f_kHz))) != bw); }else num_samps =2 ;
@@ -3894,7 +3895,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) }wlc_lcnphy_get_radio_loft (pi, &ei0, &eq0, &fi0, &fq0); -if ((ABS ((s8 ) fi0) ==15 ) && (ABS ((s8 ) fq0) ==15 )) { +if ((abs ((s8 ) fi0) ==15 ) && (abs ((s8 ) fq0) ==15 )) {if (CHSPEC_IS5G (pi->radio_chanspec)) { target_gains.gm_gain =255 ; target_gains.pga_gain =255 ;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +9 -8
@@ -14,6 +14,7 @@* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <linux/kernel.h> #include <linux/delay.h> #include <linux/cordic.h>
@@ -22648,7 +22649,7 @@ static void wlc_phy_rssi_cal_nphy_rev3(struct brcms_phy *pi) poll_results[vcm_final][result_idx];if (fine_digital_offset[result_idx] <0 ) { fine_digital_offset[result_idx] = -ABS (fine_digital_offset +abs (fine_digital_offset [result_idx]); fine_digital_offset[result_idx] += (NPHY_RSSICAL_NPOLL /2 );
@@ -22727,7 +22728,7 @@ static void wlc_phy_rssi_cal_nphy_rev3(struct brcms_phy *pi)if (fine_digital_offset[result_idx] <0 ) { fine_digital_offset[result_idx] - =ABS ( + =abs ( fine_digital_offset [result_idx]); fine_digital_offset[result_idx]
@@ -23004,7 +23005,7 @@ static void wlc_phy_rssi_cal_nphy_rev2(struct brcms_phy *pi, u8 rssi_type) min_vcm =0 ; min_poll =NPHY_RSSICAL_MAXREAD *NPHY_RSSICAL_NPOLL +1 ;for (vcm =0 ; vcm <4 ; vcm++) { - curr_d =ABS (((rssi_type ==NPHY_RSSI_SEL_NB ) ? + curr_d =abs (((rssi_type ==NPHY_RSSI_SEL_NB ) ? poll_results[vcm][result_idx] : poll_miniq[vcm][result_idx /2 ]) - (target_code *NPHY_RSSICAL_NPOLL ));
@@ -23028,7 +23029,7 @@ static void wlc_phy_rssi_cal_nphy_rev2(struct brcms_phy *pi, u8 rssi_type) poll_results[vcm_final[result_idx]][result_idx];if (fine_digital_offset[result_idx] <0 ) { fine_digital_offset[result_idx] = -ABS (fine_digital_offset[result_idx]); +abs (fine_digital_offset[result_idx]); fine_digital_offset[result_idx] += (NPHY_RSSICAL_NPOLL /2 ); fine_digital_offset[result_idx] /=NPHY_RSSICAL_NPOLL ;
@@ -27422,9 +27423,9 @@ wlc_phy_rc_sweep_nphy(struct brcms_phy *pi, u8 core_idx, u8 loopback_type)if (rccal_stepsize ==-1 ) { best_rccal_val = - (ABS ((int )last_pwr_ratio - + (abs ((int )last_pwr_ratio - (int )target_pwr_ratio) < -ABS ((int )pwr_ratio - +abs ((int )pwr_ratio - (int )target_pwr_ratio)) ? last_rccal_val : rccal_val;
@@ -28324,10 +28325,10 @@ void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi) || (wlc_phy_txpwr_ison_nphy(pi) && (((u32) - ABS(wlc_phy_txpwr_idx_cur_get_nphy(pi, 0) - + abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 0) - pi->nphy_papd_tx_gain_at_last_cal[0]) >= 4) || ((u32) - ABS(wlc_phy_txpwr_idx_cur_get_nphy(pi, 1) - + abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 1) - pi->nphy_papd_tx_gain_at_last_cal[1]) >= 4)))))wlc_phy_a4 (pi, true); }
drivers/staging/brcm80211/brcmsmac/pub.h +1 -5
@@ -237,11 +237,7 @@ struct brcms_pub {*/ bool align_wd_tbtt;/* Align watchdog with tbtt indication * handling. This flag is cleared by default -* and is set by per port code explicitly and -* you need to make sure the OSL_SYSUPTIME() -* is implemented properly in osl of that port -* when it enables this Power Save feature. -*/ +* and is set explicitly */ u16 boardrev;/* version # of particular board */ u8 sromrev;/* version # of the srom */
drivers/staging/brcm80211/brcmsmac/types.h +2 -0
@@ -341,6 +341,8 @@ do { \#define mboolisset (mb, bit) (((mb) & (bit)) != 0)#define mboolmaskset (mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val))) +#define CEIL (x, y) (((x) + ((y)-1)) / (y)) +/* forward declarations */ struct wiphy ;struct ieee80211_sta ;
drivers/staging/brcm80211/include/brcmu_utils.h +79 -82
193 lines not on this page · raw message
Signature · 1 line
1.7.4.1
cover staging: brcm80211: 4th reaction to mainline patch #2
Code cleanup items, both fullmac and softmac.
Arend van Spriel (2):
staging: brcm80211: remove static function variable in brcmfmac
staging: brcm80211: remove static variables from wl_cfg80211.c
Franky Lin (2):
staging: brcm80211: stop using kthread for iscan status check in
fullmac
staging: brcm80211: remove static function declaration in wl_cfg80211
Roland Vossen (16):
staging: brcm80211: cleaned up softmac types.h macro's
staging: brcm80211: cleaned up brcmu_utils.h macro's
staging: brcm80211: cleaned up brcmu_wifi.h macro's
staging: brcm80211: cleaned up fullmac macro's
staging: brcm80211: removed fullmac BRCMF_IOCTL_MAGIC support
staging: brcm80211: removed fullmac function brcmf_sdcard_iovar_op()
staging: brcm80211: removed unused encryption/security functionality
staging: brcm80211: removed softmac 'tunable' functionality
staging: brcm80211: cleaned up unused softmac struct members
staging: brcm80211: removed softmac ratespec override functionality
staging: brcm80211: removed unused softmac code after macro cleanup
staging: brcm80211: removed unused softmac struct brcms_c_if
staging: brcm80211: removed several unused softmac main.h struct
members
staging: brcm80211: removed unused softmac transmit power variables
staging: brcm80211: removed more unused softmac main.h struct members
staging: brcm80211: removed softmac files alloc.c/alloc.h
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 148 -- drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 34 - drivers/staging/brcm80211/brcmfmac/dhd.h | 15 +- drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 15 +- drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 17 +- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 297 +--- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 29 +- drivers/staging/brcm80211/brcmfmac/dhd_proto.h | 7 - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 868 +------- drivers/staging/brcm80211/brcmfmac/sdio_host.h | 22 - drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2692 +++++++++------------ drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 56 +- drivers/staging/brcm80211/brcmsmac/Makefile | 1 - drivers/staging/brcm80211/brcmsmac/alloc.c | 265 -- drivers/staging/brcm80211/brcmsmac/alloc.h | 19 - drivers/staging/brcm80211/brcmsmac/ampdu.c | 11 +- drivers/staging/brcm80211/brcmsmac/channel.c | 38 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 4 +- drivers/staging/brcm80211/brcmsmac/main.c | 463 ++-- drivers/staging/brcm80211/brcmsmac/main.h | 197 -- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 32 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 7 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 17 +- drivers/staging/brcm80211/brcmsmac/pub.h | 105 +- drivers/staging/brcm80211/brcmsmac/rate.c | 5 +- drivers/staging/brcm80211/brcmsmac/stf.c | 30 - drivers/staging/brcm80211/brcmsmac/types.h | 64 +- drivers/staging/brcm80211/brcmutil/utils.c | 67 - drivers/staging/brcm80211/brcmutil/wifi.c | 4 +- drivers/staging/brcm80211/include/brcmu_utils.h | 206 +- drivers/staging/brcm80211/include/brcmu_wifi.h | 69 +- 31 files changed, 1748 insertions(+), 4056 deletions(-) delete mode 100644 drivers/staging/brcm80211/brcmsmac/alloc.c delete mode 100644 drivers/staging/brcm80211/brcmsmac/alloc.h
Signature · 1 line
1.7.4.1
PATCH 1/20 staging: brcm80211: stop using kthread for iscan status check in fullmac
From: Franky Lin <[email protected]>
Use work queue instead.
--- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 76 ++++++--------------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 3 +- 2 files changed, 23 insertions(+), 56 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +22 -54
@@ -271,7 +271,6 @@ static s32 brcmf_dongle_roam(struct net_device *ndev, u32 roamvar,static void brcmf_iscan_timer (unsigned long data);static void brcmf_term_iscan (struct brcmf_cfg80211_priv *cfg_priv);static s32 brcmf_init_iscan (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_iscan_thread (void *data);static s32 brcmf_dev_iovar_setbuf (struct net_device *dev,s8 *iovar,void *param,s32 paramlen,void *bufptr,s32 buflen);
@@ -3151,18 +3150,15 @@ static void brcmf_term_iscan(struct brcmf_cfg80211_priv *cfg_priv)struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv);struct brcmf_ssid ssid; -if (cfg_priv->iscan_on && iscan->tsk) { +if (cfg_priv->iscan_on) { iscan->state =WL_ISCAN_STATE_IDLE ; -send_sig (SIGTERM , iscan->tsk,1 ); -/* -* The iscan task may want to acquire the rtnl_lock -* so release it here upon stopping the task. -*/ -rtnl_unlock (); -kthread_stop (iscan->tsk); -rtnl_lock (); - iscan->tsk =NULL ; +if (iscan->timer_on) { +del_timer_sync (&iscan->timer); + iscan->timer_on =0 ; + } + +cancel_work_sync (&iscan->work);/* Abort iscan running in FW */ memset (&ssid,0 ,sizeof (ssid));
@@ -3195,7 +3191,7 @@ static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan) {if (likely (iscan->state !=WL_ISCAN_STATE_IDLE )) {WL_SCAN ("wake up iscan\n" ); -wake_up (&iscan->waitq); +schedule_work (&iscan->work);return 0 ; }
@@ -3294,50 +3290,28 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv)return err; } -static s32 brcmf_iscan_thread (void *data) +static void brcmf_cfg80211_iscan_handler (struct work_struct *work) { -struct sched_param param = {.sched_priority =MAX_RT_PRIO -1 };struct brcmf_cfg80211_iscan_ctrl *iscan = - (struct brcmf_cfg80211_iscan_ctrl *)data; + container_of(work, struct brcmf_cfg80211_iscan_ctrl, + work);struct brcmf_cfg80211_priv *cfg_priv =iscan_to_cfg (iscan);struct brcmf_cfg80211_iscan_eloop *el = &iscan->el; -DECLARE_WAITQUEUE (wait, current); -u32 status; -int err =0 ; - -sched_setscheduler (current,SCHED_FIFO , ¶m); -allow_signal (SIGTERM ); - status =BRCMF_SCAN_RESULTS_PARTIAL ; -add_wait_queue (&iscan->waitq, &wait); -while (1 ) { -prepare_to_wait (&iscan->waitq, &wait,TASK_INTERRUPTIBLE ); - -schedule (); +u32 status =BRCMF_SCAN_RESULTS_PARTIAL ; -if (kthread_should_stop ()) -break ; -if (iscan->timer_on) { -del_timer_sync (&iscan->timer); - iscan->timer_on =0 ; - } -rtnl_lock (); - err =brcmf_get_iscan_results (iscan, &status, - &cfg_priv->bss_list); -if (unlikely (err)) { - status =BRCMF_SCAN_RESULTS_ABORTED ; -WL_ERR ("Abort iscan\n" ); - } -rtnl_unlock (); - el->handler[status](cfg_priv); - } -finish_wait (&iscan->waitq, &wait);if (iscan->timer_on) {del_timer_sync (&iscan->timer); iscan->timer_on =0 ; } -WL_SCAN ("ISCAN thread terminated\n" ); -return 0 ; +rtnl_lock (); +if (brcmf_get_iscan_results (iscan, &status, &cfg_priv->bss_list)) { + status =BRCMF_SCAN_RESULTS_ABORTED ; +WL_ERR ("Abort iscan\n" ); + } +rtnl_unlock (); + + el->handler[status](cfg_priv); }static void brcmf_iscan_timer (unsigned long data)
@@ -3356,15 +3330,9 @@ static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv) {struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); -if (cfg_priv->iscan_on && !iscan->tsk) { +if (cfg_priv->iscan_on) { iscan->state =WL_ISCAN_STATE_IDLE ; -init_waitqueue_head (&iscan->waitq); - iscan->tsk =kthread_run (brcmf_iscan_thread, iscan,"wl_iscan" ); -if (IS_ERR (iscan->tsk)) { -WL_ERR ("Could not create iscan thread\n" ); - iscan->tsk =NULL ; -return -ENOMEM ; - } +INIT_WORK (&iscan->work, brcmf_cfg80211_iscan_handler); }return 0 ;
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +1 -2
@@ -248,8 +248,7 @@ struct brcmf_cfg80211_iscan_ctrl {u32 timer_ms;u32 timer_on;s32 state; -struct task_struct *tsk; -wait_queue_head_t waitq; +struct work_struct work;struct brcmf_cfg80211_iscan_eloop el;void *data;s8 ioctl_buf[BRCMF_C_IOCTL_SMLEN ];
Signature · 1 line
1.7.4.1
PATCH 4/20 staging: brcm80211: cleaned up brcmu_wifi.h macro's
In reply to Roland VossenSubstituted/removed macro's.
--- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 2 +- drivers/staging/brcm80211/brcmsmac/channel.c | 20 +++--- drivers/staging/brcm80211/brcmsmac/main.c | 22 ++++---- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 10 ++-- drivers/staging/brcm80211/brcmsmac/pub.h | 4 - drivers/staging/brcm80211/brcmutil/wifi.c | 4 +- drivers/staging/brcm80211/include/brcmu_wifi.h | 69 +++++++++++++--------- 7 files changed, 70 insertions(+), 61 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_common.c +1 -1
@@ -261,7 +261,7 @@ bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,/* Evict if needed */ if (eprec >=0 ) {/* Detect queueing to unconfigured precedence */ - discard_oldest =AC_BITMAP_TST (drvr->wme_dp, eprec); + discard_oldest =ac_bitmap_tst (drvr->wme_dp, eprec);if (eprec == prec && !discard_oldest)return false;/* refuse newer (incoming) packet */ /* Evict packet according to discard policy */
drivers/staging/brcm80211/brcmsmac/channel.c +10 -10
@@ -1141,9 +1141,9 @@ brcms_c_quiet_chanspec(struct brcms_cm_info *wlc_cm, u16 chspec)return (wlc_cm->wlc->pub->_n_enab &SUPPORT_11N ) &&CHSPEC_IS40 (chspec) ? (isset (wlc_cm->quiet_channels.vec, -LOWER_20_SB (CHSPEC_CHANNEL (chspec))) || +lower_20_sb (CHSPEC_CHANNEL (chspec))) ||isset (wlc_cm->quiet_channels.vec, -UPPER_20_SB (CHSPEC_CHANNEL (chspec)))) : +upper_20_sb (CHSPEC_CHANNEL (chspec)))) :isset (wlc_cm->quiet_channels.vec,CHSPEC_CHANNEL (chspec)); }
@@ -1310,7 +1310,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, } chan =CHSPEC_CHANNEL (chanspec); - band = wlc->bandstate[CHSPEC_BANDUNIT (chanspec)]; + band = wlc->bandstate[chspec_bandunit (chanspec)]; li = (band->bandtype ==BRCM_BAND_5G ) ?brcms_c_get_locale_5g (country->locale_5G) :brcms_c_get_locale_2g (country->locale_2G);
@@ -1516,7 +1516,7 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec, }if (CHANNEL_BANDUNIT (wlc_cm->wlc, channel) != -CHSPEC_BANDUNIT (chspec)) +chspec_bandunit (chspec))return false;/* Check a 20Mhz channel */
@@ -1538,26 +1538,26 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec,u8 num_ch20_entries =sizeof (chan20_info) /sizeof (struct chan20_info ); -if (!VALID_40CHANSPEC_IN_BAND (wlc,CHSPEC_BANDUNIT (chspec))) +if (!VALID_40CHANSPEC_IN_BAND (wlc,chspec_bandunit (chspec)))return false;if (dualband) {if (!brcms_c_valid_channel20_db (wlc->cmi, -LOWER_20_SB (channel)) || +lower_20_sb (channel)) || !brcms_c_valid_channel20_db (wlc->cmi, -UPPER_20_SB (channel))) +upper_20_sb (channel)))return false; }else {if (!brcms_c_valid_channel20 (wlc->cmi, -LOWER_20_SB (channel)) || +lower_20_sb (channel)) || !brcms_c_valid_channel20 (wlc->cmi, -UPPER_20_SB (channel))) +upper_20_sb (channel)))return false; }/* find the lower sideband info in the sideband array */ for (idx =0 ; idx < num_ch20_entries; idx++) { -if (chan20_info[idx].sb ==LOWER_20_SB (channel)) +if (chan20_info[idx].sb ==lower_20_sb (channel)) upper_sideband = chan20_info[idx].adj_sbs; }/* check that the lower sideband allows an upper sideband */
drivers/staging/brcm80211/brcmsmac/main.c +11 -11
@@ -1058,7 +1058,7 @@ static void brcms_b_info_init(struct brcms_hardware *wlc_hw)/* default mac retry limits */ wlc_hw->SRL =RETRY_SHORT_DEF ; wlc_hw->LRL =RETRY_LONG_DEF ; - wlc_hw->chanspec =CH20MHZ_CHSPEC (1 ); + wlc_hw->chanspec =ch20mhz_chspec (1 ); }static void brcms_b_wait_for_wake (struct brcms_hardware *wlc_hw)
@@ -3266,7 +3266,7 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec, macintmask =brcms_intrsoff (wlc->wl);/* set up the specified band and chanspec */ -brcms_c_setxband (wlc_hw,CHSPEC_BANDUNIT (chanspec)); +brcms_c_setxband (wlc_hw,chspec_bandunit (chanspec));wlc_phy_chanspec_radio_set (wlc_hw->band->pi, chanspec);/* do one-time phy inits and calibration */
@@ -3366,7 +3366,7 @@ static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc, band_order[0 ] = band_order[1 ] = parkband; }else {/* park on the band of the specified chanspec */ - parkband =CHSPEC_BANDUNIT (chanspec); + parkband =chspec_bandunit (chanspec);/* order so that parkband initialize last */ band_order[0 ] = parkband ^1 ;
@@ -3815,7 +3815,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,/* Switch bands if necessary */ if (wlc_hw->_nbands >1 ) { - bandunit =CHSPEC_BANDUNIT (chanspec); + bandunit =chspec_bandunit (chanspec);if (wlc_hw->band->bandunit != bandunit) {/* brcms_b_setband disables other bandunit, * use light band switch if not up yet
@@ -3885,7 +3885,7 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, u16 chanspec)/* Switch bands if necessary */ if (wlc->pub->_nbands >1 ) { - bandunit =CHSPEC_BANDUNIT (chanspec); + bandunit =chspec_bandunit (chanspec);if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { switchband = true;if (wlc->bandlocked) {
@@ -4428,7 +4428,7 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit) wlc->device_present = true;/* Save our copy of the chanspec */ - wlc->chanspec =CH20MHZ_CHSPEC (1 ); + wlc->chanspec =ch20mhz_chspec (1 );/* various 802.11g modes */ wlc->shortslot = false;
@@ -4974,13 +4974,13 @@ static void brcms_c_bss_default_init(struct brcms_c_info *wlc)/* fill the default channel as the first valid channel * starting from the 2G channels */ - chanspec =CH20MHZ_CHSPEC (1 ); + chanspec =ch20mhz_chspec (1 ); wlc->home_chanspec = bi->chanspec = chanspec;/* find the band of our default channel */ band = wlc->band;if (wlc->pub->_nbands >1 && - band->bandunit !=CHSPEC_BANDUNIT (chanspec)) + band->bandunit !=chspec_bandunit (chanspec)) band = wlc->bandstate[OTHERBANDUNIT (wlc)];/* init bss rates to the band specific default rate set */
@@ -6222,7 +6222,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,switch (cmd) {case BRCM_SET_CHANNEL :{ -u16 chspec =CH20MHZ_CHSPEC (val); +u16 chspec =ch20mhz_chspec (val);if (val <0 || val >MAXCHANNEL ) { bcmerror = -EINVAL ;
@@ -6236,7 +6236,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,if (!wlc->pub->up &&IS_MBAND_UNLOCKED (wlc)) {if (wlc->band->bandunit != -CHSPEC_BANDUNIT (chspec)) +chspec_bandunit (chspec)) wlc->bandinit_pending = true;else wlc->bandinit_pending = false;
@@ -6787,7 +6787,7 @@ brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q,if (eprec >=0 ) {bool discard_oldest; - discard_oldest =AC_BITMAP_TST (wlc->wme_dp, eprec); + discard_oldest =ac_bitmap_tst (wlc->wme_dp, eprec);/* Refuse newer packet unless configured to discard oldest */ if (eprec == prec && !discard_oldest) {
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +5 -5
@@ -596,7 +596,7 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype, pi->bw =WL_CHANSPEC_BW_20 ; pi->radio_chanspec = (bandtype ==BRCM_BAND_2G ) ? -CH20MHZ_CHSPEC (1 ) :CH20MHZ_CHSPEC (36 ); +ch20mhz_chspec (1 ) :ch20mhz_chspec (36 ); pi->rxiq_samps =PHY_NOISE_SAMPLE_LOG_NUM_NPHY ; pi->rxiq_antsel =ANT_RX_DIV_DEF ;
@@ -1375,7 +1375,7 @@ u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band)if (j ==ARRAY_SIZE (chan_info_all))continue ; - channel =UPPER_20_SB (channel); + channel =upper_20_sb (channel); chspec = channel |WL_CHANSPEC_BW_40 |WL_CHANSPEC_CTL_SB_LOWER ;if (band ==BRCM_BAND_2G )
@@ -1383,7 +1383,7 @@ u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band)else chspec |=WL_CHANSPEC_BAND_5G ; }else - chspec =CH20MHZ_CHSPEC (channel); + chspec =ch20mhz_chspec (channel);if ((pi->a_band_high_disable) && (channel >=FIRST_REF5_CHANNUM ) && (channel <=LAST_REF5_CHANNUM ))
@@ -1650,9 +1650,9 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)if (CHSPEC_CTL_SB (chspec) ==WL_CHANSPEC_CTL_SB_NONE ) target_chan =CHSPEC_CHANNEL (chspec);else if (CHSPEC_CTL_SB (chspec) ==WL_CHANSPEC_CTL_SB_UPPER ) - target_chan =UPPER_20_SB (CHSPEC_CHANNEL (chspec)); + target_chan =upper_20_sb (CHSPEC_CHANNEL (chspec));else - target_chan =LOWER_20_SB (CHSPEC_CHANNEL (chspec)); + target_chan =lower_20_sb (CHSPEC_CHANNEL (chspec)); pactrl =0 ;if (ISLCNPHY (pi)) {
drivers/staging/brcm80211/brcmsmac/pub.h +0 -4
@@ -389,10 +389,6 @@ extern const u8 wlc_prio2prec_map[];#define MAXBANDS 2/* Maximum #of bands */ -/* bandstate array indices */ -#define BAND_2G_INDEX 0/* wlc->bandstate[x] index */ -#define BAND_5G_INDEX 1/* wlc->bandstate[x] index */ -/* max number of antenna configurations */ #define ANT_SELCFG_MAX 4
drivers/staging/brcm80211/brcmutil/wifi.c +2 -2
@@ -65,13 +65,13 @@ u8 brcmu_chspec_ctlchan(u16 chspec)* control chan is the upper 20 MHZ SB of the * 40MHZ channel */ - ctl_chan =UPPER_20_SB (CHSPEC_CHANNEL (chspec)); + ctl_chan =upper_20_sb (CHSPEC_CHANNEL (chspec)); else/* * control chan is the lower 20 MHZ SB of the * 40MHZ channel */ - ctl_chan =LOWER_20_SB (CHSPEC_CHANNEL (chspec)); + ctl_chan =lower_20_sb (CHSPEC_CHANNEL (chspec)); }return ctl_chan;
drivers/staging/brcm80211/include/brcmu_wifi.h +41 -28
98 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 6/20 staging: brcm80211: removed fullmac BRCMF_IOCTL_MAGIC support
In reply to Roland VossenLinux will never call brcmf_netdev_ioctl_entry() with the value BRCMF_IOCTL_MAGIC in a user space buffer. Thus, unused code could be removed.
--- drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 33 - drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 33 - drivers/staging/brcm80211/brcmfmac/dhd.h | 1 - drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 12 - drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 5 - drivers/staging/brcm80211/brcmfmac/dhd_common.c | 291 -------- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 9 - drivers/staging/brcm80211/brcmfmac/dhd_proto.h | 7 - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 742 --------------------- drivers/staging/brcm80211/brcmfmac/sdio_host.h | 14 - 10 files changed, 0 insertions(+), 1147 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +0 -33
@@ -235,39 +235,6 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr, fnc_num, addr, data); } -int brcmf_sdcard_cis_read (struct brcmf_sdio_dev *sdiodev,uint func,u8 * cis, -uint length) -{ -int status; - -u8 *tmp_buf, *tmp_ptr; -u8 *ptr; -bool ascii = func & ~0xf ; - func &=0x7 ; - - status =brcmf_sdioh_cis_read (sdiodev, func, cis, length); - -if (ascii) { -/* Move binary bits to tmp and format them -into the provided buffer. */ - tmp_buf =kmalloc (length,GFP_ATOMIC ); -if (tmp_buf ==NULL ) { -brcmf_dbg (ERROR ,"out of memory\n" ); -return -ENOMEM ; - } -memcpy (tmp_buf, cis, length); -for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length -4 ); - tmp_ptr++) { - ptr +=sprintf ((char *)ptr,"%.2x " , *tmp_ptr &0xff ); -if ((((tmp_ptr - tmp_buf) +1 ) &0xf ) ==0 ) - ptr +=sprintf ((char *)ptr,"\n" ); - } -kfree (tmp_buf); - } - -return status; -} -int brcmf_sdcard_set_sbaddr_window (struct brcmf_sdio_dev *sdiodev,u32 address) {
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +0 -33
@@ -423,39 +423,6 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)return scratch; } -int brcmf_sdioh_cis_read (struct brcmf_sdio_dev *sdiodev,uint func, -u8 *cisd,u32 length) -{ -u32 count; -int offset; -u32 foo; -u8 *cis = cisd; - -brcmf_dbg (TRACE ,"Func = %d\n" , func); - -if (!sdiodev->func_cis_ptr[func]) { -memset (cis,0 , length); -brcmf_dbg (ERROR ,"no func_cis_ptr[%d]\n" , func); -return -ENOTSUPP ; - } - -brcmf_dbg (ERROR ,"func_cis_ptr[%d]=0x%04x\n" , - func, sdiodev->func_cis_ptr[func]); - -for (count =0 ; count < length; count++) { - offset = sdiodev->func_cis_ptr[func] + count; -if (brcmf_sdioh_card_regread (sdiodev,0 , offset,1 , &foo) <0 ) { -brcmf_dbg (ERROR ,"regread failed: Can't read CIS\n" ); -return -EIO ; - } - - *cis = (u8) (foo &0xff ); - cis++; - } - -return 0 ; -} -static int brcmf_sdioh_enablefuncs (struct brcmf_sdio_dev *sdiodev) {int err_ret;
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -1
@@ -789,7 +789,6 @@ struct brcmf_c_ioctl {#define BRCMF_IOCTL_MAXLEN 8192/* max length ioctl buffer required */ /* common ioctl definitions */ -#define BRCMF_GET_MAGIC 0#define BRCMF_GET_VERSION 1#define BRCMF_GET_VAR 2#define BRCMF_SET_VAR 3
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +0 -12
@@ -56,18 +56,6 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);extern int brcmf_sdbrcm_bus_rxctl (struct brcmf_bus *bus,unsigned char *msg,uint msglen); -/* Check for and handle local prot-specific iovar commands */ -extern int brcmf_sdbrcm_bus_iovar_op (struct brcmf_pub *drvr,const char *name, -void *params,int plen,void *arg,int len, -bool set); - -/* Add bus dump output to a buffer */ -extern void brcmf_sdbrcm_bus_dump (struct brcmf_pub *drvr, -struct brcmu_strbuf *strbuf); - -/* Clear any bus counters */ -extern void brcmf_bus_clearcounts (struct brcmf_pub *drvr); -extern void brcmf_sdbrcm_wd_timer (struct brcmf_bus *bus,uint wdtick);#endif /* _BRCMF_BUS_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +0 -5
@@ -348,11 +348,6 @@ static void pkt_set_sum_good(struct sk_buff *skb, bool x) skb->ip_summed = (x ?CHECKSUM_UNNECESSARY :CHECKSUM_NONE ); } -void brcmf_proto_dump (struct brcmf_pub *drvr,struct brcmu_strbuf *strbuf) -{ -brcmu_bprintf (strbuf,"Protocol CDC: reqid %d\n" , drvr->prot->reqid); -} -void brcmf_proto_hdrpush (struct brcmf_pub *drvr,int ifidx,struct sk_buff *pktbuf) {
drivers/staging/brcm80211/brcmfmac/dhd_common.c +0 -291
309 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -9
@@ -1012,15 +1012,6 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr, goto done; } -/* check for local brcmf ioctl and handle it */ -if (driver ==BRCMF_IOCTL_MAGIC ) { - bcmerror =brcmf_c_ioctl ((void *)&drvr_priv->pub, &ioc, - buf, buflen); -if (bcmerror) - drvr_priv->pub.bcmerror = bcmerror; - goto done; - } -/* send to dongle (must be up, and wl) */ if ((drvr_priv->pub.busstate !=BRCMF_BUS_DATA )) {brcmf_dbg (ERROR ,"DONGLE_DOWN\n" );
drivers/staging/brcm80211/brcmfmac/dhd_proto.h +0 -7
@@ -52,16 +52,9 @@ extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,extern int brcmf_proto_ioctl (struct brcmf_pub *drvr,int ifidx,struct brcmf_ioctl *ioc,void *buf,int len); -/* Add prot dump output to a buffer */ -extern void brcmf_proto_dump (struct brcmf_pub *drvr, -struct brcmu_strbuf *strbuf); -/* Update local copy of dongle statistics */ extern void brcmf_proto_dstats (struct brcmf_pub *drvr); -extern int brcmf_c_ioctl (struct brcmf_pub *drvr,struct brcmf_c_ioctl *ioc, -void *buf,uint buflen); -extern int brcmf_c_preinit_ioctls (struct brcmf_pub *drvr); extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx,
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +0 -742
772 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -14
@@ -149,16 +149,6 @@ extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint func,extern void brcmf_sdcard_cfg_write (struct brcmf_sdio_dev *sdiodev,uint func,u32 addr,u8 data,int *err); -/* Read CIS content for specified function. -* fn: function whose CIS is being requested (0 is common CIS) -* cis: pointer to memory location to place results -* length: number of bytes to read -* Internally, this routine uses the values from the cis base regs (0x9-0xB) -* to form an SDIO-space address to read the data from. -*/ -extern int brcmf_sdcard_cis_read (struct brcmf_sdio_dev *sdiodev,uint func, -u8 *cis,uint length); -/* Synchronous access to device (client) core registers via CMD53 to F1. * addr: backplane address (i.e. >= regsva from attach) * size: register width in bytes (2 or 4)
@@ -255,10 +245,6 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, u32 addr, uint regwidth, u32 buflen, u8 *buffer, struct sk_buff *pkt); -/* get cis data */ -extern int brcmf_sdioh_cis_read (struct brcmf_sdio_dev *sdiodev,uint fuc, -u8 *cis,u32 length); -/* Watchdog timer interface for pm ops */ extern void brcmf_sdio_wdtmr_enable (struct brcmf_sdio_dev *sdiodev,bool enable);
Signature · 1 line
1.7.4.1
PATCH 7/20 staging: brcm80211: removed fullmac function brcmf_sdcard_iovar_op()
In reply to Roland Vossenbrcmf_sdcard_iovar_op was only called with iovar "sd_rxchain", and always returns 'false' as the queried value. Thus, the entire function, related iovar tables and related functions could be removed.
--- drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 115 ----------------------- drivers/staging/brcm80211/brcmfmac/dhd.h | 6 - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 14 +-- drivers/staging/brcm80211/brcmfmac/sdio_host.h | 5 - drivers/staging/brcm80211/brcmsmac/types.h | 10 ++- drivers/staging/brcm80211/brcmutil/utils.c | 67 ------------- drivers/staging/brcm80211/include/brcmu_utils.h | 45 --------- 7 files changed, 12 insertions(+), 250 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +0 -115
@@ -41,121 +41,6 @@module_param (sd_f2_blocksize, int,0 ); -/* IOVar table */ -enum { -IOV_MSGLEVEL =1 , -IOV_DEVREG , -IOV_HCIREGS , -IOV_RXCHAIN -}; - -static const struct brcmu_iovar sdioh_iovars[] = { - {"sd_devreg" ,IOV_DEVREG ,0 ,IOVT_BUFFER ,sizeof (struct brcmf_sdreg )} - , - {"sd_rxchain" ,IOV_RXCHAIN ,0 ,IOVT_BOOL ,0 } - , - {NULL ,0 ,0 ,0 ,0 } -}; - -int -brcmf_sdcard_iovar_op (struct brcmf_sdio_dev *sdiodev,const char *name, -void *params,int plen,void *arg,int len,bool set) -{ -const struct brcmu_iovar *vi =NULL ; -int bcmerror =0 ; -int val_size; -s32 int_val =0 ; -bool bool_val; -u32 actionid; - -if (name ==NULL || len <0 ) -return -EINVAL ; - -/* Set does not take qualifiers */ -if (set && (params || plen)) -return -EINVAL ; - -/* Get must have return space;*/ -if (!set && !(arg && len)) -return -EINVAL ; - -brcmf_dbg (TRACE ,"Enter (%s %s)\n" , set ?"set" :"get" , name); - - vi =brcmu_iovar_lookup (sdioh_iovars, name); -if (vi ==NULL ) { - bcmerror = -ENOTSUPP ; - goto exit; - } - - bcmerror =brcmu_iovar_lencheck (vi, arg, len, set); -if (bcmerror !=0 ) - goto exit; - -/* Set up params so get and set can share the convenience variables */ -if (params ==NULL ) { - params = arg; - plen = len; - } - -if (vi->type ==IOVT_VOID ) - val_size =0 ; -else if (vi->type ==IOVT_BUFFER ) - val_size = len; -else - val_size =sizeof (int ); - -if (plen >= (int )sizeof (int_val)) -memcpy (&int_val, params,sizeof (int_val)); - - bool_val = (int_val !=0 ) ? true : false; - - actionid = set ?IOV_SVAL (vi->varid) :IOV_GVAL (vi->varid); -switch (actionid) { -case IOV_GVAL (IOV_RXCHAIN ): - int_val = false; -memcpy (arg, &int_val, val_size); -break ; - -case IOV_GVAL (IOV_DEVREG ): - { -struct brcmf_sdreg *sd_ptr = - (struct brcmf_sdreg *) params; -u8 data =0 ; - -if (brcmf_sdioh_request_byte (sdiodev,SDIOH_READ , - sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = -EIO ; -break ; - } - - int_val = (int )data; -memcpy (arg, &int_val,sizeof (int_val)); -break ; - } - -case IOV_SVAL (IOV_DEVREG ): - { -struct brcmf_sdreg *sd_ptr = - (struct brcmf_sdreg *) params; -u8 data = (u8 ) sd_ptr->value; - -if (brcmf_sdioh_request_byte (sdiodev,SDIOH_WRITE , - sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = -EIO ; -break ; - } -break ; - } - -default : - bcmerror = -ENOTSUPP ; -break ; - } -exit: - -return bcmerror; -} -static void brcmf_sdioh_irqhandler (struct sdio_func *func) {struct brcmf_sdio_dev *sdiodev =dev_get_drvdata (&func->card->dev);
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -6
@@ -88,9 +88,6 @@#define TOE_TX_CSUM_OL 0x00000001#define TOE_RX_CSUM_OL 0x00000002 -/* maximum channels returned by the get valid channels iovar */ -#define WL_NUMCHANNELS 64 -#define BRCMF_BSS_INFO_VERSION 108/* current ver of brcmf_bss_info struct */ /* size of brcmf_scan_params not including variable length array */
@@ -810,9 +807,6 @@ struct brcmf_c_ioctl {/* Enter idle immediately (no timeout) */ #define BRCMF_IDLE_IMMEDIATE (-1) - -/* Values for idleclock iovar: other values are the sd_divisor to use -when idle */ #define BRCMF_IDLE_ACTIVE 0/* Do not request any SD clock change when idle */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +3 -11
@@ -4196,17 +4196,9 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus) bus->blocksize = bus->sdiodev->func[2 ]->cur_blksize; bus->roundup =min (max_roundup, bus->blocksize); -/* Query if bus module supports packet chaining, -default to use if supported */ -if (brcmf_sdcard_iovar_op (bus->sdiodev,"sd_rxchain" ,NULL ,0 , - &bus->sd_rxchain,sizeof (s32), - false) !=0 ) - bus->sd_rxchain = false; -else -brcmf_dbg (INFO ,"bus module (through sdiocard API) %s chaining\n" , - bus->sd_rxchain ?"supports" :"does not support" ); - - bus->use_rxchain = (bool ) bus->sd_rxchain; +/* bus module does not support packet chaining */ + bus->use_rxchain = false; + bus->sd_rxchain = false;return true; }
drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -5
@@ -205,11 +205,6 @@ extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw,/* Issue an abort to the specified function */ extern int brcmf_sdcard_abort (struct brcmf_sdio_dev *sdiodev,uint fn); -/* Miscellaneous knob tweaker. */ -extern int brcmf_sdcard_iovar_op (struct brcmf_sdio_dev *sdiodev, -const char *name,void *params,int plen, -void *arg,int len,bool set); -/* platform specific/high level functions */ extern int brcmf_sdio_function_init (void );extern int brcmf_sdio_register (void );
drivers/staging/brcm80211/brcmsmac/types.h +9 -1
@@ -351,7 +351,6 @@ struct brcms_info;struct brcms_c_info ;struct brcms_hardware ;struct brcms_c_if ; -struct brcmu_iovar ;struct brcmu_strbuf ;struct brcms_txq_info ;struct brcms_band ;
@@ -362,6 +361,15 @@ struct d11rxhdr;struct brcms_d11rxhdr ;struct txpwr_limits ; +/* iovar structure */ +struct brcmu_iovar { +const char *name;/* name for lookup and display */ +u16 varid;/* id for switch */ +u16 flags;/* driver-specific flag bits */ +u16 type;/* base type of argument */ +u16 minlen;/* min length for buffer vars */ +}; +/* brcm_msg_level is a bit vector with defs in defs.h */ extern u32 brcm_msg_level;
drivers/staging/brcm80211/brcmutil/utils.c +0 -67
73 lines not on this page · raw message
drivers/staging/brcm80211/include/brcmu_utils.h +0 -45
51 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 10/20 staging: brcm80211: removed unused encryption/security functionality
In reply to Roland VossenSoftmac relies on Mac80211 for this.
--- drivers/staging/brcm80211/brcmsmac/alloc.c | 15 ---- drivers/staging/brcm80211/brcmsmac/main.c | 59 +---------------- drivers/staging/brcm80211/brcmsmac/main.h | 97 ---------------------------- drivers/staging/brcm80211/brcmsmac/pub.h | 12 ---- 4 files changed, 3 insertions(+), 180 deletions(-)
drivers/staging/brcm80211/brcmsmac/alloc.c +0 -15
@@ -210,20 +210,6 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid) }brcms_c_bsscfg_ID_assign (wlc, wlc->cfg); - wlc->wsec_def_keys[0 ] = -kzalloc (sizeof (struct wsec_key ) *BRCMS_DEFAULT_KEYS , -GFP_ATOMIC ); -if (wlc->wsec_def_keys[0 ] ==NULL ) { - *err =1015 ; - goto fail; - }else { -int i; -for (i =1 ; i <BRCMS_DEFAULT_KEYS ; i++) - wlc->wsec_def_keys[i] = (struct wsec_key *) - ((unsigned long )wlc->wsec_def_keys[0 ] + - (sizeof (struct wsec_key ) * i)); - } - wlc->protection =kzalloc (sizeof (struct brcms_protection ),GFP_ATOMIC );if (wlc->protection ==NULL ) {
@@ -280,7 +266,6 @@ void brcms_c_detach_mfree(struct brcms_c_info *wlc)brcms_c_pub_mfree (wlc->pub);kfree (wlc->modulecb);kfree (wlc->default_bss); -kfree (wlc->wsec_def_keys[0 ]);kfree (wlc->protection);kfree (wlc->stf);kfree (wlc->bandstate[0 ]);
drivers/staging/brcm80211/brcmsmac/main.c +3 -56
113 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/main.h +0 -97
151 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/pub.h +0 -12
@@ -128,16 +128,6 @@ struct brcms_c_rateset {u8 mcs[MCSSET_LEN ];/* supported mcs index bit map */ }; -struct rsn_parms { -u8 flags;/* misc booleans (e.g., supported) */ -u8 multicast;/* multicast cipher */ -u8 ucount;/* count of unicast ciphers */ -u8 unicast[4 ];/* unicast ciphers */ -u8 acount;/* count of auth modes */ -u8 auth[4 ];/* Authentication modes */ -u8 PAD[4 ];/* padding for future growth */ -}; -/* All the HT-specific default advertised capabilities (including AMPDU) * should be grouped here at one place */
@@ -160,8 +150,6 @@ struct brcms_bss_info {s8 phy_noise;/* noise right after tx (in dBm) */ u16 capability;/* Capability information */ u8 wme_qosinfo;/* QoS Info from WME IE; valid if BSS_WME flag set */ -struct rsn_parms wpa; -struct rsn_parms wpa2;u16 qbss_load_aac;/* qbss load available admission capacity */ /* qbss_load_chan_free <- (0xff - chan utilization of qbss_load_ie_t) */ u8 qbss_load_chan_free;/* indicates how free the channel is */
Signature · 1 line
1.7.4.1
PATCH 12/20 staging: brcm80211: cleaned up unused softmac struct members
In reply to Roland VossenStruct members were unused or only written but never read.
--- drivers/staging/brcm80211/brcmsmac/alloc.c | 45 +----------------- drivers/staging/brcm80211/brcmsmac/main.c | 68 +++------------------------- drivers/staging/brcm80211/brcmsmac/main.h | 11 ----- drivers/staging/brcm80211/brcmsmac/pub.h | 62 ------------------------- 4 files changed, 9 insertions(+), 177 deletions(-)
drivers/staging/brcm80211/brcmsmac/alloc.c +2 -43
@@ -20,44 +20,11 @@#include "main.h" #include "alloc.h" -static void brcms_c_pub_mfree (struct brcms_pub *pub) -{ -if (pub ==NULL ) -return ; - -kfree (pub->multicast); -kfree (pub); -} - -static struct brcms_pub *brcms_c_pub_malloc (uint unit,uint *err,uint devid) -{ -struct brcms_pub *pub; - - pub =kzalloc (sizeof (struct brcms_pub ),GFP_ATOMIC ); -if (pub ==NULL ) { - *err =1001 ; - goto fail; - } - - pub->multicast =kzalloc (ETH_ALEN *MAXMULTILIST ,GFP_ATOMIC ); -if (pub->multicast ==NULL ) { - *err =1003 ; - goto fail; - } - -return pub; - - fail: -brcms_c_pub_mfree (pub); -return NULL ; -} -static void brcms_c_bsscfg_mfree (struct brcms_bss_cfg *cfg) {if (cfg ==NULL )return ; -kfree (cfg->maclist);kfree (cfg->current_bss);kfree (cfg); }
@@ -81,13 +48,6 @@ static struct brcms_bss_cfg *brcms_c_bsscfg_malloc(uint unit)return NULL ; } -static void brcms_c_bsscfg_ID_assign (struct brcms_c_info *wlc, -struct brcms_bss_cfg *bsscfg) -{ - bsscfg->ID = wlc->next_bsscfg_ID; - wlc->next_bsscfg_ID++; -} -/* * The common driver entry routine. Error codes should be unique */
@@ -102,7 +62,7 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid) }/* allocate struct brcms_c_pub state structure */ - wlc->pub =brcms_c_pub_malloc (unit, err, devid); + wlc->pub =kzalloc (sizeof (struct brcms_pub ),GFP_ATOMIC );if (wlc->pub ==NULL ) { *err =1003 ; goto fail;
@@ -150,7 +110,6 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid) *err =1011 ; goto fail; } -brcms_c_bsscfg_ID_assign (wlc, wlc->cfg); wlc->protection =kzalloc (sizeof (struct brcms_protection ),GFP_ATOMIC );
@@ -205,7 +164,7 @@ void brcms_c_detach_mfree(struct brcms_c_info *wlc)return ;brcms_c_bsscfg_mfree (wlc->cfg); -brcms_c_pub_mfree (wlc->pub); +kfree (wlc->pub);kfree (wlc->modulecb);kfree (wlc->default_bss);kfree (wlc->protection);
drivers/staging/brcm80211/brcmsmac/main.c +7 -61
163 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/main.h +0 -11
@@ -568,7 +568,6 @@ struct brcms_txq_info {* tempsense_lasttime; * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. -* next_bsscfg_ID; * pkt_queue: txq for transmit packets. * mpc_dur: total time (ms) in mpc mode except for the portion since * radio is turned off last time.
@@ -722,8 +721,6 @@ struct brcms_c_info {u16 tx_duty_cycle_ofdm;u16 tx_duty_cycle_cck; -u16 next_bsscfg_ID; -struct brcms_txq_info *pkt_queue;u32 mpc_dur;u32 mpc_laston_ts;
@@ -757,11 +754,6 @@ struct antsel_info {* bcmc_scb: one bcmc_scb per band * _idx: the index of this bsscfg, assigned at wlc_bsscfg_alloc() * -* MAC filter -* ---------- -* nmac: # of entries on maclist array -* macmode: allow/deny stations on maclist array -* maclist: list of source MAC addrs to match * * BSSID: BSSID (associated) * cur_etheraddr: h/w address
@@ -797,9 +789,6 @@ struct brcms_bss_cfg {u8 SSID [IEEE80211_MAX_SSID_LEN ];struct scb *bcmc_scb[MAXBANDS ];s8 _idx; -uint nmac; -int macmode; -struct ether_addr *maclist;u8 BSSID [ETH_ALEN ];u8 cur_etheraddr[ETH_ALEN ];u16 bcmc_fid;
drivers/staging/brcm80211/brcmsmac/pub.h +0 -62
104 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 15/20 staging: brcm80211: removed unused softmac struct brcms_c_if
In reply to Roland VossenNothing useful was done with this struct.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 4 ++-- drivers/staging/brcm80211/brcmsmac/main.c | 12 +++++------- drivers/staging/brcm80211/brcmsmac/main.h | 22 +--------------------- drivers/staging/brcm80211/brcmsmac/pub.h | 3 +-- drivers/staging/brcm80211/brcmsmac/types.h | 1 - 5 files changed, 9 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -2
@@ -510,7 +510,7 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,/* retrieve the current rates */ LOCK (wl); error =brcms_c_ioctl (wl->wlc,BRCM_GET_CURR_RATESET , - &rs,sizeof (rs),NULL ); + &rs,sizeof (rs));UNLOCK (wl);if (error) { wiphy_err(wiphy, "%s: retrieve rateset failed: %d\n",
@@ -530,7 +530,7 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,/* update the rate set */ LOCK (wl); -brcms_c_ioctl (wl->wlc,BRCM_SET_RATESET , &rs,sizeof (rs),NULL ); +brcms_c_ioctl (wl->wlc,BRCM_SET_RATESET , &rs,sizeof (rs));UNLOCK (wl); }if (changed &BSS_CHANGED_BEACON_INT ) {
drivers/staging/brcm80211/brcmsmac/main.c +5 -7
@@ -6060,13 +6060,13 @@ brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs_arg)/* simplified integer set interface for common ioctl handler */ int brcms_c_set (struct brcms_c_info *wlc,int cmd,int arg) { -return brcms_c_ioctl (wlc, cmd, (void *)&arg,sizeof (arg),NULL ); +return brcms_c_ioctl (wlc, cmd, (void *)&arg,sizeof (arg)); }/* simplified integer get interface for common ioctl handler */ int brcms_c_get (struct brcms_c_info *wlc,int cmd,int *arg) { -return brcms_c_ioctl (wlc, cmd, arg,sizeof (int ),NULL ); +return brcms_c_ioctl (wlc, cmd, arg,sizeof (int )); }static void brcms_c_ofdm_rateset_war (struct brcms_c_info *wlc)
@@ -6086,8 +6086,7 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)/* common ioctl handler. return: 0=ok, -1=error, positive=particular error */ static int -_brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len, -struct brcms_c_if *wlcif) +_brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len) {int val, *pval;bool bool_val;
@@ -6335,10 +6334,9 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len, }int -brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len, -struct brcms_c_if *wlcif) +brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len) { -return _brcms_c_ioctl (wlc, cmd, arg, len, wlcif); +return _brcms_c_ioctl (wlc, cmd, arg, len); }/*
drivers/staging/brcm80211/brcmsmac/main.h +1 -21
@@ -320,8 +320,7 @@ struct modulecb {*/ int (*iovar_fn)(void *handle,const struct brcmu_iovar *vi,u32 actionid,const char *name,void *params, -uint plen,void *arg,int alen,int vsize, -struct brcms_c_if *wlcif); +uint plen,void *arg,int alen,int vsize);int (*down_fn)(void *handle);/* down handler. Note: the int returned * by the down function is a count of the
@@ -347,25 +346,6 @@ struct wme_param_ie {struct edcf_acparam acparam[AC_COUNT ]; } __packed; -/* virtual interface */ -struct brcms_c_if { -struct brcms_c_if *next; -u8 type;/* BSS or WDS */ -u8 index;/* assigned in wl_add_if(), index of the wlif if any, -* not necessarily corresponding to bsscfg._idx or -* AID2PVBMAP(scb). -*/ -u8 flags;/* flags for the interface */ -struct brcms_if *wlif;/* pointer to wlif */ -struct brcms_txq_info *qi;/* pointer to associated tx queue */ -union { -/* pointer to scb if WDS */ -struct scb *scb; -/* pointer to bsscfg if BSS */ -struct brcms_bss_cfg *bsscfg; - } u; -}; -struct brcms_hw_band {int bandtype;/* BRCM_BAND_2G, BRCM_BAND_5G */ uint bandunit;/* bandstate[] index */
drivers/staging/brcm80211/brcmsmac/pub.h +1 -2
@@ -327,8 +327,7 @@ extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);extern void brcms_c_sendpkt_mac80211 (struct brcms_c_info *wlc,struct sk_buff *sdu,struct ieee80211_hw *hw); -extern int brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len, -struct brcms_c_if *wlcif); +extern int brcms_c_ioctl (struct brcms_c_info *wlc,int cmd,void *arg,int len);extern bool brcms_c_aggregatable (struct brcms_c_info *wlc,u8 tid);/* helper functions */
drivers/staging/brcm80211/brcmsmac/types.h +0 -1
@@ -334,7 +334,6 @@ struct ieee80211_tx_queue_params;struct brcms_info ;struct brcms_c_info ;struct brcms_hardware ; -struct brcms_c_if ;struct brcmu_strbuf ;struct brcms_txq_info ;struct brcms_band ;
Signature · 1 line
1.7.4.1
PATCH 18/20 staging: brcm80211: removed more unused softmac main.h struct members
In reply to Roland VossenMembers were always set to zero, or set but never read.
--- drivers/staging/brcm80211/brcmsmac/main.c | 21 ++----------- drivers/staging/brcm80211/brcmsmac/main.h | 47 ----------------------------- 2 files changed, 3 insertions(+), 65 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -18
@@ -168,8 +168,6 @@#define BRCMS_HWRXOFF 38/* chip rx buffer offset */ -#define OSL_SYSUPTIME () ((u32)jiffies * (1000 / HZ)) -/* * driver maintains internal 'tick'(wlc->pub->now) which increments in 1s * OS timer(soft watchdog) it is not a wall clock and won't increment when
@@ -3359,8 +3357,7 @@ static void brcms_c_ucode_mac_upd(struct brcms_c_info *wlc)* inits to populate a bogus beacon. */ if (BRCMS_PHY_11N_CAP (wlc->band)) -brcms_c_write_shm (wlc,M_BCN_TXTSF_OFFSET , - wlc->band->bcntsfoff); +brcms_c_write_shm (wlc,M_BCN_TXTSF_OFFSET ,0 ); } }else {/* disable an active IBSS if we are not on the home channel */
@@ -3593,7 +3590,7 @@ void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc, bool promisc)void brcms_c_mac_bcn_promisc (struct brcms_c_info *wlc) { -if (wlc->bcnmisc_ibss || wlc->bcnmisc_scan || wlc->bcnmisc_monitor) +if (wlc->bcnmisc_monitor)brcms_c_mctrl (wlc,MCTL_BCNS_PROMISC ,MCTL_BCNS_PROMISC );else brcms_c_mctrl (wlc,MCTL_BCNS_PROMISC ,0 );
@@ -4275,7 +4272,6 @@ static void brcms_c_watchdog(void *arg) WL_RADIO_MPC_DISABLE);if (wlc->mpc &&brcms_c_ismpc (wlc)) wlc->mpc_offcnt =0 ; - wlc->mpc_laston_ts =OSL_SYSUPTIME (); } }
@@ -5167,22 +5163,15 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,if (BRCMS_SGI_CAP_PHY (wlc)) {brcms_c_ht_update_sgi_rx (wlc, (BRCMS_N_SGI_20 |BRCMS_N_SGI_40 )); - wlc->sgi_tx =AUTO ; }else if (BRCMS_ISSSLPNPHY (wlc->band)) {brcms_c_ht_update_sgi_rx (wlc, (BRCMS_N_SGI_20 |BRCMS_N_SGI_40 )); - wlc->sgi_tx =AUTO ; }else {brcms_c_ht_update_sgi_rx (wlc,0 ); - wlc->sgi_tx =OFF ; }/* *******nvram 11n config overrides Start ********* */ -/* apply the sgi override from nvram conf */ -if (n_disabled &WLFEATURE_DISABLE_11N_SGI_TX ) - wlc->sgi_tx =OFF ; -if (n_disabled &WLFEATURE_DISABLE_11N_SGI_RX )brcms_c_ht_update_sgi_rx (wlc,0 );
@@ -5402,7 +5391,6 @@ void brcms_c_radio_mpc_upd(struct brcms_c_info *wlc) wlc->mpc_dlycnt =BRCMS_MPC_MAX_DELAYCNT ; else wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT; - wlc->mpc_dur +=OSL_SYSUPTIME () - wlc->mpc_laston_ts; }/* * Below logic is meant to capture the transition from mpc off
@@ -5825,9 +5813,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)if (config == true)brcms_c_protection_upd (wlc,BRCMS_PROT_G_USER , gmode); -/* Clear supported rates filter */ -memset (&wlc->sup_rates_override,0 ,sizeof (struct brcms_c_rateset )); -/* Clear rateset override */ memset (&rs,0 ,sizeof (struct brcms_c_rateset ));
@@ -6663,7 +6648,7 @@ brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q,if (eprec >=0 ) {bool discard_oldest; - discard_oldest =ac_bitmap_tst (wlc->wme_dp, eprec); + discard_oldest =ac_bitmap_tst (0 , eprec);/* Refuse newer packet unless configured to discard oldest */ if (eprec == prec && !discard_oldest) {
drivers/staging/brcm80211/brcmsmac/main.h +0 -47
114 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 19/20 staging: brcm80211: removed softmac files alloc.c/alloc.h
In reply to Roland VossenAlloc.c does not contain enough functionality anymore to warrant its own file. Moved functionality into main.c
--- drivers/staging/brcm80211/brcmsmac/Makefile | 1 - drivers/staging/brcm80211/brcmsmac/alloc.c | 181 --------------------------- drivers/staging/brcm80211/brcmsmac/alloc.h | 19 --- drivers/staging/brcm80211/brcmsmac/main.c | 159 +++++++++++++++++++++++- 4 files changed, 158 insertions(+), 202 deletions(-) delete mode 100644 drivers/staging/brcm80211/brcmsmac/alloc.c delete mode 100644 drivers/staging/brcm80211/brcmsmac/alloc.h
drivers/staging/brcm80211/brcmsmac/Makefile +0 -1
@@ -23,7 +23,6 @@ ccflags-y := \ BRCMSMAC_OFILES := \ mac80211_if.o \ ucode_loader.o \ - alloc.o \ ampdu.o \ antsel.o \ channel.o \
drivers/staging/brcm80211/brcmsmac/alloc.c deleted +0 -181
181 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/alloc.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* -* Copyright (c) 2010 Broadcom Corporation -* -* Permission to use, copy, modify, and/or distribute this software for any -* purpose with or without fee is hereby granted, provided that the above -* copyright notice and this permission notice appear in all copies. -* -* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -extern struct brcms_c_info *brcms_c_attach_malloc (uint unit,uint *err, -uint devid); -extern void brcms_c_detach_mfree (struct brcms_c_info *wlc);
drivers/staging/brcm80211/brcmsmac/main.c +158 -1
171 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 5/20 staging: brcm80211: cleaned up fullmac macro's
In reply to Roland VossenSubstituted/moved/removed macro's.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 6 -- drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 18 +++-- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 4 + drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 104 +++++++++------------- drivers/staging/brcm80211/brcmfmac/sdio_host.h | 3 - drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 105 +++++++++++++--------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 38 +++++++-- 7 files changed, 150 insertions(+), 128 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -6
@@ -83,10 +83,6 @@#define WLC_PHY_TYPE_LCN 8#define WLC_PHY_TYPE_NULL 0xf -#define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u) -#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \ - offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern) -#define BRCMF_EVENTING_MASK_LEN 16#define TOE_TX_CSUM_OL 0x00000001
@@ -478,8 +474,6 @@ struct brcmf_assoc_params {/* list of chanspecs */ u16 chanspec_list[1 ]; }; -#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ - (sizeof(struct brcmf_assoc_params) - sizeof(u16))/* used for join with or without a specific bssid and channel list */ struct brcmf_join_params {
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +11 -7
@@ -338,11 +338,15 @@ done:return ret; } -#define PKTSUMNEEDED (skb) \ - (((struct sk_buff *)(skb))->ip_summed == CHECKSUM_PARTIAL) -#define PKTSETSUMGOOD (skb, x) \ - (((struct sk_buff *)(skb))->ip_summed = \ - ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE)) +static bool pkt_sum_needed (struct sk_buff *skb) +{ +return skb->ip_summed ==CHECKSUM_PARTIAL ; +} + +static void pkt_set_sum_good (struct sk_buff *skb,bool x) +{ + skb->ip_summed = (x ?CHECKSUM_UNNECESSARY :CHECKSUM_NONE ); +}void brcmf_proto_dump (struct brcmf_pub *drvr,struct brcmu_strbuf *strbuf) {
@@ -363,7 +367,7 @@ void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx, h = (struct brcmf_proto_bdc_header *)(pktbuf->data); h->flags = (BDC_PROTO_VER <<BDC_FLAG_VER_SHIFT ); -if (PKTSUMNEEDED (pktbuf)) +if (pkt_sum_needed (pktbuf)) h->flags |=BDC_FLAG_SUM_NEEDED ; h->priority = (pktbuf->priority &BDC_PRIORITY_MASK );
@@ -405,7 +409,7 @@ int brcmf_proto_hdrpull(struct brcmf_pub *drvr, int *ifidx,if (h->flags &BDC_FLAG_SUM_GOOD ) {brcmf_dbg (INFO ,"%s: BDC packet received with good rx-csum, flags 0x%x\n" ,brcmf_ifname (drvr, *ifidx), h->flags); -PKTSETSUMGOOD (pktbuf, true); +pkt_set_sum_good (pktbuf, true); } pktbuf->priority = h->priority &BDC_PRIORITY_MASK ;
drivers/staging/brcm80211/brcmfmac/dhd_common.c +4 -0
@@ -35,6 +35,10 @@ int brcmf_msg_level;#define MSGTRACE_VERSION 1 +#define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u) +#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \ + offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern) +#ifdef BCMDBG static const char brcmf_version[] ="Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on "
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +42 -62
246 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -3
@@ -202,9 +202,6 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,/* Async request (vs. sync request) */ #define SDIO_REQ_ASYNC 0x4 -/* Pending (non-error) return code */ -#define BCME_PENDING 1 -/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only). * rw: read or write (0/1) * addr: direct SDIO address
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +62 -43
261 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +31 -7
@@ -319,15 +319,39 @@ struct brcmf_cfg80211_priv {u8 ci[0 ]__aligned(NETDEV_ALIGN) ; }; -#define cfg_to_wiphy (w) (w->wdev->wiphy) -#define wiphy_to_cfg (w) ((struct brcmf_cfg80211_priv *)(wiphy_priv(w))) -#define cfg_to_wdev (w) (w->wdev) -#define wdev_to_cfg (w) ((struct brcmf_cfg80211_priv *)(wdev_priv(w))) -#define cfg_to_ndev (w) (w->wdev->netdev) -#define ndev_to_cfg (n) (wdev_to_cfg(n->ieee80211_ptr)) +static inline struct wiphy *cfg_to_wiphy (struct brcmf_cfg80211_priv *w) +{ +return w->wdev->wiphy; +} + +static inline struct brcmf_cfg80211_priv *wiphy_to_cfg (struct wiphy *w) +{ +return (struct brcmf_cfg80211_priv *)(wiphy_priv (w)); +} + +static inline struct brcmf_cfg80211_priv *wdev_to_cfg (struct wireless_dev *wd) +{ +return (struct brcmf_cfg80211_priv *)(wdev_priv (wd)); +} + +static inline struct net_device *cfg_to_ndev (struct brcmf_cfg80211_priv *cfg) +{ +return cfg->wdev->netdev; +} + +static inline struct brcmf_cfg80211_priv *ndev_to_cfg (struct net_device *ndev) +{ +return wdev_to_cfg (ndev->ieee80211_ptr); +} +#define iscan_to_cfg (i) ((struct brcmf_cfg80211_priv *)(i->data))#define cfg_to_iscan (w) (w->iscan) -#define cfg_to_conn (w) (&w->conn_info) + +static inline struct +brcmf_cfg80211_connect_info *cfg_to_conn (struct brcmf_cfg80211_priv *cfg) +{ +return &cfg->conn_info; +}static inline struct brcmf_bss_info *next_bss (struct brcmf_scan_results *list,struct brcmf_bss_info *bss)
Signature · 1 line
1.7.4.1
PATCH 8/20 staging: brcm80211: remove static function variable in brcmfmac
In reply to Roland VossenFrom: Arend van Spriel <[email protected]>
The static local variable save_ms in brcmf_sdbrcm_wd_timer() has been removed and placed in the structure brcmf_bus definition.
--- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +4 -5
@@ -654,6 +654,7 @@ struct brcmf_bus {struct completion watchdog_wait;struct task_struct *watchdog_tsk;bool wd_timer_valid; +uint save_ms;struct tasklet_struct tasklet;struct task_struct *dpc_tsk;
@@ -5031,8 +5032,6 @@ brcmf_sdbrcm_watchdog(unsigned long data)void brcmf_sdbrcm_wd_timer (struct brcmf_bus *bus,uint wdtick) { -static uint save_ms; -/* don't start the wd until fw is loaded */ if (bus->drvr->busstate ==BRCMF_BUS_DOWN )return ;
@@ -5041,14 +5040,14 @@ brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick)if (!wdtick && bus->wd_timer_valid == true) {del_timer_sync (&bus->timer); bus->wd_timer_valid = false; - save_ms = wdtick; + bus->save_ms = wdtick;return ; }if (wdtick) { brcmf_watchdog_ms = (uint ) wdtick; -if (save_ms != brcmf_watchdog_ms) { +if (bus->save_ms != brcmf_watchdog_ms) {if (bus->wd_timer_valid == true)/* Stop timer and restart at new value */ del_timer_sync (&bus->timer);
@@ -5067,7 +5066,7 @@ brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick) } bus->wd_timer_valid = true; - save_ms = wdtick; + bus->save_ms = wdtick; } }
Signature · 1 line
1.7.4.1
PATCH 9/20 staging: brcm80211: remove static variables from wl_cfg80211.c
In reply to Roland VossenFrom: Arend van Spriel <[email protected]>
The source file contained two static variable which were used by the driver instance. This makes having multiple instances of the driver on one system impossible. This patch removes the use of these static variables allowing multiple driver instances.
--- drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 1 - drivers/staging/brcm80211/brcmfmac/dhd.h | 2 + drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 3 + drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 20 +++-- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 5 ++ drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 77 ++++++++------------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 15 ++-- 7 files changed, 59 insertions(+), 64 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +0 -1
@@ -539,7 +539,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,return -ENODEV ; sdiodev->func[2 ] = func; -brcmf_cfg80211_sdio_func (func);brcmf_dbg (TRACE ,"F2 found, calling brcmf_sdio_probe...\n" ); ret =brcmf_sdio_probe (sdiodev); }
drivers/staging/brcm80211/brcmfmac/dhd.h +2 -0
@@ -540,6 +540,7 @@ struct brcmf_ioctl {struct brcmf_bus ;/* device bus info */ struct brcmf_proto ;/* device communication protocol info */ struct brcmf_info ;/* device driver info */ +struct brcmf_cfg80211_dev ;/* cfg80211 device info */ /* Common structure for module and instance linkage */ struct brcmf_pub {
@@ -547,6 +548,7 @@ struct brcmf_pub {struct brcmf_bus *bus;struct brcmf_proto *prot;struct brcmf_info *info; +struct brcmf_cfg80211_dev *config;/* Internal brcmf items */ bool up;/* Driver up/down (to OS) */
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +3 -0
@@ -38,6 +38,9 @@ extern uint brcmf_watchdog_ms;extern int brcmf_bus_register (void );extern void brcmf_bus_unregister (void ); +/* obtain linux device object providing bus function */ +extern struct device *brcmf_bus_get_device (struct brcmf_bus *bus); +/* Stop bus module: clear pending frames, disable data flow */ extern void brcmf_sdbrcm_bus_stop (struct brcmf_bus *bus,bool enforce_mutex);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +12 -8
@@ -828,7 +828,7 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *net,sprintf (info->version,"%lu" , drvr_priv->pub.drv_version);sprintf (info->fw_version,"%s" ,BCM4329_FW_NAME );sprintf (info->bus_info,"%s" , -dev_name (&brcmf_cfg80211_get_sdio_func ()->dev)); +dev_name (brcmf_bus_get_device (drvr_priv->pub.bus))); }static struct ethtool_ops brcmf_ethtool_ops = {
@@ -1055,15 +1055,15 @@ done:static int brcmf_netdev_stop (struct net_device *net) { -struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv (net); +struct brcmf_pub *drvr = *(struct brcmf_pub **)netdev_priv (net);brcmf_dbg (TRACE ,"Enter\n" ); -brcmf_cfg80211_down (); -if (drvr_priv->pub.up ==0 ) +brcmf_cfg80211_down (drvr->config); +if (drvr->up ==0 )return 0 ;/* Set state and stop OS transmissions */ - drvr_priv->pub.up =0 ; + drvr->up =0 ;netif_stop_queue (net);return 0 ;
@@ -1102,7 +1102,7 @@ static int brcmf_netdev_open(struct net_device *net)/* Allow transmit calls */ netif_start_queue (net); drvr_priv->pub.up =1 ; -if (unlikely (brcmf_cfg80211_up ())) { +if (unlikely (brcmf_cfg80211_up (drvr_priv->pub.config))) {brcmf_dbg (ERROR ,"failed to bring up cfg80211\n" );return -1 ; }
@@ -1220,7 +1220,11 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen) }/* Attach and link in the cfg80211 */ -if (unlikely (brcmf_cfg80211_attach (net, &drvr_priv->pub))) { + drvr_priv->pub.config = +brcmf_cfg80211_attach (net, +brcmf_bus_get_device (bus), + &drvr_priv->pub); +if (unlikely (drvr_priv->pub.config ==NULL )) {brcmf_dbg (ERROR ,"wl_cfg80211_attach failed\n" ); goto fail; }
@@ -1425,7 +1429,7 @@ void brcmf_detach(struct brcmf_pub *drvr)if (drvr->prot)brcmf_proto_detach (drvr); -brcmf_cfg80211_detach (); +brcmf_cfg80211_detach (drvr->config);free_netdev (ifp->net);kfree (ifp);
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +5 -0
@@ -4317,6 +4317,11 @@ void brcmf_bus_unregister(void)brcmf_sdio_unregister (); } +struct device *brcmf_bus_get_device (struct brcmf_bus *bus) +{ +return &bus->sdiodev->func[2 ]->dev; +} +static int brcmf_sdbrcm_download_code_file (struct brcmf_bus *bus) {int offset =0 ;
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +29 -48
163 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +8 -7
@@ -364,16 +364,17 @@ static inline struct brcmf_bss_info *next_bss(struct brcmf_scan_results *list,#define for_each_bss (list, bss, __i) \ for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, \ - bss = next_bss(list, bss)) + bss = next_bss(list, bss)) + +extern struct brcmf_cfg80211_dev *brcmf_cfg80211_attach (struct net_device *ndev, +struct device *busdev, +void *data); +extern void brcmf_cfg80211_detach (struct brcmf_cfg80211_dev *cfg); -extern s32 brcmf_cfg80211_attach (struct net_device *ndev,void *data); -extern void brcmf_cfg80211_detach (void );/* event handler from dongle */ extern void brcmf_cfg80211_event (struct net_device *ndev,const struct brcmf_event_msg *e,void *data); -extern void brcmf_cfg80211_sdio_func (void *func);/* set sdio function info */ -extern struct sdio_func *brcmf_cfg80211_get_sdio_func (void ); -extern s32 brcmf_cfg80211_up (void );/* dongle up */ -extern s32 brcmf_cfg80211_down (void );/* dongle down */ +extern s32 brcmf_cfg80211_up (struct brcmf_cfg80211_dev *cfg_dev); +extern s32 brcmf_cfg80211_down (struct brcmf_cfg80211_dev *cfg_dev);#endif /* _wl_cfg80211_h_ */
Signature · 1 line
1.7.4.1
PATCH 11/20 staging: brcm80211: removed softmac 'tunable' functionality
In reply to Roland VossenRemoved unused mechanism as part of code cleanup.
--- drivers/staging/brcm80211/brcmsmac/alloc.c | 58 ---------------------------- drivers/staging/brcm80211/brcmsmac/ampdu.c | 5 ++- drivers/staging/brcm80211/brcmsmac/main.c | 41 +++++++++++++------- drivers/staging/brcm80211/brcmsmac/pub.h | 20 ---------- drivers/staging/brcm80211/brcmsmac/types.h | 16 -------- 5 files changed, 31 insertions(+), 109 deletions(-)
drivers/staging/brcm80211/brcmsmac/alloc.c +0 -58
@@ -20,61 +20,12 @@#include "main.h" #include "alloc.h" -/* Max # of entries in Tx FIFO based on 4kb page size */ -#define NTXD 256 -/* Max # of entries in Rx FIFO based on 4kb page size */ -#define NRXD 256 -/* try to keep this # rbufs posted to the chip */ -#define NRXBUFPOST 32 -/* Maximum SCBs in cache for STA */ -#define MAXSCB 32 - -/* Count of packet callback structures. either of following -* 1. Set to the number of SCBs since a STA -* can queue up a rate callback for each IBSS STA it knows about, and an AP can -* queue up an "are you there?" Null Data callback for each associated STA -* 2. controlled by tunable config file -*/ -#define MAXPKTCB MAXSCB/* Max number of packet callbacks */ - -/* Number of BSS handled in ucode bcn/prb */ -#define BRCMS_MAX_UCODE_BSS (16) -/* Number of BSS handled in sw bcn/prb */ -#define BRCMS_MAX_UCODE_BSS4 (4) - -/* data msg txq hiwat mark */ -#define BRCMS_DATAHIWAT 50 -#define BRCMS_AMPDUDATAHIWAT 255 - -/* bounded rx loops */ -#define RXBND 8/* max # frames to process in brcms_c_recv() */ -#define TXSBND 8/* max # tx status to process in wlc_txstatus() */ - -static void brcms_c_tunables_init (struct brcms_tunables *tunables,uint devid) -{ - tunables->ntxd =NTXD ; - tunables->nrxd =NRXD ; - tunables->rxbufsz =RXBUFSZ ; - tunables->nrxbufpost =NRXBUFPOST ; - tunables->maxscb =MAXSCB ; - tunables->ampdunummpdu =AMPDU_NUM_MPDU ; - tunables->maxpktcb =MAXPKTCB ; - tunables->maxucodebss =BRCMS_MAX_UCODE_BSS ; - tunables->maxucodebss4 =BRCMS_MAX_UCODE_BSS4 ; - tunables->maxbss =MAXBSS ; - tunables->datahiwat =BRCMS_DATAHIWAT ; - tunables->ampdudatahiwat =BRCMS_AMPDUDATAHIWAT ; - tunables->rxbnd =RXBND ; - tunables->txsbnd =TXSBND ; -} -static void brcms_c_pub_mfree (struct brcms_pub *pub) {if (pub ==NULL )return ;kfree (pub->multicast); -kfree (pub->tunables);kfree (pub); }
@@ -88,15 +39,6 @@ static struct brcms_pub *brcms_c_pub_malloc(uint unit, uint *err, uint devid) goto fail; } - pub->tunables =kzalloc (sizeof (struct brcms_tunables ),GFP_ATOMIC ); -if (pub->tunables ==NULL ) { - *err =1028 ; - goto fail; - } - -/* need to init the tunables now */ -brcms_c_tunables_init (pub->tunables, devid); - pub->multicast =kzalloc (ETH_ALEN *MAXMULTILIST ,GFP_ATOMIC );if (pub->multicast ==NULL ) { *err =1003 ;
drivers/staging/brcm80211/brcmsmac/ampdu.c +4 -1
@@ -62,6 +62,9 @@#define AMPDU_DELIMITER_LEN 4 +/* max allowed number of mpdus in an ampdu (2 streams) */ +#define AMPDU_NUM_MPDU 16 +#define TX_SEQ_TO_INDEX (seq) ((seq) % AMPDU_TX_BA_MAX_WSIZE)/* max possible overhead per mpdu in the ampdu; 3 is for roundup if needed */
@@ -287,7 +290,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,struct scb_ampdu *scb_ampdu = &scb->scb_ampdu;int i; - scb_ampdu->max_pdu = (u8 ) ampdu->wlc->pub->tunables->ampdunummpdu; + scb_ampdu->max_pdu =AMPDU_NUM_MPDU ;/* go back to legacy size if some preloading is occurring */ for (i =0 ; i <NUM_FFPLD_FIFO ; i++) {
drivers/staging/brcm80211/brcmsmac/main.c +27 -14
115 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/pub.h +0 -20
@@ -102,24 +102,6 @@#define MAX_STREAMS_SUPPORTED 4/* max number of streams supported */ -struct brcms_tunables { -int ntxd;/* size of tx descriptor table */ -int nrxd;/* size of rx descriptor table */ -int rxbufsz;/* size of rx buffers to post */ -int nrxbufpost;/* # of rx buffers to post */ -int maxscb;/* # of SCBs supported */ -int ampdunummpdu;/* max number of mpdu in an ampdu */ -int maxpktcb;/* max # of packet callbacks */ -int maxucodebss;/* max # of BSS handled in ucode bcn/prb */ -int maxucodebss4;/* max # of BSS handled in sw bcn/prb */ -int maxbss;/* max # of bss info elements in scan list */ -int datahiwat;/* data msg txq hiwat mark */ -int ampdudatahiwat;/* AMPDU msg txq hiwat mark */ -int rxbnd;/* max # rx bufs to process before deferring to dpc */ -int txsbnd;/* max # tx status to process in wlc_txstatus() */ -int memreserved;/* memory reserved for BMAC's USB dma rx */ -}; -struct brcms_c_rateset {uint count;/* number of rates in rates[] */ /* rates in 500kbps units w/hi bit set if basic */
@@ -176,8 +158,6 @@ struct brcms_pub {char *vars;/* "environment" name=value */ bool up;/* interface up and running */ bool hw_off;/* HW is off */ -/* tunables: ntxd, nrxd, maxscb, etc. */ -struct brcms_tunables *tunables;bool hw_up;/* one time hw up/down */ bool _piomode;/* true if pio mode */ uint _nbands;/* # bands supported */
drivers/staging/brcm80211/brcmsmac/types.h +0 -16
@@ -244,26 +244,10 @@* ******************************************************************** */ -/************************************************* -* Defaults for tunables (e.g. sizing constants) -* -* For each new tunable, add a member to the end -* of struct brcms_tunables in brcms_c_pub.h to enable -* runtime checks of tunable values. (Directly -* using the macros in code invalidates ROM code) -* -* *********************************************** -*/ - -/* max allowed number of mpdus in an ampdu (2 streams) */ -#define AMPDU_NUM_MPDU 16 -/* NetBSD also needs to keep track of this */ /* max # BSS configs */ #define BRCMS_MAXBSSCFG (1) -/* max # available networks */ -#define MAXBSS 64 #define BCMMSG(dev, fmt, args...) \ do { \
Signature · 1 line
1.7.4.1
PATCH 13/20 staging: brcm80211: removed softmac ratespec override functionality
In reply to Roland VossenThis was unused.
--- drivers/staging/brcm80211/brcmsmac/main.c | 17 +++-------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 -- drivers/staging/brcm80211/brcmsmac/stf.c | 12 ++++-------- 3 files changed, 7 insertions(+), 24 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -14
@@ -5913,12 +5913,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)*/ if ((gmode ==GMODE_LEGACY_B ) && (band->gmode !=GMODE_LEGACY_B )) { band->gmode = gmode; -if (band->rspec_override && !IS_CCK (band->rspec_override)) { - band->rspec_override =0 ; -brcms_c_reprate_init (wlc); - } -if (band->mrspec_override && !IS_CCK (band->mrspec_override)) - band->mrspec_override =0 ; } band->gmode = gmode;
@@ -5988,12 +5982,8 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)for (i =0 ; i < wlc->pub->_nbands; i++) {memset (wlc->bandstate[i]->hw_rateset.mcs,0 ,MCSSET_LEN ); -if (IS_MCS (wlc->band->rspec_override)) { - wlc->bandstate[i]->rspec_override =0 ; +if (IS_MCS (0 ))brcms_c_reprate_init (wlc); - } -if (IS_MCS (wlc->band->mrspec_override)) - wlc->bandstate[i]->mrspec_override =0 ; }break ;
@@ -7052,8 +7042,7 @@ done:static u16 brcms_c_d11hdrs_mac80211 (struct brcms_c_info *wlc,struct ieee80211_hw *hw,struct sk_buff *p,struct scb *scb,uint frag, -uint nfrags,uint queue,uint next_frag_len, -u32 rspec_override) +uint nfrags,uint queue,uint next_frag_len) {struct ieee80211_hdr *h;struct d11txh *txh;
@@ -7713,7 +7702,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, prio =ieee80211_is_data (d11_header->frame_control) ? sdu->priority :MAXPRIO ; fifo = prio2fifo[prio]; -if (brcms_c_d11hdrs_mac80211 (wlc, hw, sdu, scb,0 ,1 , fifo,0 ,0 )) +if (brcms_c_d11hdrs_mac80211 (wlc, hw, sdu, scb,0 ,1 , fifo,0 ))return ;brcms_c_txq_enq (wlc, scb, sdu,BRCMS_PRIO_TO_PREC (prio));brcms_c_send_q (wlc);
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
@@ -271,8 +271,6 @@ struct brcms_band {/* band-specific copy of default_bss.rateset */ struct brcms_c_rateset defrateset; -u32 rspec_override;/* 802.11 rate override */ -u32 mrspec_override;/* multicast rate override */ u8 band_stf_ss_mode;/* Configured STF type, 0:siso; 1:cdd */ s8 band_stf_stbc_tx;/* STBC TX 0:off; 1:force on; -1:auto */ /* rates supported by chip (phy-specific) */
drivers/staging/brcm80211/brcmsmac/stf.c +4 -8
@@ -293,26 +293,22 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)if (txstreams ==1 ) {for (i =0 ; i < wlc->pub->_nbands; i++) -if ((RSPEC_STF (wlc->bandstate[i]->rspec_override) != +if ((RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) - || (RSPEC_STF (wlc->bandstate[i]->mrspec_override) != + || (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO )) {if (!force)return -EBADE ;/* over-write the override rspec */ -if (RSPEC_STF (wlc->bandstate[i]->rspec_override) +if (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) { - wlc->bandstate[i]->rspec_override =0 ;wiphy_err (wlc->wiphy,"%s(): temp " "sense override non-SISO " "rspec_override\n" , __func__); } -if (RSPEC_STF - (wlc->bandstate[i]->mrspec_override) != -PHY_TXC1_MODE_SISO ) { - wlc->bandstate[i]->mrspec_override =0 ; +if (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) { wiphy_err(wlc->wiphy, "%s(): temp " "sense override non-SISO " "mrspec_override\n",
Signature · 1 line
1.7.4.1
PATCH 14/20 staging: brcm80211: removed unused softmac code after macro cleanup
In reply to Roland VossenSince the macro's IS_MCS(0), RSPEC_STF(0) and PHY_TXC1_MODE_SISO all expand to 0, inactive code could be removed.
--- drivers/staging/brcm80211/brcmsmac/main.c | 2 -- drivers/staging/brcm80211/brcmsmac/stf.c | 26 -------------------------- 2 files changed, 0 insertions(+), 28 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -2
@@ -5982,8 +5982,6 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)for (i =0 ; i < wlc->pub->_nbands; i++) {memset (wlc->bandstate[i]->hw_rateset.mcs,0 ,MCSSET_LEN ); -if (IS_MCS (0 )) -brcms_c_reprate_init (wlc); }break ;
drivers/staging/brcm80211/brcmsmac/stf.c +0 -26
@@ -291,32 +291,6 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)if (txstreams >MAX_STREAMS_SUPPORTED )return -EINVAL ; -if (txstreams ==1 ) { -for (i =0 ; i < wlc->pub->_nbands; i++) -if ((RSPEC_STF (0 ) != -PHY_TXC1_MODE_SISO ) - || (RSPEC_STF (0 ) != -PHY_TXC1_MODE_SISO )) { -if (!force) -return -EBADE ; - -/* over-write the override rspec */ -if (RSPEC_STF (0 ) - !=PHY_TXC1_MODE_SISO ) { -wiphy_err (wlc->wiphy,"%s(): temp " -"sense override non-SISO " -"rspec_override\n" , - __func__); - } -if (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) { -wiphy_err (wlc->wiphy,"%s(): temp " -"sense override non-SISO " -"mrspec_override\n" , - __func__); - } - } - } - wlc->stf->txchain = txchain; wlc->stf->txstreams = txstreams;brcms_c_stf_stbc_tx_set (wlc, wlc->band->band_stf_stbc_tx);
Signature · 1 line
1.7.4.1
PATCH 16/20 staging: brcm80211: removed several unused softmac main.h struct members
In reply to Roland VossenMembers were always set to zero, or set but never read.
--- drivers/staging/brcm80211/brcmsmac/main.c | 13 +------------ drivers/staging/brcm80211/brcmsmac/main.h | 13 ------------- 2 files changed, 1 insertions(+), 25 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -12
@@ -2384,9 +2384,7 @@ static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags) null_ether_addr); }else {/* resume tx fifos */ -if (!wlc_hw->wlc->tx_suspended) -brcms_b_tx_fifo_resume (wlc_hw,TX_DATA_FIFO ); - +brcms_b_tx_fifo_resume (wlc_hw,TX_DATA_FIFO );brcms_b_tx_fifo_resume (wlc_hw,TX_CTL_FIFO );brcms_b_tx_fifo_resume (wlc_hw,TX_AC_BK_FIFO );brcms_b_tx_fifo_resume (wlc_hw,TX_AC_VI_FIFO );
@@ -2774,10 +2772,6 @@ void brcms_c_coredisable(struct brcms_hardware *wlc_hw)/* turn off PHYPLL to save power */ brcms_b_core_phypll_ctl (wlc_hw, false); -/* remove gpio controls */ -if (wlc_hw->ucode_dbgsel) -ai_gpiocontrol (wlc_hw->sih, ~0 ,0 ,GPIO_DRV_PRIORITY ); - wlc_hw->clk = false;ai_core_disable (wlc_hw->sih,0 );wlc_phy_hw_clk_state_upd (wlc_hw->band->pi, false);
@@ -3601,9 +3595,6 @@ void brcms_c_init(struct brcms_c_info *wlc)/* clear tx flow control */ brcms_c_txflowcontrol_reset (wlc); -/* clear tx data fifo suspends */ - wlc->tx_suspended = false; -/* enable the RF Disable Delay timer */ W_REG (&wlc->regs->rfdisabledly,RFDISABLE_DEFAULT );
@@ -4380,8 +4371,6 @@ bool brcms_c_timers_init(struct brcms_c_info *wlc, int unit)void brcms_c_info_init (struct brcms_c_info *wlc,int unit) {int i; -/* Assume the device is there until proven otherwise */ - wlc->device_present = true;/* Save our copy of the chanspec */ wlc->chanspec =ch20mhz_chspec (1 );
drivers/staging/brcm80211/brcmsmac/main.h +0 -13
@@ -382,7 +382,6 @@ struct brcms_hardware {u32 boardflags2;/* More board flags if sromrev >= 4 */ u32 machwcap;/* MAC capabilities */ u32 machwcap_backup;/* backup of machwcap */ -u16 ucode_dbgsel;/* dbgsel for ucode debug(config gpio) */ struct si_pub *sih;/* SI handle (cookie for siutils calls) */ char *vars;/* "environment" name=value */
@@ -416,14 +415,11 @@ struct brcms_hardware {u32 wake_override;/* bit flags to force MAC to WAKE mode */ u32 mute_override;/* Prevent ucode from sending beacons */ u8 etheraddr[ETH_ALEN ];/* currently configured ethernet address */ -u32 led_gpio_mask;/* LED GPIO Mask */ bool noreset;/* true= do not reset hw, used by WLC_OUT */ bool forcefastclk;/* true if h/w is forcing to use fast clk */ bool clk;/* core is out of reset and has clock */ bool sbclk;/* sb has clock */ -struct bmac_pmq *bmac_pmq;/* bmac PM states derived from ucode PMQ */ bool phyclk;/* phy is out of reset and has clock */ -bool dma_lpbk;/* core is in DMA loopback */ bool ucode_loaded;/* true after ucode downloaded */
@@ -463,14 +459,12 @@ struct brcms_txq_info {* macintstatus: bit channel between isr and dpc. * macintmask: sw runtime master macintmask value. * defmacintmask: default "on" macintmask value. -* device_present: (removable) device is present. * clk: core is out of reset and has clock. * core: pointer to active io core. * band: pointer to active per-band state. * corestate: per-core state (one per hw core). * bandstate: per-band state (one per phy/radio). * war16165: PCI slow clock 16165 war flag. -* tx_suspended: data fifos need to remain suspended. * txpend16165war: PCI slow clock 16165 war flag. * qvalid: DirFrmQValid and BcMcFrmQValid. * txpwr_local_max: regulatory local txpwr max.
@@ -559,7 +553,6 @@ struct brcms_c_info {struct brcms_hardware *hw;/* clock */ -int clkreq_override;u16 fastpwrup_dly;/* interrupt */
@@ -567,9 +560,6 @@ struct brcms_c_info {u32 macintmask;u32 defmacintmask; -/* up and down */ -bool device_present; -bool clk;/* multiband */
@@ -579,9 +569,6 @@ struct brcms_c_info {struct brcms_band *bandstate[MAXBANDS ];bool war16165; - -bool tx_suspended; -uint txpend16165war;/* packet queue */
Signature · 1 line
1.7.4.1
PATCH 17/20 staging: brcm80211: removed unused softmac transmit power variables
In reply to Roland VossenStruct member variables were only set to '0'. As a result, function brcms_c_local_constraint_qdbm() always returned BRCMS_TXPWR_MAX and thus could be removed.
--- drivers/staging/brcm80211/brcmsmac/main.c | 34 +--------------------------- drivers/staging/brcm80211/brcmsmac/main.h | 7 ------ 2 files changed, 2 insertions(+), 39 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +2 -32
@@ -3275,44 +3275,14 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec,brcms_b_clkctl_clk (wlc_hw,CLK_DYNAMIC ); } -static u8 brcms_c_local_constraint_qdbm (struct brcms_c_info *wlc) -{ -u8 local; -s16 local_max; - - local =BRCMS_TXPWR_MAX ; -if (wlc->pub->associated && - (brcmu_chspec_ctlchan (wlc->chanspec) == -brcmu_chspec_ctlchan (wlc->home_chanspec))) { - -/* get the local power constraint if we are on the AP's -* channel [802.11h, 7.3.2.13] -*/ -/* Clamp the value between 0 and BRCMS_TXPWR_MAX w/o -* overflowing the target */ - local_max = - (wlc->txpwr_local_max - - wlc->txpwr_local_constraint) *BRCMS_TXPWR_DB_FACTOR ; -if (local_max >0 && local_max <BRCMS_TXPWR_MAX ) -return (u8 ) local_max; -if (local_max <0 ) -return 0 ; - } - -return local; -} -static void brcms_c_set_phy_chanspec (struct brcms_c_info *wlc,u16 chanspec) {/* Save our copy of the chanspec */ wlc->chanspec = chanspec; -/* Set the chanspec and power limits for this locale after computing -* any 11h local tx power constraints. -*/ -brcms_c_channel_set_chanspec (wlc->cmi, chanspec, -brcms_c_local_constraint_qdbm (wlc)); +/* Set the chanspec and power limits for this locale */ +brcms_c_channel_set_chanspec (wlc->cmi, chanspec,BRCMS_TXPWR_MAX );if (wlc->stf->ss_algosel_auto) brcms_c_stf_ss_algo_channel_get(wlc, &wlc->stf->ss_algo_channel,
drivers/staging/brcm80211/brcmsmac/main.h +0 -7
@@ -467,8 +467,6 @@ struct brcms_txq_info {* war16165: PCI slow clock 16165 war flag. * txpend16165war: PCI slow clock 16165 war flag. * qvalid: DirFrmQValid and BcMcFrmQValid. -* txpwr_local_max: regulatory local txpwr max. -* txpwr_local_constraint: local power contraint in dB. * ampdu: ampdu module handler. * asi: antsel module handler. * cmi: channel manager module handler.
@@ -574,11 +572,6 @@ struct brcms_c_info {/* packet queue */ uint qvalid; -/* Regulatory power limits */ -s8 txpwr_local_max; -u8 txpwr_local_constraint; - -struct ampdu_info *ampdu;struct antsel_info *asi;struct brcms_cm_info *cmi;
Signature · 1 line
1.7.4.1
PATCH 20/20 staging: brcm80211: remove static function declaration in wl_cfg80211
In reply to Roland VossenFrom: Franky Lin <[email protected]>
Reshuffle function order in wl_cfg80211 of fullmac to get rid of static function declaration
--- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2484 ++++++++++------------ 1 files changed, 1109 insertions(+), 1375 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +1109 -1375
@@ -40,269 +40,19 @@ static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};static u32 brcmf_dbg_level =WL_DBG_ERR ; -/* -** cfg80211_ops api/callback list -*/ -static s32 brcmf_cfg80211_change_iface (struct wiphy *wiphy, -struct net_device *ndev, -enum nl80211_iftype type,u32 *flags, -struct vif_params *params); -static s32 __brcmf_cfg80211_scan (struct wiphy *wiphy,struct net_device *ndev, -struct cfg80211_scan_request *request, -struct cfg80211_ssid *this_ssid); -static s32 brcmf_cfg80211_scan (struct wiphy *wiphy,struct net_device *ndev, -struct cfg80211_scan_request *request); -static s32 brcmf_cfg80211_set_wiphy_params (struct wiphy *wiphy,u32 changed); -static s32 brcmf_cfg80211_join_ibss (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_ibss_params *params); -static s32 brcmf_cfg80211_leave_ibss (struct wiphy *wiphy, -struct net_device *dev); -static s32 brcmf_cfg80211_get_station (struct wiphy *wiphy, -struct net_device *dev,u8 *mac, -struct station_info *sinfo); -static s32 brcmf_cfg80211_set_power_mgmt (struct wiphy *wiphy, -struct net_device *dev,bool enabled, -s32 timeout); -static s32 brcmf_cfg80211_set_bitrate_mask (struct wiphy *wiphy, -struct net_device *dev, -const u8 *addr, -const struct cfg80211_bitrate_mask - *mask); -static int brcmf_cfg80211_connect (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_cfg80211_disconnect (struct wiphy *wiphy, -struct net_device *dev, -u16 reason_code); -static s32 brcmf_cfg80211_set_tx_power (struct wiphy *wiphy, -enum nl80211_tx_power_setting type, -s32 dbm); -static s32 brcmf_cfg80211_get_tx_power (struct wiphy *wiphy,s32 *dbm); -static s32 brcmf_cfg80211_config_default_key (struct wiphy *wiphy, -struct net_device *dev,u8 key_idx, -bool unicast,bool multicast); -static s32 brcmf_cfg80211_add_key (struct wiphy *wiphy,struct net_device *dev, -u8 key_idx,bool pairwise,const u8 *mac_addr, -struct key_params *params); -static s32 brcmf_cfg80211_del_key (struct wiphy *wiphy,struct net_device *dev, -u8 key_idx,bool pairwise,const u8 *mac_addr); -static s32 brcmf_cfg80211_get_key (struct wiphy *wiphy,struct net_device *dev, -u8 key_idx,bool pairwise,const u8 *mac_addr, -void *cookie,void (*callback) (void *cookie, -struct -key_params * - params)); -static s32 brcmf_cfg80211_config_default_mgmt_key (struct wiphy *wiphy, -struct net_device *dev, -u8 key_idx); -static s32 brcmf_cfg80211_resume (struct wiphy *wiphy); -static s32 brcmf_cfg80211_suspend (struct wiphy *wiphy, -struct cfg80211_wowlan *wow); -static s32 brcmf_cfg80211_set_pmksa (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_pmksa *pmksa); -static s32 brcmf_cfg80211_del_pmksa (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_pmksa *pmksa); -static s32 brcmf_cfg80211_flush_pmksa (struct wiphy *wiphy, -struct net_device *dev); -/* -** event & event Q handlers for cfg80211 interfaces -*/ -static s32 brcmf_create_event_handler (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_destroy_event_handler (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_event_handler (void *data); -static void brcmf_init_eq (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_flush_eq (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_lock_eq (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_unlock_eq (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_init_eq_lock (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_init_eloop_handler (struct brcmf_cfg80211_event_loop *el); -static struct brcmf_cfg80211_event_q * -brcmf_deq_event (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_enq_event (struct brcmf_cfg80211_priv *cfg_priv,u32 type, -const struct brcmf_event_msg *msg); -static void brcmf_put_event (struct brcmf_cfg80211_event_q *e); -static void brcmf_wakeup_event (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_notify_connect_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e, -void *data); -static s32 brcmf_notify_roaming_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e, -void *data); -static s32 brcmf_notify_scan_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e, -void *data); -static s32 brcmf_bss_connect_done (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e, -bool completed); -static s32 brcmf_bss_roaming_done (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e); -static s32 brcmf_notify_mic_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e,void *data); - -/* -** ioctl utilites -*/ -static s32 brcmf_dev_bufvar_get (struct net_device *dev,s8 *name,s8 *buf, -s32 buf_len); -static __used s32 brcmf_dev_bufvar_set (struct net_device *dev,s8 *name, -s8 *buf,s32 len); -static s32 brcmf_dev_intvar_set (struct net_device *dev,s8 *name,s32 val); -static s32 brcmf_dev_intvar_get (struct net_device *dev,s8 *name, -s32 *retval); -static s32 brcmf_dev_ioctl (struct net_device *dev,u32 cmd,void *arg, -u32 len); - -/* -** cfg80211 set_wiphy_params utilities -*/ -static s32 brcmf_set_frag (struct net_device *dev,u32 frag_threshold); -static s32 brcmf_set_rts (struct net_device *dev,u32 frag_threshold); -static s32 brcmf_set_retry (struct net_device *dev,u32 retry,bool l); - -/* -** wl profile utilities -*/ -static s32 brcmf_update_prof (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e, -void *data,s32 item); -static void *brcmf_read_prof (struct brcmf_cfg80211_priv *cfg_priv,s32 item); -static void brcmf_init_prof (struct brcmf_cfg80211_profile *prof); - -/* -** cfg80211 connect utilites -*/ -static s32 brcmf_set_wpa_version (struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_set_auth_type (struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_set_set_cipher (struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_set_key_mgmt (struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_set_set_sharedkey (struct net_device *dev, -struct cfg80211_connect_params *sme); -static s32 brcmf_get_assoc_ies (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_clear_assoc_ies (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_ch_to_chanspec (int ch, -struct brcmf_join_params *join_params,size_t *join_params_size); - -/* -** information element utilities -*/ -static __used s32 brcmf_add_ie (struct brcmf_cfg80211_priv *cfg_priv, -u8 t,u8 l,u8 *v); -static s32 brcmf_mode_to_nl80211_iftype (s32 mode); -static struct wireless_dev *brcmf_alloc_wdev (s32 sizeof_iface, -struct device *dev); -static void brcmf_free_wdev (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_inform_bss (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_inform_single_bss (struct brcmf_cfg80211_priv *cfg_priv, -struct brcmf_bss_info *bi); -static s32 brcmf_update_bss_info (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_add_keyext (struct wiphy *wiphy,struct net_device *dev, -u8 key_idx,const u8 *mac_addr, -struct key_params *params); - -/* -** key indianess swap utilities -*/ -static void convert_key_from_CPU (struct brcmf_wsec_key *key); -static void convert_key_to_CPU (struct brcmf_wsec_key *key); - -/* -** brcmf_cfg80211_priv memory init/deinit utilities -*/ -static s32 brcmf_init_priv_mem (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_deinit_priv_mem (struct brcmf_cfg80211_priv *cfg_priv); - -static void brcmf_delay (u32 ms); - -/* -** store/restore cfg80211 instance data -*/ -static void brcmf_set_drvdata (struct brcmf_cfg80211_dev *dev,void *data); -static void *brcmf_get_drvdata (struct brcmf_cfg80211_dev *dev); - -/* -** ibss mode utilities -*/ -static bool brcmf_is_ibssmode (struct brcmf_cfg80211_priv *cfg_priv); - -/* -** dongle up/down , default configuration utilities -*/ -static bool brcmf_is_linkdown (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e); -static bool brcmf_is_linkup (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e); -static bool brcmf_is_nonetwork (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e); -static void brcmf_link_down (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_dongle_mode (struct net_device *ndev,s32 iftype); -static s32 __brcmf_cfg80211_up (struct brcmf_cfg80211_priv *cfg_priv); -static s32 __brcmf_cfg80211_down (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_dongle_probecap (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_init_conf (struct brcmf_cfg80211_conf *conf); - -/* -** dongle configuration utilities -*/ -static s32 brcmf_dongle_eventmsg (struct net_device *ndev); -static s32 brcmf_dongle_scantime (struct net_device *ndev,s32 scan_assoc_time, -s32 scan_unassoc_time,s32 scan_passive_time); -static s32 brcmf_config_dongle (struct brcmf_cfg80211_priv *cfg_priv, -bool need_lock); -static s32 brcmf_dongle_roam (struct net_device *ndev,u32 roamvar, -u32 bcn_timeout); - -/* -** iscan handler -*/ -static void brcmf_iscan_timer (unsigned long data); -static void brcmf_term_iscan (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_init_iscan (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_dev_iovar_setbuf (struct net_device *dev,s8 *iovar, -void *param,s32 paramlen,void *bufptr, -s32 buflen); -static s32 brcmf_dev_iovar_getbuf (struct net_device *dev,s8 *iovar, -void *param,s32 paramlen,void *bufptr, -s32 buflen); -static s32 brcmf_run_iscan (struct brcmf_cfg80211_iscan_ctrl *iscan, -struct brcmf_ssid *ssid,u16 action); -static s32 brcmf_do_iscan (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_wakeup_iscan (struct brcmf_cfg80211_iscan_ctrl *iscan); -static s32 brcmf_invoke_iscan (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_get_iscan_results (struct brcmf_cfg80211_iscan_ctrl *iscan, -u32 *status, -struct brcmf_scan_results **bss_list); -static void brcmf_notify_iscan_complete (struct brcmf_cfg80211_iscan_ctrl *iscan, -bool aborted); -static void brcmf_init_iscan_eloop (struct brcmf_cfg80211_iscan_eloop *el); -static s32 brcmf_iscan_done (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_iscan_pending (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_iscan_inprogress (struct brcmf_cfg80211_priv *cfg_priv); -static s32 brcmf_iscan_aborted (struct brcmf_cfg80211_priv *cfg_priv); - -/* -* update pmklist to dongle -*/ -static __used s32 brcmf_update_pmklist (struct net_device *dev, -struct brcmf_cfg80211_pmk_list *pmk_list, -s32 err); +static void brcmf_set_drvdata (struct brcmf_cfg80211_dev *dev,void *data) +{ + dev->driver_data = data; +} -static void brcmf_set_mpc (struct net_device *ndev,int mpc); +static void *brcmf_get_drvdata (struct brcmf_cfg80211_dev *dev) +{ +void *data =NULL ; -/* -* debufs support -*/ -static int -brcmf_debugfs_add_netdev_params (struct brcmf_cfg80211_priv *cfg_priv); -static void brcmf_debugfs_remove_netdev (struct brcmf_cfg80211_priv *cfg_priv); +if (dev) + data = dev->driver_data; +return data; +}static struct brcmf_cfg80211_priv *brcmf_priv_get (struct brcmf_cfg80211_dev *cfg_dev)
@@ -594,6 +344,63 @@ done:return err; } +static s32 brcmf_dev_intvar_set (struct net_device *dev,s8 *name,s32 val) +{ +s8 buf[BRCMF_C_IOCTL_SMLEN ]; +u32 len; +s32 err =0 ; + + val =cpu_to_le32 (val); + len =brcmu_mkiovar (name, (char *)(&val),sizeof (val), buf, +sizeof (buf)); +BUG_ON (!len); + + err =brcmf_dev_ioctl (dev,BRCMF_C_SET_VAR , buf, len); +if (unlikely (err)) +WL_ERR ("error (%d)\n" , err); + +return err; +} + +static s32 +brcmf_dev_intvar_get (struct net_device *dev,s8 *name,s32 *retval) +{ +union { +s8 buf[BRCMF_C_IOCTL_SMLEN ]; +s32 val; + } var; +u32 len; +u32 data_null; +s32 err =0 ; + + len = +brcmu_mkiovar (name, (char *)(&data_null),0 , (char *)(&var), +sizeof (var.buf)); +BUG_ON (!len); + err =brcmf_dev_ioctl (dev,BRCMF_C_GET_VAR , &var, len); +if (unlikely (err)) +WL_ERR ("error (%d)\n" , err); + + *retval =le32_to_cpu (var.val); + +return err; +} + +static void brcmf_set_mpc (struct net_device *ndev,int mpc) +{ +s32 err =0 ; +struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (ndev); + +if (test_bit (WL_STATUS_READY , &cfg_priv->status)) { + err =brcmf_dev_intvar_set (ndev,"mpc" , mpc); +if (unlikely (err)) { +WL_ERR ("fail to set mpc\n" ); +return ; + } +WL_INFO ("MPC : %d\n" , mpc); + } +} +static void wl_iscan_prep (struct brcmf_scan_params *params,struct brcmf_ssid *ssid) {
@@ -820,48 +627,6 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,return err; } -static s32 brcmf_dev_intvar_set (struct net_device *dev,s8 *name,s32 val) -{ -s8 buf[BRCMF_C_IOCTL_SMLEN ]; -u32 len; -s32 err =0 ; - - val =cpu_to_le32 (val); - len =brcmu_mkiovar (name, (char *)(&val),sizeof (val), buf, -sizeof (buf)); -BUG_ON (!len); - - err =brcmf_dev_ioctl (dev,BRCMF_C_SET_VAR , buf, len); -if (unlikely (err)) -WL_ERR ("error (%d)\n" , err); - -return err; -} - -static s32 -brcmf_dev_intvar_get (struct net_device *dev,s8 *name,s32 *retval) -{ -union { -s8 buf[BRCMF_C_IOCTL_SMLEN ]; -s32 val; - } var; -u32 len; -u32 data_null; -s32 err =0 ; - - len = -brcmu_mkiovar (name, (char *)(&data_null),0 , (char *)(&var), -sizeof (var.buf)); -BUG_ON (!len); - err =brcmf_dev_ioctl (dev,BRCMF_C_GET_VAR , &var, len); -if (unlikely (err)) -WL_ERR ("error (%d)\n" , err); - - *retval =le32_to_cpu (var.val); - -return err; -} -static s32 brcmf_set_rts (struct net_device *dev,u32 rts_threshold) {s32 err =0 ;
@@ -942,46 +707,158 @@ done:return err; } +static void *brcmf_read_prof (struct brcmf_cfg80211_priv *cfg_priv,s32 item) +{ +switch (item) { +case WL_PROF_SEC : +return &cfg_priv->profile->sec; +case WL_PROF_BSSID : +return &cfg_priv->profile->bssid; +case WL_PROF_SSID : +return &cfg_priv->profile->ssid; + } +WL_ERR ("invalid item (%d)\n" , item); +return NULL ; +} +static s32 -brcmf_cfg80211_join_ibss (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_ibss_params *params) +brcmf_update_prof (struct brcmf_cfg80211_priv *cfg_priv, +const struct brcmf_event_msg *e,void *data,s32 item) { -struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); -struct brcmf_join_params join_params; -size_t join_params_size =0 ;s32 err =0 ; -s32 wsec =0 ; -s32 bcnprd; - -WL_TRACE ("Enter\n" ); -if (!check_sys_up (wiphy)) -return -EIO ; +struct brcmf_ssid *ssid; -if (params->ssid) -WL_CONN ("SSID: %s\n" , params->ssid); -else { -WL_CONN ("SSID: NULL, Not supported\n" ); -return -EOPNOTSUPP ; +switch (item) { +case WL_PROF_SSID : + ssid = (struct brcmf_ssid *) data; +memset (cfg_priv->profile->ssid.SSID,0 , +sizeof (cfg_priv->profile->ssid.SSID)); +memcpy (cfg_priv->profile->ssid.SSID, + ssid->SSID, ssid->SSID_len); + cfg_priv->profile->ssid.SSID_len = ssid->SSID_len; +break ; +case WL_PROF_BSSID : +if (data) +memcpy (cfg_priv->profile->bssid, data,ETH_ALEN ); +else +memset (cfg_priv->profile->bssid,0 ,ETH_ALEN ); +break ; +case WL_PROF_SEC : +memcpy (&cfg_priv->profile->sec, data, +sizeof (cfg_priv->profile->sec)); +break ; +case WL_PROF_BEACONINT : + cfg_priv->profile->beacon_interval = *(u16 *)data; +break ; +case WL_PROF_DTIMPERIOD : + cfg_priv->profile->dtim_period = *(u8 *)data; +break ; +default : +WL_ERR ("unsupported item (%d)\n" , item); + err = -EOPNOTSUPP ; +break ; } -set_bit (WL_STATUS_CONNECTING , &cfg_priv->status); +return err; +} -if (params->bssid) -WL_CONN ("BSSID: %02X %02X %02X %02X %02X %02X\n" , - params->bssid[0 ], params->bssid[1 ], params->bssid[2 ], - params->bssid[3 ], params->bssid[4 ], params->bssid[5 ]); -else -WL_CONN ("No BSSID specified\n" ); +static void brcmf_init_prof (struct brcmf_cfg80211_profile *prof) +{ +memset (prof,0 ,sizeof (*prof)); +} -if (params->channel) -WL_CONN ("channel: %d\n" , params->channel->center_freq); -else -WL_CONN ("no channel specified\n" ); +static void brcmf_ch_to_chanspec (int ch,struct brcmf_join_params *join_params, +size_t *join_params_size) +{ +u16 chanspec =0 ; -if (params->channel_fixed) -WL_CONN ("fixed channel required\n" ); -else -WL_CONN ("no fixed channel required\n" ); +if (ch !=0 ) { + join_params->params.chanspec_num =1 ; + join_params->params.chanspec_list[0 ] = ch; + +if (join_params->params.chanspec_list[0 ] <=CH_MAX_2G_CHANNEL ) + chanspec |=WL_CHANSPEC_BAND_2G ; +else + chanspec |=WL_CHANSPEC_BAND_5G ; + + chanspec |=WL_CHANSPEC_BW_20 ; + chanspec |=WL_CHANSPEC_CTL_SB_NONE ; + + *join_params_size +=BRCMF_ASSOC_PARAMS_FIXED_SIZE + + join_params->params.chanspec_num *sizeof (u16); + + join_params->params.chanspec_list[0 ] &=WL_CHANSPEC_CHAN_MASK ; + join_params->params.chanspec_list[0 ] |= chanspec; + join_params->params.chanspec_list[0 ] = +cpu_to_le16 (join_params->params.chanspec_list[0 ]); + + join_params->params.chanspec_num = +cpu_to_le32 (join_params->params.chanspec_num); + +WL_CONN ("join_params->params.chanspec_list[0]= %#X," +"channel %d, chanspec %#X\n" , + join_params->params.chanspec_list[0 ], ch, chanspec); + } +} + +static void brcmf_link_down (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct net_device *dev =NULL ; +s32 err =0 ; + +WL_TRACE ("Enter\n" ); + +if (cfg_priv->link_up) { + dev =cfg_to_ndev (cfg_priv); +WL_INFO ("Call WLC_DISASSOC to stop excess roaming\n " ); + err =brcmf_dev_ioctl (dev,BRCMF_C_DISASSOC ,NULL ,0 ); +if (unlikely (err)) +WL_ERR ("WLC_DISASSOC failed (%d)\n" , err); + cfg_priv->link_up = false; + } +WL_TRACE ("Exit\n" ); +} + +static s32 +brcmf_cfg80211_join_ibss (struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_ibss_params *params) +{ +struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); +struct brcmf_join_params join_params; +size_t join_params_size =0 ; +s32 err =0 ; +s32 wsec =0 ; +s32 bcnprd; + +WL_TRACE ("Enter\n" ); +if (!check_sys_up (wiphy)) +return -EIO ; + +if (params->ssid) +WL_CONN ("SSID: %s\n" , params->ssid); +else { +WL_CONN ("SSID: NULL, Not supported\n" ); +return -EOPNOTSUPP ; + } + +set_bit (WL_STATUS_CONNECTING , &cfg_priv->status); + +if (params->bssid) +WL_CONN ("BSSID: %02X %02X %02X %02X %02X %02X\n" , + params->bssid[0 ], params->bssid[1 ], params->bssid[2 ], + params->bssid[3 ], params->bssid[4 ], params->bssid[5 ]); +else +WL_CONN ("No BSSID specified\n" ); + +if (params->channel) +WL_CONN ("channel: %d\n" , params->channel->center_freq); +else +WL_CONN ("no channel specified\n" ); + +if (params->channel_fixed) +WL_CONN ("fixed channel required\n" ); +else +WL_CONN ("no fixed channel required\n" );if (params->ie && params->ie_len)WL_CONN ("ie len: %d\n" , params->ie_len);
@@ -2071,122 +1948,615 @@ done:return err; } -static s32 brcmf_cfg80211_resume (struct wiphy *wiphy) +static s32 brcmf_inform_single_bss (struct brcmf_cfg80211_priv *cfg_priv, +struct brcmf_bss_info *bi) { -struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); - -/* -* Check for WL_STATUS_READY before any function call which -* could result is bus access. Don't block the resume for -* any driver error conditions -*/ -WL_TRACE ("Enter\n" ); - -if (test_bit (WL_STATUS_READY , &cfg_priv->status)) -brcmf_invoke_iscan (wiphy_to_cfg (wiphy)); - -WL_TRACE ("Exit\n" ); -return 0 ; -} +struct wiphy *wiphy =cfg_to_wiphy (cfg_priv); +struct ieee80211_channel *notify_channel; +struct cfg80211_bss *bss; +struct ieee80211_supported_band *band; +s32 err =0 ; +u16 channel; +u32 freq; +u64 notify_timestamp; +u16 notify_capability; +u16 notify_interval; +u8 *notify_ie; +size_t notify_ielen; +s32 notify_signal; -static s32 brcmf_cfg80211_suspend (struct wiphy *wiphy, -struct cfg80211_wowlan *wow) -{ -struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); -struct net_device *ndev =cfg_to_ndev (cfg_priv); +if (unlikely (le32_to_cpu (bi->length) >WL_BSS_INFO_MAX )) { +WL_ERR ("Bss info is larger than buffer. Discarding\n" ); +return 0 ; + } -WL_TRACE ("Enter\n" ); + channel = bi->ctl_ch ? bi->ctl_ch : +CHSPEC_CHANNEL (le16_to_cpu (bi->chanspec)); -/* -* Check for WL_STATUS_READY before any function call which -* could result is bus access. Don't block the suspend for -* any driver error conditions -*/ +if (channel <=CH_MAX_2G_CHANNEL ) + band = wiphy->bands[IEEE80211_BAND_2GHZ ]; +else + band = wiphy->bands[IEEE80211_BAND_5GHZ ]; -/* -* While going to suspend if associated with AP disassociate -* from AP to save power while system is in suspended state -*/ -if ((test_bit (WL_STATUS_CONNECTED , &cfg_priv->status) || -test_bit (WL_STATUS_CONNECTING , &cfg_priv->status)) && -test_bit (WL_STATUS_READY , &cfg_priv->status)) { -WL_INFO ("Disassociating from AP" -" while entering suspend state\n" ); -brcmf_link_down (cfg_priv); + freq =ieee80211_channel_to_frequency (channel, band->band); + notify_channel =ieee80211_get_channel (wiphy, freq); -/* -* Make sure WPA_Supplicant receives all the event -* generated due to DISASSOC call to the fw to keep -* the state fw and WPA_Supplicant state consistent -*/ -rtnl_unlock (); -brcmf_delay (500 ); -rtnl_lock (); - } + notify_timestamp =jiffies_to_msecs (jiffies)*1000 ;/* uSec */ + notify_capability =le16_to_cpu (bi->capability); + notify_interval =le16_to_cpu (bi->beacon_period); + notify_ie = (u8 *)bi +le16_to_cpu (bi->ie_offset); + notify_ielen =le16_to_cpu (bi->ie_length); + notify_signal = (s16 )le16_to_cpu (bi->RSSI) *100 ; -set_bit (WL_STATUS_SCAN_ABORTING , &cfg_priv->status); -if (test_bit (WL_STATUS_READY , &cfg_priv->status)) -brcmf_term_iscan (cfg_priv); +WL_CONN ("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n" , + bi->BSSID[0 ], bi->BSSID[1 ], bi->BSSID[2 ], + bi->BSSID[3 ], bi->BSSID[4 ], bi->BSSID[5 ]); +WL_CONN ("Channel: %d(%d)\n" , channel, freq); +WL_CONN ("Capability: %X\n" , notify_capability); +WL_CONN ("Beacon interval: %d\n" , notify_interval); +WL_CONN ("Signal: %d\n" , notify_signal); +WL_CONN ("notify_timestamp: %#018llx\n" , notify_timestamp); -if (cfg_priv->scan_request) { -/* Indidate scan abort to cfg80211 layer */ -WL_INFO ("Terminating scan in progress\n" ); -cfg80211_scan_done (cfg_priv->scan_request, true); - cfg_priv->scan_request =NULL ; - } -clear_bit (WL_STATUS_SCANNING , &cfg_priv->status); -clear_bit (WL_STATUS_SCAN_ABORTING , &cfg_priv->status); + bss =cfg80211_inform_bss (wiphy, notify_channel, (const u8 *)bi->BSSID, + notify_timestamp, notify_capability, notify_interval, notify_ie, + notify_ielen, notify_signal,GFP_KERNEL ); -/* Turn off watchdog timer */ -if (test_bit (WL_STATUS_READY , &cfg_priv->status)) { -WL_INFO ("Enable MPC\n" ); -brcmf_set_mpc (ndev,1 ); +if (unlikely (!bss)) { +WL_ERR ("cfg80211_inform_bss_frame error\n" ); +return -EINVAL ; } -WL_TRACE ("Exit\n" ); - -return 0 ; +return err; } -static __used s32 -brcmf_update_pmklist (struct net_device *dev, -struct brcmf_cfg80211_pmk_list *pmk_list,s32 err) +static s32 brcmf_inform_bss (struct brcmf_cfg80211_priv *cfg_priv) { -int i, j; +struct brcmf_scan_results *bss_list; +struct brcmf_bss_info *bi =NULL ;/* must be initialized */ +s32 err =0 ; +int i; -WL_CONN ("No of elements %d\n" , pmk_list->pmkids.npmkid); -for (i =0 ; i < pmk_list->pmkids.npmkid; i++) { -WL_CONN ("PMKID[%d]: %pM =\n" , i, - &pmk_list->pmkids.pmkid[i].BSSID); -for (j =0 ; j <WLAN_PMKID_LEN ; j++) -WL_CONN ("%02x\n" , pmk_list->pmkids.pmkid[i].PMKID[j]); + bss_list = cfg_priv->bss_list; +if (unlikely (bss_list->version !=BRCMF_BSS_INFO_VERSION )) { +WL_ERR ("Version %d != WL_BSS_INFO_VERSION\n" , + bss_list->version); +return -EOPNOTSUPP ; + } +WL_SCAN ("scanned AP count (%d)\n" , bss_list->count); + bi =next_bss (bss_list, bi); +for_each_bss (bss_list, bi, i) { + err =brcmf_inform_single_bss (cfg_priv, bi); +if (unlikely (err)) +break ; } - -if (likely (!err)) -brcmf_dev_bufvar_set (dev,"pmkid_info" , (char *)pmk_list, -sizeof (*pmk_list)); -return err; } -static s32 -brcmf_cfg80211_set_pmksa (struct wiphy *wiphy,struct net_device *dev, -struct cfg80211_pmksa *pmksa) +static s32 wl_inform_ibss (struct brcmf_cfg80211_priv *cfg_priv, +struct net_device *dev,const u8 *bssid) { -struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); -struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; +struct wiphy *wiphy =cfg_to_wiphy (cfg_priv); +struct ieee80211_channel *notify_channel; +struct brcmf_bss_info *bi =NULL ; +struct ieee80211_supported_band *band; +u8 *buf =NULL ;s32 err =0 ; -int i; +u16 channel; +u32 freq; +u64 notify_timestamp; +u16 notify_capability; +u16 notify_interval; +u8 *notify_ie; +size_t notify_ielen; +s32 notify_signal;WL_TRACE ("Enter\n" ); -if (!check_sys_up (wiphy)) -return -EIO ; -for (i =0 ; i < pmkids->npmkid; i++) -if (!memcmp (pmksa->bssid, pmkids->pmkid[i].BSSID,ETH_ALEN )) -break ; -if (i <WL_NUM_PMKIDS_MAX ) { -memcpy (pmkids->pmkid[i].BSSID, pmksa->bssid,ETH_ALEN ); + buf =kzalloc (WL_BSS_INFO_MAX ,GFP_KERNEL ); +if (buf ==NULL ) { +WL_ERR ("kzalloc() failed\n" ); + err = -ENOMEM ; + goto CleanUp; + } + + *(u32 *)buf =cpu_to_le32 (WL_BSS_INFO_MAX ); + + err =brcmf_dev_ioctl (dev,BRCMF_C_GET_BSS_INFO , buf,WL_BSS_INFO_MAX ); +if (unlikely (err)) { +WL_ERR ("WLC_GET_BSS_INFO failed: %d\n" , err); + goto CleanUp; + } + + bi = (struct brcmf_bss_info *)(buf +4 ); + + channel = bi->ctl_ch ? bi->ctl_ch : +CHSPEC_CHANNEL (le16_to_cpu (bi->chanspec)); + +if (channel <=CH_MAX_2G_CHANNEL ) + band = wiphy->bands[IEEE80211_BAND_2GHZ ]; +else + band = wiphy->bands[IEEE80211_BAND_5GHZ ]; + + freq =ieee80211_channel_to_frequency (channel, band->band); + notify_channel =ieee80211_get_channel (wiphy, freq); + + notify_timestamp =jiffies_to_msecs (jiffies)*1000 ;/* uSec */ + notify_capability =le16_to_cpu (bi->capability); + notify_interval =le16_to_cpu (bi->beacon_period); + notify_ie = (u8 *)bi +le16_to_cpu (bi->ie_offset); + notify_ielen =le16_to_cpu (bi->ie_length); + notify_signal = (s16 )le16_to_cpu (bi->RSSI) *100 ; + +WL_CONN ("channel: %d(%d)\n" , channel, freq); +WL_CONN ("capability: %X\n" , notify_capability); +WL_CONN ("beacon interval: %d\n" , notify_interval); +WL_CONN ("signal: %d\n" , notify_signal); +WL_CONN ("notify_timestamp: %#018llx\n" , notify_timestamp); + +cfg80211_inform_bss (wiphy, notify_channel, bssid, + notify_timestamp, notify_capability, notify_interval, + notify_ie, notify_ielen, notify_signal,GFP_KERNEL ); + +CleanUp: + +kfree (buf); + +WL_TRACE ("Exit\n" ); + +return err; +} + +static bool brcmf_is_ibssmode (struct brcmf_cfg80211_priv *cfg_priv) +{ +return cfg_priv->conf->mode ==WL_MODE_IBSS ; +} + +static s32 brcmf_update_bss_info (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_bss_info *bi; +struct brcmf_ssid *ssid; +struct brcmu_tlv *tim; +u16 beacon_interval; +u8 dtim_period; +size_t ie_len; +u8 *ie; +s32 err =0 ; + +WL_TRACE ("Enter\n" ); +if (brcmf_is_ibssmode (cfg_priv)) +return err; + + ssid = (struct brcmf_ssid *)brcmf_read_prof (cfg_priv,WL_PROF_SSID ); + + *(u32 *)cfg_priv->extra_buf =cpu_to_le32 (WL_EXTRA_BUF_MAX ); + err =brcmf_dev_ioctl (cfg_to_ndev (cfg_priv),BRCMF_C_GET_BSS_INFO , + cfg_priv->extra_buf,WL_EXTRA_BUF_MAX ); +if (unlikely (err)) { +WL_ERR ("Could not get bss info %d\n" , err); + goto update_bss_info_out; + } + + bi = (struct brcmf_bss_info *)(cfg_priv->extra_buf +4 ); + err =brcmf_inform_single_bss (cfg_priv, bi); +if (unlikely (err)) + goto update_bss_info_out; + + ie = ((u8 *)bi) + bi->ie_offset; + ie_len = bi->ie_length; + beacon_interval =cpu_to_le16 (bi->beacon_period); + + tim =brcmu_parse_tlvs (ie, ie_len,WLAN_EID_TIM ); +if (tim) + dtim_period = tim->data[1 ]; +else { +/* +* active scan was done so we could not get dtim +* information out of probe response. +* so we speficially query dtim information to dongle. +*/ +u32 var; + err =brcmf_dev_intvar_get (cfg_to_ndev (cfg_priv), +"dtim_assoc" , &var); +if (unlikely (err)) { +WL_ERR ("wl dtim_assoc failed (%d)\n" , err); + goto update_bss_info_out; + } + dtim_period = (u8 )var; + } + +brcmf_update_prof (cfg_priv,NULL , &beacon_interval,WL_PROF_BEACONINT ); +brcmf_update_prof (cfg_priv,NULL , &dtim_period,WL_PROF_DTIMPERIOD ); + +update_bss_info_out: +WL_TRACE ("Exit" ); +return err; +} + +static void brcmf_term_iscan (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); +struct brcmf_ssid ssid; + +if (cfg_priv->iscan_on) { + iscan->state =WL_ISCAN_STATE_IDLE ; + +if (iscan->timer_on) { +del_timer_sync (&iscan->timer); + iscan->timer_on =0 ; + } + +cancel_work_sync (&iscan->work); + +/* Abort iscan running in FW */ +memset (&ssid,0 ,sizeof (ssid)); +brcmf_run_iscan (iscan, &ssid,WL_SCAN_ACTION_ABORT ); + } +} + +static void brcmf_notify_iscan_complete (struct brcmf_cfg80211_iscan_ctrl *iscan, +bool aborted) +{ +struct brcmf_cfg80211_priv *cfg_priv =iscan_to_cfg (iscan); +struct net_device *ndev =cfg_to_ndev (cfg_priv); + +if (unlikely (!test_and_clear_bit (WL_STATUS_SCANNING , + &cfg_priv->status))) { +WL_ERR ("Scan complete while device not scanning\n" ); +return ; + } +if (likely (cfg_priv->scan_request)) { +WL_SCAN ("ISCAN Completed scan: %s\n" , + aborted ?"Aborted" :"Done" ); +cfg80211_scan_done (cfg_priv->scan_request, aborted); +brcmf_set_mpc (ndev,1 ); + cfg_priv->scan_request =NULL ; + } + cfg_priv->iscan_kickstart = false; +} + +static s32 brcmf_wakeup_iscan (struct brcmf_cfg80211_iscan_ctrl *iscan) +{ +if (likely (iscan->state !=WL_ISCAN_STATE_IDLE )) { +WL_SCAN ("wake up iscan\n" ); +schedule_work (&iscan->work); +return 0 ; + } + +return -EIO ; +} + +static s32 +brcmf_get_iscan_results (struct brcmf_cfg80211_iscan_ctrl *iscan,u32 *status, +struct brcmf_scan_results **bss_list) +{ +struct brcmf_iscan_results list; +struct brcmf_scan_results *results; +struct brcmf_iscan_results *list_buf; +s32 err =0 ; + +memset (iscan->scan_buf,0 ,WL_ISCAN_BUF_MAX ); + list_buf = (struct brcmf_iscan_results *)iscan->scan_buf; + results = &list_buf->results; + results->buflen =BRCMF_ISCAN_RESULTS_FIXED_SIZE ; + results->version =0 ; + results->count =0 ; + +memset (&list,0 ,sizeof (list)); + list.results.buflen =cpu_to_le32 (WL_ISCAN_BUF_MAX ); + err =brcmf_dev_iovar_getbuf (iscan->dev,"iscanresults" , &list, +BRCMF_ISCAN_RESULTS_FIXED_SIZE , iscan->scan_buf, +WL_ISCAN_BUF_MAX ); +if (unlikely (err)) { +WL_ERR ("error (%d)\n" , err); +return err; + } + results->buflen =le32_to_cpu (results->buflen); + results->version =le32_to_cpu (results->version); + results->count =le32_to_cpu (results->count); +WL_SCAN ("results->count = %d\n" , results->count); +WL_SCAN ("results->buflen = %d\n" , results->buflen); + *status =le32_to_cpu (list_buf->status); +WL_SCAN ("status = %d\n" , *status); + *bss_list = results; + +return err; +} + +static s32 brcmf_iscan_done (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; +s32 err =0 ; + + iscan->state =WL_ISCAN_STATE_IDLE ; +rtnl_lock (); +brcmf_inform_bss (cfg_priv); +brcmf_notify_iscan_complete (iscan, false); +rtnl_unlock (); + +return err; +} + +static s32 brcmf_iscan_pending (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; +s32 err =0 ; + +/* Reschedule the timer */ +mod_timer (&iscan->timer, jiffies + iscan->timer_ms *HZ /1000 ); + iscan->timer_on =1 ; + +return err; +} + +static s32 brcmf_iscan_inprogress (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; +s32 err =0 ; + +rtnl_lock (); +brcmf_inform_bss (cfg_priv); +brcmf_run_iscan (iscan,NULL ,BRCMF_SCAN_ACTION_CONTINUE ); +rtnl_unlock (); +/* Reschedule the timer */ +mod_timer (&iscan->timer, jiffies + iscan->timer_ms *HZ /1000 ); + iscan->timer_on =1 ; + +return err; +} + +static s32 brcmf_iscan_aborted (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; +s32 err =0 ; + + iscan->state =WL_ISCAN_STATE_IDLE ; +rtnl_lock (); +brcmf_notify_iscan_complete (iscan, true); +rtnl_unlock (); + +return err; +} + +static void brcmf_cfg80211_iscan_handler (struct work_struct *work) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = + container_of(work, struct brcmf_cfg80211_iscan_ctrl, + work); +struct brcmf_cfg80211_priv *cfg_priv =iscan_to_cfg (iscan); +struct brcmf_cfg80211_iscan_eloop *el = &iscan->el; +u32 status =BRCMF_SCAN_RESULTS_PARTIAL ; + +if (iscan->timer_on) { +del_timer_sync (&iscan->timer); + iscan->timer_on =0 ; + } + +rtnl_lock (); +if (brcmf_get_iscan_results (iscan, &status, &cfg_priv->bss_list)) { + status =BRCMF_SCAN_RESULTS_ABORTED ; +WL_ERR ("Abort iscan\n" ); + } +rtnl_unlock (); + + el->handler[status](cfg_priv); +} + +static void brcmf_iscan_timer (unsigned long data) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan = + (struct brcmf_cfg80211_iscan_ctrl *)data; + +if (iscan) { + iscan->timer_on =0 ; +WL_SCAN ("timer expired\n" ); +brcmf_wakeup_iscan (iscan); + } +} + +static s32 brcmf_invoke_iscan (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); + +if (cfg_priv->iscan_on) { + iscan->state =WL_ISCAN_STATE_IDLE ; +INIT_WORK (&iscan->work, brcmf_cfg80211_iscan_handler); + } + +return 0 ; +} + +static void brcmf_init_iscan_eloop (struct brcmf_cfg80211_iscan_eloop *el) +{ +memset (el,0 ,sizeof (*el)); + el->handler[BRCMF_SCAN_RESULTS_SUCCESS ] = brcmf_iscan_done; + el->handler[BRCMF_SCAN_RESULTS_PARTIAL ] = brcmf_iscan_inprogress; + el->handler[BRCMF_SCAN_RESULTS_PENDING ] = brcmf_iscan_pending; + el->handler[BRCMF_SCAN_RESULTS_ABORTED ] = brcmf_iscan_aborted; + el->handler[BRCMF_SCAN_RESULTS_NO_MEM ] = brcmf_iscan_aborted; +} + +static s32 brcmf_init_iscan (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); +int err =0 ; + +if (cfg_priv->iscan_on) { + iscan->dev =cfg_to_ndev (cfg_priv); +brcmf_init_iscan_eloop (&iscan->el); + iscan->timer_ms =WL_ISCAN_TIMER_INTERVAL_MS ; +init_timer (&iscan->timer); + iscan->timer.data = (unsigned long ) iscan; + iscan->timer.function = brcmf_iscan_timer; + err =brcmf_invoke_iscan (cfg_priv); +if (!err) + iscan->data = cfg_priv; + } + +return err; +} + +static void brcmf_delay (u32 ms) +{ +if (ms <1000 /HZ ) { +cond_resched (); +mdelay (ms); + }else { +msleep (ms); + } +} + +static s32 brcmf_cfg80211_resume (struct wiphy *wiphy) +{ +struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); + +/* +* Check for WL_STATUS_READY before any function call which +* could result is bus access. Don't block the resume for +* any driver error conditions +*/ +WL_TRACE ("Enter\n" ); + +if (test_bit (WL_STATUS_READY , &cfg_priv->status)) +brcmf_invoke_iscan (wiphy_to_cfg (wiphy)); + +WL_TRACE ("Exit\n" ); +return 0 ; +} + +static s32 brcmf_cfg80211_suspend (struct wiphy *wiphy, +struct cfg80211_wowlan *wow) +{ +struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); +struct net_device *ndev =cfg_to_ndev (cfg_priv); + +WL_TRACE ("Enter\n" ); + +/* +* Check for WL_STATUS_READY before any function call which +* could result is bus access. Don't block the suspend for +* any driver error conditions +*/ + +/* +* While going to suspend if associated with AP disassociate +* from AP to save power while system is in suspended state +*/ +if ((test_bit (WL_STATUS_CONNECTED , &cfg_priv->status) || +test_bit (WL_STATUS_CONNECTING , &cfg_priv->status)) && +test_bit (WL_STATUS_READY , &cfg_priv->status)) { +WL_INFO ("Disassociating from AP" +" while entering suspend state\n" ); +brcmf_link_down (cfg_priv); + +/* +* Make sure WPA_Supplicant receives all the event +* generated due to DISASSOC call to the fw to keep +* the state fw and WPA_Supplicant state consistent +*/ +rtnl_unlock (); +brcmf_delay (500 ); +rtnl_lock (); + } + +set_bit (WL_STATUS_SCAN_ABORTING , &cfg_priv->status); +if (test_bit (WL_STATUS_READY , &cfg_priv->status)) +brcmf_term_iscan (cfg_priv); + +if (cfg_priv->scan_request) { +/* Indidate scan abort to cfg80211 layer */ +WL_INFO ("Terminating scan in progress\n" ); +cfg80211_scan_done (cfg_priv->scan_request, true); + cfg_priv->scan_request =NULL ; + } +clear_bit (WL_STATUS_SCANNING , &cfg_priv->status); +clear_bit (WL_STATUS_SCAN_ABORTING , &cfg_priv->status); + +/* Turn off watchdog timer */ +if (test_bit (WL_STATUS_READY , &cfg_priv->status)) { +WL_INFO ("Enable MPC\n" ); +brcmf_set_mpc (ndev,1 ); + } + +WL_TRACE ("Exit\n" ); + +return 0 ; +} + +static __used s32 +brcmf_dev_bufvar_set (struct net_device *dev,s8 *name,s8 *buf,s32 len) +{ +struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (dev); +u32 buflen; + + buflen =brcmu_mkiovar (name, buf, len, cfg_priv->ioctl_buf, +WL_IOCTL_LEN_MAX ); +BUG_ON (!buflen); + +return brcmf_dev_ioctl (dev,BRCMF_C_SET_VAR , cfg_priv->ioctl_buf, + buflen); +} + +static s32 +brcmf_dev_bufvar_get (struct net_device *dev,s8 *name,s8 *buf, +s32 buf_len) +{ +struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (dev); +u32 len; +s32 err =0 ; + + len =brcmu_mkiovar (name,NULL ,0 , cfg_priv->ioctl_buf, +WL_IOCTL_LEN_MAX ); +BUG_ON (!len); + err =brcmf_dev_ioctl (dev,BRCMF_C_GET_VAR , (void *)cfg_priv->ioctl_buf, +WL_IOCTL_LEN_MAX ); +if (unlikely (err)) { +WL_ERR ("error (%d)\n" , err); +return err; + } +memcpy (buf, cfg_priv->ioctl_buf, buf_len); + +return err; +} + +static __used s32 +brcmf_update_pmklist (struct net_device *dev, +struct brcmf_cfg80211_pmk_list *pmk_list,s32 err) +{ +int i, j; + +WL_CONN ("No of elements %d\n" , pmk_list->pmkids.npmkid); +for (i =0 ; i < pmk_list->pmkids.npmkid; i++) { +WL_CONN ("PMKID[%d]: %pM =\n" , i, + &pmk_list->pmkids.pmkid[i].BSSID); +for (j =0 ; j <WLAN_PMKID_LEN ; j++) +WL_CONN ("%02x\n" , pmk_list->pmkids.pmkid[i].PMKID[j]); + } + +if (likely (!err)) +brcmf_dev_bufvar_set (dev,"pmkid_info" , (char *)pmk_list, +sizeof (*pmk_list)); + +return err; +} + +static s32 +brcmf_cfg80211_set_pmksa (struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_pmksa *pmksa) +{ +struct brcmf_cfg80211_priv *cfg_priv =wiphy_to_cfg (wiphy); +struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; +s32 err =0 ; +int i; + +WL_TRACE ("Enter\n" ); +if (!check_sys_up (wiphy)) +return -EIO ; + +for (i =0 ; i < pmkids->npmkid; i++) +if (!memcmp (pmksa->bssid, pmkids->pmkid[i].BSSID,ETH_ALEN )) +break ; +if (i <WL_NUM_PMKIDS_MAX ) { +memcpy (pmkids->pmkid[i].BSSID, pmksa->bssid,ETH_ALEN );memcpy (pmkids->pmkid[i].PMKID, pmksa->pmkid,WLAN_PMKID_LEN );if (i == pmkids->npmkid) pmkids->npmkid++;
@@ -2382,165 +2752,6 @@ static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv) cfg_priv->wdev =NULL ; } -static s32 brcmf_inform_bss (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_scan_results *bss_list; -struct brcmf_bss_info *bi =NULL ;/* must be initialized */ -s32 err =0 ; -int i; - - bss_list = cfg_priv->bss_list; -if (unlikely (bss_list->version !=BRCMF_BSS_INFO_VERSION )) { -WL_ERR ("Version %d != WL_BSS_INFO_VERSION\n" , - bss_list->version); -return -EOPNOTSUPP ; - } -WL_SCAN ("scanned AP count (%d)\n" , bss_list->count); - bi =next_bss (bss_list, bi); -for_each_bss (bss_list, bi, i) { - err =brcmf_inform_single_bss (cfg_priv, bi); -if (unlikely (err)) -break ; - } -return err; -} - - -static s32 brcmf_inform_single_bss (struct brcmf_cfg80211_priv *cfg_priv, -struct brcmf_bss_info *bi) -{ -struct wiphy *wiphy =cfg_to_wiphy (cfg_priv); -struct ieee80211_channel *notify_channel; -struct cfg80211_bss *bss; -struct ieee80211_supported_band *band; -s32 err =0 ; -u16 channel; -u32 freq; -u64 notify_timestamp; -u16 notify_capability; -u16 notify_interval; -u8 *notify_ie; -size_t notify_ielen; -s32 notify_signal; - -if (unlikely (le32_to_cpu (bi->length) >WL_BSS_INFO_MAX )) { -WL_ERR ("Bss info is larger than buffer. Discarding\n" ); -return 0 ; - } - - channel = bi->ctl_ch ? bi->ctl_ch : -CHSPEC_CHANNEL (le16_to_cpu (bi->chanspec)); - -if (channel <=CH_MAX_2G_CHANNEL ) - band = wiphy->bands[IEEE80211_BAND_2GHZ ]; -else - band = wiphy->bands[IEEE80211_BAND_5GHZ ]; - - freq =ieee80211_channel_to_frequency (channel, band->band); - notify_channel =ieee80211_get_channel (wiphy, freq); - - notify_timestamp =jiffies_to_msecs (jiffies)*1000 ;/* uSec */ - notify_capability =le16_to_cpu (bi->capability); - notify_interval =le16_to_cpu (bi->beacon_period); - notify_ie = (u8 *)bi +le16_to_cpu (bi->ie_offset); - notify_ielen =le16_to_cpu (bi->ie_length); - notify_signal = (s16 )le16_to_cpu (bi->RSSI) *100 ; - -WL_CONN ("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n" , - bi->BSSID[0 ], bi->BSSID[1 ], bi->BSSID[2 ], - bi->BSSID[3 ], bi->BSSID[4 ], bi->BSSID[5 ]); -WL_CONN ("Channel: %d(%d)\n" , channel, freq); -WL_CONN ("Capability: %X\n" , notify_capability); -WL_CONN ("Beacon interval: %d\n" , notify_interval); -WL_CONN ("Signal: %d\n" , notify_signal); -WL_CONN ("notify_timestamp: %#018llx\n" , notify_timestamp); - - bss =cfg80211_inform_bss (wiphy, notify_channel, (const u8 *)bi->BSSID, - notify_timestamp, notify_capability, notify_interval, notify_ie, - notify_ielen, notify_signal,GFP_KERNEL ); - -if (unlikely (!bss)) { -WL_ERR ("cfg80211_inform_bss_frame error\n" ); -return -EINVAL ; - } - -return err; -} - -static s32 wl_inform_ibss (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *dev,const u8 *bssid) -{ -struct wiphy *wiphy =cfg_to_wiphy (cfg_priv); -struct ieee80211_channel *notify_channel; -struct brcmf_bss_info *bi =NULL ; -struct ieee80211_supported_band *band; -u8 *buf =NULL ; -s32 err =0 ; -u16 channel; -u32 freq; -u64 notify_timestamp; -u16 notify_capability; -u16 notify_interval; -u8 *notify_ie; -size_t notify_ielen; -s32 notify_signal; - -WL_TRACE ("Enter\n" ); - - buf =kzalloc (WL_BSS_INFO_MAX ,GFP_KERNEL ); -if (buf ==NULL ) { -WL_ERR ("kzalloc() failed\n" ); - err = -ENOMEM ; - goto CleanUp; - } - - *(u32 *)buf =cpu_to_le32 (WL_BSS_INFO_MAX ); - - err =brcmf_dev_ioctl (dev,BRCMF_C_GET_BSS_INFO , buf,WL_BSS_INFO_MAX ); -if (unlikely (err)) { -WL_ERR ("WLC_GET_BSS_INFO failed: %d\n" , err); - goto CleanUp; - } - - bi = (struct brcmf_bss_info *)(buf +4 ); - - channel = bi->ctl_ch ? bi->ctl_ch : -CHSPEC_CHANNEL (le16_to_cpu (bi->chanspec)); - -if (channel <=CH_MAX_2G_CHANNEL ) - band = wiphy->bands[IEEE80211_BAND_2GHZ ]; -else - band = wiphy->bands[IEEE80211_BAND_5GHZ ]; - - freq =ieee80211_channel_to_frequency (channel, band->band); - notify_channel =ieee80211_get_channel (wiphy, freq); - - notify_timestamp =jiffies_to_msecs (jiffies)*1000 ;/* uSec */ - notify_capability =le16_to_cpu (bi->capability); - notify_interval =le16_to_cpu (bi->beacon_period); - notify_ie = (u8 *)bi +le16_to_cpu (bi->ie_offset); - notify_ielen =le16_to_cpu (bi->ie_length); - notify_signal = (s16 )le16_to_cpu (bi->RSSI) *100 ; - -WL_CONN ("channel: %d(%d)\n" , channel, freq); -WL_CONN ("capability: %X\n" , notify_capability); -WL_CONN ("beacon interval: %d\n" , notify_interval); -WL_CONN ("signal: %d\n" , notify_signal); -WL_CONN ("notify_timestamp: %#018llx\n" , notify_timestamp); - -cfg80211_inform_bss (wiphy, notify_channel, bssid, - notify_timestamp, notify_capability, notify_interval, - notify_ie, notify_ielen, notify_signal,GFP_KERNEL ); - -CleanUp: - -kfree (buf); - -WL_TRACE ("Exit\n" ); - -return err; -} -static bool brcmf_is_linkup (struct brcmf_cfg80211_priv *cfg_priv,const struct brcmf_event_msg *e) {
@@ -2556,138 +2767,50 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv,return false; } -static bool brcmf_is_linkdown (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e) -{ -u32 event =be32_to_cpu (e->event_type); -u16 flags =be16_to_cpu (e->flags); - -if (event ==BRCMF_E_LINK && (!(flags &BRCMF_EVENT_MSG_LINK ))) { -WL_CONN ("Processing link down\n" ); -return true; - } -return false; -} - -static bool brcmf_is_nonetwork (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e) -{ -u32 event =be32_to_cpu (e->event_type); -u32 status =be32_to_cpu (e->status); - -if (event ==BRCMF_E_LINK && status ==BRCMF_E_STATUS_NO_NETWORKS ) { -WL_CONN ("Processing Link %s & no network found\n" , -be16_to_cpu (e->flags) &BRCMF_EVENT_MSG_LINK ? -"up" :"down" ); -return true; - } - -if (event ==BRCMF_E_SET_SSID && status !=BRCMF_E_STATUS_SUCCESS ) { -WL_CONN ("Processing connecting & no network found\n" ); -return true; - } - -return false; -} - -static s32 -brcmf_notify_connect_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e,void *data) -{ -s32 err =0 ; - -if (brcmf_is_linkup (cfg_priv, e)) { -WL_CONN ("Linkup\n" ); -if (brcmf_is_ibssmode (cfg_priv)) { -brcmf_update_prof (cfg_priv,NULL , (void *)e->addr, -WL_PROF_BSSID ); -wl_inform_ibss (cfg_priv, ndev, e->addr); -cfg80211_ibss_joined (ndev, e->addr,GFP_KERNEL ); -clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); -set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); - }else -brcmf_bss_connect_done (cfg_priv, ndev, e, true); - }else if (brcmf_is_linkdown (cfg_priv, e)) { -WL_CONN ("Linkdown\n" ); -if (brcmf_is_ibssmode (cfg_priv)) { -clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); -if (test_and_clear_bit (WL_STATUS_CONNECTED , - &cfg_priv->status)) -brcmf_link_down (cfg_priv); - }else { -brcmf_bss_connect_done (cfg_priv, ndev, e, false); -if (test_and_clear_bit (WL_STATUS_CONNECTED , - &cfg_priv->status)) { -cfg80211_disconnected (ndev,0 ,NULL ,0 , -GFP_KERNEL ); -brcmf_link_down (cfg_priv); - } - } -brcmf_init_prof (cfg_priv->profile); - }else if (brcmf_is_nonetwork (cfg_priv, e)) { -if (brcmf_is_ibssmode (cfg_priv)) -clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); -else -brcmf_bss_connect_done (cfg_priv, ndev, e, false); - } - -return err; -} - -static s32 -brcmf_notify_roaming_status (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev, -const struct brcmf_event_msg *e,void *data) +static bool brcmf_is_linkdown (struct brcmf_cfg80211_priv *cfg_priv, +const struct brcmf_event_msg *e) { -s32 err =0 ;u32 event =be32_to_cpu (e->event_type); -u32 status =be32_to_cpu (e->status); +u16 flags =be16_to_cpu (e->flags); -if (event ==BRCMF_E_ROAM && status ==BRCMF_E_STATUS_SUCCESS ) { -if (test_bit (WL_STATUS_CONNECTED , &cfg_priv->status)) -brcmf_bss_roaming_done (cfg_priv, ndev, e); -else -brcmf_bss_connect_done (cfg_priv, ndev, e, true); +if (event ==BRCMF_E_LINK && (!(flags &BRCMF_EVENT_MSG_LINK ))) { +WL_CONN ("Processing link down\n" ); +return true; } - -return err; +return false; } -static __used s32 -brcmf_dev_bufvar_set (struct net_device *dev,s8 *name,s8 *buf,s32 len) +static bool brcmf_is_nonetwork (struct brcmf_cfg80211_priv *cfg_priv, +const struct brcmf_event_msg *e) { -struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (dev); -u32 buflen; +u32 event =be32_to_cpu (e->event_type); +u32 status =be32_to_cpu (e->status); - buflen =brcmu_mkiovar (name, buf, len, cfg_priv->ioctl_buf, -WL_IOCTL_LEN_MAX ); -BUG_ON (!buflen); +if (event ==BRCMF_E_LINK && status ==BRCMF_E_STATUS_NO_NETWORKS ) { +WL_CONN ("Processing Link %s & no network found\n" , +be16_to_cpu (e->flags) &BRCMF_EVENT_MSG_LINK ? +"up" :"down" ); +return true; + } -return brcmf_dev_ioctl (dev,BRCMF_C_SET_VAR , cfg_priv->ioctl_buf, - buflen); +if (event ==BRCMF_E_SET_SSID && status !=BRCMF_E_STATUS_SUCCESS ) { +WL_CONN ("Processing connecting & no network found\n" ); +return true; + } + +return false; } -static s32 -brcmf_dev_bufvar_get (struct net_device *dev,s8 *name,s8 *buf, -s32 buf_len) +static void brcmf_clear_assoc_ies (struct brcmf_cfg80211_priv *cfg_priv) { -struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (dev); -u32 len; -s32 err =0 ; - - len =brcmu_mkiovar (name,NULL ,0 , cfg_priv->ioctl_buf, -WL_IOCTL_LEN_MAX ); -BUG_ON (!len); - err =brcmf_dev_ioctl (dev,BRCMF_C_GET_VAR , (void *)cfg_priv->ioctl_buf, -WL_IOCTL_LEN_MAX ); -if (unlikely (err)) { -WL_ERR ("error (%d)\n" , err); -return err; - } -memcpy (buf, cfg_priv->ioctl_buf, buf_len); +struct brcmf_cfg80211_connect_info *conn_info =cfg_to_conn (cfg_priv); -return err; +kfree (conn_info->req_ie); + conn_info->req_ie =NULL ; + conn_info->req_ie_len =0 ; +kfree (conn_info->resp_ie); + conn_info->resp_ie =NULL ; + conn_info->resp_ie_len =0 ; }static s32 brcmf_get_assoc_ies (struct brcmf_cfg80211_priv *cfg_priv)
@@ -2748,114 +2871,6 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)return err; } -static void brcmf_clear_assoc_ies (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_connect_info *conn_info =cfg_to_conn (cfg_priv); - -kfree (conn_info->req_ie); - conn_info->req_ie =NULL ; - conn_info->req_ie_len =0 ; -kfree (conn_info->resp_ie); - conn_info->resp_ie =NULL ; - conn_info->resp_ie_len =0 ; -} - - -static void brcmf_ch_to_chanspec (int ch,struct brcmf_join_params *join_params, -size_t *join_params_size) -{ -u16 chanspec =0 ; - -if (ch !=0 ) { - join_params->params.chanspec_num =1 ; - join_params->params.chanspec_list[0 ] = ch; - -if (join_params->params.chanspec_list[0 ] <=CH_MAX_2G_CHANNEL ) - chanspec |=WL_CHANSPEC_BAND_2G ; -else - chanspec |=WL_CHANSPEC_BAND_5G ; - - chanspec |=WL_CHANSPEC_BW_20 ; - chanspec |=WL_CHANSPEC_CTL_SB_NONE ; - - *join_params_size +=BRCMF_ASSOC_PARAMS_FIXED_SIZE + - join_params->params.chanspec_num *sizeof (u16); - - join_params->params.chanspec_list[0 ] &=WL_CHANSPEC_CHAN_MASK ; - join_params->params.chanspec_list[0 ] |= chanspec; - join_params->params.chanspec_list[0 ] = -cpu_to_le16 (join_params->params.chanspec_list[0 ]); - - join_params->params.chanspec_num = -cpu_to_le32 (join_params->params.chanspec_num); - -WL_CONN ("join_params->params.chanspec_list[0]= %#X," -"channel %d, chanspec %#X\n" , - join_params->params.chanspec_list[0 ], ch, chanspec); - } -} - -static s32 brcmf_update_bss_info (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_bss_info *bi; -struct brcmf_ssid *ssid; -struct brcmu_tlv *tim; -u16 beacon_interval; -u8 dtim_period; -size_t ie_len; -u8 *ie; -s32 err =0 ; - -WL_TRACE ("Enter\n" ); -if (brcmf_is_ibssmode (cfg_priv)) -return err; - - ssid = (struct brcmf_ssid *)brcmf_read_prof (cfg_priv,WL_PROF_SSID ); - - *(u32 *)cfg_priv->extra_buf =cpu_to_le32 (WL_EXTRA_BUF_MAX ); - err =brcmf_dev_ioctl (cfg_to_ndev (cfg_priv),BRCMF_C_GET_BSS_INFO , - cfg_priv->extra_buf,WL_EXTRA_BUF_MAX ); -if (unlikely (err)) { -WL_ERR ("Could not get bss info %d\n" , err); - goto update_bss_info_out; - } - - bi = (struct brcmf_bss_info *)(cfg_priv->extra_buf +4 ); - err =brcmf_inform_single_bss (cfg_priv, bi); -if (unlikely (err)) - goto update_bss_info_out; - - ie = ((u8 *)bi) + bi->ie_offset; - ie_len = bi->ie_length; - beacon_interval =cpu_to_le16 (bi->beacon_period); - - tim =brcmu_parse_tlvs (ie, ie_len,WLAN_EID_TIM ); -if (tim) - dtim_period = tim->data[1 ]; -else { -/* -* active scan was done so we could not get dtim -* information out of probe response. -* so we speficially query dtim information to dongle. -*/ -u32 var; - err =brcmf_dev_intvar_get (cfg_to_ndev (cfg_priv), -"dtim_assoc" , &var); -if (unlikely (err)) { -WL_ERR ("wl dtim_assoc failed (%d)\n" , err); - goto update_bss_info_out; - } - dtim_period = (u8 )var; - } - -brcmf_update_prof (cfg_priv,NULL , &beacon_interval,WL_PROF_BEACONINT ); -brcmf_update_prof (cfg_priv,NULL , &dtim_period,WL_PROF_DTIMPERIOD ); - -update_bss_info_out: -WL_TRACE ("Exit" ); -return err; -} - static s32 brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev,
@@ -2895,44 +2910,108 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);WL_CONN ("Report roaming result\n" ); -set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); -WL_TRACE ("Exit\n" ); +set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); +WL_TRACE ("Exit\n" ); +return err; +} + +static s32 +brcmf_bss_connect_done (struct brcmf_cfg80211_priv *cfg_priv, +struct net_device *ndev,const struct brcmf_event_msg *e, +bool completed) +{ +struct brcmf_cfg80211_connect_info *conn_info =cfg_to_conn (cfg_priv); +s32 err =0 ; + +WL_TRACE ("Enter\n" ); + +if (test_and_clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status)) { +if (completed) { +brcmf_get_assoc_ies (cfg_priv); +brcmf_update_prof (cfg_priv,NULL , &e->addr, +WL_PROF_BSSID ); +brcmf_update_bss_info (cfg_priv); + } +cfg80211_connect_result (ndev, + (u8 *)brcmf_read_prof (cfg_priv, +WL_PROF_BSSID ), + conn_info->req_ie, + conn_info->req_ie_len, + conn_info->resp_ie, + conn_info->resp_ie_len, + completed ?WLAN_STATUS_SUCCESS : +WLAN_STATUS_AUTH_TIMEOUT , +GFP_KERNEL ); +if (completed) +set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); +WL_CONN ("Report connect result - connection %s\n" , + completed ?"succeeded" :"failed" ); + } +WL_TRACE ("Exit\n" ); +return err; +} + +static s32 +brcmf_notify_connect_status (struct brcmf_cfg80211_priv *cfg_priv, +struct net_device *ndev, +const struct brcmf_event_msg *e,void *data) +{ +s32 err =0 ; + +if (brcmf_is_linkup (cfg_priv, e)) { +WL_CONN ("Linkup\n" ); +if (brcmf_is_ibssmode (cfg_priv)) { +brcmf_update_prof (cfg_priv,NULL , (void *)e->addr, +WL_PROF_BSSID ); +wl_inform_ibss (cfg_priv, ndev, e->addr); +cfg80211_ibss_joined (ndev, e->addr,GFP_KERNEL ); +clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); +set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); + }else +brcmf_bss_connect_done (cfg_priv, ndev, e, true); + }else if (brcmf_is_linkdown (cfg_priv, e)) { +WL_CONN ("Linkdown\n" ); +if (brcmf_is_ibssmode (cfg_priv)) { +clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); +if (test_and_clear_bit (WL_STATUS_CONNECTED , + &cfg_priv->status)) +brcmf_link_down (cfg_priv); + }else { +brcmf_bss_connect_done (cfg_priv, ndev, e, false); +if (test_and_clear_bit (WL_STATUS_CONNECTED , + &cfg_priv->status)) { +cfg80211_disconnected (ndev,0 ,NULL ,0 , +GFP_KERNEL ); +brcmf_link_down (cfg_priv); + } + } +brcmf_init_prof (cfg_priv->profile); + }else if (brcmf_is_nonetwork (cfg_priv, e)) { +if (brcmf_is_ibssmode (cfg_priv)) +clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status); +else +brcmf_bss_connect_done (cfg_priv, ndev, e, false); + } +return err; }static s32 -brcmf_bss_connect_done (struct brcmf_cfg80211_priv *cfg_priv, -struct net_device *ndev,const struct brcmf_event_msg *e, -bool completed) +brcmf_notify_roaming_status (struct brcmf_cfg80211_priv *cfg_priv, +struct net_device *ndev, +const struct brcmf_event_msg *e,void *data) { -struct brcmf_cfg80211_connect_info *conn_info =cfg_to_conn (cfg_priv);s32 err =0 ; +u32 event =be32_to_cpu (e->event_type); +u32 status =be32_to_cpu (e->status); -WL_TRACE ("Enter\n" ); - -if (test_and_clear_bit (WL_STATUS_CONNECTING , &cfg_priv->status)) { -if (completed) { -brcmf_get_assoc_ies (cfg_priv); -brcmf_update_prof (cfg_priv,NULL , &e->addr, -WL_PROF_BSSID ); -brcmf_update_bss_info (cfg_priv); - } -cfg80211_connect_result (ndev, - (u8 *)brcmf_read_prof (cfg_priv, -WL_PROF_BSSID ), - conn_info->req_ie, - conn_info->req_ie_len, - conn_info->resp_ie, - conn_info->resp_ie_len, - completed ?WLAN_STATUS_SUCCESS : -WLAN_STATUS_AUTH_TIMEOUT , -GFP_KERNEL ); -if (completed) -set_bit (WL_STATUS_CONNECTED , &cfg_priv->status); -WL_CONN ("Report connect result - connection %s\n" , - completed ?"succeeded" :"failed" ); +if (event ==BRCMF_E_ROAM && status ==BRCMF_E_STATUS_SUCCESS ) { +if (test_bit (WL_STATUS_CONNECTED , &cfg_priv->status)) +brcmf_bss_roaming_done (cfg_priv, ndev, e); +else +brcmf_bss_connect_done (cfg_priv, ndev, e, true); } -WL_TRACE ("Exit\n" ); +return err; }
@@ -3041,11 +3120,6 @@ static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf) conf->tx_power =-1 ; } -static void brcmf_init_prof (struct brcmf_cfg80211_profile *prof) -{ -memset (prof,0 ,sizeof (*prof)); -} -static void brcmf_init_eloop_handler (struct brcmf_cfg80211_event_loop *el) {memset (el,0 ,sizeof (*el));
@@ -3056,6 +3130,28 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el) el->handler[BRCMF_E_SET_SSID ] = brcmf_notify_connect_status; } +static void brcmf_deinit_priv_mem (struct brcmf_cfg80211_priv *cfg_priv) +{ +kfree (cfg_priv->scan_results); + cfg_priv->scan_results =NULL ; +kfree (cfg_priv->bss_info); + cfg_priv->bss_info =NULL ; +kfree (cfg_priv->conf); + cfg_priv->conf =NULL ; +kfree (cfg_priv->profile); + cfg_priv->profile =NULL ; +kfree (cfg_priv->scan_req_int); + cfg_priv->scan_req_int =NULL ; +kfree (cfg_priv->ioctl_buf); + cfg_priv->ioctl_buf =NULL ; +kfree (cfg_priv->extra_buf); + cfg_priv->extra_buf =NULL ; +kfree (cfg_priv->iscan); + cfg_priv->iscan =NULL ; +kfree (cfg_priv->pmk_list); + cfg_priv->pmk_list =NULL ; +} +static s32 brcmf_init_priv_mem (struct brcmf_cfg80211_priv *cfg_priv) { cfg_priv->scan_results =kzalloc (WL_SCAN_BUF_MAX ,GFP_KERNEL );
@@ -3113,271 +3209,156 @@ init_priv_mem_out:return -ENOMEM ; } -static void brcmf_deinit_priv_mem (struct brcmf_cfg80211_priv *cfg_priv) +static void brcmf_lock_eq (struct brcmf_cfg80211_priv *cfg_priv) { -kfree (cfg_priv->scan_results); - cfg_priv->scan_results =NULL ; -kfree (cfg_priv->bss_info); - cfg_priv->bss_info =NULL ; -kfree (cfg_priv->conf); - cfg_priv->conf =NULL ; -kfree (cfg_priv->profile); - cfg_priv->profile =NULL ; -kfree (cfg_priv->scan_req_int); - cfg_priv->scan_req_int =NULL ; -kfree (cfg_priv->ioctl_buf); - cfg_priv->ioctl_buf =NULL ; -kfree (cfg_priv->extra_buf); - cfg_priv->extra_buf =NULL ; -kfree (cfg_priv->iscan); - cfg_priv->iscan =NULL ; -kfree (cfg_priv->pmk_list); - cfg_priv->pmk_list =NULL ; +spin_lock_irq (&cfg_priv->eq_lock); } -static s32 brcmf_create_event_handler (struct brcmf_cfg80211_priv *cfg_priv) +static void brcmf_unlock_eq (struct brcmf_cfg80211_priv *cfg_priv) { -init_waitqueue_head (&cfg_priv->event_waitq); - cfg_priv->event_tsk =kthread_run (brcmf_event_handler, cfg_priv, -"wl_event_handler" ); -if (IS_ERR (cfg_priv->event_tsk)) { - cfg_priv->event_tsk =NULL ; -WL_ERR ("failed to create event thread\n" ); -return -ENOMEM ; - } -return 0 ; +spin_unlock_irq (&cfg_priv->eq_lock); } -static void brcmf_destroy_event_handler (struct brcmf_cfg80211_priv *cfg_priv) +static void brcmf_init_eq_lock (struct brcmf_cfg80211_priv *cfg_priv) { -if (cfg_priv->event_tsk) { -send_sig (SIGTERM , cfg_priv->event_tsk,1 ); -kthread_stop (cfg_priv->event_tsk); - cfg_priv->event_tsk =NULL ; - } +spin_lock_init (&cfg_priv->eq_lock); } -static void brcmf_term_iscan (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); -struct brcmf_ssid ssid; - -if (cfg_priv->iscan_on) { - iscan->state =WL_ISCAN_STATE_IDLE ; - -if (iscan->timer_on) { -del_timer_sync (&iscan->timer); - iscan->timer_on =0 ; - } - -cancel_work_sync (&iscan->work); - -/* Abort iscan running in FW */ -memset (&ssid,0 ,sizeof (ssid)); -brcmf_run_iscan (iscan, &ssid,WL_SCAN_ACTION_ABORT ); - } -} +/* +* retrieve first queued event from head +*/ -static void brcmf_notify_iscan_complete (struct brcmf_cfg80211_iscan_ctrl *iscan, -bool aborted) +static struct brcmf_cfg80211_event_q *brcmf_deq_event ( +struct brcmf_cfg80211_priv *cfg_priv) { -struct brcmf_cfg80211_priv *cfg_priv =iscan_to_cfg (iscan); -struct net_device *ndev =cfg_to_ndev (cfg_priv); - -if (unlikely (!test_and_clear_bit (WL_STATUS_SCANNING , - &cfg_priv->status))) { -WL_ERR ("Scan complete while device not scanning\n" ); -return ; - } -if (likely (cfg_priv->scan_request)) { -WL_SCAN ("ISCAN Completed scan: %s\n" , - aborted ?"Aborted" :"Done" ); -cfg80211_scan_done (cfg_priv->scan_request, aborted); -brcmf_set_mpc (ndev,1 ); - cfg_priv->scan_request =NULL ; - } - cfg_priv->iscan_kickstart = false; -} +struct brcmf_cfg80211_event_q *e =NULL ; -static s32 brcmf_wakeup_iscan (struct brcmf_cfg80211_iscan_ctrl *iscan) -{ -if (likely (iscan->state !=WL_ISCAN_STATE_IDLE )) { -WL_SCAN ("wake up iscan\n" ); -schedule_work (&iscan->work); -return 0 ; +brcmf_lock_eq (cfg_priv); +if (likely (!list_empty (&cfg_priv->eq_list))) { + e =list_first_entry (&cfg_priv->eq_list, + struct brcmf_cfg80211_event_q, eq_list); +list_del (&e->eq_list); } +brcmf_unlock_eq (cfg_priv); -return -EIO ; +return e; } +/* +** push event to tail of the queue +*/ +static s32 -brcmf_get_iscan_results (struct brcmf_cfg80211_iscan_ctrl *iscan,u32 *status, -struct brcmf_scan_results **bss_list) +brcmf_enq_event (struct brcmf_cfg80211_priv *cfg_priv,u32 event, +const struct brcmf_event_msg *msg) { -struct brcmf_iscan_results list; -struct brcmf_scan_results *results; -struct brcmf_iscan_results *list_buf; +struct brcmf_cfg80211_event_q *e;s32 err =0 ; -memset (iscan->scan_buf,0 ,WL_ISCAN_BUF_MAX ); - list_buf = (struct brcmf_iscan_results *)iscan->scan_buf; - results = &list_buf->results; - results->buflen =BRCMF_ISCAN_RESULTS_FIXED_SIZE ; - results->version =0 ; - results->count =0 ; - -memset (&list,0 ,sizeof (list)); - list.results.buflen =cpu_to_le32 (WL_ISCAN_BUF_MAX ); - err =brcmf_dev_iovar_getbuf (iscan->dev,"iscanresults" , &list, -BRCMF_ISCAN_RESULTS_FIXED_SIZE , iscan->scan_buf, -WL_ISCAN_BUF_MAX ); -if (unlikely (err)) { -WL_ERR ("error (%d)\n" , err); -return err; + e =kzalloc (sizeof (struct brcmf_cfg80211_event_q ),GFP_KERNEL ); +if (unlikely (!e)) { +WL_ERR ("event alloc failed\n" ); +return -ENOMEM ; } - results->buflen =le32_to_cpu (results->buflen); - results->version =le32_to_cpu (results->version); - results->count =le32_to_cpu (results->count); -WL_SCAN ("results->count = %d\n" , results->count); -WL_SCAN ("results->buflen = %d\n" , results->buflen); - *status =le32_to_cpu (list_buf->status); -WL_SCAN ("status = %d\n" , *status); - *bss_list = results; - -return err; -} - -static s32 brcmf_iscan_done (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; -s32 err =0 ; - - iscan->state =WL_ISCAN_STATE_IDLE ; -rtnl_lock (); -brcmf_inform_bss (cfg_priv); -brcmf_notify_iscan_complete (iscan, false); -rtnl_unlock (); - -return err; -} -static s32 brcmf_iscan_pending (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; -s32 err =0 ; + e->etype = event; +memcpy (&e->emsg, msg,sizeof (struct brcmf_event_msg )); -/* Reschedule the timer */ -mod_timer (&iscan->timer, jiffies + iscan->timer_ms *HZ /1000 ); - iscan->timer_on =1 ; +brcmf_lock_eq (cfg_priv); +list_add_tail (&e->eq_list, &cfg_priv->eq_list); +brcmf_unlock_eq (cfg_priv);return err; } -static s32 brcmf_iscan_inprogress (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; -s32 err =0 ; - -rtnl_lock (); -brcmf_inform_bss (cfg_priv); -brcmf_run_iscan (iscan,NULL ,BRCMF_SCAN_ACTION_CONTINUE ); -rtnl_unlock (); -/* Reschedule the timer */ -mod_timer (&iscan->timer, jiffies + iscan->timer_ms *HZ /1000 ); - iscan->timer_on =1 ; - -return err; +static void brcmf_put_event (struct brcmf_cfg80211_event_q *e) +{ +kfree (e); } -static s32 brcmf_iscan_aborted (struct brcmf_cfg80211_priv *cfg_priv) +static s32 brcmf_event_handler (void *data) { -struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; -s32 err =0 ; +struct brcmf_cfg80211_priv *cfg_priv = + (struct brcmf_cfg80211_priv *)data; +struct sched_param param = {.sched_priority =MAX_RT_PRIO -1 }; +struct brcmf_cfg80211_event_q *e; +DECLARE_WAITQUEUE (wait, current); - iscan->state =WL_ISCAN_STATE_IDLE ; -rtnl_lock (); -brcmf_notify_iscan_complete (iscan, true); -rtnl_unlock (); +sched_setscheduler (current,SCHED_FIFO , ¶m); +allow_signal (SIGTERM ); +add_wait_queue (&cfg_priv->event_waitq, &wait); +while (1 ) { +prepare_to_wait (&cfg_priv->event_waitq, &wait, +TASK_INTERRUPTIBLE ); -return err; -} +schedule (); -static void brcmf_cfg80211_iscan_handler (struct work_struct *work) -{ -struct brcmf_cfg80211_iscan_ctrl *iscan = - container_of(work, struct brcmf_cfg80211_iscan_ctrl, - work); -struct brcmf_cfg80211_priv *cfg_priv =iscan_to_cfg (iscan); -struct brcmf_cfg80211_iscan_eloop *el = &iscan->el; -u32 status =BRCMF_SCAN_RESULTS_PARTIAL ; +if (kthread_should_stop ()) +break ; -if (iscan->timer_on) { -del_timer_sync (&iscan->timer); - iscan->timer_on =0 ; - } + e =brcmf_deq_event (cfg_priv); +if (unlikely (!e)) { +WL_ERR ("event queue empty...\n" ); +continue ; + } -rtnl_lock (); -if (brcmf_get_iscan_results (iscan, &status, &cfg_priv->bss_list)) { - status =BRCMF_SCAN_RESULTS_ABORTED ; -WL_ERR ("Abort iscan\n" ); +do { +WL_INFO ("event type (%d)\n" , e->etype); +if (cfg_priv->el.handler[e->etype]) + cfg_priv->el.handler[e->etype](cfg_priv, +cfg_to_ndev (cfg_priv), + &e->emsg, e->edata); +else +WL_INFO ("Unknown Event (%d): ignoring\n" , + e->etype); +brcmf_put_event (e); + }while ((e =brcmf_deq_event (cfg_priv))); } -rtnl_unlock (); - - el->handler[status](cfg_priv); +finish_wait (&cfg_priv->event_waitq, &wait); +WL_INFO ("was terminated\n" ); +return 0 ; } -static void brcmf_iscan_timer (unsigned long data) +static s32 brcmf_create_event_handler (struct brcmf_cfg80211_priv *cfg_priv) { -struct brcmf_cfg80211_iscan_ctrl *iscan = - (struct brcmf_cfg80211_iscan_ctrl *)data; - -if (iscan) { - iscan->timer_on =0 ; -WL_SCAN ("timer expired\n" ); -brcmf_wakeup_iscan (iscan); +init_waitqueue_head (&cfg_priv->event_waitq); + cfg_priv->event_tsk =kthread_run (brcmf_event_handler, cfg_priv, +"wl_event_handler" ); +if (IS_ERR (cfg_priv->event_tsk)) { + cfg_priv->event_tsk =NULL ; +WL_ERR ("failed to create event thread\n" ); +return -ENOMEM ; } +return 0 ; } -static s32 brcmf_invoke_iscan (struct brcmf_cfg80211_priv *cfg_priv) +static void brcmf_destroy_event_handler (struct brcmf_cfg80211_priv *cfg_priv) { -struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); - -if (cfg_priv->iscan_on) { - iscan->state =WL_ISCAN_STATE_IDLE ; -INIT_WORK (&iscan->work, brcmf_cfg80211_iscan_handler); +if (cfg_priv->event_tsk) { +send_sig (SIGTERM , cfg_priv->event_tsk,1 ); +kthread_stop (cfg_priv->event_tsk); + cfg_priv->event_tsk =NULL ; } - -return 0 ; } -static void brcmf_init_iscan_eloop (struct brcmf_cfg80211_iscan_eloop *el) +static void brcmf_init_eq (struct brcmf_cfg80211_priv *cfg_priv) { -memset (el,0 ,sizeof (*el)); - el->handler[BRCMF_SCAN_RESULTS_SUCCESS ] = brcmf_iscan_done; - el->handler[BRCMF_SCAN_RESULTS_PARTIAL ] = brcmf_iscan_inprogress; - el->handler[BRCMF_SCAN_RESULTS_PENDING ] = brcmf_iscan_pending; - el->handler[BRCMF_SCAN_RESULTS_ABORTED ] = brcmf_iscan_aborted; - el->handler[BRCMF_SCAN_RESULTS_NO_MEM ] = brcmf_iscan_aborted; +brcmf_init_eq_lock (cfg_priv); +INIT_LIST_HEAD (&cfg_priv->eq_list); } -static s32 brcmf_init_iscan (struct brcmf_cfg80211_priv *cfg_priv) +static void brcmf_flush_eq (struct brcmf_cfg80211_priv *cfg_priv) { -struct brcmf_cfg80211_iscan_ctrl *iscan =cfg_to_iscan (cfg_priv); -int err =0 ; +struct brcmf_cfg80211_event_q *e; -if (cfg_priv->iscan_on) { - iscan->dev =cfg_to_ndev (cfg_priv); -brcmf_init_iscan_eloop (&iscan->el); - iscan->timer_ms =WL_ISCAN_TIMER_INTERVAL_MS ; -init_timer (&iscan->timer); - iscan->timer.data = (unsigned long ) iscan; - iscan->timer.function = brcmf_iscan_timer; - err =brcmf_invoke_iscan (cfg_priv); -if (!err) - iscan->data = cfg_priv; +brcmf_lock_eq (cfg_priv); +while (!list_empty (&cfg_priv->eq_list)) { + e =list_first_entry (&cfg_priv->eq_list, + struct brcmf_cfg80211_event_q, eq_list); +list_del (&e->eq_list); +kfree (e); } - -return err; +brcmf_unlock_eq (cfg_priv); }static s32 wl_init_priv (struct brcmf_cfg80211_priv *cfg_priv)
@@ -3480,140 +3461,25 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg_dev) cfg_priv =brcmf_priv_get (cfg_dev);wl_deinit_priv (cfg_priv); -brcmf_free_wdev (cfg_priv); -brcmf_set_drvdata (cfg_dev,NULL ); -kfree (cfg_dev); -} - -static void brcmf_wakeup_event (struct brcmf_cfg80211_priv *cfg_priv) -{ -wake_up (&cfg_priv->event_waitq); -} - -static s32 brcmf_event_handler (void *data) -{ -struct brcmf_cfg80211_priv *cfg_priv = - (struct brcmf_cfg80211_priv *)data; -struct sched_param param = {.sched_priority =MAX_RT_PRIO -1 }; -struct brcmf_cfg80211_event_q *e; -DECLARE_WAITQUEUE (wait, current); - -sched_setscheduler (current,SCHED_FIFO , ¶m); -allow_signal (SIGTERM ); -add_wait_queue (&cfg_priv->event_waitq, &wait); -while (1 ) { -prepare_to_wait (&cfg_priv->event_waitq, &wait, -TASK_INTERRUPTIBLE ); - -schedule (); - -if (kthread_should_stop ()) -break ; - - e =brcmf_deq_event (cfg_priv); -if (unlikely (!e)) { -WL_ERR ("event queue empty...\n" ); -continue ; - } - -do { -WL_INFO ("event type (%d)\n" , e->etype); -if (cfg_priv->el.handler[e->etype]) - cfg_priv->el.handler[e->etype](cfg_priv, -cfg_to_ndev (cfg_priv), - &e->emsg, e->edata); -else -WL_INFO ("Unknown Event (%d): ignoring\n" , - e->etype); -brcmf_put_event (e); - }while ((e =brcmf_deq_event (cfg_priv))); - } -finish_wait (&cfg_priv->event_waitq, &wait); -WL_INFO ("was terminated\n" ); -return 0 ; -} - -void -brcmf_cfg80211_event (struct net_device *ndev, -const struct brcmf_event_msg *e,void *data) -{ -u32 event_type =be32_to_cpu (e->event_type); -struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (ndev); - -if (likely (!brcmf_enq_event (cfg_priv, event_type, e))) -brcmf_wakeup_event (cfg_priv); -} - -static void brcmf_init_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -brcmf_init_eq_lock (cfg_priv); -INIT_LIST_HEAD (&cfg_priv->eq_list); -} - -static void brcmf_flush_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_event_q *e; - -brcmf_lock_eq (cfg_priv); -while (!list_empty (&cfg_priv->eq_list)) { - e =list_first_entry (&cfg_priv->eq_list, - struct brcmf_cfg80211_event_q, eq_list); -list_del (&e->eq_list); -kfree (e); - } -brcmf_unlock_eq (cfg_priv); -} - -/* -* retrieve first queued event from head -*/ - -static struct brcmf_cfg80211_event_q *brcmf_deq_event ( -struct brcmf_cfg80211_priv *cfg_priv) -{ -struct brcmf_cfg80211_event_q *e =NULL ; - -brcmf_lock_eq (cfg_priv); -if (likely (!list_empty (&cfg_priv->eq_list))) { - e =list_first_entry (&cfg_priv->eq_list, - struct brcmf_cfg80211_event_q, eq_list); -list_del (&e->eq_list); - } -brcmf_unlock_eq (cfg_priv); - -return e; -} - -/* -** push event to tail of the queue -*/ - -static s32 -brcmf_enq_event (struct brcmf_cfg80211_priv *cfg_priv,u32 event, -const struct brcmf_event_msg *msg) -{ -struct brcmf_cfg80211_event_q *e; -s32 err =0 ; - - e =kzalloc (sizeof (struct brcmf_cfg80211_event_q ),GFP_KERNEL ); -if (unlikely (!e)) { -WL_ERR ("event alloc failed\n" ); -return -ENOMEM ; - } - - e->etype = event; -memcpy (&e->emsg, msg,sizeof (struct brcmf_event_msg )); - -brcmf_lock_eq (cfg_priv); -list_add_tail (&e->eq_list, &cfg_priv->eq_list); -brcmf_unlock_eq (cfg_priv); +brcmf_free_wdev (cfg_priv); +brcmf_set_drvdata (cfg_dev,NULL ); +kfree (cfg_dev); +} -return err; +static void brcmf_wakeup_event (struct brcmf_cfg80211_priv *cfg_priv) +{ +wake_up (&cfg_priv->event_waitq); } -static void brcmf_put_event (struct brcmf_cfg80211_event_q *e) +void +brcmf_cfg80211_event (struct net_device *ndev, +const struct brcmf_event_msg *e,void *data) { -kfree (e); +u32 event_type =be32_to_cpu (e->event_type); +struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (ndev); + +if (likely (!brcmf_enq_event (cfg_priv, event_type, e))) +brcmf_wakeup_event (cfg_priv); }static s32 brcmf_dongle_mode (struct net_device *ndev,s32 iftype)
@@ -3798,6 +3664,35 @@ dongle_scantime_out:return err; } +static s32 wl_update_wiphybands (struct brcmf_cfg80211_priv *cfg_priv) +{ +struct wiphy *wiphy; +s32 phy_list; +s8 phy; +s32 err =0 ; + + err =brcmf_dev_ioctl (cfg_to_ndev (cfg_priv),BRCM_GET_PHYLIST , + &phy_list,sizeof (phy_list)); +if (unlikely (err)) { +WL_ERR ("error (%d)\n" , err); +return err; + } + + phy = ((char *)&phy_list)[1 ]; +WL_INFO ("%c phy\n" , phy); +if (phy =='n' || phy =='a' ) { + wiphy =cfg_to_wiphy (cfg_priv); + wiphy->bands[IEEE80211_BAND_5GHZ ] = &__wl_band_5ghz_n; + } + +return err; +} + +static s32 brcmf_dongle_probecap (struct brcmf_cfg80211_priv *cfg_priv) +{ +return wl_update_wiphybands (cfg_priv); +} +static s32 brcmf_config_dongle (struct brcmf_cfg80211_priv *cfg_priv,bool need_lock) {
@@ -3853,30 +3748,40 @@ default_conf_out: } -static s32 wl_update_wiphybands (struct brcmf_cfg80211_priv *cfg_priv) +static int brcmf_debugfs_add_netdev_params (struct brcmf_cfg80211_priv *cfg_priv) { -struct wiphy *wiphy; -s32 phy_list; -s8 phy; +char buf[10 +IFNAMSIZ ]; +struct dentry *fd;s32 err =0 ; - err =brcmf_dev_ioctl (cfg_to_ndev (cfg_priv),BRCM_GET_PHYLIST , - &phy_list,sizeof (phy_list)); -if (unlikely (err)) { -WL_ERR ("error (%d)\n" , err); -return err; +sprintf (buf,"netdev:%s" ,cfg_to_ndev (cfg_priv)->name); + cfg_priv->debugfsdir =debugfs_create_dir (buf, +cfg_to_wiphy (cfg_priv)->debugfsdir); + + fd =debugfs_create_u16 ("beacon_int" ,S_IRUGO , cfg_priv->debugfsdir, + (u16 *)&cfg_priv->profile->beacon_interval); +if (!fd) { + err = -ENOMEM ; + goto err_out; } - phy = ((char *)&phy_list)[1 ]; -WL_INFO ("%c phy\n" , phy); -if (phy =='n' || phy =='a' ) { - wiphy =cfg_to_wiphy (cfg_priv); - wiphy->bands[IEEE80211_BAND_5GHZ ] = &__wl_band_5ghz_n; + fd =debugfs_create_u8 ("dtim_period" ,S_IRUGO , cfg_priv->debugfsdir, + (u8 *)&cfg_priv->profile->dtim_period); +if (!fd) { + err = -ENOMEM ; + goto err_out; } +err_out:return err; } +static void brcmf_debugfs_remove_netdev (struct brcmf_cfg80211_priv *cfg_priv) +{ +debugfs_remove_recursive (cfg_priv->debugfsdir); + cfg_priv->debugfsdir =NULL ; +} +static s32 __brcmf_cfg80211_up (struct brcmf_cfg80211_priv *cfg_priv) {s32 err =0 ;
@@ -3958,71 +3863,6 @@ s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev)return err; } -static s32 brcmf_dongle_probecap (struct brcmf_cfg80211_priv *cfg_priv) -{ -return wl_update_wiphybands (cfg_priv); -} - -static void *brcmf_read_prof (struct brcmf_cfg80211_priv *cfg_priv,s32 item) -{ -switch (item) { -case WL_PROF_SEC : -return &cfg_priv->profile->sec; -case WL_PROF_BSSID : -return &cfg_priv->profile->bssid; -case WL_PROF_SSID : -return &cfg_priv->profile->ssid; - } -WL_ERR ("invalid item (%d)\n" , item); -return NULL ; -} - -static s32 -brcmf_update_prof (struct brcmf_cfg80211_priv *cfg_priv, -const struct brcmf_event_msg *e,void *data,s32 item) -{ -s32 err =0 ; -struct brcmf_ssid *ssid; - -switch (item) { -case WL_PROF_SSID : - ssid = (struct brcmf_ssid *) data; -memset (cfg_priv->profile->ssid.SSID,0 , -sizeof (cfg_priv->profile->ssid.SSID)); -memcpy (cfg_priv->profile->ssid.SSID, - ssid->SSID, ssid->SSID_len); - cfg_priv->profile->ssid.SSID_len = ssid->SSID_len; -break ; -case WL_PROF_BSSID : -if (data) -memcpy (cfg_priv->profile->bssid, data,ETH_ALEN ); -else -memset (cfg_priv->profile->bssid,0 ,ETH_ALEN ); -break ; -case WL_PROF_SEC : -memcpy (&cfg_priv->profile->sec, data, -sizeof (cfg_priv->profile->sec)); -break ; -case WL_PROF_BEACONINT : - cfg_priv->profile->beacon_interval = *(u16 *)data; -break ; -case WL_PROF_DTIMPERIOD : - cfg_priv->profile->dtim_period = *(u8 *)data; -break ; -default : -WL_ERR ("unsupported item (%d)\n" , item); - err = -EOPNOTSUPP ; -break ; - } - -return err; -} - -static bool brcmf_is_ibssmode (struct brcmf_cfg80211_priv *cfg_priv) -{ -return cfg_priv->conf->mode ==WL_MODE_IBSS ; -} -static __used s32 brcmf_add_ie (struct brcmf_cfg80211_priv *cfg_priv,u8 t,u8 l,u8 *v) {
@@ -4040,109 +3880,3 @@ static __used s32 brcmf_add_ie(struct brcmf_cfg80211_priv *cfg_priv,return err; } - -static void brcmf_link_down (struct brcmf_cfg80211_priv *cfg_priv) -{ -struct net_device *dev =NULL ; -s32 err =0 ; - -WL_TRACE ("Enter\n" ); - -if (cfg_priv->link_up) { - dev =cfg_to_ndev (cfg_priv); -WL_INFO ("Call WLC_DISASSOC to stop excess roaming\n " ); - err =brcmf_dev_ioctl (dev,BRCMF_C_DISASSOC ,NULL ,0 ); -if (unlikely (err)) -WL_ERR ("WLC_DISASSOC failed (%d)\n" , err); - cfg_priv->link_up = false; - } -WL_TRACE ("Exit\n" ); -} - -static void brcmf_lock_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_lock_irq (&cfg_priv->eq_lock); -} - -static void brcmf_unlock_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_unlock_irq (&cfg_priv->eq_lock); -} - -static void brcmf_init_eq_lock (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_lock_init (&cfg_priv->eq_lock); -} - -static void brcmf_delay (u32 ms) -{ -if (ms <1000 /HZ ) { -cond_resched (); -mdelay (ms); - }else { -msleep (ms); - } -} - -static void brcmf_set_drvdata (struct brcmf_cfg80211_dev *dev,void *data) -{ - dev->driver_data = data; -} - -static void *brcmf_get_drvdata (struct brcmf_cfg80211_dev *dev) -{ -void *data =NULL ; - -if (dev) - data = dev->driver_data; -return data; -} - -static void brcmf_set_mpc (struct net_device *ndev,int mpc) -{ -s32 err =0 ; -struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (ndev); - -if (test_bit (WL_STATUS_READY , &cfg_priv->status)) { - err =brcmf_dev_intvar_set (ndev,"mpc" , mpc); -if (unlikely (err)) { -WL_ERR ("fail to set mpc\n" ); -return ; - } -WL_INFO ("MPC : %d\n" , mpc); - } -} - -static int brcmf_debugfs_add_netdev_params (struct brcmf_cfg80211_priv *cfg_priv) -{ -char buf[10 +IFNAMSIZ ]; -struct dentry *fd; -s32 err =0 ; - -sprintf (buf,"netdev:%s" ,cfg_to_ndev (cfg_priv)->name); - cfg_priv->debugfsdir =debugfs_create_dir (buf, -cfg_to_wiphy (cfg_priv)->debugfsdir); - - fd =debugfs_create_u16 ("beacon_int" ,S_IRUGO , cfg_priv->debugfsdir, - (u16 *)&cfg_priv->profile->beacon_interval); -if (!fd) { - err = -ENOMEM ; - goto err_out; - } - - fd =debugfs_create_u8 ("dtim_period" ,S_IRUGO , cfg_priv->debugfsdir, - (u8 *)&cfg_priv->profile->dtim_period); -if (!fd) { - err = -ENOMEM ; - goto err_out; - } - -err_out: -return err; -} - -static void brcmf_debugfs_remove_netdev (struct brcmf_cfg80211_priv *cfg_priv) -{ -debugfs_remove_recursive (cfg_priv->debugfsdir); - cfg_priv->debugfsdir =NULL ; -}
Signature · 1 line
1.7.4.1
Re: [PATCH 09/20] staging: brcm80211: remove static variables from wl_cfg80211.c
In reply to Roland Vossendrivers/staging/brcm80211/brcmfmac/wl_cfg80211.c static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv) · line 3442
Quoted 5 lines · Roland Vossen
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +2
-2- cfg80211_dev =kzalloc (sizeof (struct brcmf_cfg80211_dev ),GFP_KERNEL ); -if (unlikely (!cfg80211_dev)) { + cfg_dev =kzalloc (sizeof (struct brcmf_cfg80211_dev ),GFP_KERNEL ); +if (unlikely (!cfg_dev)) {WL_ERR ("wl_cfg80211_dev is invalid\n" );
This message is wrong. Also it isn't needed because kzalloc() prints its own more complete message.
Also unlikely() isn't needed here in the attach function. Likely and unlikely hints only belong in the fast path, and generally shouldn't be included in driver code (only in core kernel code).
Don't resend the patch obviously since this was there in the original code.
regards,
dan carpenter
Re: [PATCH 10/20] staging: brcm80211: removed unused encryption/security functionality
In reply to Roland Vossendrivers/staging/brcm80211/brcmsmac/main.c line 366
Quoted 5 lines · Roland Vossen
drivers/staging/brcm80211/brcmsmac/main.c +1
-3-#define BRCMS_PORTOPEN (cfg) \ - (((cfg)->WPA_auth != WPA_AUTH_DISABLED && WSEC_ENABLED((cfg)->wsec)) ? \ - (cfg)->wsec_portopen : true) +#define BRCMS_PORTOPEN (cfg) true
We could just delete BRCMS_PORTOPEN(), yes?
regards,
dan carpenter
Re: [PATCH 13/20] staging: brcm80211: removed softmac ratespec override functionality
In reply to Roland Vossendrivers/staging/brcm80211/brcmsmac/main.c int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode) · line 5994
Quoted 9 lines · Roland Vossen
drivers/staging/brcm80211/brcmsmac/main.c +1
-3@@ -5988,12 +5982,8 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)for (i =0 ; i < wlc->pub->_nbands; i++) {memset (wlc->bandstate[i]->hw_rateset.mcs,0 ,MCSSET_LEN ); -if (IS_MCS (wlc->band->rspec_override)) { - wlc->bandstate[i]->rspec_override =0 ; +if (IS_MCS (0 ))brcms_c_reprate_init (wlc); - }
IS_MCS(0) is always false.
Quoted 3 lines
drivers/staging/brcm80211/brcmsmac/main.c +0
-2-if (IS_MCS (wlc->band->mrspec_override)) - wlc->bandstate[i]->mrspec_override =0 ; }
[snip]
drivers/staging/brcm80211/brcmsmac/stf.c int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) · line 297
Quoted 11 lines
drivers/staging/brcm80211/brcmsmac/stf.c +1
-1@@ -293,26 +293,22 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)if (txstreams ==1 ) {for (i =0 ; i < wlc->pub->_nbands; i++) -if ((RSPEC_STF (wlc->bandstate[i]->rspec_override) != +if ((RSPEC_STF (0 ) != PHY_TXC1_MODE_SISO)
RSPEC_STF(0) is false as well. Same below.
regards,
dan carpenter
Quoted 24 lines
drivers/staging/brcm80211/brcmsmac/stf.c +3
-7- || (RSPEC_STF(wlc->bandstate[i]->mrspec_override) != + || (RSPEC_STF(0) != PHY_TXC1_MODE_SISO)) {if (!force)return -EBADE ;/* over-write the override rspec */ -if (RSPEC_STF (wlc->bandstate[i]->rspec_override) +if (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) { - wlc->bandstate[i]->rspec_override =0 ;wiphy_err (wlc->wiphy,"%s(): temp " "sense override non-SISO " "rspec_override\n" , __func__); } -if (RSPEC_STF - (wlc->bandstate[i]->mrspec_override) != -PHY_TXC1_MODE_SISO ) { - wlc->bandstate[i]->mrspec_override =0 ; +if (RSPEC_STF (0 ) !=PHY_TXC1_MODE_SISO ) { wiphy_err(wlc->wiphy, "%s(): temp " "sense override non-SISO " "mrspec_override\n",
Re: [PATCH 13/20] staging: brcm80211: removed softmac ratespec override functionality
Never mind. I see these are removed in the next patch.
regards,
dan carpenter
Re: [PATCH 13/20] staging: brcm80211: removed softmac ratespec override functionality
Quoted 1 line
Never mind. I see these are removed in the next patch.
Yes, I wanted to take small steps to facilitate reviewing.
Re: [PATCH 09/20] staging: brcm80211: remove static variables from wl_cfg80211.c
In reply to Dan CarpenterQuoted 9 lines · Dan Carpenter
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv) · line 3442
Quoted 5 lines · Roland Vossen
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +2
-2- cfg80211_dev =kzalloc (sizeof (struct brcmf_cfg80211_dev ),GFP_KERNEL ); -if (unlikely (!cfg80211_dev)) { + cfg_dev =kzalloc (sizeof (struct brcmf_cfg80211_dev ),GFP_KERNEL ); +if (unlikely (!cfg_dev)) {WL_ERR ("wl_cfg80211_dev is invalid\n" );This message is wrong. Also it isn't needed because
kzalloc()prints its own more complete message.
Understood. Will remove this in a subsequent patch.
Quoted 3 lines
Also
unlikely()isn't needed here in the attach function. Likely and unlikely hints only belong in the fast path, and generally shouldn't be included in driver code (only in core kernel code).
I will remove all likely/unlikely instances in the drivers except for places where we think they are justified, which I suspect is in 0 places.
Thanks for the review,
Roland.
Quoted 1 line · Roland Vossen
Code cleanup items, both fullmac and softmac.
All applied to my local tree, and will push out publicly when kernel.org is back up and running.
greg k-h