staging: brcm80211: 8th reaction for mainline patch #2
PATCH v2 16/26 staging: brcm80211: various global var related changes in softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmsmac/main.c | 11 +---------- drivers/staging/brcm80211/brcmsmac/main.h | 2 +- drivers/staging/brcm80211/brcmsmac/otp.c | 4 ++-- drivers/staging/brcm80211/brcmsmac/rate.h | 1 - drivers/staging/brcm80211/brcmsmac/srom.c | 15 +++++++++------ 5 files changed, 13 insertions(+), 20 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -10
@@ -428,8 +428,6 @@ const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };/* WME/802.1E Access Category to TX FIFO number */ static const u8 wme_ac2fifo[] = {1 ,0 ,2 ,3 }; -static bool in_send_q; -/* 802.1D Priority to precedence queue mapping */ const u8 wlc_prio2prec_map[] = { _BRCMS_PREC_BE,/* 0 BE - Best-effort */
@@ -442,7 +440,7 @@ const u8 wlc_prio2prec_map[] = { _BRCMS_PREC_NC, /* 7 NC - Network Control */ }; -static u16 xmtfifo_sz[][NFIFO ] = { +static const u16 xmtfifo_sz[][NFIFO ] = {/* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */ {20 ,192 ,192 ,21 ,17 ,5 },/* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */
@@ -7716,11 +7714,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc)struct pktq *q = &qi->q;struct ieee80211_tx_info *tx_info; -if (in_send_q) -return ; -else - in_send_q = true; - prec_map = wlc->tx_prec_map;/* Send all the enq'd pkts that we can.
@@ -7752,8 +7745,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc) prec_map = wlc->tx_prec_map; } } - - in_send_q = false; }void
drivers/staging/brcm80211/brcmsmac/main.h +1 -1
@@ -359,7 +359,7 @@ struct brcms_hardware {u16 chanspec;/* bmac chanspec shadow */ uint *txavail[NFIFO ];/* # tx descriptors available */ -u16 *xmtfifo_sz;/* fifo size in 256B for each xmt fifo */ +const u16 *xmtfifo_sz;/* fifo size in 256B for each xmt fifo */ u32 pllreq;/* pll requests to keep PLL on */
drivers/staging/brcm80211/brcmsmac/otp.c +2 -2
@@ -80,7 +80,7 @@ struct otp_fn_s {struct otpinfo {uint ccrev;/* chipc revision */ -struct otp_fn_s *fn;/* OTP functions */ +const struct otp_fn_s *fn;/* OTP functions */ struct si_pub *sih;/* Saved sb handle */ /* IPX OTP section */
@@ -442,7 +442,7 @@ static int ipxotp_nvread(struct otpinfo *oi, char *data, uint *len)return -ENOTSUPP ; } -static struct otp_fn_s ipxotp_fn = { +static const struct otp_fn_s ipxotp_fn = { (int (*)(struct otpinfo *)) ipxotp_size, (u16 (*)(struct otpinfo *,struct chipcregs *,uint )) ipxotp_read_bit,
drivers/staging/brcm80211/brcmsmac/rate.h +0 -1
@@ -27,7 +27,6 @@ extern const struct brcms_c_rateset cck_ofdm_rates;extern const struct brcms_c_rateset ofdm_rates;extern const struct brcms_c_rateset cck_rates;extern const struct brcms_c_rateset gphy_legacy_rates; -extern const struct brcms_c_rateset wlc_lrs_rates;extern const struct brcms_c_rateset rate_limit_1_2;struct brcms_mcs_info {
drivers/staging/brcm80211/brcmsmac/srom.c +9 -6
@@ -778,7 +778,9 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = { {NULL, 0, 0, 0, 0} }; -static u8 srom_crc8_table[CRC8_TABLE_SIZE ]; +/* crc table has the same contents for every device instance, so it can be +* shared between devices. */ +static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE ];static u16 *srom_window_address (struct si_pub *sih,u8 *curmap) {
@@ -1052,8 +1054,9 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,/* fixup the endianness so crc8 will pass */ htol16_buf (buf, nwords *2 ); -if (crc8 (srom_crc8_table, (u8 *) buf, nwords *2 , -CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (srom_crc8_table)) +if (crc8 (brcms_srom_crc8_table, (u8 *) buf, nwords *2 , +CRC8_INIT_VALUE ) != +CRC8_GOOD_VALUE (brcms_srom_crc8_table))/* DBG only pci always read srom4 first, then srom8/9 */ err = -EIO ;
@@ -1089,8 +1092,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)/* fixup the endianness so crc8 will pass */ htol16_buf (buf, bufsz); -if (crc8 (srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 , -CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (srom_crc8_table)) +if (crc8 (brcms_srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 , +CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (brcms_srom_crc8_table)) err = -EIO ;/* now correct the endianness of the byte array */
@@ -1147,7 +1150,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars, sromwindow =srom_window_address (sih, curmap); -crc8_populate_lsb (srom_crc8_table,SROM_CRC8_POLY ); +crc8_populate_lsb (brcms_srom_crc8_table,SROM_CRC8_POLY );if (ai_is_sprom_available (sih)) { err =sprom_read_pci (sih, sromwindow,0 , srom,SROM_WORDS , true);
Signature · 1 line
1.7.1
PATCH v2 21/26 staging: brcm80211: use endian annotated structures in brcmsmac
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Structures interfacing with the device have a specific endianess and structures exchanged between host and device have been annotated so sparse checking can be done. The Makefile has been modified to add the __CHECK_ENDIAN__ flag.
--- drivers/staging/brcm80211/brcmsmac/Makefile | 3 +- drivers/staging/brcm80211/brcmsmac/d11.h | 77 +++++++++++-------- drivers/staging/brcm80211/brcmsmac/dma.c | 41 +++++----- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 12 ++-- drivers/staging/brcm80211/brcmsmac/main.c | 86 +++++++++++---------- drivers/staging/brcm80211/brcmsmac/srom.c | 4 +- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 8 +- 7 files changed, 126 insertions(+), 105 deletions(-)
drivers/staging/brcm80211/brcmsmac/Makefile +2 -1
@@ -15,7 +15,8 @@ # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -ccflags-y := \ +ccflags-y := \ + -D__CHECK_ENDIAN__ \ -Idrivers/staging/brcm80211/brcmsmac \ -Idrivers/staging/brcm80211/brcmsmac/phy \ -Idrivers/staging/brcm80211/include
drivers/staging/brcm80211/brcmsmac/d11.h +45 -32
108 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/dma.c +22 -19
81 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +6 -6
@@ -89,9 +89,9 @@ }struct firmware_hdr { -u32 offset; -u32 len; -u32 idx; +__le32 offset; +__le32 len; +__le32 idx; };static const char *const brcms_firmwares[MAX_FW_IMAGES ] = {
@@ -243,7 +243,7 @@ static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = { .mcs = { /* placeholders for now */ .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = 500, + .rx_highest = cpu_to_le16(500), .tx_params = IEEE80211_HT_MCS_TX_DEFINED} } };
@@ -265,7 +265,7 @@ static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = { .mcs = { /* placeholders for now */ .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = 500, + .rx_highest = cpu_to_le16(500), .tx_params = IEEE80211_HT_MCS_TX_DEFINED} } };
@@ -1625,7 +1625,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx) "ERROR: fw hdr len\n");return -ENOMSG ; } - *data =le32_to_cpu (*((u32 *) pdata)); + *data =le32_to_cpu (*((__le32 *) pdata));return 0 ; } }
drivers/staging/brcm80211/brcmsmac/main.c +45 -41
174 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/srom.c +2 -2
@@ -822,14 +822,14 @@ static inline void ltoh16_buf(u16 *buf, unsigned int size) { size /=2 ;while (size--) - *(buf + size) =le16_to_cpu (*(buf + size)); + *(buf + size) =le16_to_cpu (*(__le16 *)(buf + size)); }static inline void htol16_buf (u16 *buf,unsigned int size) { size /=2 ;while (size--) - *(buf + size) =cpu_to_le16 (*(buf + size)); + *(__le16 *)(buf + size) =cpu_to_le16 (*(buf + size)); }/* Initialization of varbuf structure */
drivers/staging/brcm80211/brcmsmac/ucode_loader.h +4 -4
@@ -35,10 +35,10 @@ struct brcms_ucode {struct d11init *d11n0absinitvals16;struct d11init *d11n0bsinitvals16;struct d11init *d11n0initvals16; -u32 *bcm43xx_16_mimo; -u32 bcm43xx_16_mimosz; -u32 *bcm43xx_24_lcn; -u32 bcm43xx_24_lcnsz; +__le32 *bcm43xx_16_mimo; +size_t bcm43xx_16_mimosz; +__le32 *bcm43xx_24_lcn; +size_t bcm43xx_24_lcnsz;u32 *bcm43xx_bommajor;u32 *bcm43xx_bomminor; };
Signature · 1 line
1.7.1
PATCH v2 10/26 staging: brcm80211: remove unused function si_pmu_ilp_clock()
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function is not used in the driver and has been removed.
--- drivers/staging/brcm80211/brcmsmac/pmu.c | 22 ---------------------- drivers/staging/brcm80211/brcmsmac/pmu.h | 1 - 2 files changed, 0 insertions(+), 23 deletions(-)
drivers/staging/brcm80211/brcmsmac/pmu.c +0 -22
@@ -202,28 +202,6 @@ si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs *cc,W_REG (&cc->pmucontrol, tmp); } -u32 si_pmu_ilp_clock (struct si_pub *sih) -{ -static u32 ilpcycles_per_sec; - -if (!(sih->cccaps &CC_CAP_PMU )) -return ILP_CLOCK ; - -if (ilpcycles_per_sec ==0 ) { -u32 start, end, delta; -u32 origidx =ai_coreidx (sih); -struct chipcregs *cc =ai_setcoreidx (sih,SI_CC_IDX ); - start =R_REG (&cc->pmutimer); -mdelay (ILP_CALC_DUR ); - end =R_REG (&cc->pmutimer); - delta = end - start; - ilpcycles_per_sec = delta * (1000 /ILP_CALC_DUR ); -ai_setcoreidx (sih, origidx); - } - -return ilpcycles_per_sec; -} -u16 si_pmu_fast_pwrup_delay (struct si_pub *sih) {uint delay =PMU_MAX_TRANSITION_DLY ;
drivers/staging/brcm80211/brcmsmac/pmu.h +0 -1
@@ -24,7 +24,6 @@ extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih);extern void si_pmu_sprom_enable (struct si_pub *sih,bool enable);extern u32 si_pmu_chipcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val);extern u32 si_pmu_regcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val); -extern u32 si_pmu_ilp_clock (struct si_pub *sih);extern u32 si_pmu_alp_clock (struct si_pub *sih);extern void si_pmu_pllupd (struct si_pub *sih);extern void si_pmu_spuravoid (struct si_pub *sih,u8 spuravoid);
Signature · 1 line
1.7.1
PATCH v2 12/26 staging: brcm80211: remove dongle firmware related debug code
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
When the device dies the driver could extract cpu registers on the device to analyze the trap handling on the dongle. As the firmware with this driver is stable this code does not belong in the brcmfmac driver.
--- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 259 +------------------------ 1 files changed, 1 insertions(+), 258 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +1 -258
@@ -37,29 +37,7 @@#ifdef BCMDBG -/* ARM trap handling */ -struct brcmf_trap { -u32 type; -u32 epc; -u32 cpsr; -u32 spsr; -u32 r0; -u32 r1; -u32 r2; -u32 r3; -u32 r4; -u32 r5; -u32 r6; -u32 r7; -u32 r8; -u32 r9; -u32 r10; -u32 r11; -u32 r12; -u32 r13; -u32 r14; -u32 pc; -}; +#define BRCMF_TRAP_INFO_SIZE 80#define CBUF_LEN (128)
@@ -2890,231 +2868,6 @@ xfer_done: }#ifdef BCMDBG -static int -brcmf_sdbrcm_readshared (struct brcmf_bus *bus,struct sdpcm_shared *sh) -{ -u32 addr; -__le32 addr_le; -int rv; -struct sdpcm_shared_le sh_le; - -/* Read last word in memory to determine address of -sdpcm_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, bus->ramsize -4 , (u8 *)&addr_le, -4 ); -if (rv <0 ) -return rv; - - addr =le32_to_cpu (addr_le); - -brcmf_dbg (INFO ,"sdpcm_shared address 0x%08X\n" , addr); - -/* -* Check if addr is valid. -* NVRAM length at the end of memory should have been overwritten. -*/ -if (addr ==0 || ((~addr >>16 ) &0xffff ) == (addr &0xffff )) { -brcmf_dbg (ERROR ,"address (0x%08x) of sdpcm_shared invalid\n" , - addr); -return -EBADE ; - } - -/* Read rte_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *) &sh_le, -sizeof (struct sdpcm_shared_le )); -if (rv <0 ) -return rv; - -/* Endianness */ - sh->flags =le32_to_cpu (sh_le.flags); - sh->trap_addr =le32_to_cpu (sh_le.trap_addr); - sh->assert_exp_addr =le32_to_cpu (sh_le.assert_exp_addr); - sh->assert_file_addr =le32_to_cpu (sh_le.assert_file_addr); - sh->assert_line =le32_to_cpu (sh_le.assert_line); - sh->console_addr =le32_to_cpu (sh_le.console_addr); - sh->msgtrace_addr =le32_to_cpu (sh_le.msgtrace_addr); -memcpy (sh->tag, sh_le.tag,sizeof (sh->tag)); - -if ((sh->flags &SDPCM_SHARED_VERSION_MASK ) !=SDPCM_SHARED_VERSION ) { -brcmf_dbg (ERROR ,"sdpcm_shared version %d in brcmf is different than sdpcm_shared version %d in dongle\n" , -SDPCM_SHARED_VERSION , - sh->flags &SDPCM_SHARED_VERSION_MASK ); -return -EBADE ; - } - -return 0 ; -} - -static int brcmf_sdbrcm_mem_dump (struct brcmf_bus *bus) -{ -int ret =0 ; -int size;/* Full mem size */ -int start =0 ;/* Start address */ -int read_size =0 ;/* Read size of each iteration */ -u8 *buf =NULL , *databuf =NULL ; - -/* Get full mem size */ - size = bus->ramsize; - buf =kmalloc (size,GFP_ATOMIC ); -if (!buf) -return -1 ; - -/* Read mem content */ -printk (KERN_DEBUG "Dump dongle memory" ); - databuf = buf; -while (size) { - read_size =min (MEMBLOCK , size); - ret =brcmf_sdbrcm_membytes (bus, false, start, databuf, - read_size); -if (ret) { -brcmf_dbg (ERROR ,"Error membytes %d\n" , ret); -kfree (buf); -return -1 ; - } -printk ("." ); - -/* Decrement size and increment start address */ - size -= read_size; - start += read_size; - databuf += read_size; - } -printk (KERN_DEBUG "Done\n" ); - -/* free buf before return !!! */ -if (brcmf_write_to_file (bus->drvr, buf, bus->ramsize)) { -brcmf_dbg (ERROR ,"Error writing to files\n" ); -return -1 ; - } - -/* buf free handled in brcmf_write_to_file, not here */ -return 0 ; -} - -static int brcmf_sdbrcm_checkdied (struct brcmf_bus *bus,u8 *data,uint size) -{ -int bcmerror =0 ; -uint msize =512 ; -char *mbuffer =NULL ; -uint maxstrlen =256 ; -char *str =NULL ; -struct brcmf_trap tr; -struct sdpcm_shared sdpcm_shared; -struct brcmu_strbuf strbuf; - -brcmf_dbg (TRACE ,"Enter\n" ); - -if (data ==NULL ) { -/* -* Called after a rx ctrl timeout. "data" is NULL. -* allocate memory to trace the trap or assert. -*/ - size = msize; - mbuffer = data =kmalloc (msize,GFP_ATOMIC ); -if (mbuffer ==NULL ) { - bcmerror = -ENOMEM ; - goto done; - } - } - - str =kmalloc (maxstrlen,GFP_ATOMIC ); -if (str ==NULL ) { - bcmerror = -ENOMEM ; - goto done; - } - - bcmerror =brcmf_sdbrcm_readshared (bus, &sdpcm_shared); -if (bcmerror <0 ) - goto done; - -brcmu_binit (&strbuf, data, size); - -brcmu_bprintf (&strbuf, -"msgtrace address : 0x%08X\nconsole address : 0x%08X\n" , - sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr); - -if ((sdpcm_shared.flags &SDPCM_SHARED_ASSERT_BUILT ) ==0 ) -/* NOTE: Misspelled assert is intentional - DO NOT FIX. -* (Avoids conflict with real asserts for programmatic -* parsing of output.) -*/ -brcmu_bprintf (&strbuf,"Assrt not built in dongle\n" ); - -if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT |SDPCM_SHARED_TRAP )) == -0 ) { -/* NOTE: Misspelled assert is intentional - DO NOT FIX. -* (Avoids conflict with real asserts for programmatic -* parsing of output.) -*/ -brcmu_bprintf (&strbuf,"No trap%s in dongle" , - (sdpcm_shared.flags &SDPCM_SHARED_ASSERT_BUILT ) - ?"/assrt" :"" ); - }else { -if (sdpcm_shared.flags &SDPCM_SHARED_ASSERT ) { -/* Download assert */ -brcmu_bprintf (&strbuf,"Dongle assert" ); -if (sdpcm_shared.assert_exp_addr !=0 ) { - str[0 ] ='\0' ; - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.assert_exp_addr, - (u8 *) str, maxstrlen); -if (bcmerror <0 ) - goto done; - - str[maxstrlen -1 ] ='\0' ; -brcmu_bprintf (&strbuf," expr \"%s\"" , str); - } - -if (sdpcm_shared.assert_file_addr !=0 ) { - str[0 ] ='\0' ; - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.assert_file_addr, - (u8 *) str, maxstrlen); -if (bcmerror <0 ) - goto done; - - str[maxstrlen -1 ] ='\0' ; -brcmu_bprintf (&strbuf," file \"%s\"" , str); - } - -brcmu_bprintf (&strbuf," line %d " , - sdpcm_shared.assert_line); - } - -if (sdpcm_shared.flags &SDPCM_SHARED_TRAP ) { - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.trap_addr, (u8 *)&tr, -sizeof (struct brcmf_trap )); -if (bcmerror <0 ) - goto done; - -brcmu_bprintf (&strbuf, -"Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x," -"lp 0x%x, rpc 0x%x Trap offset 0x%x, " -"r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n" , - tr.type, tr.epc, tr.cpsr, tr.spsr, tr.r13, - tr.r14, tr.pc, sdpcm_shared.trap_addr, - tr.r0, tr.r1, tr.r2, tr.r3, tr.r4, tr.r5, - tr.r6, tr.r7); - } - } - -if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT |SDPCM_SHARED_TRAP )) -brcmf_dbg (ERROR ,"%s\n" , strbuf.origbuf); - -#ifdef BCMDBG -if (sdpcm_shared.flags &SDPCM_SHARED_TRAP ) -/* Mem dump to a file on device */ -brcmf_sdbrcm_mem_dump (bus); - -#endif /* BCMDBG */ - -done: -kfree (mbuffer); -kfree (str); - -return bcmerror; -} -#define CONSOLE_LINE_MAX 192static int brcmf_sdbrcm_readconsole (struct brcmf_bus *bus)
@@ -3377,21 +3130,11 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) rxlen, msglen); }else if (timeleft ==0 ) {brcmf_dbg (ERROR ,"resumed on timeout\n" ); -#ifdef BCMDBG -brcmf_sdbrcm_sdlock (bus); -brcmf_sdbrcm_checkdied (bus,NULL ,0 ); -brcmf_sdbrcm_sdunlock (bus); -#endif /* BCMDBG */ }else if (pending == true) {brcmf_dbg (CTL ,"cancelled\n" );return -ERESTARTSYS ; }else {brcmf_dbg (CTL ,"resumed for unknown reason?\n" ); -#ifdef BCMDBG -brcmf_sdbrcm_sdlock (bus); -brcmf_sdbrcm_checkdied (bus,NULL ,0 ); -brcmf_sdbrcm_sdunlock (bus); -#endif /* BCMDBG */ }if (rxlen)
Signature · 1 line
1.7.1
PATCH v2 14/26 staging: brcm80211: removed band related global vars from softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only. Variables are now maintained in a device specific structure.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 29 +++++++++++++--------- drivers/staging/brcm80211/brcmsmac/main.h | 1 + 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +17 -12
@@ -31,6 +31,7 @@#include "pub.h" #include "ucode_loader.h" #include "mac80211_if.h" +#include "main.h" #define N_TX_QUEUES 4/* #tx queues on mac80211<->driver interface */
@@ -225,7 +226,7 @@ static struct ieee80211_rate legacy_ratetable[] = { RATE(540, 0), }; -static struct ieee80211_supported_band brcms_band_2GHz_nphy = { +static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = { .band =IEEE80211_BAND_2GHZ , .channels = brcms_2ghz_chantable, .n_channels =ARRAY_SIZE (brcms_2ghz_chantable),
@@ -247,7 +248,7 @@ static struct ieee80211_supported_band brcms_band_2GHz_nphy = { } }; -static struct ieee80211_supported_band brcms_band_5GHz_nphy = { +static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = { .band =IEEE80211_BAND_5GHZ , .channels = brcms_5ghz_nphy_chantable, .n_channels =ARRAY_SIZE (brcms_5ghz_nphy_chantable),
@@ -981,22 +982,24 @@ static irqreturn_t brcms_isr(int irq, void *dev_id)static int ieee_hw_rate_init (struct ieee80211_hw *hw) {struct brcms_info *wl = hw->priv; -int has_5g; +struct brcms_c_info *wlc = wl->wlc; +struct ieee80211_supported_band *band; +int has_5g =0 ;u16 phy_type; - has_5g =0 ; - hw->wiphy->bands[IEEE80211_BAND_2GHZ ] =NULL ; hw->wiphy->bands[IEEE80211_BAND_5GHZ ] =NULL ; phy_type =brcms_c_get_phy_type (wl->wlc,0 );if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) { + band = &wlc->bandstate[BAND_2G_INDEX ]->band; + *band = brcms_band_2GHz_nphy_template;if (phy_type ==PHY_TYPE_LCN ) {/* Single stream */ - brcms_band_2GHz_nphy.ht_cap.mcs.rx_mask[1 ] =0 ; - brcms_band_2GHz_nphy.ht_cap.mcs.rx_highest =72 ; + band->ht_cap.mcs.rx_mask[1 ] =0 ; + band->ht_cap.mcs.rx_highest =72 ; } - hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = &brcms_band_2GHz_nphy; + hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = band; }else {return -EPERM ; }
@@ -1004,11 +1007,13 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)/* Assume all bands use the same phy. True for 11n devices. */ if (wl->pub->_nbands >1 ) { has_5g++; -if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) - hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = - &brcms_band_5GHz_nphy; -else +if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) { + band = &wlc->bandstate[BAND_5G_INDEX ]->band; + *band = brcms_band_5GHz_nphy_template; + hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = band; + }else {return -EPERM ; + } }return 0 ; }
drivers/staging/brcm80211/brcmsmac/main.h +1 -0
@@ -281,6 +281,7 @@ struct brcms_band {u16 CWmin;/* minimum size of contention window, in unit of aSlotTime */ u16 CWmax;/* maximum size of contention window, in unit of aSlotTime */ +struct ieee80211_supported_band band; };/* module control blocks */
Signature · 1 line
1.7.1
PATCH v2 15/26 staging: brcm80211: removed global var global_scb from softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only. Removed by instead using an already defined Station Control Block variable in a per-device structure.
--- drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +++--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 19 ++++--------------- drivers/staging/brcm80211/brcmsmac/main.c | 21 +++++++++++++-------- drivers/staging/brcm80211/brcmsmac/main.h | 4 ++++ drivers/staging/brcm80211/brcmsmac/pub.h | 1 - 5 files changed, 24 insertions(+), 27 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +3 -3
@@ -314,7 +314,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,static void brcms_c_scb_ampdu_update_config_all (struct ampdu_info *ampdu) { -brcms_c_scb_ampdu_update_config (ampdu, ampdu->wlc->pub->global_scb); +brcms_c_scb_ampdu_update_config (ampdu, &du->wlc->pri_scb); }static void brcms_c_ffpld_calc_mcs2ampdu_table (struct ampdu_info *ampdu,int f)
@@ -482,7 +482,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,struct scb_ampdu *scb_ampdu;struct scb_ampdu_tid_ini *ini;struct ampdu_info *ampdu = wlc->ampdu; -struct scb *scb = wlc->pub->global_scb; +struct scb *scb = &wlc->pri_scb; scb_ampdu = &scb->scb_ampdu;if (!ampdu->ini_enable[tid]) {
@@ -542,7 +542,7 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi, f = ampdu->fifo_tb + prio2fifo[tid]; - scb = wlc->pub->global_scb; + scb = &wlc->pri_scb; scb_ampdu = &scb->scb_ampdu; ini = &scb_ampdu->ini[tid];
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +4 -15
@@ -616,25 +616,14 @@ static int brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct scb *scb; - -int i; struct brcms_info *wl = hw->priv; +struct scb *scb = &wl->wlc->pri_scb; -/* Init the scb */ - scb = (struct scb *)sta->drv_priv; -memset (scb,0 ,sizeof (struct scb )); -for (i =0 ; i <NUMPRIO ; i++) - scb->seqctl[i] =0xFFFF ; - scb->seqctl_nonqos =0xFFFF ; - scb->magic =SCB_MAGIC ; +brcms_c_init_scb (scb); - wl->pub->global_scb = scb; wl->pub->global_ampdu = &(scb->scb_ampdu); wl->pub->global_ampdu->scb = scb; wl->pub->global_ampdu->max_pdu =16 ; -brcmu_pktq_init (&scb->scb_ampdu.txq,AMPDU_MAX_SCB_TID , -AMPDU_MAX_SCB_TID *PKTQ_LEN_DEFAULT ); sta->ht_cap.ht_supported = true; sta->ht_cap.ampdu_factor =IEEE80211_HT_MAX_AMPDU_64K ;
@@ -657,8 +646,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size) { - struct scb *scb = (struct scb *)sta->drv_priv; struct brcms_info *wl = hw->priv; +struct scb *scb = &wl->wlc->pri_scb;int status;if (WARN_ON (scb->magic !=SCB_MAGIC ))
@@ -1038,7 +1027,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw) hw->rate_control_algorithm ="minstrel_ht" ; - hw->sta_data_size =sizeof (struct scb ); + hw->sta_data_size =0 ;return ieee_hw_rate_init (hw); }
drivers/staging/brcm80211/brcmsmac/main.c +13 -8
@@ -882,7 +882,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN );if (tx_info->control.sta) - scb = (struct scb *)tx_info->control.sta->drv_priv; + scb = &wlc->pri_scb;if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) {brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs);
@@ -3331,14 +3331,21 @@ static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc)return chanspec; } -static struct scb global_scb; - -static void brcms_c_init_scb (struct brcms_c_info *wlc,struct scb *scb) +void brcms_c_init_scb (struct scb *scb) {int i; + +memset (scb,0 ,sizeof (struct scb )); scb->flags =SCB_WMECAP |SCB_HTCAP ; -for (i =0 ; i <NUMPRIO ; i++) +for (i =0 ; i <NUMPRIO ; i++) { scb->seqnum[i] =0 ; + scb->seqctl[i] =0xFFFF ; + } + + scb->seqctl_nonqos =0xFFFF ; + scb->magic =SCB_MAGIC ; +brcmu_pktq_init (&scb->scb_ampdu.txq,AMPDU_MAX_SCB_TID , +AMPDU_MAX_SCB_TID *PKTQ_LEN_DEFAULT ); }/* d11 core init
@@ -3799,8 +3806,6 @@ void brcms_c_init(struct brcms_c_info *wlc)brcms_c_bandinit_ordered (wlc, chanspec); -brcms_c_init_scb (wlc, &global_scb); -/* init probe response timeout */ brcms_c_write_shm (wlc,M_PRS_MAXTIME , wlc->prb_resp_timeout);
@@ -7684,7 +7689,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, {u8 prio;uint fifo; -struct scb *scb = &global_scb; +struct scb *scb = &wlc->pri_scb;struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);/*
drivers/staging/brcm80211/brcmsmac/main.h +4 -0
@@ -22,6 +22,7 @@#include <brcmu_utils.h> #include "types.h" #include "d11.h" +#include "scb.h" #define INVCHANNEL 255/* invalid channel */
@@ -483,6 +484,7 @@ struct brcms_txq_info {* tx_duty_cycle_cck: maximum allowed duty cycle for CCK. * pkt_queue: txq for transmit packets. * wiphy: +* pri_scb: primary Station Control Block */ struct brcms_c_info {struct brcms_pub *pub;
@@ -610,6 +612,7 @@ struct brcms_c_info {struct brcms_txq_info *pkt_queue;struct wiphy *wiphy; +struct scb pri_scb; };/* antsel module specific state */
@@ -864,5 +867,6 @@ extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);extern void brcms_b_txant_set (struct brcms_hardware *wlc_hw,u16 phytxant);extern void brcms_b_band_stf_ss_set (struct brcms_hardware *wlc_hw,u8 stf_mode); +extern void brcms_c_init_scb (struct scb *scb);#endif /* _BRCM_MAIN_H_ */
drivers/staging/brcm80211/brcmsmac/pub.h +0 -1
@@ -144,7 +144,6 @@ struct brcms_bss_info {struct brcms_pub {struct brcms_c_info *wlc;struct ieee80211_hw *ieee_hw; -struct scb *global_scb;struct scb_ampdu *global_ampdu;uint mac80211_state;uint unit;/* device instance number */
Signature · 1 line
1.7.1
PATCH v2 18/26 staging: brcm80211: changing interface to n-phy rssi compute function
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function wlc_phy_rssi_compute_nphy() was called with pointer to brcms_d11rxhdr structure in which it filled in the received power per antenna. However, these are not used further in the driver so it only needs the d11rxhdr structure as input for rssi calculation.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -2646,7 +2646,7 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, rssi -=256 ; }else if (radioid ==BCM2055_ID || radioid ==BCM2056_ID || radioid ==BCM2057_ID ) { - rssi =wlc_phy_rssi_compute_nphy (pi, wlc_rxhdr); + rssi =wlc_phy_rssi_compute_nphy (pi, rxh); } end:
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +1 -1
@@ -1183,7 +1183,7 @@ extern void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf,extern void wlc_phy_radio205x_vcocal_nphy (struct brcms_phy *pi);extern int wlc_phy_rssi_compute_nphy (struct brcms_phy *pi, -struct brcms_d11rxhdr *wlc_rxh); +struct d11rxhdr *rxh);#define NPHY_TESTPATTERN_BPHY_EVM 0#define NPHY_TESTPATTERN_BPHY_RFCS 1
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +1 -6
@@ -23109,9 +23109,8 @@ void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi) }int -wlc_phy_rssi_compute_nphy (struct brcms_phy *pi,struct brcms_d11rxhdr *wlc_rxh) +wlc_phy_rssi_compute_nphy (struct brcms_phy *pi,struct d11rxhdr *rxh) { -struct d11rxhdr *rxh = &wlc_rxh->rxhdr;s16 rxpwr, rxpwr0, rxpwr1;s16 phyRx0_l, phyRx2_l;
@@ -23134,10 +23133,6 @@ wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct brcms_d11rxhdr *wlc_rxh) rxpwr1 = phyRx2_l; } - wlc_rxh->rxpwr[0 ] = (s8 ) rxpwr0; - wlc_rxh->rxpwr[1 ] = (s8 ) rxpwr1; - wlc_rxh->do_rssi_ma =0 ; -if (pi->sh->rssi_mode ==RSSI_ANT_MERGE_MAX ) rxpwr = (rxpwr0 > rxpwr1) ? rxpwr0 : rxpwr1;else if (pi->sh->rssi_mode ==RSSI_ANT_MERGE_MIN )
Signature · 1 line
1.7.1
PATCH v2 23/26 staging: brcm80211: use d11rxhdr structure in brcms_c_recover_tsf64()
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
All information needed for this function is available in the d11rxhdr structure. This is the last place where the brcms_d11rxhdr structure so it can be removed.
--- drivers/staging/brcm80211/brcmsmac/d11.h | 17 ----------------- drivers/staging/brcm80211/brcmsmac/main.c | 9 +++------ drivers/staging/brcm80211/brcmsmac/types.h | 1 - 3 files changed, 3 insertions(+), 24 deletions(-)
drivers/staging/brcm80211/brcmsmac/d11.h +0 -17
@@ -1407,23 +1407,6 @@ struct d11rxhdr {u16 RxStatus2;u16 RxTSFTime;u16 RxChan; -}; - -/* -* rxhdr: received frame header data -* rssi: rssi computed by PHY -* rxpwr0: obsoleted, place holder for legacy ROM code. use rxpwr[] -* rxpwr1: obsoleted, place holder for legacy ROM code. use rxpwr[] -* do_rssi_ma: do per-pkt sampling for per-antenna ma in HIGH -* rxpwr: rssi for supported antennas -*/ -struct brcms_d11rxhdr { -struct d11rxhdr rxh_cpu; -s8 rssi; -s8 rxpwr0; -s8 rxpwr1; -s8 do_rssi_ma; -s8 rxpwr[WL_RSSI_ANT_MAX ]; } __packed;/* PhyRxStatus_0: */
drivers/staging/brcm80211/brcmsmac/main.c +3 -6
@@ -783,7 +783,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)struct sk_buff *tail =NULL ;uint n =0 ;uint bound_limit = bound ?RXBND :-1 ; -struct brcms_d11rxhdr *wlc_rxhdr =NULL ;BCMMSG (wlc_hw->wlc->wiphy,"wl%d\n" , wlc_hw->unit);/* gather received frames */
@@ -813,7 +812,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) rxh_le = (struct d11rxhdr_le *)p->data; rxh = (struct d11rxhdr *)p->data; - wlc_rxhdr = (struct brcms_d11rxhdr *) p->data;/* fixup rx header endianness */ rxh->RxFrameSize =le16_to_cpu (rxh_le->RxFrameSize);
@@ -8117,7 +8115,7 @@ brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr,* are used. Finally, the tsf_h is read from the tsf register. */ static u64 brcms_c_recover_tsf64 (struct brcms_c_info *wlc, -struct brcms_d11rxhdr *rxh) +struct d11rxhdr *rxh) {u32 tsf_h, tsf_l;u16 rx_tsf_0_15, rx_tsf_16_31;
@@ -8125,7 +8123,7 @@ static u64 brcms_c_recover_tsf64(struct brcms_c_info *wlc,brcms_b_read_tsf (wlc->hw, &tsf_l, &tsf_h); rx_tsf_16_31 = (u16)(tsf_l >>16 ); - rx_tsf_0_15 = rxh->rxh_cpu.RxTSFTime; + rx_tsf_0_15 = rxh->RxTSFTime;/* * a greater tsf time indicates the low 16 bits of
@@ -8145,14 +8143,13 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,struct sk_buff *p, struct ieee80211_rx_status *rx_status) { - struct brcms_d11rxhdr *wlc_rxh = (struct brcms_d11rxhdr *) rxh; int preamble;int channel;u32 rspec;unsigned char *plcp;/* fill in TSF and flag its presence */ - rx_status->mactime =brcms_c_recover_tsf64 (wlc, wlc_rxh); + rx_status->mactime =brcms_c_recover_tsf64 (wlc, rxh); rx_status->flag |=RX_FLAG_MACTIME_MPDU ; channel =BRCMS_CHAN_CHANNEL (rxh->RxChan);
drivers/staging/brcm80211/brcmsmac/types.h +0 -1
@@ -336,7 +336,6 @@ struct dma_pub;struct si_pub ;struct tx_status ;struct d11rxhdr ; -struct brcms_d11rxhdr ;struct txpwr_limits ;/* iovar structure */
Signature · 1 line
1.7.1
PATCH v2 25/26 staging: brcm80211: simple changes to softmac phy variables
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Code cleanup resulting in less sparse warnings.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 ++++++++++---------- .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c | 2 +- 4 files changed, 34 insertions(+), 36 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; }; -static const struct chan_info_basic chan_info_all[] = { +static struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +3 -3
@@ -558,7 +558,7 @@ struct chan_info_2064_lcnphy {u8 rxrf_rxrf_spare1; }; -static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { +static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {1 ,2412 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {2 ,2417 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {3 ,2422 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 },
@@ -575,7 +575,7 @@ static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, }; -static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { +static struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { {0x00 ,0 ,0 ,0 ,0 }, {0x01 ,0x64 ,0x64 ,0 ,0 }, {0x02, 0x20, 0x20, 0, 0},
@@ -4489,7 +4489,7 @@ static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)static void wlc_radio_2064_init (struct brcms_phy *pi) {u32 i; -const struct lcnphy_radio_regs *lcnphyregs =NULL ; +struct lcnphy_radio_regs *lcnphyregs =NULL ; lcnphyregs = lcnphy_radio_regs_2064;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +29 -31
164 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c +1 -1
@@ -1611,7 +1611,7 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =sizeof (dot11lcnphytbl_rx_gain_info_rev0) /sizeof (dot11lcnphytbl_rx_gain_info_rev0[0 ]); -const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 = +static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =sizeof (dot11lcnphytbl_rx_gain_info_rev1) /sizeof (dot11lcnphytbl_rx_gain_info_rev1[0 ]);
Signature · 1 line
1.7.1
PATCH v2 26/26 staging: brcm80211: declared global vars in softmac phy as const
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 +++++++++++---------- 3 files changed, 35 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; }; -static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +3 -3
@@ -558,7 +558,7 @@ struct chan_info_2064_lcnphy {u8 rxrf_rxrf_spare1; }; -static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { +static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {1 ,2412 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {2 ,2417 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {3 ,2422 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 },
@@ -575,7 +575,7 @@ static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, }; -static struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { +static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { {0x00 ,0 ,0 ,0 ,0 }, {0x01 ,0x64 ,0x64 ,0 ,0 }, {0x02, 0x20, 0x20, 0, 0},
@@ -4489,7 +4489,7 @@ static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)static void wlc_radio_2064_init (struct brcms_phy *pi) {u32 i; -struct lcnphy_radio_regs *lcnphyregs =NULL ; +const struct lcnphy_radio_regs *lcnphyregs =NULL ; lcnphyregs = lcnphy_radio_regs_2064;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +31 -29
164 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 2/26 staging: brcm80211: removed unused argument from softmac functions
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Parameter 's2' was unused. Affected function was only used internally to main.c and has been made static and moved above its callers.
--- drivers/staging/brcm80211/brcmsmac/main.c | 380 ++++++++++++++--------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 - 2 files changed, 188 insertions(+), 194 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +188 -192
@@ -830,9 +830,193 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)return n >= bound_limit; } +static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) +{ +if (tx) { +/* the post-increment is used in STAY_AWAKE macro */ +if (wlc->txpend16165war++ ==0 ) +brcms_c_set_ps_ctrl (wlc); + }else { + wlc->txpend16165war--; +if (wlc->txpend16165war ==0 ) +brcms_c_set_ps_ctrl (wlc); + } +} + +/* process an individual struct tx_status */ static bool -brcms_b_dotxstatus (struct brcms_hardware *wlc_hw,struct tx_status *txs, -u32 s2) +brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs) +{ +struct sk_buff *p; +uint queue; +struct d11txh *txh; +struct scb *scb =NULL ; +bool free_pdu; +int tx_rts, tx_frame_count, tx_rts_count; +uint totlen, supr_status; +bool lastframe; +struct ieee80211_hdr *h; +u16 mcl; +struct ieee80211_tx_info *tx_info; +struct ieee80211_tx_rate *txrate; +int i; + +/* discard intermediate indications for ucode with one legitimate case: +* e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, +* but the subsequent tx of DATA failed. so it will start rts/cts +* from the beginning (resetting the rts transmission count) +*/ +if (!(txs->status &TX_STATUS_AMPDU ) + && (txs->status &TX_STATUS_INTERMEDIATE )) { +wiphy_err (wlc->wiphy,"%s: INTERMEDIATE but not AMPDU\n" , + __func__); +return false; + } + + queue = txs->frameid &TXFID_QUEUE_MASK ; +if (queue >=NFIFO ) { + p =NULL ; + goto fatal; + } + + p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); +if (wlc->war16165) +brcms_c_war16165 (wlc, false); +if (p ==NULL ) + goto fatal; + + txh = (struct d11txh *) (p->data); + mcl =le16_to_cpu (txh->MacTxControlLow); + +if (txs->phyerr) { +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); + } +brcms_c_print_txstatus (txs); + } + +if (txs->frameid !=cpu_to_le16 (txh->TxFrameID)) + goto fatal; + tx_info =IEEE80211_SKB_CB (p); + h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN ); + +if (tx_info->control.sta) + scb = (struct scb *)tx_info->control.sta->drv_priv; + +if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { +brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs); +return false; + } + + supr_status = txs->status &TX_STATUS_SUPR_MASK ; +if (supr_status ==TX_STATUS_SUPR_BADCH ) +BCMMSG (wlc->wiphy, +"%s: Pkt tx suppressed, possibly channel %d\n" , + __func__,CHSPEC_CHANNEL (wlc->default_bss->chanspec)); + + tx_rts =cpu_to_le16 (txh->MacTxControlLow) &TXC_SENDRTS ; + tx_frame_count = + (txs->status &TX_STATUS_FRM_RTX_MASK ) >>TX_STATUS_FRM_RTX_SHIFT ; + tx_rts_count = + (txs->status &TX_STATUS_RTS_RTX_MASK ) >>TX_STATUS_RTS_RTX_SHIFT ; + + lastframe = !ieee80211_has_morefrags (h->frame_control); + +if (!lastframe) { +wiphy_err (wlc->wiphy,"Not last frame!\n" ); + }else { +/* +* Set information to be consumed by Minstrel ht. +* +* The "fallback limit" is the number of tx attempts a given +* MPDU is sent at the "primary" rate. Tx attempts beyond that +* limit are sent at the "secondary" rate. +* A 'short frame' does not exceed RTS treshold. +*/ +u16 sfbl,/* Short Frame Rate Fallback Limit */ + lfbl,/* Long Frame Rate Fallback Limit */ + fbl; + +if (queue <AC_COUNT ) { + sfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], +EDCF_SFB ); + lfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], +EDCF_LFB ); + }else { + sfbl = wlc->SFBL; + lfbl = wlc->LFBL; + } + + txrate = tx_info->status.rates; +if (txrate[0 ].flags &IEEE80211_TX_RC_USE_RTS_CTS ) + fbl = lfbl; +else + fbl = sfbl; + +ieee80211_tx_info_clear_status (tx_info); + +if ((tx_frame_count > fbl) && (txrate[1 ].idx >=0 )) { +/* +* rate selection requested a fallback rate +* and we used it +*/ + txrate[0 ].count = fbl; + txrate[1 ].count = tx_frame_count - fbl; + }else { +/* +* rate selection did not request fallback rate, or +* we didn't need it +*/ + txrate[0 ].count = tx_frame_count; +/* +* rc80211_minstrel.c:minstrel_tx_status() expects +* unused rates to be marked with idx = -1 +*/ + txrate[1 ].idx =-1 ; + txrate[1 ].count =0 ; + } + +/* clear the rest of the rates */ +for (i =2 ; i <IEEE80211_TX_MAX_RATES ; i++) { + txrate[i].idx =-1 ; + txrate[i].count =0 ; + } + +if (txs->status &TX_STATUS_ACK_RCV ) + tx_info->flags |=IEEE80211_TX_STAT_ACK ; + } + + totlen =brcmu_pkttotlen (p); + free_pdu = true; + +brcms_c_txfifo_complete (wlc, queue,1 ); + +if (lastframe) { + p->next =NULL ; + p->prev =NULL ; +/* remove PLCP & Broadcom tx descriptor header */ +skb_pull (p,D11_PHY_HDR_LEN ); +skb_pull (p,D11_TXH_LEN ); +ieee80211_tx_status_irqsafe (wlc->pub->ieee_hw, p); + }else { +wiphy_err (wlc->wiphy,"%s: Not last frame => not calling " +"tx_status\n" , __func__); + } + +return false; + + fatal: +if (p) +brcmu_pkt_buf_free_skb (p); + +return true; + +} + +static bool +brcms_b_dotxstatus (struct brcms_hardware *wlc_hw,struct tx_status *txs) {/* discard intermediate indications for ucode with one legitimate case: * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
@@ -843,7 +1027,7 @@ brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs, && (txs->status & TX_STATUS_INTERMEDIATE))return false; -return brcms_c_dotxstatus (wlc_hw->wlc, txs, s2); +return brcms_c_dotxstatus (wlc_hw->wlc, txs); }/* process tx completion events in BMAC
@@ -885,7 +1069,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) txs->phyerr = (s2 &TXS_PTX_MASK ) >>TXS_PTX_SHIFT ; txs->lasttxtime =0 ; - *fatal =brcms_b_dotxstatus (wlc_hw, txs, s2); + *fatal =brcms_b_dotxstatus (wlc_hw, txs);/* !give others some time to run! */ if (++n >= max_tx_num)
@@ -7654,19 +7838,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc) in_send_q = false; } -static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) -{ -if (tx) { -/* the post-increment is used in STAY_AWAKE macro */ -if (wlc->txpend16165war++ ==0 ) -brcms_c_set_ps_ctrl (wlc); - }else { - wlc->txpend16165war--; -if (wlc->txpend16165war ==0 ) -brcms_c_set_ps_ctrl (wlc); - } -} -void brcms_c_txfifo (struct brcms_c_info *wlc,uint fifo,struct sk_buff *p,bool commit,s8 txpktpend)
@@ -7978,181 +8149,6 @@ void brcms_c_tbtt(struct brcms_c_info *wlc) wlc->qvalid |=MCMD_DIRFRMQVAL ; } -/* process an individual struct tx_status */ -bool -brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs,u32 frm_tx2) -{ -struct sk_buff *p; -uint queue; -struct d11txh *txh; -struct scb *scb =NULL ; -bool free_pdu; -int tx_rts, tx_frame_count, tx_rts_count; -uint totlen, supr_status; -bool lastframe; -struct ieee80211_hdr *h; -u16 mcl; -struct ieee80211_tx_info *tx_info; -struct ieee80211_tx_rate *txrate; -int i; - -/* Compiler reference to avoid unused variable warning */ - (void )(frm_tx2); - -/* discard intermediate indications for ucode with one legitimate case: -* e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, -* but the subsequent tx of DATA failed. so it will start rts/cts -* from the beginning (resetting the rts transmission count) -*/ -if (!(txs->status &TX_STATUS_AMPDU ) - && (txs->status &TX_STATUS_INTERMEDIATE )) { -wiphy_err (wlc->wiphy,"%s: INTERMEDIATE but not AMPDU\n" , - __func__); -return false; - } - - queue = txs->frameid &TXFID_QUEUE_MASK ; -if (queue >=NFIFO ) { - p =NULL ; - goto fatal; - } - - p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); -if (wlc->war16165) -brcms_c_war16165 (wlc, false); -if (p ==NULL ) - goto fatal; - - txh = (struct d11txh *) (p->data); - mcl =le16_to_cpu (txh->MacTxControlLow); - -if (txs->phyerr) { -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); - } -brcms_c_print_txstatus (txs); - } - -if (txs->frameid !=cpu_to_le16 (txh->TxFrameID)) - goto fatal; - tx_info =IEEE80211_SKB_CB (p); - h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN ); - -if (tx_info->control.sta) - scb = (struct scb *)tx_info->control.sta->drv_priv; - -if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { -brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs); -return false; - } - - supr_status = txs->status &TX_STATUS_SUPR_MASK ; -if (supr_status ==TX_STATUS_SUPR_BADCH ) -BCMMSG (wlc->wiphy, -"%s: Pkt tx suppressed, possibly channel %d\n" , - __func__,CHSPEC_CHANNEL (wlc->default_bss->chanspec)); - - tx_rts =cpu_to_le16 (txh->MacTxControlLow) &TXC_SENDRTS ; - tx_frame_count = - (txs->status &TX_STATUS_FRM_RTX_MASK ) >>TX_STATUS_FRM_RTX_SHIFT ; - tx_rts_count = - (txs->status &TX_STATUS_RTS_RTX_MASK ) >>TX_STATUS_RTS_RTX_SHIFT ; - - lastframe = !ieee80211_has_morefrags (h->frame_control); - -if (!lastframe) { -wiphy_err (wlc->wiphy,"Not last frame!\n" ); - }else { -/* -* Set information to be consumed by Minstrel ht. -* -* The "fallback limit" is the number of tx attempts a given -* MPDU is sent at the "primary" rate. Tx attempts beyond that -* limit are sent at the "secondary" rate. -* A 'short frame' does not exceed RTS treshold. -*/ -u16 sfbl,/* Short Frame Rate Fallback Limit */ - lfbl,/* Long Frame Rate Fallback Limit */ - fbl; - -if (queue <AC_COUNT ) { - sfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], -EDCF_SFB ); - lfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], -EDCF_LFB ); - }else { - sfbl = wlc->SFBL; - lfbl = wlc->LFBL; - } - - txrate = tx_info->status.rates; -if (txrate[0 ].flags &IEEE80211_TX_RC_USE_RTS_CTS ) - fbl = lfbl; -else - fbl = sfbl; - -ieee80211_tx_info_clear_status (tx_info); - -if ((tx_frame_count > fbl) && (txrate[1 ].idx >=0 )) { -/* -* rate selection requested a fallback rate -* and we used it -*/ - txrate[0 ].count = fbl; - txrate[1 ].count = tx_frame_count - fbl; - }else { -/* -* rate selection did not request fallback rate, or -* we didn't need it -*/ - txrate[0 ].count = tx_frame_count; -/* -* rc80211_minstrel.c:minstrel_tx_status() expects -* unused rates to be marked with idx = -1 -*/ - txrate[1 ].idx =-1 ; - txrate[1 ].count =0 ; - } - -/* clear the rest of the rates */ -for (i =2 ; i <IEEE80211_TX_MAX_RATES ; i++) { - txrate[i].idx =-1 ; - txrate[i].count =0 ; - } - -if (txs->status &TX_STATUS_ACK_RCV ) - tx_info->flags |=IEEE80211_TX_STAT_ACK ; - } - - totlen =brcmu_pkttotlen (p); - free_pdu = true; - -brcms_c_txfifo_complete (wlc, queue,1 ); - -if (lastframe) { - p->next =NULL ; - p->prev =NULL ; -/* remove PLCP & Broadcom tx descriptor header */ -skb_pull (p,D11_PHY_HDR_LEN ); -skb_pull (p,D11_TXH_LEN ); -ieee80211_tx_status_irqsafe (wlc->pub->ieee_hw, p); - }else { -wiphy_err (wlc->wiphy,"%s: Not last frame => not calling " -"tx_status\n" , __func__); - } - -return false; - - fatal: -if (p) -brcmu_pkt_buf_free_skb (p); - -return true; - -} -void brcms_c_txfifo_complete (struct brcms_c_info *wlc,uint fifo,s8 txpktpend) {
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
@@ -702,8 +702,6 @@ struct brcms_bss_cfg {extern void brcms_c_fatal_error (struct brcms_c_info *wlc);extern void brcms_b_rpc_watchdog (struct brcms_c_info *wlc);extern void brcms_c_recv (struct brcms_c_info *wlc,struct sk_buff *p); -extern bool brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs, -u32 frm_tx2);extern void brcms_c_txfifo (struct brcms_c_info *wlc,uint fifo,struct sk_buff *p,bool commit,s8 txpktpend);
Signature · 1 line
1.7.1
PATCH v2 5/26 staging: brcm80211: removed global var from aiutils.c
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmsmac/aiutils.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +1 -5
@@ -477,9 +477,6 @@ struct aidmp {u32 componentid3;/* 0xffc */ }; -/* global kernel resource */ -static struct si_info ksii; -/* EROM parsing */ static u32
@@ -1216,8 +1213,7 @@ void ai_detach(struct si_pub *sih)pcicore_deinit (sii->pch); sii->pch =NULL ; -if (sii != &ksii) -kfree (sii); +kfree (sii); }/* register driver interrupt disabling and restoring callback functions */
Signature · 1 line
1.7.1
PATCH v2 8/26 staging: brcm80211: remove ht_cap field from brcms_c_info structure
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The field ht_cap was typed ieee80211_ht_cap from ieee80211.h. This contained little endian annotated field cap_info resulting in sparse endian warnings. It turned out the driver was setting the field, but it was actually never used. Therefore it has been removed.
--- drivers/staging/brcm80211/brcmsmac/main.c | 23 ----------------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 -- drivers/staging/brcm80211/brcmsmac/stf.c | 9 --------- 3 files changed, 0 insertions(+), 34 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -23
@@ -325,11 +325,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)*/ #define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1) -/* defaults for the HT (MIMO) bss */ -#define HT_CAP (IEEE80211_HT_CAP_SM_PS |\ - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\ - IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40) -/* * The following table lists the buffer memory allocated to xmt fifos in HW. * the size is in units of 256bytes(one block), total size is HW dependent
@@ -4213,13 +4208,6 @@ void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val)static void brcms_c_ht_update_sgi_rx (struct brcms_c_info *wlc,int val) { - wlc->ht_cap.cap_info &= ~(IEEE80211_HT_CAP_SGI_20 | -IEEE80211_HT_CAP_SGI_40 ); - wlc->ht_cap.cap_info |= (val &BRCMS_N_SGI_20 ) ? -IEEE80211_HT_CAP_SGI_20 :0 ; - wlc->ht_cap.cap_info |= (val &BRCMS_N_SGI_40 ) ? -IEEE80211_HT_CAP_SGI_40 :0 ; -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -4230,10 +4218,6 @@ static void brcms_c_ht_update_ldpc(struct brcms_c_info *wlc, s8 val) { wlc->stf->ldpc = val; - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_LDPC_CODING ; -if (wlc->stf->ldpc !=OFF ) - wlc->ht_cap.cap_info |=IEEE80211_HT_CAP_LDPC_CODING ; -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -5376,8 +5360,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, wlc->bsscfg->wlc = wlc; wlc->mimoft =FT_HT ; - wlc->ht_cap.cap_info =HT_CAP ; - wlc->mimo_40txbw =AUTO ; wlc->ofdm_40txbw =AUTO ; wlc->cck_40txbw =AUTO ;
@@ -5403,15 +5385,10 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,if (n_disabled &WLFEATURE_DISABLE_11N_STBC_TX ) { wlc->bandstate[BAND_2G_INDEX ]->band_stf_stbc_tx =OFF ; wlc->bandstate[BAND_5G_INDEX ]->band_stf_stbc_tx =OFF ; - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC ; }if (n_disabled &WLFEATURE_DISABLE_11N_STBC_RX )brcms_c_stf_stbc_rx_set (wlc,HT_CAP_RX_STBC_NO ); -/* apply the GF override from nvram conf */ -if (n_disabled &WLFEATURE_DISABLE_11N_GF ) - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_GRN_FLD ; -/* initialize radio_mpc_disable according to wlc->mpc */ brcms_c_radio_mpc_upd (wlc);brcms_b_antsel_set (wlc->hw, wlc->asi->antsel_avail);
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
@@ -456,7 +456,6 @@ struct brcms_txq_info {* cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode. * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode. -* ht_cap: HT CAP IE being advertised by this node. * default_bss: configured BSS parameters. * mc_fid_counter: BC/MC FIFO frame ID counter. * country_default: saved country for leaving 802.11d auto-country mode.
@@ -570,7 +569,6 @@ struct brcms_c_info {s8 cck_40txbw;s8 ofdm_40txbw;s8 mimo_40txbw; -struct ieee80211_ht_cap ht_cap;struct brcms_bss_info *default_bss;
drivers/staging/brcm80211/brcmsmac/stf.c +0 -9
@@ -53,9 +53,6 @@ static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)return ; } - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_RX_STBC ; - wlc->ht_cap.cap_info |= (val <<IEEE80211_HT_CAP_RX_STBC_SHIFT ); -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -140,12 +137,6 @@ static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)if ((int_val ==ON ) && (wlc->stf->txstreams ==1 ))return false; -if ((int_val ==OFF ) || (wlc->stf->txstreams ==1 ) - || !BRCMS_STBC_CAP_PHY (wlc)) - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC ; -else - wlc->ht_cap.cap_info |=IEEE80211_HT_CAP_TX_STBC ; - wlc->bandstate[BAND_2G_INDEX ]->band_stf_stbc_tx = (s8 ) int_val; wlc->bandstate[BAND_5G_INDEX ]->band_stf_stbc_tx = (s8 ) int_val;
Signature · 1 line
1.7.1
PATCH v2 9/26 staging: brcm80211: use fragment number provided in transmit frame
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
In the transmit path the field seq_ctrl is filled in, but the fragment number was not properly determined.
--- drivers/staging/brcm80211/brcmsmac/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
@@ -7100,7 +7100,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, scb->seqnum[p->priority]++;/* extract fragment number from frame first */ - seq =le16_to_cpu (seq) &FRAGNUM_MASK ; + seq =le16_to_cpu (h->seq_ctrl) &FRAGNUM_MASK ; seq |= (scb->seqnum[p->priority] <<SEQNUM_SHIFT ); h->seq_ctrl =cpu_to_le16 (seq);
Signature · 1 line
1.7.1
PATCH v2 20/26 staging: brcm80211: convert endianess before handling the frame
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The received frame from the device is in little-endian order and converted in the receive path. However, the phy code was doing the rssi calculation with packet in LE order. This has been changed to do the le_to_cpu conversion before doing the rssi computation and further receive processing.
--- drivers/staging/brcm80211/brcmsmac/main.c | 27 ++++++++++----------- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 6 ++-- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 8 +++--- 3 files changed, 20 insertions(+), 21 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +13 -14
@@ -813,11 +813,23 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) wlc_rxhdr = (struct brcms_d11rxhdr *) p->data; rxh = (struct d11rxhdr *)p->data; +/* fixup rx header endianness */ + rxh->RxFrameSize =le16_to_cpu (rxh->RxFrameSize); + rxh->PhyRxStatus_0 =le16_to_cpu (rxh->PhyRxStatus_0); + rxh->PhyRxStatus_1 =le16_to_cpu (rxh->PhyRxStatus_1); + rxh->PhyRxStatus_2 =le16_to_cpu (rxh->PhyRxStatus_2); + rxh->PhyRxStatus_3 =le16_to_cpu (rxh->PhyRxStatus_3); + rxh->PhyRxStatus_4 =le16_to_cpu (rxh->PhyRxStatus_4); + rxh->PhyRxStatus_5 =le16_to_cpu (rxh->PhyRxStatus_5); + rxh->RxStatus1 =le16_to_cpu (rxh->RxStatus1); + rxh->RxStatus2 =le16_to_cpu (rxh->RxStatus2); + rxh->RxTSFTime =le16_to_cpu (rxh->RxTSFTime); + rxh->RxChan =le16_to_cpu (rxh->RxChan); +/* * compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ wlc_rxhdr->rssi =wlc_phy_rssi_compute (wlc_hw->band->pi, rxh); -brcms_c_recv (wlc_hw->wlc, p); }
@@ -8289,19 +8301,6 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)/* strip off rxhdr */ skb_pull (p,BRCMS_HWRXOFF ); -/* fixup rx header endianness */ - rxh->RxFrameSize =le16_to_cpu (rxh->RxFrameSize); - rxh->PhyRxStatus_0 =le16_to_cpu (rxh->PhyRxStatus_0); - rxh->PhyRxStatus_1 =le16_to_cpu (rxh->PhyRxStatus_1); - rxh->PhyRxStatus_2 =le16_to_cpu (rxh->PhyRxStatus_2); - rxh->PhyRxStatus_3 =le16_to_cpu (rxh->PhyRxStatus_3); - rxh->PhyRxStatus_4 =le16_to_cpu (rxh->PhyRxStatus_4); - rxh->PhyRxStatus_5 =le16_to_cpu (rxh->PhyRxStatus_5); - rxh->RxStatus1 =le16_to_cpu (rxh->RxStatus1); - rxh->RxStatus2 =le16_to_cpu (rxh->RxStatus2); - rxh->RxTSFTime =le16_to_cpu (rxh->RxTSFTime); - rxh->RxChan =le16_to_cpu (rxh->RxChan); -/* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ if (rxh->RxStatus1 &RXS_PBPRES ) {if (p->len <2 ) {
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +3 -3
@@ -2613,18 +2613,18 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)int wlc_phy_rssi_compute (struct brcms_phy_pub *pih,struct d11rxhdr *rxh) { -int rssi =le16_to_cpu (rxh->PhyRxStatus_1) &PRXS1_JSSI_MASK ; +int rssi = rxh->PhyRxStatus_1 &PRXS1_JSSI_MASK ;uint radioid = pih->radioid;struct brcms_phy *pi = (struct brcms_phy *) pih;if ((pi->sh->corerev >=11 ) - && !(le16_to_cpu (rxh->RxStatus2) &RXS_PHYRXST_VALID )) { + && !(rxh->RxStatus2 &RXS_PHYRXST_VALID )) { rssi =BRCMS_RSSI_INVALID ; goto end; }if (ISLCNPHY (pi)) { -u8 gidx = (le16_to_cpu (rxh->PhyRxStatus_2) &0xFC00 ) >>10 ; +u8 gidx = (rxh->PhyRxStatus_2 &0xFC00 ) >>10 ;struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;if (rssi >127 )
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +4 -4
@@ -23115,16 +23115,16 @@ wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh)s16 phyRx0_l, phyRx2_l; rxpwr =0 ; - rxpwr0 =le16_to_cpu (rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK; - rxpwr1 = (le16_to_cpu (rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >>8 ; + rxpwr0 = rxh->PhyRxStatus_1 & PRXS1_nphy_PWR0_MASK; + rxpwr1 = (rxh->PhyRxStatus_1 & PRXS1_nphy_PWR1_MASK) >>8 ;if (rxpwr0 >127 ) rxpwr0 -=256 ;if (rxpwr1 >127 ) rxpwr1 -=256 ; - phyRx0_l =le16_to_cpu (rxh->PhyRxStatus_0) &0x00ff ; - phyRx2_l =le16_to_cpu (rxh->PhyRxStatus_2) &0x00ff ; + phyRx0_l = rxh->PhyRxStatus_0 &0x00ff ; + phyRx2_l = rxh->PhyRxStatus_2 &0x00ff ;if (phyRx2_l >127 ) phyRx2_l -=256 ;
Signature · 1 line
1.7.1
PATCH v2 24/26 staging: brcm80211: declared global vars in softmac phy as const
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 16 +----- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 23 -------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 ++++++++++---------- .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c | 2 +- 5 files changed, 36 insertions(+), 71 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -15
@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; }; -static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },
@@ -111,20 +111,6 @@ static struct chan_info_basic chan_info_all[] = { {216, 50800} }; -u16 ltrn_list[PHY_LTRN_LIST_LEN ] = { -0x18f9 ,0x0d01 ,0x00e4 ,0xdef4 ,0x06f1 ,0x0ffc , -0xfa27 ,0x1dff ,0x10f0 ,0x0918 ,0xf20a ,0xe010 , -0x1417 ,0x1104 ,0xf114 ,0xf2fa ,0xf7db ,0xe2fc , -0xe1fb ,0x13ee ,0xff0d ,0xe91c ,0x171a ,0x0318 , -0xda00 ,0x03e8 ,0x17e6 ,0xe9e4 ,0xfff3 ,0x1312 , -0xe105 ,0xe204 ,0xf725 ,0xf206 ,0xf1ec ,0x11fc , -0x14e9 ,0xe0f0 ,0xf2f6 ,0x09e8 ,0x1010 ,0x1d01 , -0xfad9 ,0x0f04 ,0x060f ,0xde0c ,0x001c ,0x0dff , -0x1807 ,0xf61a ,0xe40e ,0x0f16 ,0x05f9 ,0x18ec , -0x0a1b ,0xff1e ,0x2600 ,0xffe2 ,0x0ae5 ,0x1814 , -0x0507 ,0x0fea ,0xe4f2 ,0xf6e6 -}; -const u8 ofdm_rate_lookup[] = {BRCM_RATE_48M ,
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +0 -23
@@ -247,9 +247,6 @@ enum phy_cal_mode {#define PUB_NOT_ASSOC (pi) \ (mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC)) -#define PHY_LTRN_LIST_LEN 64 -extern u16 ltrn_list[PHY_LTRN_LIST_LEN ]; -struct phy_table_info {uint table;int q;
@@ -922,26 +919,6 @@ struct lcnphy_radio_regs {u8 do_init_g; }; -extern struct lcnphy_radio_regs lcnphy_radio_regs_2064[]; -extern struct lcnphy_radio_regs lcnphy_radio_regs_2066[]; - -extern struct radio_regs regs_2055[], regs_SYN_2056[], regs_TX_2056[], - regs_RX_2056[]; -extern struct radio_regs regs_SYN_2056_A1[], regs_TX_2056_A1[], - regs_RX_2056_A1[]; -extern struct radio_regs regs_SYN_2056_rev5[], regs_TX_2056_rev5[], - regs_RX_2056_rev5[]; -extern struct radio_regs regs_SYN_2056_rev6[], regs_TX_2056_rev6[], - regs_RX_2056_rev6[]; -extern struct radio_regs regs_SYN_2056_rev7[], regs_TX_2056_rev7[], - regs_RX_2056_rev7[]; -extern struct radio_regs regs_SYN_2056_rev8[], regs_TX_2056_rev8[], - regs_RX_2056_rev8[]; - -extern struct radio_20xx_regs regs_2057_rev4[], regs_2057_rev5[], - regs_2057_rev5v1[]; -extern struct radio_20xx_regs regs_2057_rev7[], regs_2057_rev8[]; -extern char *phy_getvar (struct brcms_phy *pi,const char *name);extern int phy_getintvar (struct brcms_phy *pi,const char *name);
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +3 -3
@@ -558,7 +558,7 @@ struct chan_info_2064_lcnphy {u8 rxrf_rxrf_spare1; }; -static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { +static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {1 ,2412 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {2 ,2417 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {3 ,2422 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 },
@@ -575,7 +575,7 @@ static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, }; -struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { +static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { {0x00 ,0 ,0 ,0 ,0 }, {0x01 ,0x64 ,0x64 ,0 ,0 }, {0x02, 0x20, 0x20, 0, 0},
@@ -4489,7 +4489,7 @@ static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)static void wlc_radio_2064_init (struct brcms_phy *pi) {u32 i; -struct lcnphy_radio_regs *lcnphyregs =NULL ; +const struct lcnphy_radio_regs *lcnphyregs =NULL ; lcnphyregs = lcnphy_radio_regs_2064;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +31 -29
164 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c +1 -1
@@ -1611,7 +1611,7 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =sizeof (dot11lcnphytbl_rx_gain_info_rev0) /sizeof (dot11lcnphytbl_rx_gain_info_rev0[0 ]); -static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 = +const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =sizeof (dot11lcnphytbl_rx_gain_info_rev1) /sizeof (dot11lcnphytbl_rx_gain_info_rev1[0 ]);
Signature · 1 line
1.7.1
v2 cover staging: brcm80211: 8th reaction for mainline patch #2
Code clean up for softmac.
V2:
* Rework some patches based on the comments from community
Arend van Spriel (13):
staging: brcm80211: remove uncoditional code blocks from brcmsmac
staging: brcm80211: remove ht_cap field from brcms_c_info structure
staging: brcm80211: use fragment number provided in transmit frame
staging: brcm80211: remove unused function si_pmu_ilp_clock()
staging: brcm80211: make device initializer table for wme constant
staging: brcm80211: remove dongle firmware related debug code
staging: brcm80211: remove unnecessary mac80211 callbacks
staging: brcm80211: changing interface to n-phy rssi compute function
staging: brcm80211: change interface for common rssi compute function
staging: brcm80211: convert endianess before handling the frame
staging: brcm80211: use endian annotated structures in brcmsmac
staging: brcm80211: move rssi computation to place we need it
staging: brcm80211: use d11rxhdr structure in brcms_c_recover_tsf64()
Roland Vossen (13):
staging: brcm80211: removed unused argument from softmac functions
staging: brcm80211: deleted unused array of bss configurations in
softmac
staging: brcm80211: removed redundant wlc->cfg struct member
staging: brcm80211: removed global var from aiutils.c
staging: brcm80211: removed global vars in softmac ucode handling
staging: brcm80211: removed unused softmac workaround
staging: brcm80211: removed band related global vars from softmac
staging: brcm80211: removed global var global_scb from softmac
staging: brcm80211: various global var related changes in softmac
staging: brcm80211: removed global variable in softmac otp
staging: brcm80211: declared global vars in softmac phy as const
staging: brcm80211: simple changes to softmac phy variables
staging: brcm80211: declared global vars in softmac phy as const
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 259 +------- drivers/staging/brcm80211/brcmsmac/Makefile | 3 +- drivers/staging/brcm80211/brcmsmac/aiutils.c | 15 +- drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 - drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +- drivers/staging/brcm80211/brcmsmac/d11.h | 91 ++-- drivers/staging/brcm80211/brcmsmac/dma.c | 41 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 125 +--- drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 747 +++++++++------------ drivers/staging/brcm80211/brcmsmac/main.h | 19 +- drivers/staging/brcm80211/brcmsmac/otp.c | 147 +---- drivers/staging/brcm80211/brcmsmac/otp.h | 8 - drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 62 +-- drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 25 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 112 ++-- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 75 +-- drivers/staging/brcm80211/brcmsmac/pmu.c | 22 - drivers/staging/brcm80211/brcmsmac/pmu.h | 1 - drivers/staging/brcm80211/brcmsmac/pub.h | 1 - drivers/staging/brcm80211/brcmsmac/rate.h | 1 - drivers/staging/brcm80211/brcmsmac/srom.c | 19 +- drivers/staging/brcm80211/brcmsmac/stf.c | 9 - drivers/staging/brcm80211/brcmsmac/types.h | 6 - drivers/staging/brcm80211/brcmsmac/ucode_loader.c | 121 ++-- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 46 +- 27 files changed, 648 insertions(+), 1322 deletions(-)
PATCH v2 1/26 staging: brcm80211: remove uncoditional code blocks from brcmsmac
From: Arend van Spriel <[email protected]>
Using a block statement to scope function variables is not common in linux kernel development. Browsed through the brcmsmac to remove those.
--- drivers/staging/brcm80211/brcmsmac/main.c | 9 +-- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 31 +++---- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 106 ++++++++++------------ 3 files changed, 63 insertions(+), 83 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -6
@@ -5076,7 +5076,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, {struct brcms_c_info *wlc;uint err =0 ; -uint j; +uint i, j;struct brcms_pub *pub;uint n_disabled;
@@ -5149,11 +5149,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, wlc->stf->hw_rxchain);/* pull up some info resulting from the low attach */ - { -int i; -for (i =0 ; i <NFIFO ; i++) - wlc->core->txavail[i] = wlc->hw->txavail[i]; - } +for (i =0 ; i <NFIFO ; i++) + wlc->core->txavail[i] = wlc->hw->txavail[i];brcms_b_hw_etheraddr (wlc->hw, wlc->perm_etheraddr);
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +11 -20
@@ -1199,12 +1199,7 @@ static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi)void wlc_phy_switch_radio (struct brcms_phy_pub *pih,bool on) {struct brcms_phy *pi = (struct brcms_phy *) pih; - - { -uint mc; - - mc =R_REG (&pi->regs->maccontrol); - } + (void )R_REG (&pi->regs->maccontrol);if (ISNPHY (pi)) {wlc_phy_switch_radio_nphy (pi, on);
@@ -1696,26 +1691,22 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi) band, rate); - { - -wlc_phy_txpower_sromlimit ((struct brcms_phy_pub *) pi, - target_chan, - &mintxpwr, &maxtxpwr, rate); +wlc_phy_txpower_sromlimit ((struct brcms_phy_pub *) pi, + target_chan, + &mintxpwr, &maxtxpwr, rate); - maxtxpwr =min (maxtxpwr, pi->txpwr_limit[rate]); + maxtxpwr =min (maxtxpwr, pi->txpwr_limit[rate]); - maxtxpwr = - (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) :0 ; + maxtxpwr = (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) :0 ; - maxtxpwr = (maxtxpwr >6 ) ? (maxtxpwr -6 ) :0 ; + maxtxpwr = (maxtxpwr >6 ) ? (maxtxpwr -6 ) :0 ; - maxtxpwr =min (maxtxpwr, tx_pwr_target[rate]); + maxtxpwr =min (maxtxpwr, tx_pwr_target[rate]); -if (pi->txpwr_percent <=100 ) - maxtxpwr = (maxtxpwr * pi->txpwr_percent) /100 ; +if (pi->txpwr_percent <=100 ) + maxtxpwr = (maxtxpwr * pi->txpwr_percent) /100 ; - tx_pwr_target[rate] =max (maxtxpwr, mintxpwr); - } + tx_pwr_target[rate] =max (maxtxpwr, mintxpwr); tx_pwr_target[rate] =min (tx_pwr_target[rate], pi->txpwr_env_limit[rate]);
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +49 -57
153 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 3/26 staging: brcm80211: deleted unused array of bss configurations in softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
List always had one element. Converted the array to a scalar.
--- drivers/staging/brcm80211/brcmsmac/main.c | 139 +++++++++------------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 +- drivers/staging/brcm80211/brcmsmac/types.h | 5 - 3 files changed, 43 insertions(+), 103 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +42 -97
@@ -342,15 +342,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)/* Starting corerev for the fifo size table */ #define XMTFIFOTBL_STARTREV 20 -/* iterate through all valid bsscfg entries */ -#define FOREACH_BSS (wlc, idx, cfg) \ - for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) { \ - cfg = (wlc)->bsscfg[idx]; \ - if (!cfg) \ - continue; -/* close marker for iterator code block */ -#define END_FOREACH_BSS () } -/* currently the best mechanism for determining SIFS is the band in use */ static u16 get_sifs (struct brcms_band *band) {
@@ -3278,8 +3269,7 @@ static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)*/ bool brcms_c_ps_allowed (struct brcms_c_info *wlc) { -int idx; -struct brcms_bss_cfg *cfg; +struct brcms_bss_cfg *cfg = wlc->bsscfg;/* disallow PS when one of the following global conditions meets */ if (!wlc->pub->associated)
@@ -3289,19 +3279,16 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)if (wlc->monitor)return false; -for (idx =0 ; idx <BRCMS_MAXBSSCFG ; idx++) { - cfg = wlc->bsscfg[idx]; -if (cfg && cfg->associated) { -/* -* disallow PS when one of the following -* bsscfg specific conditions meets -*/ -if (!cfg->BSS) -return false; +if (cfg->associated) { +/* +* disallow PS when one of the following +* bsscfg specific conditions meets +*/ +if (!cfg->BSS) +return false; -if (!cfg->dtim_programmed) -return false; - } +if (!cfg->dtim_programmed) +return false; }return true;
@@ -3779,8 +3766,6 @@ void brcms_c_init(struct brcms_c_info *wlc) {struct d11regs *regs;u16 chanspec; -int i; -struct brcms_bss_cfg *bsscfg;bool mute = false;BCMMSG (wlc->wiphy,"wl%d\n" , wlc->pub->unit);
@@ -3806,32 +3791,24 @@ void brcms_c_init(struct brcms_c_info *wlc)brcms_c_reprate_init (wlc);/* write ethernet address to core */ - FOREACH_BSS(wlc, i, bsscfg) -brcms_c_set_mac (bsscfg); -brcms_c_set_bssid (bsscfg); -END_FOREACH_BSS () +brcms_c_set_mac (wlc->bsscfg); +brcms_c_set_bssid (wlc->bsscfg);/* Update tsf_cfprep if associated and up */ -if (wlc->pub->associated) { - FOREACH_BSS(wlc, i, bsscfg) -if (bsscfg->up) { -u32 bi; +if (wlc->pub->associated && wlc->bsscfg->up) { +u32 bi; -/* get beacon period and convert to uS */ - bi = bsscfg->current_bss->beacon_period <<10 ; -/* -* update since init path would reset -* to default value -*/ -W_REG (®s->tsf_cfprep, - (bi <<CFPREP_CBI_SHIFT )); - -/* Update maccontrol PM related bits */ -brcms_c_set_ps_ctrl (wlc); +/* get beacon period and convert to uS */ + bi = wlc->bsscfg->current_bss->beacon_period <<10 ; +/* +* update since init path would reset +* to default value +*/ +W_REG (®s->tsf_cfprep, + (bi <<CFPREP_CBI_SHIFT )); -break ; - } - END_FOREACH_BSS() +/* Update maccontrol PM related bits */ +brcms_c_set_ps_ctrl (wlc); }brcms_c_bandinit_ordered (wlc, chanspec);
@@ -4021,26 +3998,13 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)brcms_b_set_shortslot (wlc->hw, shortslot); } -/* -* propagate home chanspec to all bsscfgs in -* case bsscfg->current_bss->chanspec is referenced -*/ void brcms_c_set_home_chanspec (struct brcms_c_info *wlc,u16 chanspec) {if (wlc->home_chanspec != chanspec) { -int idx; -struct brcms_bss_cfg *cfg; - wlc->home_chanspec = chanspec; - FOREACH_BSS(wlc, idx, cfg) -if (!cfg->associated) -continue ; - - cfg->current_bss->chanspec = chanspec; - END_FOREACH_BSS() - - +if (wlc->bsscfg->associated) + wlc->bsscfg->current_bss->chanspec = chanspec; } }
@@ -4092,8 +4056,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,static void brcms_c_setband (struct brcms_c_info *wlc,uint bandunit) { -int idx; -struct brcms_bss_cfg *cfg; +struct brcms_bss_cfg *cfg = wlc->bsscfg; wlc->band = wlc->bandstate[bandunit];
@@ -4101,11 +4064,9 @@ static void brcms_c_setband(struct brcms_c_info *wlc,return ;/* wait for at least one beacon before entering sleeping state */ -for (idx =0 ; idx <BRCMS_MAXBSSCFG ; idx++) { - cfg = wlc->bsscfg[idx]; -if (cfg && cfg->associated) - cfg->PMawakebcn = true; - } +if (cfg->associated) + cfg->PMawakebcn = true; +brcms_c_set_ps_ctrl (wlc);/* band-specific initializations */
@@ -5427,7 +5388,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, goto fail; } - wlc->bsscfg[0 ] = wlc->cfg; + wlc->bsscfg = wlc->cfg; wlc->cfg->_idx =0 ; wlc->cfg->wlc = wlc;
@@ -5840,19 +5801,15 @@ int brcms_c_up(struct brcms_c_info *wlc)if (status == -ENOMEDIUM ) {if (!mboolisset (wlc->pub->radio_disabled,WL_RADIO_HW_DISABLE )) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg;mboolset (wlc->pub->radio_disabled,WL_RADIO_HW_DISABLE ); - FOREACH_BSS(wlc, idx, bsscfg) -if (!bsscfg->enable || !bsscfg->BSS) -continue ; -wiphy_err (wlc->wiphy,"wl%d.%d: up" +if (bsscfg->enable && bsscfg->BSS) +wiphy_err (wlc->wiphy,"wl%d: up" ": rfdisable -> " "bsscfg_disable()\n" , - wlc->pub->unit, idx); - END_FOREACH_BSS() + wlc->pub->unit); } } }
@@ -8993,14 +8950,10 @@ void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,*/ void brcms_c_update_beacon (struct brcms_c_info *wlc) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg; -/* update AP or IBSS beacons */ - FOREACH_BSS(wlc, idx, bsscfg) -if (bsscfg->up && !bsscfg->BSS) -brcms_c_bss_update_beacon (wlc, bsscfg); - END_FOREACH_BSS() +if (bsscfg->up && !bsscfg->BSS) +brcms_c_bss_update_beacon (wlc, bsscfg); }/* Write ssid into shared memory */
@@ -9020,14 +8973,11 @@ void brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg)void brcms_c_update_probe_resp (struct brcms_c_info *wlc,bool suspend) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg;/* update AP or IBSS probe responses */ - FOREACH_BSS(wlc, idx, bsscfg) -if (bsscfg->up && !bsscfg->BSS) -brcms_c_bss_update_probe_resp (wlc, bsscfg, suspend); - END_FOREACH_BSS() +if (bsscfg->up && !bsscfg->BSS) +brcms_c_bss_update_probe_resp (wlc, bsscfg, suspend); }void
@@ -9105,12 +9055,7 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)/* init tx reported rate mechanism */ void brcms_c_reprate_init (struct brcms_c_info *wlc) { -int i; -struct brcms_bss_cfg *bsscfg; - - FOREACH_BSS(wlc, i, bsscfg) -brcms_c_bsscfg_reprate_init (bsscfg); - END_FOREACH_BSS() +brcms_c_bsscfg_reprate_init (wlc->bsscfg); }/* per bsscfg init tx reported rate mechanism */
drivers/staging/brcm80211/brcmsmac/main.h +1 -1
@@ -564,7 +564,7 @@ struct brcms_c_info {u16 tx_prec_map;u16 fifo2prec_map[NFIFO ]; -struct brcms_bss_cfg *bsscfg[BRCMS_MAXBSSCFG ]; +struct brcms_bss_cfg *bsscfg;struct brcms_bss_cfg *cfg;/* tx queue */
drivers/staging/brcm80211/brcmsmac/types.h +0 -5
@@ -244,11 +244,6 @@* ******************************************************************** */ -/* NetBSD also needs to keep track of this */ - -/* max # BSS configs */ -#define BRCMS_MAXBSSCFG (1) - #define BCMMSG(dev, fmt, args...) \ do { \ if (brcm_msg_level & LOG_TRACE_VAL) \
Signature · 1 line
1.7.1
PATCH v2 4/26 staging: brcm80211: removed redundant wlc->cfg struct member
In reply to Franky LinFrom: Roland Vossen <[email protected]>
After initialization ('attach'), this struct member always pointed at the same memory as wlc->bsscfg.
--- drivers/staging/brcm80211/brcmsmac/main.c | 47 ++++++++++++---------------- drivers/staging/brcm80211/brcmsmac/main.h | 1 - 2 files changed, 20 insertions(+), 28 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +20 -27
@@ -486,7 +486,7 @@ static void brcms_c_detach_mfree(struct brcms_c_info *wlc)if (wlc ==NULL )return ; -brcms_c_bsscfg_mfree (wlc->cfg); +brcms_c_bsscfg_mfree (wlc->bsscfg);kfree (wlc->pub);kfree (wlc->modulecb);kfree (wlc->default_bss);
@@ -577,8 +577,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) goto fail; } - wlc->cfg =brcms_c_bsscfg_malloc (unit); -if (wlc->cfg ==NULL ) { + wlc->bsscfg =brcms_c_bsscfg_malloc (unit); +if (wlc->bsscfg ==NULL ) { *err =1011 ; goto fail; }
@@ -3943,14 +3943,13 @@ void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)* Write this BSS config's MAC address to core. * Updates RXE match engine. */ -int brcms_c_set_mac (struct brcms_bss_cfg *cfg) +int brcms_c_set_mac (struct brcms_bss_cfg *bsscfg) {int err =0 ; -struct brcms_c_info *wlc = cfg->wlc; +struct brcms_c_info *wlc = bsscfg->wlc; -if (cfg == wlc->cfg) -/* enter the MAC addr into the RXE match registers */ -brcms_c_set_addrmatch (wlc,RCM_MAC_OFFSET , cfg->cur_etheraddr); +/* enter the MAC addr into the RXE match registers */ +brcms_c_set_addrmatch (wlc,RCM_MAC_OFFSET , bsscfg->cur_etheraddr);brcms_c_ampdu_macaddr_upd (wlc);
@@ -3960,13 +3959,10 @@ int brcms_c_set_mac(struct brcms_bss_cfg *cfg)/* Write the BSS config's BSSID address to core (set_bssid in d11procs.tcl). * Updates RXE match engine. */ -void brcms_c_set_bssid (struct brcms_bss_cfg *cfg) +void brcms_c_set_bssid (struct brcms_bss_cfg *bsscfg) { -struct brcms_c_info *wlc = cfg->wlc; - -/* if primary config, we need to update BSSID in RXE match registers */ -if (cfg == wlc->cfg) -brcms_c_set_addrmatch (wlc,RCM_BSSID_OFFSET , cfg->BSSID); +/* we need to update BSSID in RXE match registers */ +brcms_c_set_addrmatch (bsscfg->wlc,RCM_BSSID_OFFSET , bsscfg->BSSID); }static void brcms_b_set_shortslot (struct brcms_hardware *wlc_hw,bool shortslot)
@@ -5388,9 +5384,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, goto fail; } - wlc->bsscfg = wlc->cfg; - wlc->cfg->_idx =0 ; - wlc->cfg->wlc = wlc; + wlc->bsscfg->_idx =0 ; + wlc->bsscfg->wlc = wlc; wlc->mimoft =FT_HT ; wlc->ht_cap.cap_info =HT_CAP ;
@@ -6241,8 +6236,8 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)u8 r;bool war = false; -if (wlc->cfg->associated) - r = wlc->cfg->current_bss->rateset.rates[0 ]; +if (wlc->bsscfg->associated) + r = wlc->bsscfg->current_bss->rateset.rates[0 ];else r = wlc->default_bss->rateset.rates[0 ];
@@ -6311,7 +6306,7 @@ void brcms_c_get_current_rateset(struct brcms_c_info *wlc,struct brcms_c_rateset *rs;if (wlc->pub->associated) - rs = &wlc->cfg->current_bss->rateset; + rs = &wlc->bsscfg->current_bss->rateset;else rs = &wlc->default_bss->rateset;
@@ -6337,8 +6332,8 @@ int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs)/* merge rateset coming in with the current mcsset */ if (wlc->pub->_n_enab &SUPPORT_11N ) {struct brcms_bss_info *mcsset_bss; -if (wlc->cfg->associated) - mcsset_bss = wlc->cfg->current_bss; +if (wlc->bsscfg->associated) + mcsset_bss = wlc->bsscfg->current_bss;else mcsset_bss = wlc->default_bss; memcpy(internal_rs.mcs, &mcsset_bss->rateset.mcs[0],
@@ -8096,9 +8091,7 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,void brcms_c_tbtt (struct brcms_c_info *wlc) { -struct brcms_bss_cfg *cfg = wlc->cfg; - -if (!cfg->BSS) +if (!wlc->bsscfg->BSS)/* * DirFrmQ is now valid...defer setting until end * of ATIM window
@@ -9144,7 +9137,7 @@ brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset, {brcms_b_set_addrmatch (wlc->hw, match_reg_offset, addr);if (match_reg_offset ==RCM_BSSID_OFFSET ) -memcpy (wlc->cfg->BSSID, addr,ETH_ALEN ); +memcpy (wlc->bsscfg->BSSID, addr,ETH_ALEN ); }void brcms_c_pllreq (struct brcms_c_info *wlc,bool set,u32 req_bit)
@@ -9273,7 +9266,7 @@ void brcms_c_scan_stop(struct brcms_c_info *wlc)void brcms_c_associate_upd (struct brcms_c_info *wlc,bool state) { wlc->pub->associated = state; - wlc->cfg->associated = state; + wlc->bsscfg->associated = state; }/*
drivers/staging/brcm80211/brcmsmac/main.h +0 -1
@@ -565,7 +565,6 @@ struct brcms_c_info {u16 fifo2prec_map[NFIFO ];struct brcms_bss_cfg *bsscfg; -struct brcms_bss_cfg *cfg;/* tx queue */ struct brcms_txq_info *tx_queues;
Signature · 1 line
1.7.1
PATCH v2 6/26 staging: brcm80211: removed global vars in softmac ucode handling
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Moved global vars into a per-device structure.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 4 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 27 ++++-- drivers/staging/brcm80211/brcmsmac/ucode_loader.c | 121 ++++++++++----------- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 46 +++++---- 5 files changed, 106 insertions(+), 95 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -2
@@ -894,7 +894,7 @@ static int brcms_request_fw(struct brcms_info *wl, struct pci_dev *pdev) wl->fw.fw_hdr[i]->size / (sizeof (struct firmware_hdr )); } wl->fw.fw_cnt = i; -return brcms_ucode_data_init (wl); +return brcms_ucode_data_init (wl, &wl->ucode); }/*
@@ -925,7 +925,7 @@ static void brcms_free(struct brcms_info *wl)/* free ucode data */ if (wl->fw.fw_cnt) -brcms_ucode_data_free (); +brcms_ucode_data_free (&wl->ucode);if (wl->irq)free_irq (wl->irq, wl);
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +2 -1
@@ -19,7 +19,7 @@#include <linux/timer.h> #include <linux/interrupt.h> - +#include "ucode_loader.h" /* * Starting index for 5G rates in the * legacy rate table.
@@ -77,6 +77,7 @@ struct brcms_info {bool resched;/* dpc needs to be and is rescheduled */ struct brcms_firmware fw;struct wiphy *wiphy; +struct brcms_ucode ucode; };/* misc callbacks */
drivers/staging/brcm80211/brcmsmac/main.c +19 -8
@@ -342,6 +342,12 @@ static u16 frametype(u32 rspec, u8 mimoframe)/* Starting corerev for the fifo size table */ #define XMTFIFOTBL_STARTREV 20 +struct d11init { +u16 addr; +u16 size; +u32 value; +}; +/* currently the best mechanism for determining SIFS is the band in use */ static u16 get_sifs (struct brcms_band *band) {
@@ -349,6 +355,7 @@ static u16 get_sifs(struct brcms_band *band)BPHY_SIFS_TIME ; } +/* * Detect Card removed. * Even checking an sbconfig register read will not false trigger when the core
@@ -694,6 +701,7 @@ static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs)static void brcms_c_ucode_bsinit (struct brcms_hardware *wlc_hw) {struct wiphy *wiphy = wlc_hw->wlc->wiphy; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode;/* init microcode host flags */ brcms_c_write_mhf (wlc_hw, wlc_hw->band->mhfs);
@@ -701,7 +709,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)/* do band-specific ucode IHR, SHM, and SCR inits */ if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11n0bsinitvals16); +brcms_c_write_inits (wlc_hw, ucode->d11n0bsinitvals16);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" " %d\n", __func__, wlc_hw->unit,
@@ -710,7 +718,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band))brcms_c_write_inits (wlc_hw, - d11lcn0bsinitvals24); + ucode->d11lcn0bsinitvals24);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in" " core rev %d\n", __func__,
@@ -2457,6 +2465,8 @@ static void brcms_ucode_write(struct brcms_hardware *wlc_hw, const u32 ucode[],static void brcms_ucode_download (struct brcms_hardware *wlc_hw) {struct brcms_c_info *wlc; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; + wlc = wlc_hw->wlc;if (wlc_hw->ucode_loaded)
@@ -2464,8 +2474,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) { -brcms_ucode_write (wlc_hw, bcm43xx_16_mimo, - bcm43xx_16_mimosz); +brcms_ucode_write (wlc_hw, ucode->bcm43xx_16_mimo, + ucode->bcm43xx_16_mimosz); wlc_hw->ucode_loaded = true; }else wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -2473,8 +2483,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw) __func__, wlc_hw->unit, wlc_hw->corerev); }else if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band)) { -brcms_ucode_write (wlc_hw, bcm43xx_24_lcn, - bcm43xx_24_lcnsz); +brcms_ucode_write (wlc_hw, ucode->bcm43xx_24_lcn, + ucode->bcm43xx_24_lcnsz); wlc_hw->ucode_loaded = true; }else { wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -3372,6 +3382,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)int err =0 ;u16 buf[NFIFO ];struct wiphy *wiphy = wlc->wiphy; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; regs = wlc_hw->regs;
@@ -3404,14 +3415,14 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11n0initvals16); +brcms_c_write_inits (wlc_hw, ucode->d11n0initvals16);else wiphy_err (wiphy,"%s: wl%d: unsupported phy in corerev" " %d\n" , __func__, wlc_hw->unit, wlc_hw->corerev); }else if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11lcn0initvals24); +brcms_c_write_inits (wlc_hw, ucode->d11lcn0initvals24);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" " %d\n", __func__, wlc_hw->unit,
drivers/staging/brcm80211/brcmsmac/ucode_loader.c +57 -64
137 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/ucode_loader.h +26 -20
63 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 7/26 staging: brcm80211: removed unused softmac workaround
In reply to Franky LinFrom: Roland Vossen <[email protected]>
WAR16165 is only used on older PCI chips, the driver does not support these chips.
--- drivers/staging/brcm80211/brcmsmac/aiutils.c | 9 ------- drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 - drivers/staging/brcm80211/brcmsmac/d11.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 31 -------------------------- drivers/staging/brcm80211/brcmsmac/main.h | 5 ---- 5 files changed, 1 insertions(+), 49 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +0 -9
@@ -1852,15 +1852,6 @@ int ai_devpath(struct si_pub *sih, char *path, int size)return 0 ; } -bool ai_pci_war16165 (struct si_pub *sih) -{ -struct si_info *sii; - - sii = (struct si_info *)sih; - -return PCI (sii) && (sih->buscorerev <=10 ); -} -void ai_pci_up (struct si_pub *sih) {struct si_info *sii;
drivers/staging/brcm80211/brcmsmac/aiutils.h +0 -2
@@ -322,8 +322,6 @@ extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);extern struct si_pub *ai_attach (void *regs,struct pci_dev *sdh,char **vars,uint *varsz);extern void ai_detach (struct si_pub *sih); -extern bool ai_pci_war16165 (struct si_pub *sih); -extern uint ai_coreid (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih); extern uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
drivers/staging/brcm80211/brcmsmac/d11.h +1 -2
@@ -1330,8 +1330,7 @@ struct shm_acparams {#define MHF1_FORCEFASTCLK 0x0400/* Flags in M_HOST_FLAGS2 */ -/* PR16165WAR : Enable ucode PCI slow clock WAR */ -#define MHF2_PCISLOWCLKWAR 0x0008 +/* Flush BCMC FIFO immediately */ #define MHF2_TXBCMC_NOW 0x0040/* Enable ucode/hw power control */
drivers/staging/brcm80211/brcmsmac/main.c +0 -31
@@ -829,19 +829,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)return n >= bound_limit; } -static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) -{ -if (tx) { -/* the post-increment is used in STAY_AWAKE macro */ -if (wlc->txpend16165war++ ==0 ) -brcms_c_set_ps_ctrl (wlc); - }else { - wlc->txpend16165war--; -if (wlc->txpend16165war ==0 ) -brcms_c_set_ps_ctrl (wlc); - } -} -/* process an individual struct tx_status */ static bool brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs)
@@ -879,8 +866,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) } p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); -if (wlc->war16165) -brcms_c_war16165 (wlc, false);if (p ==NULL ) goto fatal;
@@ -3109,8 +3094,6 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc)struct brcms_hardware *wlc_hw = wlc->hw;uint i; - wlc->txpend16165war =0 ; -/* free any posted tx packets */ for (i =0 ; i <NFIFO ; i++)if (wlc_hw->di[i]) {
@@ -3532,9 +3515,6 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)AND_REG (®s->ifs_ctl,0x0FFF );W_REG (®s->ifs_aifsn,EDCF_AIFSN_MIN ); -/* dma initializations */ - wlc->txpend16165war =0 ; -/* init the tx dma engines */ for (i =0 ; i <NFIFO ; i++) {if (wlc_hw->di[i])
@@ -4832,9 +4812,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,if (wlc_hw->boardflags &BFL_NOPLLDOWN )brcms_b_pllreq (wlc_hw, true,BRCMS_PLLREQ_SHARED ); -if (ai_pci_war16165 (wlc_hw->sih)) - wlc->war16165 = true; -/* check device id(srom, nvram etc.) to set bands */ if (wlc_hw->deviceid ==BCM43224_D11N_ID || wlc_hw->deviceid ==BCM43224_D11N_ID_VEN1 )
@@ -5833,10 +5810,6 @@ int brcms_c_up(struct brcms_c_info *wlc)/* Set EDCF hostflags */ brcms_c_mhf (wlc,MHF1 ,MHF1_EDCF ,MHF1_EDCF ,BRCM_BAND_ALL ); -if (wlc->war16165) -brcms_c_mhf (wlc,MHF2 ,MHF2_PCISLOWCLKWAR ,MHF2_PCISLOWCLKWAR , -BRCM_BAND_ALL ); -brcms_init (wlc->wl); wlc->pub->up = true;
@@ -7816,10 +7789,6 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,if (fifo ==TX_BCMC_FIFO ) frameid =le16_to_cpu (txh->TxFrameID); -if (wlc->war16165) -brcms_c_war16165 (wlc, true); - -/* * Bump up pending count for if not using rpc. If rpc is * used, this will be handled in brcms_b_txfifo()
drivers/staging/brcm80211/brcmsmac/main.h +0 -5
@@ -416,8 +416,6 @@ struct brcms_txq_info {* 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. -* txpend16165war: PCI slow clock 16165 war flag. * qvalid: DirFrmQValid and BcMcFrmQValid. * ampdu: ampdu module handler. * asi: antsel module handler.
@@ -508,9 +506,6 @@ struct brcms_c_info {struct brcms_core *corestate;struct brcms_band *bandstate[MAXBANDS ]; -bool war16165; -uint txpend16165war; -/* packet queue */ uint qvalid;
Signature · 1 line
1.7.1
PATCH v2 11/26 staging: brcm80211: make device initializer table for wme constant
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
For chip initialisation of the wme parameters a table is used, but it was not marked as constant.
--- drivers/staging/brcm80211/brcmsmac/main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +2 -2
@@ -4297,7 +4297,7 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)int i_ac;struct ieee80211_tx_queue_params txq_pars;struct ieee80211_tx_queue_params *params = &txq_pars; -static struct edcf_acparam default_edcf_acparams[] = { +static const struct edcf_acparam default_edcf_acparams[] = { {EDCF_AC_BE_ACI_STA ,EDCF_AC_BE_ECW_STA ,cpu_to_le16 (EDCF_AC_BE_TXOP_STA )}, {EDCF_AC_BK_ACI_STA ,EDCF_AC_BK_ECW_STA ,
@@ -4307,7 +4307,7 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend) {EDCF_AC_VO_ACI_STA ,EDCF_AC_VO_ECW_STA , cpu_to_le16(EDCF_AC_VO_TXOP_STA)} };/* ucode needs these parameters during its initialization */ -struct edcf_acparam *edcf_acp = &default_edcf_acparams[0 ]; +const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0 ];for (i_ac =0 ; i_ac <AC_COUNT ; i_ac++, edcf_acp++) {/* find out which ac this set of params applies to */
Signature · 1 line
1.7.1
PATCH v2 13/26 staging: brcm80211: remove unnecessary mac80211 callbacks
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Several callback were implemented without executing any further function calls into the driver. Review feedback indicated that these could be removed.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 61 ---------------------- 1 files changed, 0 insertions(+), 61 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +0 -61
@@ -580,12 +580,6 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw,return ; } -static int -brcms_ops_set_tim (struct ieee80211_hw *hw,struct ieee80211_sta *sta,bool set) -{ -return 0 ; -} -static void brcms_ops_sw_scan_start (struct ieee80211_hw *hw) {struct brcms_info *wl = hw->priv;
@@ -604,42 +598,6 @@ static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw)return ; } -static void brcms_ops_set_tsf (struct ieee80211_hw *hw,u64 tsf) -{ -wiphy_err (hw->wiphy,"%s: Enter\n" , __func__); -return ; -} - -static int -brcms_ops_get_stats (struct ieee80211_hw *hw, -struct ieee80211_low_level_stats *stats) -{ -struct brcms_info *wl = hw->priv; -struct wl_cnt *cnt; - -LOCK (wl); - cnt = wl->pub->_cnt; - stats->dot11ACKFailureCount =0 ; - stats->dot11RTSFailureCount =0 ; - stats->dot11FCSErrorCount =0 ; - stats->dot11RTSSuccessCount =0 ; -UNLOCK (wl); -return 0 ; -} - -static void -brcms_ops_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum sta_notify_cmd cmd,struct ieee80211_sta *sta) -{ -switch (cmd) { -default : -wiphy_err (hw->wiphy,"%s: Unknown cmd = %d\n" , __func__, - cmd); -break ; - } -return ; -} -static int brcms_ops_conf_tx (struct ieee80211_hw *hw,u16 queue,const struct ieee80211_tx_queue_params *params)
@@ -653,12 +611,6 @@ brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,return 0 ; } -static u64 brcms_ops_get_tsf (struct ieee80211_hw *hw) -{ -wiphy_err (hw->wiphy,"%s: Enter\n" , __func__); -return 0 ; -} -static int brcms_ops_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta)
@@ -698,13 +650,6 @@ brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } static int -brcms_ops_sta_remove (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -return 0 ; -} - -static int brcms_ops_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action,
@@ -800,16 +745,10 @@ static const struct ieee80211_ops brcms_ops = { .config = brcms_ops_config, .bss_info_changed = brcms_ops_bss_info_changed, .configure_filter = brcms_ops_configure_filter, - .set_tim = brcms_ops_set_tim, .sw_scan_start = brcms_ops_sw_scan_start, .sw_scan_complete = brcms_ops_sw_scan_complete, - .set_tsf = brcms_ops_set_tsf, - .get_stats = brcms_ops_get_stats, - .sta_notify = brcms_ops_sta_notify, .conf_tx = brcms_ops_conf_tx, - .get_tsf = brcms_ops_get_tsf, .sta_add = brcms_ops_sta_add, - .sta_remove = brcms_ops_sta_remove, .ampdu_action = brcms_ops_ampdu_action, .rfkill_poll = brcms_ops_rfkill_poll, .flush = brcms_ops_flush,
Signature · 1 line
1.7.1
PATCH v2 17/26 staging: brcm80211: removed global variable in softmac otp
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Placed variable on the stack instead and deleted unused functions. Softmac was tested to function properly with multiple adapters in one system.
--- drivers/staging/brcm80211/brcmsmac/otp.c | 143 ++++-------------------------- drivers/staging/brcm80211/brcmsmac/otp.h | 8 -- 2 files changed, 18 insertions(+), 133 deletions(-)
drivers/staging/brcm80211/brcmsmac/otp.c +18 -125
@@ -67,15 +67,13 @@/* Fixed size subregions sizes in words */ #define OTPGU_CI_SZ 2 +struct otpinfo ; +/* OTP function struct */ struct otp_fn_s { -int (*size)(struct otpinfo *oi); -u16 (*read_bit)(struct otpinfo *oi,struct chipcregs *cc,uint off); -struct otpinfo *(*init)(struct si_pub *sih); +int (*init)(struct si_pub *sih,struct otpinfo *oi);int (*read_region)(struct otpinfo *oi,int region,u16 *data,uint *wlen); -int (*nvread)(struct otpinfo *oi,char *data,uint *len); -int (*status)(struct otpinfo *oi); };struct otpinfo {
@@ -99,21 +97,6 @@ struct otpinfo {int otpgu_base;/* offset to General Use Region */ }; -static struct otpinfo otpinfo; - -/* -* IPX OTP Code -* -* Exported functions: -* ipxotp_status() -* ipxotp_size() -* ipxotp_init() -* ipxotp_read_bit() -* ipxotp_read_region() -* ipxotp_nvread() -* -*/ -/* OTP layout */ /* CC revs 21, 24 and 27 OTP General Use Region word offset */ #define REVA4_OTPGU_BASE 12
@@ -149,51 +132,11 @@ static struct otpinfo otpinfo;#define OTP4315_SWREG_SZ 178/* 178 bytes */ #define OTP_SZ_FU_144 (144/8)/* 144 bits */ -static int ipxotp_status (struct otpinfo *oi) -{ -return (int )(oi->status); -} - -/* Return size in bytes */ -static int ipxotp_size (struct otpinfo *oi) -{ -return (int )oi->wsize *2 ; -} -static u16 ipxotp_otpr (struct otpinfo *oi,struct chipcregs *cc,uint wn) {return R_REG (&cc->sromotp[wn]); } -static u16 ipxotp_read_bit (struct otpinfo *oi,struct chipcregs *cc,uint off) -{ -uint k, row, col; -u32 otpp, st; - - row = off / oi->cols; - col = off % oi->cols; - - otpp =OTPP_START_BUSY | - ((OTPPOC_READ <<OTPP_OC_SHIFT ) &OTPP_OC_MASK ) | - ((row <<OTPP_ROW_SHIFT ) &OTPP_ROW_MASK ) | - ((col <<OTPP_COL_SHIFT ) &OTPP_COL_MASK ); -W_REG (&cc->otpprog, otpp); - -for (k =0 ; - ((st =R_REG (&cc->otpprog)) &OTPP_START_BUSY ) - && (k <OTPP_TRIES ); k++) - ; -if (k >=OTPP_TRIES ) -return 0xffff ; - -if (st &OTPP_READERR ) -return 0xffff ; - - st = (st &OTPP_VALUE_MASK ) >>OTPP_VALUE_SHIFT ; - -return (int )st; -} -/* * Calculate max HW/SW region byte size by subtracting fuse region * and checksum size, osizew is oi->wsize (OTP size - GU size) in words
@@ -294,28 +237,24 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc) oi->flim = oi->wsize; } -static struct otpinfo *ipxotp_init (struct si_pub *sih) +static int ipxotp_init (struct si_pub *sih,struct otpinfo *oi) {uint idx;struct chipcregs *cc; -struct otpinfo *oi;/* Make sure we're running IPX OTP */ if (!OTPTYPE_IPX (sih->ccrev)) -return NULL ; +return -EBADE ;/* Make sure OTP is not disabled */ if (ai_is_otp_disabled (sih)) -return NULL ; - -/* OTP is always powered */ - oi = &otpinfo; +return -EBADE ;/* Check for otp size */ switch ((sih->cccaps &CC_CAP_OTPSIZE ) >>CC_CAP_OTPSIZE_SHIFT ) {case 0 :/* Nothing there */ -return NULL ; +return -EBADE ;case 1 :/* 32x64 */ oi->rows =32 ; oi->cols =64 ;
@@ -338,7 +277,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)break ;default :/* Don't know the geometry */ -return NULL ; +return -EBADE ; }/* Retrieve OTP region info */
@@ -349,7 +288,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)ai_setcoreidx (sih, idx); -return oi; +return 0 ; } static int
@@ -437,56 +376,16 @@ ipxotp_read_region(struct otpinfo *oi, int region, u16 *data, uint *wlen)return 0 ; } -static int ipxotp_nvread (struct otpinfo *oi,char *data,uint *len) -{ -return -ENOTSUPP ; -} -static const struct otp_fn_s ipxotp_fn = { - (int (*)(struct otpinfo *)) ipxotp_size, - (u16 (*)(struct otpinfo *,struct chipcregs *,uint )) ipxotp_read_bit, - - (struct otpinfo *(*)(struct si_pub *)) ipxotp_init, + (int (*)(struct si_pub *,struct otpinfo *)) ipxotp_init, (int (*)(struct otpinfo *,int ,u16 *,uint *)) ipxotp_read_region, - (int (*)(struct otpinfo *,char *,uint *)) ipxotp_nvread, - - (int (*)(struct otpinfo *)) ipxotp_status }; -/* -* otp_status() -* otp_size() -* otp_read_bit() -* otp_init() -* otp_read_region() -* otp_nvread() -*/ - -int otp_status (struct otpinfo *oi) +static int otp_init (struct si_pub *sih,struct otpinfo *oi) { -return oi->fn->status (oi); -} - -int otp_size (struct otpinfo *oi) -{ -return oi->fn->size (oi); -} -u16 otp_read_bit (struct otpinfo *oi,uint offset) -{ -uint idx =ai_coreidx (oi->sih); -struct chipcregs *cc =ai_setcoreidx (oi->sih,SI_CC_IDX ); -u16 readBit = (u16 ) oi->fn->read_bit (oi, cc, offset); -ai_setcoreidx (oi->sih, idx); -return readBit; -} +int ret; -struct otpinfo *otp_init (struct si_pub *sih) -{ -struct otpinfo *oi; -struct otpinfo *ret =NULL ; - - oi = &otpinfo;memset (oi,0 ,sizeof (struct otpinfo )); oi->ccrev = sih->ccrev;
@@ -495,18 +394,19 @@ struct otpinfo *otp_init(struct si_pub *sih) oi->fn = &ipxotp_fn;if (oi->fn ==NULL ) -return NULL ; +return -EBADE ; oi->sih = sih; - ret = (oi->fn->init) (sih); + ret = (oi->fn->init) (sih, oi);return ret; }int otp_read_region (struct si_pub *sih,int region,u16 *data,uint *wlen) { -struct otpinfo *oi; +struct otpinfo otpinfo; +struct otpinfo *oi = &otpinfo;int err =0 ;if (ai_is_otp_disabled (sih)) {
@@ -514,19 +414,12 @@ otp_read_region(struct si_pub *sih, int region, u16 *data, uint *wlen) { goto out; } - oi =otp_init (sih); -if (oi ==NULL ) { - err = -EBADE ; + err =otp_init (sih, oi); +if (err) goto out; - } err = ((oi)->fn->read_region)(oi, region, data, wlen); out:return err; } - -int otp_nvread (struct otpinfo *oi,char *data,uint *len) -{ -return oi->fn->nvread (oi, data, len); -}
drivers/staging/brcm80211/brcmsmac/otp.h +0 -8
@@ -30,15 +30,7 @@/* OTP Size */ #define OTP_SZ_MAX (6144/8)/* maximum bytes in one CIS */ -struct otpinfo ; - -/* Exported functions */ -extern int otp_status (struct otpinfo *oi); -extern int otp_size (struct otpinfo *oi); -extern u16 otp_read_bit (struct otpinfo *oi,uint offset); -extern struct otpinfo *otp_init (struct si_pub *sih);extern int otp_read_region (struct si_pub *sih,int region,u16 *data,uint *wlen); -extern int otp_nvread (struct otpinfo *oi,char *data,uint *len);#endif /* _BRCM_OTP_H_ */
Signature · 1 line
1.7.1
PATCH v2 19/26 staging: brcm80211: change interface for common rssi compute function
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function wlc_phy_rssi_compute() now uses d11rxhdr struct as purely input parameter and returns the computed rssi value.
--- drivers/staging/brcm80211/brcmsmac/main.c | 4 +++- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 7 +++---- drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -1
@@ -806,15 +806,17 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)/* process each frame */ while ((p = head) !=NULL ) { +struct d11rxhdr *rxh; head = head->prev; p->prev =NULL ; wlc_rxhdr = (struct brcms_d11rxhdr *) p->data; + rxh = (struct d11rxhdr *)p->data;/* * compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ -wlc_phy_rssi_compute (wlc_hw->band->pi, wlc_rxhdr); + wlc_rxhdr->rssi =wlc_phy_rssi_compute (wlc_hw->band->pi, rxh);brcms_c_recv (wlc_hw->wlc, p); }
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +3 -4
@@ -2610,10 +2610,9 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core) } } -void wlc_phy_rssi_compute (struct brcms_phy_pub *pih, -struct brcms_d11rxhdr *wlc_rxhdr) +int wlc_phy_rssi_compute (struct brcms_phy_pub *pih, +struct d11rxhdr *rxh) { -struct d11rxhdr *rxh = &wlc_rxhdr->rxhdr;int rssi =le16_to_cpu (rxh->PhyRxStatus_1) &PRXS1_JSSI_MASK ;uint radioid = pih->radioid;struct brcms_phy *pi = (struct brcms_phy *) pih;
@@ -2650,7 +2649,7 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, } end: - wlc_rxhdr->rssi = (s8 ) rssi; +return rssi; }void wlc_phy_freqtrack_start (struct brcms_phy_pub *pih)
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +2 -2
@@ -212,8 +212,8 @@ extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi,extern u16 wlc_phy_bw_state_get (struct brcms_phy_pub *ppi);extern void wlc_phy_bw_state_set (struct brcms_phy_pub *ppi,u16 bw); -extern void wlc_phy_rssi_compute (struct brcms_phy_pub *pih, -struct brcms_d11rxhdr *wlc_rxhdr); +extern int wlc_phy_rssi_compute (struct brcms_phy_pub *pih, +struct d11rxhdr *rxh);extern void wlc_phy_por_inform (struct brcms_phy_pub *ppi);extern void wlc_phy_noise_sample_intr (struct brcms_phy_pub *ppi);extern bool wlc_phy_bist_check_phy (struct brcms_phy_pub *ppi);
Signature · 1 line
1.7.1
PATCH v2 22/26 staging: brcm80211: move rssi computation to place we need it
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The rssi computation was done upon getting the frame from the queue, but the value is needed when filling in the receive status data for mac80211. The call to wlc_phy_rssi_compute() has been deferred.
--- drivers/staging/brcm80211/brcmsmac/main.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -6
@@ -828,11 +828,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) rxh->RxTSFTime =le16_to_cpu (rxh_le->RxTSFTime); rxh->RxChan =le16_to_cpu (rxh_le->RxChan); -/* -* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr -*/ - wlc_rxhdr->rssi = (s8 )wlc_phy_rssi_compute (wlc_hw->band->pi, - rxh);brcms_c_recv (wlc_hw->wlc, p); }
@@ -8172,7 +8167,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, rx_status->freq =ieee80211_dsss_chan_to_freq (channel); } - rx_status->signal = wlc_rxh->rssi; + rx_status->signal =wlc_phy_rssi_compute (wlc->hw->band->pi, rxh);/* noise */ /* qual */
Signature · 1 line
1.7.1
Re: [PATCH v2 24/26] staging: brcm80211: declared global vars in softmac phy as const
In reply to Franky LinQuoted 21 lines · Franky Lin
From: Roland Vossen<[email protected]>
Global variables are undesirable unless they are read only.
Reported-by Johannes Berg<[email protected]>Reviewed-by Pieter-Paul Giesberts<[email protected]>Reviewed-by Arend van Spriel<[email protected]>Signed-off-by Franky Lin<[email protected]>--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 16 +----- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 23 -------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 ++++++++++---------- .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c | 2 +- 5 files changed, 36 insertions(+), 71 deletions(-)drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0
-0
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c struct chan_info_basic { · line 58
Quoted 8 lines
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1
-1@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; }; -static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },
What are you doing? You make this change here in patch 24, then undo it in #25, and redo it in #26! Are you guys actually thinking about what you are doing?
This needs to be fixed. In addition, the next time you submit this patch bomb, change from V2 to V3. That is the standard way to handle resubmissions that are addressing comments, not by increasing some extra counter in the 00/XX cover patch. The VX notation helps the maintainer keep track of the patches as he knows to drop all the V2 ones when V3 arrives. Maintainers are precious and must be treated very carefully.
Larry
Re: [PATCH v2 24/26] staging: brcm80211: declared global vars in softmac phy as const
Quoted 25 lines · Larry Finger
Quoted 24 lines · Franky Lin
From: Roland Vossen<[email protected]>
Global variables are undesirable unless they are read only.
Reported-by Johannes Berg<[email protected]>Reviewed-by Pieter-Paul Giesberts<[email protected]>Reviewed-by Arend van Spriel<[email protected]>Signed-off-by Franky Lin<[email protected]>--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 16 +----- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 23 -------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 ++++++++++---------- .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c | 2 +- 5 files changed, 36 insertions(+), 71 deletions(-)drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0
-0@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; };
Quoted 7 lines
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c struct chan_info_basic { · line 58
Quoted 5 lines
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1
-1-static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },What are you doing? You make this change here in patch 24, then undo it in #25, and redo it in #26! Are you guys actually thinking about what you are doing?
We reordered the patches a little to move the ones we got feedback about at the end for rework. My bet is that you see rebase at work although I agree this is pretty tricky. I am glad the net result is that the const qualifier is added. There was some thinking involved in what we did today ;-)
Quoted 6 lines
This needs to be fixed. In addition, the next time you submit this patch bomb, change from V2 to V3. That is the standard way to handle resubmissions that are addressing comments, not by increasing some extra counter in the 00/XX cover patch. The VX notation helps the maintainer keep track of the patches as he knows to drop all the V2 ones when V3 arrives. Maintainers are precious and must be treated very carefully.
And here we were thinking we would have learned all tricks about submitting patches in our staging year ;-)
So to be sure I have it right: Only the cover letter should say: [PATCH v2 00/20] with the same headline as the orignal. Or should each patch say [PATCH v2 xx/20] even when there are 26 patches?
Quoted 1 line
Larry
It would not have hurt if the cover letter of this series would indicate it replaces the previous series by refering to its message-id. Would that be an alternative approach or just a good addition.
Gr. AvS
Re: [PATCH v2 24/26] staging: brcm80211: declared global vars in softmac phy as const
Quoted 47 lines · Arend van Spriel
Quoted 26 lines · Larry Finger
Quoted 25 lines · Franky Lin
From: Roland Vossen<[email protected]>
Global variables are undesirable unless they are read only.
Reported-by Johannes Berg<[email protected]>Reviewed-by Pieter-Paul Giesberts<[email protected]>Reviewed-by Arend van Spriel<[email protected]>Signed-off-by Franky Lin<[email protected]>---
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 16 +----- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 23 -------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 ++++++++++---------- .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c | 2 +- 5 files changed, 36 insertions(+), 71 deletions(-)drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0
-0@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; };Quoted 7 lines
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c struct chan_info_basic { · line 58
Quoted 5 lines
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1
-1-static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },What are you doing? You make this change here in patch 24, then undo it in #25, and redo it in #26! Are you guys actually thinking about what you are doing?
We reordered the patches a little to move the ones we got feedback about at the end for rework. My bet is that you see rebase at work although I agree this is pretty tricky. I am glad the net result is that the const qualifier is added. There was some thinking involved in what we did today ;-)
Quoted 6 lines
This needs to be fixed. In addition, the next time you submit this patch bomb, change from V2 to V3. That is the standard way to handle resubmissions that are addressing comments, not by increasing some extra counter in the 00/XX cover patch. The VX notation helps the maintainer keep track of the patches as he knows to drop all the V2 ones when V3 arrives. Maintainers are precious and must be treated very carefully.
Quoted 6 lines
And here we were thinking we would have learned all tricks about submitting patches in our staging year ;-)
So to be sure I have it right: Only the cover letter should say: [PATCH v2 00/20] with the same headline as the orignal. Or should each patch say [PATCH v2 xx/20] even when there are 26 patches?
No, the number of patches should always be correct, but I would go to V2 even if there are a different number of patches in the series than there were with V1.
There are as many ways to do it as there are kernel hackers - perhaps more. The main thing is to make is absolutely clear to the maintainer and any possible reviewers what is happening. Make certain that the patch subject is unique and have the cover patch spell out what is happening in great detail. That material is never included with the git commit, so you can say anything.
It would be best if your brcmsmac and brcmfmac patches are clearly distinguished in the subject line. That was what tripped me. I saw V2 for soft mac and thought I had seen V2 already. I had, but it was for full mac.
Quoted 3 lines
It would not have hurt if the cover letter of this series would indicate it replaces the previous series by refering to its message-id. Would that be an alternative approach or just a good addition.
That would be a good addition, but I would still keep the other description as well.
Larry
PATCH v3 3/25 staging: brcm80211: deleted unused array of bss configurations in softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
List always had one element. Converted the array to a scalar.
--- drivers/staging/brcm80211/brcmsmac/main.c | 139 +++++++++------------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 +- drivers/staging/brcm80211/brcmsmac/types.h | 5 - 3 files changed, 43 insertions(+), 103 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +42 -97
@@ -342,15 +342,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)/* Starting corerev for the fifo size table */ #define XMTFIFOTBL_STARTREV 20 -/* iterate through all valid bsscfg entries */ -#define FOREACH_BSS (wlc, idx, cfg) \ - for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) { \ - cfg = (wlc)->bsscfg[idx]; \ - if (!cfg) \ - continue; -/* close marker for iterator code block */ -#define END_FOREACH_BSS () } -/* currently the best mechanism for determining SIFS is the band in use */ static u16 get_sifs (struct brcms_band *band) {
@@ -3278,8 +3269,7 @@ static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)*/ bool brcms_c_ps_allowed (struct brcms_c_info *wlc) { -int idx; -struct brcms_bss_cfg *cfg; +struct brcms_bss_cfg *cfg = wlc->bsscfg;/* disallow PS when one of the following global conditions meets */ if (!wlc->pub->associated)
@@ -3289,19 +3279,16 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)if (wlc->monitor)return false; -for (idx =0 ; idx <BRCMS_MAXBSSCFG ; idx++) { - cfg = wlc->bsscfg[idx]; -if (cfg && cfg->associated) { -/* -* disallow PS when one of the following -* bsscfg specific conditions meets -*/ -if (!cfg->BSS) -return false; +if (cfg->associated) { +/* +* disallow PS when one of the following +* bsscfg specific conditions meets +*/ +if (!cfg->BSS) +return false; -if (!cfg->dtim_programmed) -return false; - } +if (!cfg->dtim_programmed) +return false; }return true;
@@ -3779,8 +3766,6 @@ void brcms_c_init(struct brcms_c_info *wlc) {struct d11regs *regs;u16 chanspec; -int i; -struct brcms_bss_cfg *bsscfg;bool mute = false;BCMMSG (wlc->wiphy,"wl%d\n" , wlc->pub->unit);
@@ -3806,32 +3791,24 @@ void brcms_c_init(struct brcms_c_info *wlc)brcms_c_reprate_init (wlc);/* write ethernet address to core */ - FOREACH_BSS(wlc, i, bsscfg) -brcms_c_set_mac (bsscfg); -brcms_c_set_bssid (bsscfg); -END_FOREACH_BSS () +brcms_c_set_mac (wlc->bsscfg); +brcms_c_set_bssid (wlc->bsscfg);/* Update tsf_cfprep if associated and up */ -if (wlc->pub->associated) { - FOREACH_BSS(wlc, i, bsscfg) -if (bsscfg->up) { -u32 bi; +if (wlc->pub->associated && wlc->bsscfg->up) { +u32 bi; -/* get beacon period and convert to uS */ - bi = bsscfg->current_bss->beacon_period <<10 ; -/* -* update since init path would reset -* to default value -*/ -W_REG (®s->tsf_cfprep, - (bi <<CFPREP_CBI_SHIFT )); - -/* Update maccontrol PM related bits */ -brcms_c_set_ps_ctrl (wlc); +/* get beacon period and convert to uS */ + bi = wlc->bsscfg->current_bss->beacon_period <<10 ; +/* +* update since init path would reset +* to default value +*/ +W_REG (®s->tsf_cfprep, + (bi <<CFPREP_CBI_SHIFT )); -break ; - } - END_FOREACH_BSS() +/* Update maccontrol PM related bits */ +brcms_c_set_ps_ctrl (wlc); }brcms_c_bandinit_ordered (wlc, chanspec);
@@ -4021,26 +3998,13 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)brcms_b_set_shortslot (wlc->hw, shortslot); } -/* -* propagate home chanspec to all bsscfgs in -* case bsscfg->current_bss->chanspec is referenced -*/ void brcms_c_set_home_chanspec (struct brcms_c_info *wlc,u16 chanspec) {if (wlc->home_chanspec != chanspec) { -int idx; -struct brcms_bss_cfg *cfg; - wlc->home_chanspec = chanspec; - FOREACH_BSS(wlc, idx, cfg) -if (!cfg->associated) -continue ; - - cfg->current_bss->chanspec = chanspec; - END_FOREACH_BSS() - - +if (wlc->bsscfg->associated) + wlc->bsscfg->current_bss->chanspec = chanspec; } }
@@ -4092,8 +4056,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,static void brcms_c_setband (struct brcms_c_info *wlc,uint bandunit) { -int idx; -struct brcms_bss_cfg *cfg; +struct brcms_bss_cfg *cfg = wlc->bsscfg; wlc->band = wlc->bandstate[bandunit];
@@ -4101,11 +4064,9 @@ static void brcms_c_setband(struct brcms_c_info *wlc,return ;/* wait for at least one beacon before entering sleeping state */ -for (idx =0 ; idx <BRCMS_MAXBSSCFG ; idx++) { - cfg = wlc->bsscfg[idx]; -if (cfg && cfg->associated) - cfg->PMawakebcn = true; - } +if (cfg->associated) + cfg->PMawakebcn = true; +brcms_c_set_ps_ctrl (wlc);/* band-specific initializations */
@@ -5427,7 +5388,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, goto fail; } - wlc->bsscfg[0 ] = wlc->cfg; + wlc->bsscfg = wlc->cfg; wlc->cfg->_idx =0 ; wlc->cfg->wlc = wlc;
@@ -5840,19 +5801,15 @@ int brcms_c_up(struct brcms_c_info *wlc)if (status == -ENOMEDIUM ) {if (!mboolisset (wlc->pub->radio_disabled,WL_RADIO_HW_DISABLE )) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg;mboolset (wlc->pub->radio_disabled,WL_RADIO_HW_DISABLE ); - FOREACH_BSS(wlc, idx, bsscfg) -if (!bsscfg->enable || !bsscfg->BSS) -continue ; -wiphy_err (wlc->wiphy,"wl%d.%d: up" +if (bsscfg->enable && bsscfg->BSS) +wiphy_err (wlc->wiphy,"wl%d: up" ": rfdisable -> " "bsscfg_disable()\n" , - wlc->pub->unit, idx); - END_FOREACH_BSS() + wlc->pub->unit); } } }
@@ -8993,14 +8950,10 @@ void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,*/ void brcms_c_update_beacon (struct brcms_c_info *wlc) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg; -/* update AP or IBSS beacons */ - FOREACH_BSS(wlc, idx, bsscfg) -if (bsscfg->up && !bsscfg->BSS) -brcms_c_bss_update_beacon (wlc, bsscfg); - END_FOREACH_BSS() +if (bsscfg->up && !bsscfg->BSS) +brcms_c_bss_update_beacon (wlc, bsscfg); }/* Write ssid into shared memory */
@@ -9020,14 +8973,11 @@ void brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg)void brcms_c_update_probe_resp (struct brcms_c_info *wlc,bool suspend) { -int idx; -struct brcms_bss_cfg *bsscfg; +struct brcms_bss_cfg *bsscfg = wlc->bsscfg;/* update AP or IBSS probe responses */ - FOREACH_BSS(wlc, idx, bsscfg) -if (bsscfg->up && !bsscfg->BSS) -brcms_c_bss_update_probe_resp (wlc, bsscfg, suspend); - END_FOREACH_BSS() +if (bsscfg->up && !bsscfg->BSS) +brcms_c_bss_update_probe_resp (wlc, bsscfg, suspend); }void
@@ -9105,12 +9055,7 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)/* init tx reported rate mechanism */ void brcms_c_reprate_init (struct brcms_c_info *wlc) { -int i; -struct brcms_bss_cfg *bsscfg; - - FOREACH_BSS(wlc, i, bsscfg) -brcms_c_bsscfg_reprate_init (bsscfg); - END_FOREACH_BSS() +brcms_c_bsscfg_reprate_init (wlc->bsscfg); }/* per bsscfg init tx reported rate mechanism */
drivers/staging/brcm80211/brcmsmac/main.h +1 -1
@@ -564,7 +564,7 @@ struct brcms_c_info {u16 tx_prec_map;u16 fifo2prec_map[NFIFO ]; -struct brcms_bss_cfg *bsscfg[BRCMS_MAXBSSCFG ]; +struct brcms_bss_cfg *bsscfg;struct brcms_bss_cfg *cfg;/* tx queue */
drivers/staging/brcm80211/brcmsmac/types.h +0 -5
@@ -244,11 +244,6 @@* ******************************************************************** */ -/* NetBSD also needs to keep track of this */ - -/* max # BSS configs */ -#define BRCMS_MAXBSSCFG (1) - #define BCMMSG(dev, fmt, args...) \ do { \ if (brcm_msg_level & LOG_TRACE_VAL) \
Signature · 1 line
1.7.1
PATCH v3 4/25 staging: brcm80211: removed redundant wlc->cfg struct member
In reply to Franky LinFrom: Roland Vossen <[email protected]>
After initialization ('attach'), this struct member always pointed at the same memory as wlc->bsscfg.
--- drivers/staging/brcm80211/brcmsmac/main.c | 47 ++++++++++++---------------- drivers/staging/brcm80211/brcmsmac/main.h | 1 - 2 files changed, 20 insertions(+), 28 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +20 -27
@@ -486,7 +486,7 @@ static void brcms_c_detach_mfree(struct brcms_c_info *wlc)if (wlc ==NULL )return ; -brcms_c_bsscfg_mfree (wlc->cfg); +brcms_c_bsscfg_mfree (wlc->bsscfg);kfree (wlc->pub);kfree (wlc->modulecb);kfree (wlc->default_bss);
@@ -577,8 +577,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) goto fail; } - wlc->cfg =brcms_c_bsscfg_malloc (unit); -if (wlc->cfg ==NULL ) { + wlc->bsscfg =brcms_c_bsscfg_malloc (unit); +if (wlc->bsscfg ==NULL ) { *err =1011 ; goto fail; }
@@ -3943,14 +3943,13 @@ void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)* Write this BSS config's MAC address to core. * Updates RXE match engine. */ -int brcms_c_set_mac (struct brcms_bss_cfg *cfg) +int brcms_c_set_mac (struct brcms_bss_cfg *bsscfg) {int err =0 ; -struct brcms_c_info *wlc = cfg->wlc; +struct brcms_c_info *wlc = bsscfg->wlc; -if (cfg == wlc->cfg) -/* enter the MAC addr into the RXE match registers */ -brcms_c_set_addrmatch (wlc,RCM_MAC_OFFSET , cfg->cur_etheraddr); +/* enter the MAC addr into the RXE match registers */ +brcms_c_set_addrmatch (wlc,RCM_MAC_OFFSET , bsscfg->cur_etheraddr);brcms_c_ampdu_macaddr_upd (wlc);
@@ -3960,13 +3959,10 @@ int brcms_c_set_mac(struct brcms_bss_cfg *cfg)/* Write the BSS config's BSSID address to core (set_bssid in d11procs.tcl). * Updates RXE match engine. */ -void brcms_c_set_bssid (struct brcms_bss_cfg *cfg) +void brcms_c_set_bssid (struct brcms_bss_cfg *bsscfg) { -struct brcms_c_info *wlc = cfg->wlc; - -/* if primary config, we need to update BSSID in RXE match registers */ -if (cfg == wlc->cfg) -brcms_c_set_addrmatch (wlc,RCM_BSSID_OFFSET , cfg->BSSID); +/* we need to update BSSID in RXE match registers */ +brcms_c_set_addrmatch (bsscfg->wlc,RCM_BSSID_OFFSET , bsscfg->BSSID); }static void brcms_b_set_shortslot (struct brcms_hardware *wlc_hw,bool shortslot)
@@ -5388,9 +5384,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, goto fail; } - wlc->bsscfg = wlc->cfg; - wlc->cfg->_idx =0 ; - wlc->cfg->wlc = wlc; + wlc->bsscfg->_idx =0 ; + wlc->bsscfg->wlc = wlc; wlc->mimoft =FT_HT ; wlc->ht_cap.cap_info =HT_CAP ;
@@ -6241,8 +6236,8 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)u8 r;bool war = false; -if (wlc->cfg->associated) - r = wlc->cfg->current_bss->rateset.rates[0 ]; +if (wlc->bsscfg->associated) + r = wlc->bsscfg->current_bss->rateset.rates[0 ];else r = wlc->default_bss->rateset.rates[0 ];
@@ -6311,7 +6306,7 @@ void brcms_c_get_current_rateset(struct brcms_c_info *wlc,struct brcms_c_rateset *rs;if (wlc->pub->associated) - rs = &wlc->cfg->current_bss->rateset; + rs = &wlc->bsscfg->current_bss->rateset;else rs = &wlc->default_bss->rateset;
@@ -6337,8 +6332,8 @@ int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs)/* merge rateset coming in with the current mcsset */ if (wlc->pub->_n_enab &SUPPORT_11N ) {struct brcms_bss_info *mcsset_bss; -if (wlc->cfg->associated) - mcsset_bss = wlc->cfg->current_bss; +if (wlc->bsscfg->associated) + mcsset_bss = wlc->bsscfg->current_bss;else mcsset_bss = wlc->default_bss; memcpy(internal_rs.mcs, &mcsset_bss->rateset.mcs[0],
@@ -8096,9 +8091,7 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,void brcms_c_tbtt (struct brcms_c_info *wlc) { -struct brcms_bss_cfg *cfg = wlc->cfg; - -if (!cfg->BSS) +if (!wlc->bsscfg->BSS)/* * DirFrmQ is now valid...defer setting until end * of ATIM window
@@ -9144,7 +9137,7 @@ brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset, {brcms_b_set_addrmatch (wlc->hw, match_reg_offset, addr);if (match_reg_offset ==RCM_BSSID_OFFSET ) -memcpy (wlc->cfg->BSSID, addr,ETH_ALEN ); +memcpy (wlc->bsscfg->BSSID, addr,ETH_ALEN ); }void brcms_c_pllreq (struct brcms_c_info *wlc,bool set,u32 req_bit)
@@ -9273,7 +9266,7 @@ void brcms_c_scan_stop(struct brcms_c_info *wlc)void brcms_c_associate_upd (struct brcms_c_info *wlc,bool state) { wlc->pub->associated = state; - wlc->cfg->associated = state; + wlc->bsscfg->associated = state; }/*
drivers/staging/brcm80211/brcmsmac/main.h +0 -1
@@ -565,7 +565,6 @@ struct brcms_c_info {u16 fifo2prec_map[NFIFO ];struct brcms_bss_cfg *bsscfg; -struct brcms_bss_cfg *cfg;/* tx queue */ struct brcms_txq_info *tx_queues;
Signature · 1 line
1.7.1
PATCH v3 7/25 staging: brcm80211: removed unused softmac workaround
In reply to Franky LinFrom: Roland Vossen <[email protected]>
WAR16165 is only used on older PCI chips, the driver does not support these chips.
--- drivers/staging/brcm80211/brcmsmac/aiutils.c | 9 ------- drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 - drivers/staging/brcm80211/brcmsmac/d11.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 31 -------------------------- drivers/staging/brcm80211/brcmsmac/main.h | 5 ---- 5 files changed, 1 insertions(+), 49 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +0 -9
@@ -1852,15 +1852,6 @@ int ai_devpath(struct si_pub *sih, char *path, int size)return 0 ; } -bool ai_pci_war16165 (struct si_pub *sih) -{ -struct si_info *sii; - - sii = (struct si_info *)sih; - -return PCI (sii) && (sih->buscorerev <=10 ); -} -void ai_pci_up (struct si_pub *sih) {struct si_info *sii;
drivers/staging/brcm80211/brcmsmac/aiutils.h +0 -2
@@ -322,8 +322,6 @@ extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);extern struct si_pub *ai_attach (void *regs,struct pci_dev *sdh,char **vars,uint *varsz);extern void ai_detach (struct si_pub *sih); -extern bool ai_pci_war16165 (struct si_pub *sih); -extern uint ai_coreid (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih); extern uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
drivers/staging/brcm80211/brcmsmac/d11.h +1 -2
@@ -1330,8 +1330,7 @@ struct shm_acparams {#define MHF1_FORCEFASTCLK 0x0400/* Flags in M_HOST_FLAGS2 */ -/* PR16165WAR : Enable ucode PCI slow clock WAR */ -#define MHF2_PCISLOWCLKWAR 0x0008 +/* Flush BCMC FIFO immediately */ #define MHF2_TXBCMC_NOW 0x0040/* Enable ucode/hw power control */
drivers/staging/brcm80211/brcmsmac/main.c +0 -31
@@ -829,19 +829,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)return n >= bound_limit; } -static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) -{ -if (tx) { -/* the post-increment is used in STAY_AWAKE macro */ -if (wlc->txpend16165war++ ==0 ) -brcms_c_set_ps_ctrl (wlc); - }else { - wlc->txpend16165war--; -if (wlc->txpend16165war ==0 ) -brcms_c_set_ps_ctrl (wlc); - } -} -/* process an individual struct tx_status */ static bool brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs)
@@ -879,8 +866,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) } p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); -if (wlc->war16165) -brcms_c_war16165 (wlc, false);if (p ==NULL ) goto fatal;
@@ -3109,8 +3094,6 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc)struct brcms_hardware *wlc_hw = wlc->hw;uint i; - wlc->txpend16165war =0 ; -/* free any posted tx packets */ for (i =0 ; i <NFIFO ; i++)if (wlc_hw->di[i]) {
@@ -3532,9 +3515,6 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)AND_REG (®s->ifs_ctl,0x0FFF );W_REG (®s->ifs_aifsn,EDCF_AIFSN_MIN ); -/* dma initializations */ - wlc->txpend16165war =0 ; -/* init the tx dma engines */ for (i =0 ; i <NFIFO ; i++) {if (wlc_hw->di[i])
@@ -4832,9 +4812,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,if (wlc_hw->boardflags &BFL_NOPLLDOWN )brcms_b_pllreq (wlc_hw, true,BRCMS_PLLREQ_SHARED ); -if (ai_pci_war16165 (wlc_hw->sih)) - wlc->war16165 = true; -/* check device id(srom, nvram etc.) to set bands */ if (wlc_hw->deviceid ==BCM43224_D11N_ID || wlc_hw->deviceid ==BCM43224_D11N_ID_VEN1 )
@@ -5833,10 +5810,6 @@ int brcms_c_up(struct brcms_c_info *wlc)/* Set EDCF hostflags */ brcms_c_mhf (wlc,MHF1 ,MHF1_EDCF ,MHF1_EDCF ,BRCM_BAND_ALL ); -if (wlc->war16165) -brcms_c_mhf (wlc,MHF2 ,MHF2_PCISLOWCLKWAR ,MHF2_PCISLOWCLKWAR , -BRCM_BAND_ALL ); -brcms_init (wlc->wl); wlc->pub->up = true;
@@ -7816,10 +7789,6 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,if (fifo ==TX_BCMC_FIFO ) frameid =le16_to_cpu (txh->TxFrameID); -if (wlc->war16165) -brcms_c_war16165 (wlc, true); - -/* * Bump up pending count for if not using rpc. If rpc is * used, this will be handled in brcms_b_txfifo()
drivers/staging/brcm80211/brcmsmac/main.h +0 -5
@@ -416,8 +416,6 @@ struct brcms_txq_info {* 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. -* txpend16165war: PCI slow clock 16165 war flag. * qvalid: DirFrmQValid and BcMcFrmQValid. * ampdu: ampdu module handler. * asi: antsel module handler.
@@ -508,9 +506,6 @@ struct brcms_c_info {struct brcms_core *corestate;struct brcms_band *bandstate[MAXBANDS ]; -bool war16165; -uint txpend16165war; -/* packet queue */ uint qvalid;
Signature · 1 line
1.7.1
PATCH v3 13/25 staging: brcm80211: remove unnecessary mac80211 callbacks
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Several callback were implemented without executing any further function calls into the driver. Review feedback indicated that these could be removed.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 61 ---------------------- 1 files changed, 0 insertions(+), 61 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +0 -61
@@ -580,12 +580,6 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw,return ; } -static int -brcms_ops_set_tim (struct ieee80211_hw *hw,struct ieee80211_sta *sta,bool set) -{ -return 0 ; -} -static void brcms_ops_sw_scan_start (struct ieee80211_hw *hw) {struct brcms_info *wl = hw->priv;
@@ -604,42 +598,6 @@ static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw)return ; } -static void brcms_ops_set_tsf (struct ieee80211_hw *hw,u64 tsf) -{ -wiphy_err (hw->wiphy,"%s: Enter\n" , __func__); -return ; -} - -static int -brcms_ops_get_stats (struct ieee80211_hw *hw, -struct ieee80211_low_level_stats *stats) -{ -struct brcms_info *wl = hw->priv; -struct wl_cnt *cnt; - -LOCK (wl); - cnt = wl->pub->_cnt; - stats->dot11ACKFailureCount =0 ; - stats->dot11RTSFailureCount =0 ; - stats->dot11FCSErrorCount =0 ; - stats->dot11RTSSuccessCount =0 ; -UNLOCK (wl); -return 0 ; -} - -static void -brcms_ops_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum sta_notify_cmd cmd,struct ieee80211_sta *sta) -{ -switch (cmd) { -default : -wiphy_err (hw->wiphy,"%s: Unknown cmd = %d\n" , __func__, - cmd); -break ; - } -return ; -} -static int brcms_ops_conf_tx (struct ieee80211_hw *hw,u16 queue,const struct ieee80211_tx_queue_params *params)
@@ -653,12 +611,6 @@ brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,return 0 ; } -static u64 brcms_ops_get_tsf (struct ieee80211_hw *hw) -{ -wiphy_err (hw->wiphy,"%s: Enter\n" , __func__); -return 0 ; -} -static int brcms_ops_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta)
@@ -698,13 +650,6 @@ brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } static int -brcms_ops_sta_remove (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -return 0 ; -} - -static int brcms_ops_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action,
@@ -800,16 +745,10 @@ static const struct ieee80211_ops brcms_ops = { .config = brcms_ops_config, .bss_info_changed = brcms_ops_bss_info_changed, .configure_filter = brcms_ops_configure_filter, - .set_tim = brcms_ops_set_tim, .sw_scan_start = brcms_ops_sw_scan_start, .sw_scan_complete = brcms_ops_sw_scan_complete, - .set_tsf = brcms_ops_set_tsf, - .get_stats = brcms_ops_get_stats, - .sta_notify = brcms_ops_sta_notify, .conf_tx = brcms_ops_conf_tx, - .get_tsf = brcms_ops_get_tsf, .sta_add = brcms_ops_sta_add, - .sta_remove = brcms_ops_sta_remove, .ampdu_action = brcms_ops_ampdu_action, .rfkill_poll = brcms_ops_rfkill_poll, .flush = brcms_ops_flush,
Signature · 1 line
1.7.1
PATCH v3 20/25 staging: brcm80211: convert endianess before handling the frame
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The received frame from the device is in little-endian order and converted in the receive path. However, the phy code was doing the rssi calculation with packet in LE order. This has been changed to do the le_to_cpu conversion before doing the rssi computation and further receive processing.
--- drivers/staging/brcm80211/brcmsmac/main.c | 27 ++++++++++----------- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 6 ++-- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 8 +++--- 3 files changed, 20 insertions(+), 21 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +13 -14
@@ -813,11 +813,23 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) wlc_rxhdr = (struct brcms_d11rxhdr *) p->data; rxh = (struct d11rxhdr *)p->data; +/* fixup rx header endianness */ + rxh->RxFrameSize =le16_to_cpu (rxh->RxFrameSize); + rxh->PhyRxStatus_0 =le16_to_cpu (rxh->PhyRxStatus_0); + rxh->PhyRxStatus_1 =le16_to_cpu (rxh->PhyRxStatus_1); + rxh->PhyRxStatus_2 =le16_to_cpu (rxh->PhyRxStatus_2); + rxh->PhyRxStatus_3 =le16_to_cpu (rxh->PhyRxStatus_3); + rxh->PhyRxStatus_4 =le16_to_cpu (rxh->PhyRxStatus_4); + rxh->PhyRxStatus_5 =le16_to_cpu (rxh->PhyRxStatus_5); + rxh->RxStatus1 =le16_to_cpu (rxh->RxStatus1); + rxh->RxStatus2 =le16_to_cpu (rxh->RxStatus2); + rxh->RxTSFTime =le16_to_cpu (rxh->RxTSFTime); + rxh->RxChan =le16_to_cpu (rxh->RxChan); +/* * compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ wlc_rxhdr->rssi =wlc_phy_rssi_compute (wlc_hw->band->pi, rxh); -brcms_c_recv (wlc_hw->wlc, p); }
@@ -8289,19 +8301,6 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)/* strip off rxhdr */ skb_pull (p,BRCMS_HWRXOFF ); -/* fixup rx header endianness */ - rxh->RxFrameSize =le16_to_cpu (rxh->RxFrameSize); - rxh->PhyRxStatus_0 =le16_to_cpu (rxh->PhyRxStatus_0); - rxh->PhyRxStatus_1 =le16_to_cpu (rxh->PhyRxStatus_1); - rxh->PhyRxStatus_2 =le16_to_cpu (rxh->PhyRxStatus_2); - rxh->PhyRxStatus_3 =le16_to_cpu (rxh->PhyRxStatus_3); - rxh->PhyRxStatus_4 =le16_to_cpu (rxh->PhyRxStatus_4); - rxh->PhyRxStatus_5 =le16_to_cpu (rxh->PhyRxStatus_5); - rxh->RxStatus1 =le16_to_cpu (rxh->RxStatus1); - rxh->RxStatus2 =le16_to_cpu (rxh->RxStatus2); - rxh->RxTSFTime =le16_to_cpu (rxh->RxTSFTime); - rxh->RxChan =le16_to_cpu (rxh->RxChan); -/* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ if (rxh->RxStatus1 &RXS_PBPRES ) {if (p->len <2 ) {
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +3 -3
@@ -2613,18 +2613,18 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)int wlc_phy_rssi_compute (struct brcms_phy_pub *pih,struct d11rxhdr *rxh) { -int rssi =le16_to_cpu (rxh->PhyRxStatus_1) &PRXS1_JSSI_MASK ; +int rssi = rxh->PhyRxStatus_1 &PRXS1_JSSI_MASK ;uint radioid = pih->radioid;struct brcms_phy *pi = (struct brcms_phy *) pih;if ((pi->sh->corerev >=11 ) - && !(le16_to_cpu (rxh->RxStatus2) &RXS_PHYRXST_VALID )) { + && !(rxh->RxStatus2 &RXS_PHYRXST_VALID )) { rssi =BRCMS_RSSI_INVALID ; goto end; }if (ISLCNPHY (pi)) { -u8 gidx = (le16_to_cpu (rxh->PhyRxStatus_2) &0xFC00 ) >>10 ; +u8 gidx = (rxh->PhyRxStatus_2 &0xFC00 ) >>10 ;struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;if (rssi >127 )
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +4 -4
@@ -23115,16 +23115,16 @@ wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh)s16 phyRx0_l, phyRx2_l; rxpwr =0 ; - rxpwr0 =le16_to_cpu (rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK; - rxpwr1 = (le16_to_cpu (rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >>8 ; + rxpwr0 = rxh->PhyRxStatus_1 & PRXS1_nphy_PWR0_MASK; + rxpwr1 = (rxh->PhyRxStatus_1 & PRXS1_nphy_PWR1_MASK) >>8 ;if (rxpwr0 >127 ) rxpwr0 -=256 ;if (rxpwr1 >127 ) rxpwr1 -=256 ; - phyRx0_l =le16_to_cpu (rxh->PhyRxStatus_0) &0x00ff ; - phyRx2_l =le16_to_cpu (rxh->PhyRxStatus_2) &0x00ff ; + phyRx0_l = rxh->PhyRxStatus_0 &0x00ff ; + phyRx2_l = rxh->PhyRxStatus_2 &0x00ff ;if (phyRx2_l >127 ) phyRx2_l -=256 ;
Signature · 1 line
1.7.1
v3 cover staging: brcm80211: 8th reaction for mainline patch #2
In reply to Franky LinCode clean up for softmac.
This patch series is in order to replace the following one:
Message-ID: <[email protected]>
V2:
* Rework some patches based on the comments from community V3:
* Fix patch misorder of V2
Arend van Spriel (13):
staging: brcm80211: remove uncoditional code blocks from brcmsmac
staging: brcm80211: remove ht_cap field from brcms_c_info structure
staging: brcm80211: use fragment number provided in transmit frame
staging: brcm80211: remove unused function si_pmu_ilp_clock()
staging: brcm80211: make device initializer table for wme constant
staging: brcm80211: remove dongle firmware related debug code
staging: brcm80211: remove unnecessary mac80211 callbacks
staging: brcm80211: changing interface to n-phy rssi compute function
staging: brcm80211: change interface for common rssi compute function
staging: brcm80211: convert endianess before handling the frame
staging: brcm80211: use endian annotated structures in brcmsmac
staging: brcm80211: move rssi computation to place we need it
staging: brcm80211: use d11rxhdr structure in brcms_c_recover_tsf64()
Roland Vossen (12):
staging: brcm80211: removed unused argument from softmac functions
staging: brcm80211: deleted unused array of bss configurations in
softmac
staging: brcm80211: removed redundant wlc->cfg struct member
staging: brcm80211: removed global var from aiutils.c
staging: brcm80211: removed global vars in softmac ucode handling
staging: brcm80211: removed unused softmac workaround
staging: brcm80211: removed band related global vars from softmac
staging: brcm80211: removed global var global_scb from softmac
staging: brcm80211: various global var related changes in softmac
staging: brcm80211: removed global variable in softmac otp
staging: brcm80211: simple changes to softmac phy variables
staging: brcm80211: declared global vars in softmac phy as const
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 259 +------- drivers/staging/brcm80211/brcmsmac/Makefile | 3 +- drivers/staging/brcm80211/brcmsmac/aiutils.c | 15 +- drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 - drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +- drivers/staging/brcm80211/brcmsmac/d11.h | 91 ++-- drivers/staging/brcm80211/brcmsmac/dma.c | 41 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 125 +--- drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 747 +++++++++------------ drivers/staging/brcm80211/brcmsmac/main.h | 19 +- drivers/staging/brcm80211/brcmsmac/otp.c | 147 +---- drivers/staging/brcm80211/brcmsmac/otp.h | 8 - drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 62 +-- drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 25 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 112 ++-- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 75 +-- drivers/staging/brcm80211/brcmsmac/pmu.c | 22 - drivers/staging/brcm80211/brcmsmac/pmu.h | 1 - drivers/staging/brcm80211/brcmsmac/pub.h | 1 - drivers/staging/brcm80211/brcmsmac/rate.h | 1 - drivers/staging/brcm80211/brcmsmac/srom.c | 19 +- drivers/staging/brcm80211/brcmsmac/stf.c | 9 - drivers/staging/brcm80211/brcmsmac/types.h | 6 - drivers/staging/brcm80211/brcmsmac/ucode_loader.c | 121 ++-- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 46 +- 27 files changed, 648 insertions(+), 1322 deletions(-)
PATCH v3 1/25 staging: brcm80211: remove uncoditional code blocks from brcmsmac
From: Arend van Spriel <[email protected]>
Using a block statement to scope function variables is not common in linux kernel development. Browsed through the brcmsmac to remove those.
--- drivers/staging/brcm80211/brcmsmac/main.c | 9 +-- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 31 +++---- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 106 ++++++++++------------ 3 files changed, 63 insertions(+), 83 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -6
@@ -5076,7 +5076,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, {struct brcms_c_info *wlc;uint err =0 ; -uint j; +uint i, j;struct brcms_pub *pub;uint n_disabled;
@@ -5149,11 +5149,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, wlc->stf->hw_rxchain);/* pull up some info resulting from the low attach */ - { -int i; -for (i =0 ; i <NFIFO ; i++) - wlc->core->txavail[i] = wlc->hw->txavail[i]; - } +for (i =0 ; i <NFIFO ; i++) + wlc->core->txavail[i] = wlc->hw->txavail[i];brcms_b_hw_etheraddr (wlc->hw, wlc->perm_etheraddr);
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +11 -20
@@ -1199,12 +1199,7 @@ static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi)void wlc_phy_switch_radio (struct brcms_phy_pub *pih,bool on) {struct brcms_phy *pi = (struct brcms_phy *) pih; - - { -uint mc; - - mc =R_REG (&pi->regs->maccontrol); - } + (void )R_REG (&pi->regs->maccontrol);if (ISNPHY (pi)) {wlc_phy_switch_radio_nphy (pi, on);
@@ -1696,26 +1691,22 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi) band, rate); - { - -wlc_phy_txpower_sromlimit ((struct brcms_phy_pub *) pi, - target_chan, - &mintxpwr, &maxtxpwr, rate); +wlc_phy_txpower_sromlimit ((struct brcms_phy_pub *) pi, + target_chan, + &mintxpwr, &maxtxpwr, rate); - maxtxpwr =min (maxtxpwr, pi->txpwr_limit[rate]); + maxtxpwr =min (maxtxpwr, pi->txpwr_limit[rate]); - maxtxpwr = - (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) :0 ; + maxtxpwr = (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) :0 ; - maxtxpwr = (maxtxpwr >6 ) ? (maxtxpwr -6 ) :0 ; + maxtxpwr = (maxtxpwr >6 ) ? (maxtxpwr -6 ) :0 ; - maxtxpwr =min (maxtxpwr, tx_pwr_target[rate]); + maxtxpwr =min (maxtxpwr, tx_pwr_target[rate]); -if (pi->txpwr_percent <=100 ) - maxtxpwr = (maxtxpwr * pi->txpwr_percent) /100 ; +if (pi->txpwr_percent <=100 ) + maxtxpwr = (maxtxpwr * pi->txpwr_percent) /100 ; - tx_pwr_target[rate] =max (maxtxpwr, mintxpwr); - } + tx_pwr_target[rate] =max (maxtxpwr, mintxpwr); tx_pwr_target[rate] =min (tx_pwr_target[rate], pi->txpwr_env_limit[rate]);
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +49 -57
153 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 2/25 staging: brcm80211: removed unused argument from softmac functions
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Parameter 's2' was unused. Affected function was only used internally to main.c and has been made static and moved above its callers.
--- drivers/staging/brcm80211/brcmsmac/main.c | 380 ++++++++++++++--------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 - 2 files changed, 188 insertions(+), 194 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +188 -192
@@ -830,9 +830,193 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)return n >= bound_limit; } +static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) +{ +if (tx) { +/* the post-increment is used in STAY_AWAKE macro */ +if (wlc->txpend16165war++ ==0 ) +brcms_c_set_ps_ctrl (wlc); + }else { + wlc->txpend16165war--; +if (wlc->txpend16165war ==0 ) +brcms_c_set_ps_ctrl (wlc); + } +} + +/* process an individual struct tx_status */ static bool -brcms_b_dotxstatus (struct brcms_hardware *wlc_hw,struct tx_status *txs, -u32 s2) +brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs) +{ +struct sk_buff *p; +uint queue; +struct d11txh *txh; +struct scb *scb =NULL ; +bool free_pdu; +int tx_rts, tx_frame_count, tx_rts_count; +uint totlen, supr_status; +bool lastframe; +struct ieee80211_hdr *h; +u16 mcl; +struct ieee80211_tx_info *tx_info; +struct ieee80211_tx_rate *txrate; +int i; + +/* discard intermediate indications for ucode with one legitimate case: +* e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, +* but the subsequent tx of DATA failed. so it will start rts/cts +* from the beginning (resetting the rts transmission count) +*/ +if (!(txs->status &TX_STATUS_AMPDU ) + && (txs->status &TX_STATUS_INTERMEDIATE )) { +wiphy_err (wlc->wiphy,"%s: INTERMEDIATE but not AMPDU\n" , + __func__); +return false; + } + + queue = txs->frameid &TXFID_QUEUE_MASK ; +if (queue >=NFIFO ) { + p =NULL ; + goto fatal; + } + + p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); +if (wlc->war16165) +brcms_c_war16165 (wlc, false); +if (p ==NULL ) + goto fatal; + + txh = (struct d11txh *) (p->data); + mcl =le16_to_cpu (txh->MacTxControlLow); + +if (txs->phyerr) { +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); + } +brcms_c_print_txstatus (txs); + } + +if (txs->frameid !=cpu_to_le16 (txh->TxFrameID)) + goto fatal; + tx_info =IEEE80211_SKB_CB (p); + h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN ); + +if (tx_info->control.sta) + scb = (struct scb *)tx_info->control.sta->drv_priv; + +if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { +brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs); +return false; + } + + supr_status = txs->status &TX_STATUS_SUPR_MASK ; +if (supr_status ==TX_STATUS_SUPR_BADCH ) +BCMMSG (wlc->wiphy, +"%s: Pkt tx suppressed, possibly channel %d\n" , + __func__,CHSPEC_CHANNEL (wlc->default_bss->chanspec)); + + tx_rts =cpu_to_le16 (txh->MacTxControlLow) &TXC_SENDRTS ; + tx_frame_count = + (txs->status &TX_STATUS_FRM_RTX_MASK ) >>TX_STATUS_FRM_RTX_SHIFT ; + tx_rts_count = + (txs->status &TX_STATUS_RTS_RTX_MASK ) >>TX_STATUS_RTS_RTX_SHIFT ; + + lastframe = !ieee80211_has_morefrags (h->frame_control); + +if (!lastframe) { +wiphy_err (wlc->wiphy,"Not last frame!\n" ); + }else { +/* +* Set information to be consumed by Minstrel ht. +* +* The "fallback limit" is the number of tx attempts a given +* MPDU is sent at the "primary" rate. Tx attempts beyond that +* limit are sent at the "secondary" rate. +* A 'short frame' does not exceed RTS treshold. +*/ +u16 sfbl,/* Short Frame Rate Fallback Limit */ + lfbl,/* Long Frame Rate Fallback Limit */ + fbl; + +if (queue <AC_COUNT ) { + sfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], +EDCF_SFB ); + lfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], +EDCF_LFB ); + }else { + sfbl = wlc->SFBL; + lfbl = wlc->LFBL; + } + + txrate = tx_info->status.rates; +if (txrate[0 ].flags &IEEE80211_TX_RC_USE_RTS_CTS ) + fbl = lfbl; +else + fbl = sfbl; + +ieee80211_tx_info_clear_status (tx_info); + +if ((tx_frame_count > fbl) && (txrate[1 ].idx >=0 )) { +/* +* rate selection requested a fallback rate +* and we used it +*/ + txrate[0 ].count = fbl; + txrate[1 ].count = tx_frame_count - fbl; + }else { +/* +* rate selection did not request fallback rate, or +* we didn't need it +*/ + txrate[0 ].count = tx_frame_count; +/* +* rc80211_minstrel.c:minstrel_tx_status() expects +* unused rates to be marked with idx = -1 +*/ + txrate[1 ].idx =-1 ; + txrate[1 ].count =0 ; + } + +/* clear the rest of the rates */ +for (i =2 ; i <IEEE80211_TX_MAX_RATES ; i++) { + txrate[i].idx =-1 ; + txrate[i].count =0 ; + } + +if (txs->status &TX_STATUS_ACK_RCV ) + tx_info->flags |=IEEE80211_TX_STAT_ACK ; + } + + totlen =brcmu_pkttotlen (p); + free_pdu = true; + +brcms_c_txfifo_complete (wlc, queue,1 ); + +if (lastframe) { + p->next =NULL ; + p->prev =NULL ; +/* remove PLCP & Broadcom tx descriptor header */ +skb_pull (p,D11_PHY_HDR_LEN ); +skb_pull (p,D11_TXH_LEN ); +ieee80211_tx_status_irqsafe (wlc->pub->ieee_hw, p); + }else { +wiphy_err (wlc->wiphy,"%s: Not last frame => not calling " +"tx_status\n" , __func__); + } + +return false; + + fatal: +if (p) +brcmu_pkt_buf_free_skb (p); + +return true; + +} + +static bool +brcms_b_dotxstatus (struct brcms_hardware *wlc_hw,struct tx_status *txs) {/* discard intermediate indications for ucode with one legitimate case: * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
@@ -843,7 +1027,7 @@ brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs, && (txs->status & TX_STATUS_INTERMEDIATE))return false; -return brcms_c_dotxstatus (wlc_hw->wlc, txs, s2); +return brcms_c_dotxstatus (wlc_hw->wlc, txs); }/* process tx completion events in BMAC
@@ -885,7 +1069,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) txs->phyerr = (s2 &TXS_PTX_MASK ) >>TXS_PTX_SHIFT ; txs->lasttxtime =0 ; - *fatal =brcms_b_dotxstatus (wlc_hw, txs, s2); + *fatal =brcms_b_dotxstatus (wlc_hw, txs);/* !give others some time to run! */ if (++n >= max_tx_num)
@@ -7654,19 +7838,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc) in_send_q = false; } -static void brcms_c_war16165 (struct brcms_c_info *wlc,bool tx) -{ -if (tx) { -/* the post-increment is used in STAY_AWAKE macro */ -if (wlc->txpend16165war++ ==0 ) -brcms_c_set_ps_ctrl (wlc); - }else { - wlc->txpend16165war--; -if (wlc->txpend16165war ==0 ) -brcms_c_set_ps_ctrl (wlc); - } -} -void brcms_c_txfifo (struct brcms_c_info *wlc,uint fifo,struct sk_buff *p,bool commit,s8 txpktpend)
@@ -7978,181 +8149,6 @@ void brcms_c_tbtt(struct brcms_c_info *wlc) wlc->qvalid |=MCMD_DIRFRMQVAL ; } -/* process an individual struct tx_status */ -bool -brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs,u32 frm_tx2) -{ -struct sk_buff *p; -uint queue; -struct d11txh *txh; -struct scb *scb =NULL ; -bool free_pdu; -int tx_rts, tx_frame_count, tx_rts_count; -uint totlen, supr_status; -bool lastframe; -struct ieee80211_hdr *h; -u16 mcl; -struct ieee80211_tx_info *tx_info; -struct ieee80211_tx_rate *txrate; -int i; - -/* Compiler reference to avoid unused variable warning */ - (void )(frm_tx2); - -/* discard intermediate indications for ucode with one legitimate case: -* e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, -* but the subsequent tx of DATA failed. so it will start rts/cts -* from the beginning (resetting the rts transmission count) -*/ -if (!(txs->status &TX_STATUS_AMPDU ) - && (txs->status &TX_STATUS_INTERMEDIATE )) { -wiphy_err (wlc->wiphy,"%s: INTERMEDIATE but not AMPDU\n" , - __func__); -return false; - } - - queue = txs->frameid &TXFID_QUEUE_MASK ; -if (queue >=NFIFO ) { - p =NULL ; - goto fatal; - } - - p =dma_getnexttxp (wlc->hw->di[queue],DMA_RANGE_TRANSMITTED ); -if (wlc->war16165) -brcms_c_war16165 (wlc, false); -if (p ==NULL ) - goto fatal; - - txh = (struct d11txh *) (p->data); - mcl =le16_to_cpu (txh->MacTxControlLow); - -if (txs->phyerr) { -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); - } -brcms_c_print_txstatus (txs); - } - -if (txs->frameid !=cpu_to_le16 (txh->TxFrameID)) - goto fatal; - tx_info =IEEE80211_SKB_CB (p); - h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN ); - -if (tx_info->control.sta) - scb = (struct scb *)tx_info->control.sta->drv_priv; - -if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { -brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs); -return false; - } - - supr_status = txs->status &TX_STATUS_SUPR_MASK ; -if (supr_status ==TX_STATUS_SUPR_BADCH ) -BCMMSG (wlc->wiphy, -"%s: Pkt tx suppressed, possibly channel %d\n" , - __func__,CHSPEC_CHANNEL (wlc->default_bss->chanspec)); - - tx_rts =cpu_to_le16 (txh->MacTxControlLow) &TXC_SENDRTS ; - tx_frame_count = - (txs->status &TX_STATUS_FRM_RTX_MASK ) >>TX_STATUS_FRM_RTX_SHIFT ; - tx_rts_count = - (txs->status &TX_STATUS_RTS_RTX_MASK ) >>TX_STATUS_RTS_RTX_SHIFT ; - - lastframe = !ieee80211_has_morefrags (h->frame_control); - -if (!lastframe) { -wiphy_err (wlc->wiphy,"Not last frame!\n" ); - }else { -/* -* Set information to be consumed by Minstrel ht. -* -* The "fallback limit" is the number of tx attempts a given -* MPDU is sent at the "primary" rate. Tx attempts beyond that -* limit are sent at the "secondary" rate. -* A 'short frame' does not exceed RTS treshold. -*/ -u16 sfbl,/* Short Frame Rate Fallback Limit */ - lfbl,/* Long Frame Rate Fallback Limit */ - fbl; - -if (queue <AC_COUNT ) { - sfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], -EDCF_SFB ); - lfbl =GFIELD (wlc->wme_retries[wme_fifo2ac[queue]], -EDCF_LFB ); - }else { - sfbl = wlc->SFBL; - lfbl = wlc->LFBL; - } - - txrate = tx_info->status.rates; -if (txrate[0 ].flags &IEEE80211_TX_RC_USE_RTS_CTS ) - fbl = lfbl; -else - fbl = sfbl; - -ieee80211_tx_info_clear_status (tx_info); - -if ((tx_frame_count > fbl) && (txrate[1 ].idx >=0 )) { -/* -* rate selection requested a fallback rate -* and we used it -*/ - txrate[0 ].count = fbl; - txrate[1 ].count = tx_frame_count - fbl; - }else { -/* -* rate selection did not request fallback rate, or -* we didn't need it -*/ - txrate[0 ].count = tx_frame_count; -/* -* rc80211_minstrel.c:minstrel_tx_status() expects -* unused rates to be marked with idx = -1 -*/ - txrate[1 ].idx =-1 ; - txrate[1 ].count =0 ; - } - -/* clear the rest of the rates */ -for (i =2 ; i <IEEE80211_TX_MAX_RATES ; i++) { - txrate[i].idx =-1 ; - txrate[i].count =0 ; - } - -if (txs->status &TX_STATUS_ACK_RCV ) - tx_info->flags |=IEEE80211_TX_STAT_ACK ; - } - - totlen =brcmu_pkttotlen (p); - free_pdu = true; - -brcms_c_txfifo_complete (wlc, queue,1 ); - -if (lastframe) { - p->next =NULL ; - p->prev =NULL ; -/* remove PLCP & Broadcom tx descriptor header */ -skb_pull (p,D11_PHY_HDR_LEN ); -skb_pull (p,D11_TXH_LEN ); -ieee80211_tx_status_irqsafe (wlc->pub->ieee_hw, p); - }else { -wiphy_err (wlc->wiphy,"%s: Not last frame => not calling " -"tx_status\n" , __func__); - } - -return false; - - fatal: -if (p) -brcmu_pkt_buf_free_skb (p); - -return true; - -} -void brcms_c_txfifo_complete (struct brcms_c_info *wlc,uint fifo,s8 txpktpend) {
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
@@ -702,8 +702,6 @@ struct brcms_bss_cfg {extern void brcms_c_fatal_error (struct brcms_c_info *wlc);extern void brcms_b_rpc_watchdog (struct brcms_c_info *wlc);extern void brcms_c_recv (struct brcms_c_info *wlc,struct sk_buff *p); -extern bool brcms_c_dotxstatus (struct brcms_c_info *wlc,struct tx_status *txs, -u32 frm_tx2);extern void brcms_c_txfifo (struct brcms_c_info *wlc,uint fifo,struct sk_buff *p,bool commit,s8 txpktpend);
Signature · 1 line
1.7.1
PATCH v3 5/25 staging: brcm80211: removed global var from aiutils.c
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmsmac/aiutils.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +1 -5
@@ -477,9 +477,6 @@ struct aidmp {u32 componentid3;/* 0xffc */ }; -/* global kernel resource */ -static struct si_info ksii; -/* EROM parsing */ static u32
@@ -1216,8 +1213,7 @@ void ai_detach(struct si_pub *sih)pcicore_deinit (sii->pch); sii->pch =NULL ; -if (sii != &ksii) -kfree (sii); +kfree (sii); }/* register driver interrupt disabling and restoring callback functions */
Signature · 1 line
1.7.1
PATCH v3 10/25 staging: brcm80211: remove unused function si_pmu_ilp_clock()
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function is not used in the driver and has been removed.
--- drivers/staging/brcm80211/brcmsmac/pmu.c | 22 ---------------------- drivers/staging/brcm80211/brcmsmac/pmu.h | 1 - 2 files changed, 0 insertions(+), 23 deletions(-)
drivers/staging/brcm80211/brcmsmac/pmu.c +0 -22
@@ -202,28 +202,6 @@ si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs *cc,W_REG (&cc->pmucontrol, tmp); } -u32 si_pmu_ilp_clock (struct si_pub *sih) -{ -static u32 ilpcycles_per_sec; - -if (!(sih->cccaps &CC_CAP_PMU )) -return ILP_CLOCK ; - -if (ilpcycles_per_sec ==0 ) { -u32 start, end, delta; -u32 origidx =ai_coreidx (sih); -struct chipcregs *cc =ai_setcoreidx (sih,SI_CC_IDX ); - start =R_REG (&cc->pmutimer); -mdelay (ILP_CALC_DUR ); - end =R_REG (&cc->pmutimer); - delta = end - start; - ilpcycles_per_sec = delta * (1000 /ILP_CALC_DUR ); -ai_setcoreidx (sih, origidx); - } - -return ilpcycles_per_sec; -} -u16 si_pmu_fast_pwrup_delay (struct si_pub *sih) {uint delay =PMU_MAX_TRANSITION_DLY ;
drivers/staging/brcm80211/brcmsmac/pmu.h +0 -1
@@ -24,7 +24,6 @@ extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih);extern void si_pmu_sprom_enable (struct si_pub *sih,bool enable);extern u32 si_pmu_chipcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val);extern u32 si_pmu_regcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val); -extern u32 si_pmu_ilp_clock (struct si_pub *sih);extern u32 si_pmu_alp_clock (struct si_pub *sih);extern void si_pmu_pllupd (struct si_pub *sih);extern void si_pmu_spuravoid (struct si_pub *sih,u8 spuravoid);
Signature · 1 line
1.7.1
PATCH v3 9/25 staging: brcm80211: use fragment number provided in transmit frame
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
In the transmit path the field seq_ctrl is filled in, but the fragment number was not properly determined.
--- drivers/staging/brcm80211/brcmsmac/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
@@ -7100,7 +7100,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, scb->seqnum[p->priority]++;/* extract fragment number from frame first */ - seq =le16_to_cpu (seq) &FRAGNUM_MASK ; + seq =le16_to_cpu (h->seq_ctrl) &FRAGNUM_MASK ; seq |= (scb->seqnum[p->priority] <<SEQNUM_SHIFT ); h->seq_ctrl =cpu_to_le16 (seq);
Signature · 1 line
1.7.1
PATCH v3 15/25 staging: brcm80211: removed global var global_scb from softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only. Removed by instead using an already defined Station Control Block variable in a per-device structure.
--- drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +++--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 19 ++++--------------- drivers/staging/brcm80211/brcmsmac/main.c | 21 +++++++++++++-------- drivers/staging/brcm80211/brcmsmac/main.h | 4 ++++ drivers/staging/brcm80211/brcmsmac/pub.h | 1 - 5 files changed, 24 insertions(+), 27 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +3 -3
@@ -314,7 +314,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,static void brcms_c_scb_ampdu_update_config_all (struct ampdu_info *ampdu) { -brcms_c_scb_ampdu_update_config (ampdu, ampdu->wlc->pub->global_scb); +brcms_c_scb_ampdu_update_config (ampdu, &du->wlc->pri_scb); }static void brcms_c_ffpld_calc_mcs2ampdu_table (struct ampdu_info *ampdu,int f)
@@ -482,7 +482,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,struct scb_ampdu *scb_ampdu;struct scb_ampdu_tid_ini *ini;struct ampdu_info *ampdu = wlc->ampdu; -struct scb *scb = wlc->pub->global_scb; +struct scb *scb = &wlc->pri_scb; scb_ampdu = &scb->scb_ampdu;if (!ampdu->ini_enable[tid]) {
@@ -542,7 +542,7 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi, f = ampdu->fifo_tb + prio2fifo[tid]; - scb = wlc->pub->global_scb; + scb = &wlc->pri_scb; scb_ampdu = &scb->scb_ampdu; ini = &scb_ampdu->ini[tid];
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +4 -15
@@ -616,25 +616,14 @@ static int brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct scb *scb; - -int i; struct brcms_info *wl = hw->priv; +struct scb *scb = &wl->wlc->pri_scb; -/* Init the scb */ - scb = (struct scb *)sta->drv_priv; -memset (scb,0 ,sizeof (struct scb )); -for (i =0 ; i <NUMPRIO ; i++) - scb->seqctl[i] =0xFFFF ; - scb->seqctl_nonqos =0xFFFF ; - scb->magic =SCB_MAGIC ; +brcms_c_init_scb (scb); - wl->pub->global_scb = scb; wl->pub->global_ampdu = &(scb->scb_ampdu); wl->pub->global_ampdu->scb = scb; wl->pub->global_ampdu->max_pdu =16 ; -brcmu_pktq_init (&scb->scb_ampdu.txq,AMPDU_MAX_SCB_TID , -AMPDU_MAX_SCB_TID *PKTQ_LEN_DEFAULT ); sta->ht_cap.ht_supported = true; sta->ht_cap.ampdu_factor =IEEE80211_HT_MAX_AMPDU_64K ;
@@ -657,8 +646,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size) { - struct scb *scb = (struct scb *)sta->drv_priv; struct brcms_info *wl = hw->priv; +struct scb *scb = &wl->wlc->pri_scb;int status;if (WARN_ON (scb->magic !=SCB_MAGIC ))
@@ -1038,7 +1027,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw) hw->rate_control_algorithm ="minstrel_ht" ; - hw->sta_data_size =sizeof (struct scb ); + hw->sta_data_size =0 ;return ieee_hw_rate_init (hw); }
drivers/staging/brcm80211/brcmsmac/main.c +13 -8
@@ -882,7 +882,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) h = (struct ieee80211_hdr *)((u8 *) (txh +1 ) +D11_PHY_HDR_LEN );if (tx_info->control.sta) - scb = (struct scb *)tx_info->control.sta->drv_priv; + scb = &wlc->pri_scb;if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) {brcms_c_ampdu_dotxstatus (wlc->ampdu, scb, p, txs);
@@ -3331,14 +3331,21 @@ static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc)return chanspec; } -static struct scb global_scb; - -static void brcms_c_init_scb (struct brcms_c_info *wlc,struct scb *scb) +void brcms_c_init_scb (struct scb *scb) {int i; + +memset (scb,0 ,sizeof (struct scb )); scb->flags =SCB_WMECAP |SCB_HTCAP ; -for (i =0 ; i <NUMPRIO ; i++) +for (i =0 ; i <NUMPRIO ; i++) { scb->seqnum[i] =0 ; + scb->seqctl[i] =0xFFFF ; + } + + scb->seqctl_nonqos =0xFFFF ; + scb->magic =SCB_MAGIC ; +brcmu_pktq_init (&scb->scb_ampdu.txq,AMPDU_MAX_SCB_TID , +AMPDU_MAX_SCB_TID *PKTQ_LEN_DEFAULT ); }/* d11 core init
@@ -3799,8 +3806,6 @@ void brcms_c_init(struct brcms_c_info *wlc)brcms_c_bandinit_ordered (wlc, chanspec); -brcms_c_init_scb (wlc, &global_scb); -/* init probe response timeout */ brcms_c_write_shm (wlc,M_PRS_MAXTIME , wlc->prb_resp_timeout);
@@ -7684,7 +7689,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, {u8 prio;uint fifo; -struct scb *scb = &global_scb; +struct scb *scb = &wlc->pri_scb;struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);/*
drivers/staging/brcm80211/brcmsmac/main.h +4 -0
@@ -22,6 +22,7 @@#include <brcmu_utils.h> #include "types.h" #include "d11.h" +#include "scb.h" #define INVCHANNEL 255/* invalid channel */
@@ -483,6 +484,7 @@ struct brcms_txq_info {* tx_duty_cycle_cck: maximum allowed duty cycle for CCK. * pkt_queue: txq for transmit packets. * wiphy: +* pri_scb: primary Station Control Block */ struct brcms_c_info {struct brcms_pub *pub;
@@ -610,6 +612,7 @@ struct brcms_c_info {struct brcms_txq_info *pkt_queue;struct wiphy *wiphy; +struct scb pri_scb; };/* antsel module specific state */
@@ -864,5 +867,6 @@ extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);extern void brcms_b_txant_set (struct brcms_hardware *wlc_hw,u16 phytxant);extern void brcms_b_band_stf_ss_set (struct brcms_hardware *wlc_hw,u8 stf_mode); +extern void brcms_c_init_scb (struct scb *scb);#endif /* _BRCM_MAIN_H_ */
drivers/staging/brcm80211/brcmsmac/pub.h +0 -1
@@ -144,7 +144,6 @@ struct brcms_bss_info {struct brcms_pub {struct brcms_c_info *wlc;struct ieee80211_hw *ieee_hw; -struct scb *global_scb;struct scb_ampdu *global_ampdu;uint mac80211_state;uint unit;/* device instance number */
Signature · 1 line
1.7.1
PATCH v3 22/25 staging: brcm80211: move rssi computation to place we need it
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The rssi computation was done upon getting the frame from the queue, but the value is needed when filling in the receive status data for mac80211. The call to wlc_phy_rssi_compute() has been deferred.
--- drivers/staging/brcm80211/brcmsmac/main.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -6
@@ -828,11 +828,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) rxh->RxTSFTime =le16_to_cpu (rxh_le->RxTSFTime); rxh->RxChan =le16_to_cpu (rxh_le->RxChan); -/* -* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr -*/ - wlc_rxhdr->rssi = (s8 )wlc_phy_rssi_compute (wlc_hw->band->pi, - rxh);brcms_c_recv (wlc_hw->wlc, p); }
@@ -8172,7 +8167,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, rx_status->freq =ieee80211_dsss_chan_to_freq (channel); } - rx_status->signal = wlc_rxh->rssi; + rx_status->signal =wlc_phy_rssi_compute (wlc->hw->band->pi, rxh);/* noise */ /* qual */
Signature · 1 line
1.7.1
PATCH v3 25/25 staging: brcm80211: declared global vars in softmac phy as const
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 60 +++++++++++---------- 3 files changed, 35 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -52,7 +52,7 @@ struct chan_info_basic {u16 freq; }; -static struct chan_info_basic chan_info_all[] = { +static const struct chan_info_basic chan_info_all[] = { {1 ,2412 }, {2 ,2417 }, {3 ,2422 },
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +3 -3
@@ -558,7 +558,7 @@ struct chan_info_2064_lcnphy {u8 rxrf_rxrf_spare1; }; -static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { +static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {1 ,2412 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {2 ,2417 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 }, {3 ,2422 ,0x0B ,0x0A ,0x00 ,0x07 ,0x0A ,0x88 ,0x88 ,0x80 },
@@ -575,7 +575,7 @@ static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, }; -static struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { +static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { {0x00 ,0 ,0 ,0 ,0 }, {0x01 ,0x64 ,0x64 ,0 ,0 }, {0x02, 0x20, 0x20, 0, 0},
@@ -4489,7 +4489,7 @@ static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)static void wlc_radio_2064_init (struct brcms_phy *pi) {u32 i; -struct lcnphy_radio_regs *lcnphyregs =NULL ; +const struct lcnphy_radio_regs *lcnphyregs =NULL ; lcnphyregs = lcnphy_radio_regs_2064;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +31 -29
164 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 8/25 staging: brcm80211: remove ht_cap field from brcms_c_info structure
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The field ht_cap was typed ieee80211_ht_cap from ieee80211.h. This contained little endian annotated field cap_info resulting in sparse endian warnings. It turned out the driver was setting the field, but it was actually never used. Therefore it has been removed.
--- drivers/staging/brcm80211/brcmsmac/main.c | 23 ----------------------- drivers/staging/brcm80211/brcmsmac/main.h | 2 -- drivers/staging/brcm80211/brcmsmac/stf.c | 9 --------- 3 files changed, 0 insertions(+), 34 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -23
@@ -325,11 +325,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)*/ #define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1) -/* defaults for the HT (MIMO) bss */ -#define HT_CAP (IEEE80211_HT_CAP_SM_PS |\ - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\ - IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40) -/* * The following table lists the buffer memory allocated to xmt fifos in HW. * the size is in units of 256bytes(one block), total size is HW dependent
@@ -4213,13 +4208,6 @@ void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val)static void brcms_c_ht_update_sgi_rx (struct brcms_c_info *wlc,int val) { - wlc->ht_cap.cap_info &= ~(IEEE80211_HT_CAP_SGI_20 | -IEEE80211_HT_CAP_SGI_40 ); - wlc->ht_cap.cap_info |= (val &BRCMS_N_SGI_20 ) ? -IEEE80211_HT_CAP_SGI_20 :0 ; - wlc->ht_cap.cap_info |= (val &BRCMS_N_SGI_40 ) ? -IEEE80211_HT_CAP_SGI_40 :0 ; -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -4230,10 +4218,6 @@ static void brcms_c_ht_update_ldpc(struct brcms_c_info *wlc, s8 val) { wlc->stf->ldpc = val; - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_LDPC_CODING ; -if (wlc->stf->ldpc !=OFF ) - wlc->ht_cap.cap_info |=IEEE80211_HT_CAP_LDPC_CODING ; -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -5376,8 +5360,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, wlc->bsscfg->wlc = wlc; wlc->mimoft =FT_HT ; - wlc->ht_cap.cap_info =HT_CAP ; - wlc->mimo_40txbw =AUTO ; wlc->ofdm_40txbw =AUTO ; wlc->cck_40txbw =AUTO ;
@@ -5403,15 +5385,10 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,if (n_disabled &WLFEATURE_DISABLE_11N_STBC_TX ) { wlc->bandstate[BAND_2G_INDEX ]->band_stf_stbc_tx =OFF ; wlc->bandstate[BAND_5G_INDEX ]->band_stf_stbc_tx =OFF ; - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC ; }if (n_disabled &WLFEATURE_DISABLE_11N_STBC_RX )brcms_c_stf_stbc_rx_set (wlc,HT_CAP_RX_STBC_NO ); -/* apply the GF override from nvram conf */ -if (n_disabled &WLFEATURE_DISABLE_11N_GF ) - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_GRN_FLD ; -/* initialize radio_mpc_disable according to wlc->mpc */ brcms_c_radio_mpc_upd (wlc);brcms_b_antsel_set (wlc->hw, wlc->asi->antsel_avail);
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
@@ -456,7 +456,6 @@ struct brcms_txq_info {* cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode. * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode. -* ht_cap: HT CAP IE being advertised by this node. * default_bss: configured BSS parameters. * mc_fid_counter: BC/MC FIFO frame ID counter. * country_default: saved country for leaving 802.11d auto-country mode.
@@ -570,7 +569,6 @@ struct brcms_c_info {s8 cck_40txbw;s8 ofdm_40txbw;s8 mimo_40txbw; -struct ieee80211_ht_cap ht_cap;struct brcms_bss_info *default_bss;
drivers/staging/brcm80211/brcmsmac/stf.c +0 -9
@@ -53,9 +53,6 @@ static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)return ; } - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_RX_STBC ; - wlc->ht_cap.cap_info |= (val <<IEEE80211_HT_CAP_RX_STBC_SHIFT ); -if (wlc->pub->up) {brcms_c_update_beacon (wlc);brcms_c_update_probe_resp (wlc, true);
@@ -140,12 +137,6 @@ static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)if ((int_val ==ON ) && (wlc->stf->txstreams ==1 ))return false; -if ((int_val ==OFF ) || (wlc->stf->txstreams ==1 ) - || !BRCMS_STBC_CAP_PHY (wlc)) - wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC ; -else - wlc->ht_cap.cap_info |=IEEE80211_HT_CAP_TX_STBC ; - wlc->bandstate[BAND_2G_INDEX ]->band_stf_stbc_tx = (s8 ) int_val; wlc->bandstate[BAND_5G_INDEX ]->band_stf_stbc_tx = (s8 ) int_val;
Signature · 1 line
1.7.1
PATCH v3 11/25 staging: brcm80211: make device initializer table for wme constant
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
For chip initialisation of the wme parameters a table is used, but it was not marked as constant.
--- drivers/staging/brcm80211/brcmsmac/main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +2 -2
@@ -4297,7 +4297,7 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)int i_ac;struct ieee80211_tx_queue_params txq_pars;struct ieee80211_tx_queue_params *params = &txq_pars; -static struct edcf_acparam default_edcf_acparams[] = { +static const struct edcf_acparam default_edcf_acparams[] = { {EDCF_AC_BE_ACI_STA ,EDCF_AC_BE_ECW_STA ,cpu_to_le16 (EDCF_AC_BE_TXOP_STA )}, {EDCF_AC_BK_ACI_STA ,EDCF_AC_BK_ECW_STA ,
@@ -4307,7 +4307,7 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend) {EDCF_AC_VO_ACI_STA ,EDCF_AC_VO_ECW_STA , cpu_to_le16(EDCF_AC_VO_TXOP_STA)} };/* ucode needs these parameters during its initialization */ -struct edcf_acparam *edcf_acp = &default_edcf_acparams[0 ]; +const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0 ];for (i_ac =0 ; i_ac <AC_COUNT ; i_ac++, edcf_acp++) {/* find out which ac this set of params applies to */
Signature · 1 line
1.7.1
PATCH v3 14/25 staging: brcm80211: removed band related global vars from softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Global variables are undesirable unless they are read only. Variables are now maintained in a device specific structure.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 29 +++++++++++++--------- drivers/staging/brcm80211/brcmsmac/main.h | 1 + 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +17 -12
@@ -31,6 +31,7 @@#include "pub.h" #include "ucode_loader.h" #include "mac80211_if.h" +#include "main.h" #define N_TX_QUEUES 4/* #tx queues on mac80211<->driver interface */
@@ -225,7 +226,7 @@ static struct ieee80211_rate legacy_ratetable[] = { RATE(540, 0), }; -static struct ieee80211_supported_band brcms_band_2GHz_nphy = { +static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = { .band =IEEE80211_BAND_2GHZ , .channels = brcms_2ghz_chantable, .n_channels =ARRAY_SIZE (brcms_2ghz_chantable),
@@ -247,7 +248,7 @@ static struct ieee80211_supported_band brcms_band_2GHz_nphy = { } }; -static struct ieee80211_supported_band brcms_band_5GHz_nphy = { +static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = { .band =IEEE80211_BAND_5GHZ , .channels = brcms_5ghz_nphy_chantable, .n_channels =ARRAY_SIZE (brcms_5ghz_nphy_chantable),
@@ -981,22 +982,24 @@ static irqreturn_t brcms_isr(int irq, void *dev_id)static int ieee_hw_rate_init (struct ieee80211_hw *hw) {struct brcms_info *wl = hw->priv; -int has_5g; +struct brcms_c_info *wlc = wl->wlc; +struct ieee80211_supported_band *band; +int has_5g =0 ;u16 phy_type; - has_5g =0 ; - hw->wiphy->bands[IEEE80211_BAND_2GHZ ] =NULL ; hw->wiphy->bands[IEEE80211_BAND_5GHZ ] =NULL ; phy_type =brcms_c_get_phy_type (wl->wlc,0 );if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) { + band = &wlc->bandstate[BAND_2G_INDEX ]->band; + *band = brcms_band_2GHz_nphy_template;if (phy_type ==PHY_TYPE_LCN ) {/* Single stream */ - brcms_band_2GHz_nphy.ht_cap.mcs.rx_mask[1 ] =0 ; - brcms_band_2GHz_nphy.ht_cap.mcs.rx_highest =72 ; + band->ht_cap.mcs.rx_mask[1 ] =0 ; + band->ht_cap.mcs.rx_highest =72 ; } - hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = &brcms_band_2GHz_nphy; + hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = band; }else {return -EPERM ; }
@@ -1004,11 +1007,13 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)/* Assume all bands use the same phy. True for 11n devices. */ if (wl->pub->_nbands >1 ) { has_5g++; -if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) - hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = - &brcms_band_5GHz_nphy; -else +if (phy_type ==PHY_TYPE_N || phy_type ==PHY_TYPE_LCN ) { + band = &wlc->bandstate[BAND_5G_INDEX ]->band; + *band = brcms_band_5GHz_nphy_template; + hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = band; + }else {return -EPERM ; + } }return 0 ; }
drivers/staging/brcm80211/brcmsmac/main.h +1 -0
@@ -281,6 +281,7 @@ struct brcms_band {u16 CWmin;/* minimum size of contention window, in unit of aSlotTime */ u16 CWmax;/* maximum size of contention window, in unit of aSlotTime */ +struct ieee80211_supported_band band; };/* module control blocks */
Signature · 1 line
1.7.1
PATCH v3 17/25 staging: brcm80211: removed global variable in softmac otp
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Placed variable on the stack instead and deleted unused functions. Softmac was tested to function properly with multiple adapters in one system.
--- drivers/staging/brcm80211/brcmsmac/otp.c | 143 ++++-------------------------- drivers/staging/brcm80211/brcmsmac/otp.h | 8 -- 2 files changed, 18 insertions(+), 133 deletions(-)
drivers/staging/brcm80211/brcmsmac/otp.c +18 -125
@@ -67,15 +67,13 @@/* Fixed size subregions sizes in words */ #define OTPGU_CI_SZ 2 +struct otpinfo ; +/* OTP function struct */ struct otp_fn_s { -int (*size)(struct otpinfo *oi); -u16 (*read_bit)(struct otpinfo *oi,struct chipcregs *cc,uint off); -struct otpinfo *(*init)(struct si_pub *sih); +int (*init)(struct si_pub *sih,struct otpinfo *oi);int (*read_region)(struct otpinfo *oi,int region,u16 *data,uint *wlen); -int (*nvread)(struct otpinfo *oi,char *data,uint *len); -int (*status)(struct otpinfo *oi); };struct otpinfo {
@@ -99,21 +97,6 @@ struct otpinfo {int otpgu_base;/* offset to General Use Region */ }; -static struct otpinfo otpinfo; - -/* -* IPX OTP Code -* -* Exported functions: -* ipxotp_status() -* ipxotp_size() -* ipxotp_init() -* ipxotp_read_bit() -* ipxotp_read_region() -* ipxotp_nvread() -* -*/ -/* OTP layout */ /* CC revs 21, 24 and 27 OTP General Use Region word offset */ #define REVA4_OTPGU_BASE 12
@@ -149,51 +132,11 @@ static struct otpinfo otpinfo;#define OTP4315_SWREG_SZ 178/* 178 bytes */ #define OTP_SZ_FU_144 (144/8)/* 144 bits */ -static int ipxotp_status (struct otpinfo *oi) -{ -return (int )(oi->status); -} - -/* Return size in bytes */ -static int ipxotp_size (struct otpinfo *oi) -{ -return (int )oi->wsize *2 ; -} -static u16 ipxotp_otpr (struct otpinfo *oi,struct chipcregs *cc,uint wn) {return R_REG (&cc->sromotp[wn]); } -static u16 ipxotp_read_bit (struct otpinfo *oi,struct chipcregs *cc,uint off) -{ -uint k, row, col; -u32 otpp, st; - - row = off / oi->cols; - col = off % oi->cols; - - otpp =OTPP_START_BUSY | - ((OTPPOC_READ <<OTPP_OC_SHIFT ) &OTPP_OC_MASK ) | - ((row <<OTPP_ROW_SHIFT ) &OTPP_ROW_MASK ) | - ((col <<OTPP_COL_SHIFT ) &OTPP_COL_MASK ); -W_REG (&cc->otpprog, otpp); - -for (k =0 ; - ((st =R_REG (&cc->otpprog)) &OTPP_START_BUSY ) - && (k <OTPP_TRIES ); k++) - ; -if (k >=OTPP_TRIES ) -return 0xffff ; - -if (st &OTPP_READERR ) -return 0xffff ; - - st = (st &OTPP_VALUE_MASK ) >>OTPP_VALUE_SHIFT ; - -return (int )st; -} -/* * Calculate max HW/SW region byte size by subtracting fuse region * and checksum size, osizew is oi->wsize (OTP size - GU size) in words
@@ -294,28 +237,24 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc) oi->flim = oi->wsize; } -static struct otpinfo *ipxotp_init (struct si_pub *sih) +static int ipxotp_init (struct si_pub *sih,struct otpinfo *oi) {uint idx;struct chipcregs *cc; -struct otpinfo *oi;/* Make sure we're running IPX OTP */ if (!OTPTYPE_IPX (sih->ccrev)) -return NULL ; +return -EBADE ;/* Make sure OTP is not disabled */ if (ai_is_otp_disabled (sih)) -return NULL ; - -/* OTP is always powered */ - oi = &otpinfo; +return -EBADE ;/* Check for otp size */ switch ((sih->cccaps &CC_CAP_OTPSIZE ) >>CC_CAP_OTPSIZE_SHIFT ) {case 0 :/* Nothing there */ -return NULL ; +return -EBADE ;case 1 :/* 32x64 */ oi->rows =32 ; oi->cols =64 ;
@@ -338,7 +277,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)break ;default :/* Don't know the geometry */ -return NULL ; +return -EBADE ; }/* Retrieve OTP region info */
@@ -349,7 +288,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)ai_setcoreidx (sih, idx); -return oi; +return 0 ; } static int
@@ -437,56 +376,16 @@ ipxotp_read_region(struct otpinfo *oi, int region, u16 *data, uint *wlen)return 0 ; } -static int ipxotp_nvread (struct otpinfo *oi,char *data,uint *len) -{ -return -ENOTSUPP ; -} -static const struct otp_fn_s ipxotp_fn = { - (int (*)(struct otpinfo *)) ipxotp_size, - (u16 (*)(struct otpinfo *,struct chipcregs *,uint )) ipxotp_read_bit, - - (struct otpinfo *(*)(struct si_pub *)) ipxotp_init, + (int (*)(struct si_pub *,struct otpinfo *)) ipxotp_init, (int (*)(struct otpinfo *,int ,u16 *,uint *)) ipxotp_read_region, - (int (*)(struct otpinfo *,char *,uint *)) ipxotp_nvread, - - (int (*)(struct otpinfo *)) ipxotp_status }; -/* -* otp_status() -* otp_size() -* otp_read_bit() -* otp_init() -* otp_read_region() -* otp_nvread() -*/ - -int otp_status (struct otpinfo *oi) +static int otp_init (struct si_pub *sih,struct otpinfo *oi) { -return oi->fn->status (oi); -} - -int otp_size (struct otpinfo *oi) -{ -return oi->fn->size (oi); -} -u16 otp_read_bit (struct otpinfo *oi,uint offset) -{ -uint idx =ai_coreidx (oi->sih); -struct chipcregs *cc =ai_setcoreidx (oi->sih,SI_CC_IDX ); -u16 readBit = (u16 ) oi->fn->read_bit (oi, cc, offset); -ai_setcoreidx (oi->sih, idx); -return readBit; -} +int ret; -struct otpinfo *otp_init (struct si_pub *sih) -{ -struct otpinfo *oi; -struct otpinfo *ret =NULL ; - - oi = &otpinfo;memset (oi,0 ,sizeof (struct otpinfo )); oi->ccrev = sih->ccrev;
@@ -495,18 +394,19 @@ struct otpinfo *otp_init(struct si_pub *sih) oi->fn = &ipxotp_fn;if (oi->fn ==NULL ) -return NULL ; +return -EBADE ; oi->sih = sih; - ret = (oi->fn->init) (sih); + ret = (oi->fn->init) (sih, oi);return ret; }int otp_read_region (struct si_pub *sih,int region,u16 *data,uint *wlen) { -struct otpinfo *oi; +struct otpinfo otpinfo; +struct otpinfo *oi = &otpinfo;int err =0 ;if (ai_is_otp_disabled (sih)) {
@@ -514,19 +414,12 @@ otp_read_region(struct si_pub *sih, int region, u16 *data, uint *wlen) { goto out; } - oi =otp_init (sih); -if (oi ==NULL ) { - err = -EBADE ; + err =otp_init (sih, oi); +if (err) goto out; - } err = ((oi)->fn->read_region)(oi, region, data, wlen); out:return err; } - -int otp_nvread (struct otpinfo *oi,char *data,uint *len) -{ -return oi->fn->nvread (oi, data, len); -}
drivers/staging/brcm80211/brcmsmac/otp.h +0 -8
@@ -30,15 +30,7 @@/* OTP Size */ #define OTP_SZ_MAX (6144/8)/* maximum bytes in one CIS */ -struct otpinfo ; - -/* Exported functions */ -extern int otp_status (struct otpinfo *oi); -extern int otp_size (struct otpinfo *oi); -extern u16 otp_read_bit (struct otpinfo *oi,uint offset); -extern struct otpinfo *otp_init (struct si_pub *sih);extern int otp_read_region (struct si_pub *sih,int region,u16 *data,uint *wlen); -extern int otp_nvread (struct otpinfo *oi,char *data,uint *len);#endif /* _BRCM_OTP_H_ */
Signature · 1 line
1.7.1
PATCH v3 18/25 staging: brcm80211: changing interface to n-phy rssi compute function
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function wlc_phy_rssi_compute_nphy() was called with pointer to brcms_d11rxhdr structure in which it filled in the received power per antenna. However, these are not used further in the driver so it only needs the d11rxhdr structure as input for rssi calculation.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -2646,7 +2646,7 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, rssi -=256 ; }else if (radioid ==BCM2055_ID || radioid ==BCM2056_ID || radioid ==BCM2057_ID ) { - rssi =wlc_phy_rssi_compute_nphy (pi, wlc_rxhdr); + rssi =wlc_phy_rssi_compute_nphy (pi, rxh); } end:
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +1 -1
@@ -1183,7 +1183,7 @@ extern void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf,extern void wlc_phy_radio205x_vcocal_nphy (struct brcms_phy *pi);extern int wlc_phy_rssi_compute_nphy (struct brcms_phy *pi, -struct brcms_d11rxhdr *wlc_rxh); +struct d11rxhdr *rxh);#define NPHY_TESTPATTERN_BPHY_EVM 0#define NPHY_TESTPATTERN_BPHY_RFCS 1
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +1 -6
@@ -23109,9 +23109,8 @@ void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi) }int -wlc_phy_rssi_compute_nphy (struct brcms_phy *pi,struct brcms_d11rxhdr *wlc_rxh) +wlc_phy_rssi_compute_nphy (struct brcms_phy *pi,struct d11rxhdr *rxh) { -struct d11rxhdr *rxh = &wlc_rxh->rxhdr;s16 rxpwr, rxpwr0, rxpwr1;s16 phyRx0_l, phyRx2_l;
@@ -23134,10 +23133,6 @@ wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct brcms_d11rxhdr *wlc_rxh) rxpwr1 = phyRx2_l; } - wlc_rxh->rxpwr[0 ] = (s8 ) rxpwr0; - wlc_rxh->rxpwr[1 ] = (s8 ) rxpwr1; - wlc_rxh->do_rssi_ma =0 ; -if (pi->sh->rssi_mode ==RSSI_ANT_MERGE_MAX ) rxpwr = (rxpwr0 > rxpwr1) ? rxpwr0 : rxpwr1;else if (pi->sh->rssi_mode ==RSSI_ANT_MERGE_MIN )
Signature · 1 line
1.7.1
PATCH v3 19/25 staging: brcm80211: change interface for common rssi compute function
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The function wlc_phy_rssi_compute() now uses d11rxhdr struct as purely input parameter and returns the computed rssi value.
--- drivers/staging/brcm80211/brcmsmac/main.c | 4 +++- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 7 +++---- drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -1
@@ -806,15 +806,17 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)/* process each frame */ while ((p = head) !=NULL ) { +struct d11rxhdr *rxh; head = head->prev; p->prev =NULL ; wlc_rxhdr = (struct brcms_d11rxhdr *) p->data; + rxh = (struct d11rxhdr *)p->data;/* * compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ -wlc_phy_rssi_compute (wlc_hw->band->pi, wlc_rxhdr); + wlc_rxhdr->rssi =wlc_phy_rssi_compute (wlc_hw->band->pi, rxh);brcms_c_recv (wlc_hw->wlc, p); }
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +3 -4
@@ -2610,10 +2610,9 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core) } } -void wlc_phy_rssi_compute (struct brcms_phy_pub *pih, -struct brcms_d11rxhdr *wlc_rxhdr) +int wlc_phy_rssi_compute (struct brcms_phy_pub *pih, +struct d11rxhdr *rxh) { -struct d11rxhdr *rxh = &wlc_rxhdr->rxhdr;int rssi =le16_to_cpu (rxh->PhyRxStatus_1) &PRXS1_JSSI_MASK ;uint radioid = pih->radioid;struct brcms_phy *pi = (struct brcms_phy *) pih;
@@ -2650,7 +2649,7 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, } end: - wlc_rxhdr->rssi = (s8 ) rssi; +return rssi; }void wlc_phy_freqtrack_start (struct brcms_phy_pub *pih)
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +2 -2
@@ -212,8 +212,8 @@ extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi,extern u16 wlc_phy_bw_state_get (struct brcms_phy_pub *ppi);extern void wlc_phy_bw_state_set (struct brcms_phy_pub *ppi,u16 bw); -extern void wlc_phy_rssi_compute (struct brcms_phy_pub *pih, -struct brcms_d11rxhdr *wlc_rxhdr); +extern int wlc_phy_rssi_compute (struct brcms_phy_pub *pih, +struct d11rxhdr *rxh);extern void wlc_phy_por_inform (struct brcms_phy_pub *ppi);extern void wlc_phy_noise_sample_intr (struct brcms_phy_pub *ppi);extern bool wlc_phy_bist_check_phy (struct brcms_phy_pub *ppi);
Signature · 1 line
1.7.1
PATCH v3 23/25 staging: brcm80211: use d11rxhdr structure in brcms_c_recover_tsf64()
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
All information needed for this function is available in the d11rxhdr structure. This is the last place where the brcms_d11rxhdr structure so it can be removed.
--- drivers/staging/brcm80211/brcmsmac/d11.h | 17 ----------------- drivers/staging/brcm80211/brcmsmac/main.c | 9 +++------ drivers/staging/brcm80211/brcmsmac/types.h | 1 - 3 files changed, 3 insertions(+), 24 deletions(-)
drivers/staging/brcm80211/brcmsmac/d11.h +0 -17
@@ -1407,23 +1407,6 @@ struct d11rxhdr {u16 RxStatus2;u16 RxTSFTime;u16 RxChan; -}; - -/* -* rxhdr: received frame header data -* rssi: rssi computed by PHY -* rxpwr0: obsoleted, place holder for legacy ROM code. use rxpwr[] -* rxpwr1: obsoleted, place holder for legacy ROM code. use rxpwr[] -* do_rssi_ma: do per-pkt sampling for per-antenna ma in HIGH -* rxpwr: rssi for supported antennas -*/ -struct brcms_d11rxhdr { -struct d11rxhdr rxh_cpu; -s8 rssi; -s8 rxpwr0; -s8 rxpwr1; -s8 do_rssi_ma; -s8 rxpwr[WL_RSSI_ANT_MAX ]; } __packed;/* PhyRxStatus_0: */
drivers/staging/brcm80211/brcmsmac/main.c +3 -6
@@ -783,7 +783,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)struct sk_buff *tail =NULL ;uint n =0 ;uint bound_limit = bound ?RXBND :-1 ; -struct brcms_d11rxhdr *wlc_rxhdr =NULL ;BCMMSG (wlc_hw->wlc->wiphy,"wl%d\n" , wlc_hw->unit);/* gather received frames */
@@ -813,7 +812,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) rxh_le = (struct d11rxhdr_le *)p->data; rxh = (struct d11rxhdr *)p->data; - wlc_rxhdr = (struct brcms_d11rxhdr *) p->data;/* fixup rx header endianness */ rxh->RxFrameSize =le16_to_cpu (rxh_le->RxFrameSize);
@@ -8117,7 +8115,7 @@ brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr,* are used. Finally, the tsf_h is read from the tsf register. */ static u64 brcms_c_recover_tsf64 (struct brcms_c_info *wlc, -struct brcms_d11rxhdr *rxh) +struct d11rxhdr *rxh) {u32 tsf_h, tsf_l;u16 rx_tsf_0_15, rx_tsf_16_31;
@@ -8125,7 +8123,7 @@ static u64 brcms_c_recover_tsf64(struct brcms_c_info *wlc,brcms_b_read_tsf (wlc->hw, &tsf_l, &tsf_h); rx_tsf_16_31 = (u16)(tsf_l >>16 ); - rx_tsf_0_15 = rxh->rxh_cpu.RxTSFTime; + rx_tsf_0_15 = rxh->RxTSFTime;/* * a greater tsf time indicates the low 16 bits of
@@ -8145,14 +8143,13 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,struct sk_buff *p, struct ieee80211_rx_status *rx_status) { - struct brcms_d11rxhdr *wlc_rxh = (struct brcms_d11rxhdr *) rxh; int preamble;int channel;u32 rspec;unsigned char *plcp;/* fill in TSF and flag its presence */ - rx_status->mactime =brcms_c_recover_tsf64 (wlc, wlc_rxh); + rx_status->mactime =brcms_c_recover_tsf64 (wlc, rxh); rx_status->flag |=RX_FLAG_MACTIME_MPDU ; channel =BRCMS_CHAN_CHANNEL (rxh->RxChan);
drivers/staging/brcm80211/brcmsmac/types.h +0 -1
@@ -336,7 +336,6 @@ struct dma_pub;struct si_pub ;struct tx_status ;struct d11rxhdr ; -struct brcms_d11rxhdr ;struct txpwr_limits ;/* iovar structure */
Signature · 1 line
1.7.1
PATCH v3 6/25 staging: brcm80211: removed global vars in softmac ucode handling
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Moved global vars into a per-device structure.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 4 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 3 +- drivers/staging/brcm80211/brcmsmac/main.c | 27 ++++-- drivers/staging/brcm80211/brcmsmac/ucode_loader.c | 121 ++++++++++----------- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 46 +++++---- 5 files changed, 106 insertions(+), 95 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -2
@@ -894,7 +894,7 @@ static int brcms_request_fw(struct brcms_info *wl, struct pci_dev *pdev) wl->fw.fw_hdr[i]->size / (sizeof (struct firmware_hdr )); } wl->fw.fw_cnt = i; -return brcms_ucode_data_init (wl); +return brcms_ucode_data_init (wl, &wl->ucode); }/*
@@ -925,7 +925,7 @@ static void brcms_free(struct brcms_info *wl)/* free ucode data */ if (wl->fw.fw_cnt) -brcms_ucode_data_free (); +brcms_ucode_data_free (&wl->ucode);if (wl->irq)free_irq (wl->irq, wl);
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +2 -1
@@ -19,7 +19,7 @@#include <linux/timer.h> #include <linux/interrupt.h> - +#include "ucode_loader.h" /* * Starting index for 5G rates in the * legacy rate table.
@@ -77,6 +77,7 @@ struct brcms_info {bool resched;/* dpc needs to be and is rescheduled */ struct brcms_firmware fw;struct wiphy *wiphy; +struct brcms_ucode ucode; };/* misc callbacks */
drivers/staging/brcm80211/brcmsmac/main.c +19 -8
@@ -342,6 +342,12 @@ static u16 frametype(u32 rspec, u8 mimoframe)/* Starting corerev for the fifo size table */ #define XMTFIFOTBL_STARTREV 20 +struct d11init { +u16 addr; +u16 size; +u32 value; +}; +/* currently the best mechanism for determining SIFS is the band in use */ static u16 get_sifs (struct brcms_band *band) {
@@ -349,6 +355,7 @@ static u16 get_sifs(struct brcms_band *band)BPHY_SIFS_TIME ; } +/* * Detect Card removed. * Even checking an sbconfig register read will not false trigger when the core
@@ -694,6 +701,7 @@ static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs)static void brcms_c_ucode_bsinit (struct brcms_hardware *wlc_hw) {struct wiphy *wiphy = wlc_hw->wlc->wiphy; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode;/* init microcode host flags */ brcms_c_write_mhf (wlc_hw, wlc_hw->band->mhfs);
@@ -701,7 +709,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)/* do band-specific ucode IHR, SHM, and SCR inits */ if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11n0bsinitvals16); +brcms_c_write_inits (wlc_hw, ucode->d11n0bsinitvals16);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" " %d\n", __func__, wlc_hw->unit,
@@ -710,7 +718,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band))brcms_c_write_inits (wlc_hw, - d11lcn0bsinitvals24); + ucode->d11lcn0bsinitvals24);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in" " core rev %d\n", __func__,
@@ -2457,6 +2465,8 @@ static void brcms_ucode_write(struct brcms_hardware *wlc_hw, const u32 ucode[],static void brcms_ucode_download (struct brcms_hardware *wlc_hw) {struct brcms_c_info *wlc; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; + wlc = wlc_hw->wlc;if (wlc_hw->ucode_loaded)
@@ -2464,8 +2474,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) { -brcms_ucode_write (wlc_hw, bcm43xx_16_mimo, - bcm43xx_16_mimosz); +brcms_ucode_write (wlc_hw, ucode->bcm43xx_16_mimo, + ucode->bcm43xx_16_mimosz); wlc_hw->ucode_loaded = true; }else wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -2473,8 +2483,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw) __func__, wlc_hw->unit, wlc_hw->corerev); }else if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band)) { -brcms_ucode_write (wlc_hw, bcm43xx_24_lcn, - bcm43xx_24_lcnsz); +brcms_ucode_write (wlc_hw, ucode->bcm43xx_24_lcn, + ucode->bcm43xx_24_lcnsz); wlc_hw->ucode_loaded = true; }else { wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -3372,6 +3382,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)int err =0 ;u16 buf[NFIFO ];struct wiphy *wiphy = wlc->wiphy; +struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; regs = wlc_hw->regs;
@@ -3404,14 +3415,14 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)if (D11REV_IS (wlc_hw->corerev,23 )) {if (BRCMS_ISNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11n0initvals16); +brcms_c_write_inits (wlc_hw, ucode->d11n0initvals16);else wiphy_err (wiphy,"%s: wl%d: unsupported phy in corerev" " %d\n" , __func__, wlc_hw->unit, wlc_hw->corerev); }else if (D11REV_IS (wlc_hw->corerev,24 )) {if (BRCMS_ISLCNPHY (wlc_hw->band)) -brcms_c_write_inits (wlc_hw, d11lcn0initvals24); +brcms_c_write_inits (wlc_hw, ucode->d11lcn0initvals24);else wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" " %d\n", __func__, wlc_hw->unit,
drivers/staging/brcm80211/brcmsmac/ucode_loader.c +57 -64
137 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/ucode_loader.h +26 -20
63 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 12/25 staging: brcm80211: remove dongle firmware related debug code
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
When the device dies the driver could extract cpu registers on the device to analyze the trap handling on the dongle. As the firmware with this driver is stable this code does not belong in the brcmfmac driver.
--- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 259 +------------------------ 1 files changed, 1 insertions(+), 258 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +1 -258
@@ -37,29 +37,7 @@#ifdef BCMDBG -/* ARM trap handling */ -struct brcmf_trap { -u32 type; -u32 epc; -u32 cpsr; -u32 spsr; -u32 r0; -u32 r1; -u32 r2; -u32 r3; -u32 r4; -u32 r5; -u32 r6; -u32 r7; -u32 r8; -u32 r9; -u32 r10; -u32 r11; -u32 r12; -u32 r13; -u32 r14; -u32 pc; -}; +#define BRCMF_TRAP_INFO_SIZE 80#define CBUF_LEN (128)
@@ -2890,231 +2868,6 @@ xfer_done: }#ifdef BCMDBG -static int -brcmf_sdbrcm_readshared (struct brcmf_bus *bus,struct sdpcm_shared *sh) -{ -u32 addr; -__le32 addr_le; -int rv; -struct sdpcm_shared_le sh_le; - -/* Read last word in memory to determine address of -sdpcm_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, bus->ramsize -4 , (u8 *)&addr_le, -4 ); -if (rv <0 ) -return rv; - - addr =le32_to_cpu (addr_le); - -brcmf_dbg (INFO ,"sdpcm_shared address 0x%08X\n" , addr); - -/* -* Check if addr is valid. -* NVRAM length at the end of memory should have been overwritten. -*/ -if (addr ==0 || ((~addr >>16 ) &0xffff ) == (addr &0xffff )) { -brcmf_dbg (ERROR ,"address (0x%08x) of sdpcm_shared invalid\n" , - addr); -return -EBADE ; - } - -/* Read rte_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *) &sh_le, -sizeof (struct sdpcm_shared_le )); -if (rv <0 ) -return rv; - -/* Endianness */ - sh->flags =le32_to_cpu (sh_le.flags); - sh->trap_addr =le32_to_cpu (sh_le.trap_addr); - sh->assert_exp_addr =le32_to_cpu (sh_le.assert_exp_addr); - sh->assert_file_addr =le32_to_cpu (sh_le.assert_file_addr); - sh->assert_line =le32_to_cpu (sh_le.assert_line); - sh->console_addr =le32_to_cpu (sh_le.console_addr); - sh->msgtrace_addr =le32_to_cpu (sh_le.msgtrace_addr); -memcpy (sh->tag, sh_le.tag,sizeof (sh->tag)); - -if ((sh->flags &SDPCM_SHARED_VERSION_MASK ) !=SDPCM_SHARED_VERSION ) { -brcmf_dbg (ERROR ,"sdpcm_shared version %d in brcmf is different than sdpcm_shared version %d in dongle\n" , -SDPCM_SHARED_VERSION , - sh->flags &SDPCM_SHARED_VERSION_MASK ); -return -EBADE ; - } - -return 0 ; -} - -static int brcmf_sdbrcm_mem_dump (struct brcmf_bus *bus) -{ -int ret =0 ; -int size;/* Full mem size */ -int start =0 ;/* Start address */ -int read_size =0 ;/* Read size of each iteration */ -u8 *buf =NULL , *databuf =NULL ; - -/* Get full mem size */ - size = bus->ramsize; - buf =kmalloc (size,GFP_ATOMIC ); -if (!buf) -return -1 ; - -/* Read mem content */ -printk (KERN_DEBUG "Dump dongle memory" ); - databuf = buf; -while (size) { - read_size =min (MEMBLOCK , size); - ret =brcmf_sdbrcm_membytes (bus, false, start, databuf, - read_size); -if (ret) { -brcmf_dbg (ERROR ,"Error membytes %d\n" , ret); -kfree (buf); -return -1 ; - } -printk ("." ); - -/* Decrement size and increment start address */ - size -= read_size; - start += read_size; - databuf += read_size; - } -printk (KERN_DEBUG "Done\n" ); - -/* free buf before return !!! */ -if (brcmf_write_to_file (bus->drvr, buf, bus->ramsize)) { -brcmf_dbg (ERROR ,"Error writing to files\n" ); -return -1 ; - } - -/* buf free handled in brcmf_write_to_file, not here */ -return 0 ; -} - -static int brcmf_sdbrcm_checkdied (struct brcmf_bus *bus,u8 *data,uint size) -{ -int bcmerror =0 ; -uint msize =512 ; -char *mbuffer =NULL ; -uint maxstrlen =256 ; -char *str =NULL ; -struct brcmf_trap tr; -struct sdpcm_shared sdpcm_shared; -struct brcmu_strbuf strbuf; - -brcmf_dbg (TRACE ,"Enter\n" ); - -if (data ==NULL ) { -/* -* Called after a rx ctrl timeout. "data" is NULL. -* allocate memory to trace the trap or assert. -*/ - size = msize; - mbuffer = data =kmalloc (msize,GFP_ATOMIC ); -if (mbuffer ==NULL ) { - bcmerror = -ENOMEM ; - goto done; - } - } - - str =kmalloc (maxstrlen,GFP_ATOMIC ); -if (str ==NULL ) { - bcmerror = -ENOMEM ; - goto done; - } - - bcmerror =brcmf_sdbrcm_readshared (bus, &sdpcm_shared); -if (bcmerror <0 ) - goto done; - -brcmu_binit (&strbuf, data, size); - -brcmu_bprintf (&strbuf, -"msgtrace address : 0x%08X\nconsole address : 0x%08X\n" , - sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr); - -if ((sdpcm_shared.flags &SDPCM_SHARED_ASSERT_BUILT ) ==0 ) -/* NOTE: Misspelled assert is intentional - DO NOT FIX. -* (Avoids conflict with real asserts for programmatic -* parsing of output.) -*/ -brcmu_bprintf (&strbuf,"Assrt not built in dongle\n" ); - -if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT |SDPCM_SHARED_TRAP )) == -0 ) { -/* NOTE: Misspelled assert is intentional - DO NOT FIX. -* (Avoids conflict with real asserts for programmatic -* parsing of output.) -*/ -brcmu_bprintf (&strbuf,"No trap%s in dongle" , - (sdpcm_shared.flags &SDPCM_SHARED_ASSERT_BUILT ) - ?"/assrt" :"" ); - }else { -if (sdpcm_shared.flags &SDPCM_SHARED_ASSERT ) { -/* Download assert */ -brcmu_bprintf (&strbuf,"Dongle assert" ); -if (sdpcm_shared.assert_exp_addr !=0 ) { - str[0 ] ='\0' ; - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.assert_exp_addr, - (u8 *) str, maxstrlen); -if (bcmerror <0 ) - goto done; - - str[maxstrlen -1 ] ='\0' ; -brcmu_bprintf (&strbuf," expr \"%s\"" , str); - } - -if (sdpcm_shared.assert_file_addr !=0 ) { - str[0 ] ='\0' ; - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.assert_file_addr, - (u8 *) str, maxstrlen); -if (bcmerror <0 ) - goto done; - - str[maxstrlen -1 ] ='\0' ; -brcmu_bprintf (&strbuf," file \"%s\"" , str); - } - -brcmu_bprintf (&strbuf," line %d " , - sdpcm_shared.assert_line); - } - -if (sdpcm_shared.flags &SDPCM_SHARED_TRAP ) { - bcmerror =brcmf_sdbrcm_membytes (bus, false, - sdpcm_shared.trap_addr, (u8 *)&tr, -sizeof (struct brcmf_trap )); -if (bcmerror <0 ) - goto done; - -brcmu_bprintf (&strbuf, -"Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x," -"lp 0x%x, rpc 0x%x Trap offset 0x%x, " -"r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n" , - tr.type, tr.epc, tr.cpsr, tr.spsr, tr.r13, - tr.r14, tr.pc, sdpcm_shared.trap_addr, - tr.r0, tr.r1, tr.r2, tr.r3, tr.r4, tr.r5, - tr.r6, tr.r7); - } - } - -if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT |SDPCM_SHARED_TRAP )) -brcmf_dbg (ERROR ,"%s\n" , strbuf.origbuf); - -#ifdef BCMDBG -if (sdpcm_shared.flags &SDPCM_SHARED_TRAP ) -/* Mem dump to a file on device */ -brcmf_sdbrcm_mem_dump (bus); - -#endif /* BCMDBG */ - -done: -kfree (mbuffer); -kfree (str); - -return bcmerror; -} -#define CONSOLE_LINE_MAX 192static int brcmf_sdbrcm_readconsole (struct brcmf_bus *bus)
@@ -3377,21 +3130,11 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) rxlen, msglen); }else if (timeleft ==0 ) {brcmf_dbg (ERROR ,"resumed on timeout\n" ); -#ifdef BCMDBG -brcmf_sdbrcm_sdlock (bus); -brcmf_sdbrcm_checkdied (bus,NULL ,0 ); -brcmf_sdbrcm_sdunlock (bus); -#endif /* BCMDBG */ }else if (pending == true) {brcmf_dbg (CTL ,"cancelled\n" );return -ERESTARTSYS ; }else {brcmf_dbg (CTL ,"resumed for unknown reason?\n" ); -#ifdef BCMDBG -brcmf_sdbrcm_sdlock (bus); -brcmf_sdbrcm_checkdied (bus,NULL ,0 ); -brcmf_sdbrcm_sdunlock (bus); -#endif /* BCMDBG */ }if (rxlen)
Signature · 1 line
1.7.1
PATCH v3 16/25 staging: brcm80211: various global var related changes in softmac
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmsmac/main.c | 11 +---------- drivers/staging/brcm80211/brcmsmac/main.h | 2 +- drivers/staging/brcm80211/brcmsmac/otp.c | 4 ++-- drivers/staging/brcm80211/brcmsmac/rate.h | 1 - drivers/staging/brcm80211/brcmsmac/srom.c | 15 +++++++++------ 5 files changed, 13 insertions(+), 20 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -10
@@ -428,8 +428,6 @@ const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };/* WME/802.1E Access Category to TX FIFO number */ static const u8 wme_ac2fifo[] = {1 ,0 ,2 ,3 }; -static bool in_send_q; -/* 802.1D Priority to precedence queue mapping */ const u8 wlc_prio2prec_map[] = { _BRCMS_PREC_BE,/* 0 BE - Best-effort */
@@ -442,7 +440,7 @@ const u8 wlc_prio2prec_map[] = { _BRCMS_PREC_NC, /* 7 NC - Network Control */ }; -static u16 xmtfifo_sz[][NFIFO ] = { +static const u16 xmtfifo_sz[][NFIFO ] = {/* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */ {20 ,192 ,192 ,21 ,17 ,5 },/* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */
@@ -7716,11 +7714,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc)struct pktq *q = &qi->q;struct ieee80211_tx_info *tx_info; -if (in_send_q) -return ; -else - in_send_q = true; - prec_map = wlc->tx_prec_map;/* Send all the enq'd pkts that we can.
@@ -7752,8 +7745,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc) prec_map = wlc->tx_prec_map; } } - - in_send_q = false; }void
drivers/staging/brcm80211/brcmsmac/main.h +1 -1
@@ -359,7 +359,7 @@ struct brcms_hardware {u16 chanspec;/* bmac chanspec shadow */ uint *txavail[NFIFO ];/* # tx descriptors available */ -u16 *xmtfifo_sz;/* fifo size in 256B for each xmt fifo */ +const u16 *xmtfifo_sz;/* fifo size in 256B for each xmt fifo */ u32 pllreq;/* pll requests to keep PLL on */
drivers/staging/brcm80211/brcmsmac/otp.c +2 -2
@@ -80,7 +80,7 @@ struct otp_fn_s {struct otpinfo {uint ccrev;/* chipc revision */ -struct otp_fn_s *fn;/* OTP functions */ +const struct otp_fn_s *fn;/* OTP functions */ struct si_pub *sih;/* Saved sb handle */ /* IPX OTP section */
@@ -442,7 +442,7 @@ static int ipxotp_nvread(struct otpinfo *oi, char *data, uint *len)return -ENOTSUPP ; } -static struct otp_fn_s ipxotp_fn = { +static const struct otp_fn_s ipxotp_fn = { (int (*)(struct otpinfo *)) ipxotp_size, (u16 (*)(struct otpinfo *,struct chipcregs *,uint )) ipxotp_read_bit,
drivers/staging/brcm80211/brcmsmac/rate.h +0 -1
@@ -27,7 +27,6 @@ extern const struct brcms_c_rateset cck_ofdm_rates;extern const struct brcms_c_rateset ofdm_rates;extern const struct brcms_c_rateset cck_rates;extern const struct brcms_c_rateset gphy_legacy_rates; -extern const struct brcms_c_rateset wlc_lrs_rates;extern const struct brcms_c_rateset rate_limit_1_2;struct brcms_mcs_info {
drivers/staging/brcm80211/brcmsmac/srom.c +9 -6
@@ -778,7 +778,9 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = { {NULL, 0, 0, 0, 0} }; -static u8 srom_crc8_table[CRC8_TABLE_SIZE ]; +/* crc table has the same contents for every device instance, so it can be +* shared between devices. */ +static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE ];static u16 *srom_window_address (struct si_pub *sih,u8 *curmap) {
@@ -1052,8 +1054,9 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,/* fixup the endianness so crc8 will pass */ htol16_buf (buf, nwords *2 ); -if (crc8 (srom_crc8_table, (u8 *) buf, nwords *2 , -CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (srom_crc8_table)) +if (crc8 (brcms_srom_crc8_table, (u8 *) buf, nwords *2 , +CRC8_INIT_VALUE ) != +CRC8_GOOD_VALUE (brcms_srom_crc8_table))/* DBG only pci always read srom4 first, then srom8/9 */ err = -EIO ;
@@ -1089,8 +1092,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)/* fixup the endianness so crc8 will pass */ htol16_buf (buf, bufsz); -if (crc8 (srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 , -CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (srom_crc8_table)) +if (crc8 (brcms_srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 , +CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (brcms_srom_crc8_table)) err = -EIO ;/* now correct the endianness of the byte array */
@@ -1147,7 +1150,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars, sromwindow =srom_window_address (sih, curmap); -crc8_populate_lsb (srom_crc8_table,SROM_CRC8_POLY ); +crc8_populate_lsb (brcms_srom_crc8_table,SROM_CRC8_POLY );if (ai_is_sprom_available (sih)) { err =sprom_read_pci (sih, sromwindow,0 , srom,SROM_WORDS , true);
Signature · 1 line
1.7.1
PATCH v3 21/25 staging: brcm80211: use endian annotated structures in brcmsmac
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Structures interfacing with the device have a specific endianess and structures exchanged between host and device have been annotated so sparse checking can be done. The Makefile has been modified to add the __CHECK_ENDIAN__ flag.
--- drivers/staging/brcm80211/brcmsmac/Makefile | 3 +- drivers/staging/brcm80211/brcmsmac/d11.h | 77 +++++++++++-------- drivers/staging/brcm80211/brcmsmac/dma.c | 41 +++++----- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 12 ++-- drivers/staging/brcm80211/brcmsmac/main.c | 86 +++++++++++---------- drivers/staging/brcm80211/brcmsmac/srom.c | 4 +- drivers/staging/brcm80211/brcmsmac/ucode_loader.h | 8 +- 7 files changed, 126 insertions(+), 105 deletions(-)
drivers/staging/brcm80211/brcmsmac/Makefile +2 -1
@@ -15,7 +15,8 @@ # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -ccflags-y := \ +ccflags-y := \ + -D__CHECK_ENDIAN__ \ -Idrivers/staging/brcm80211/brcmsmac \ -Idrivers/staging/brcm80211/brcmsmac/phy \ -Idrivers/staging/brcm80211/include
drivers/staging/brcm80211/brcmsmac/d11.h +45 -32
108 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/dma.c +22 -19
81 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +6 -6
@@ -89,9 +89,9 @@ }struct firmware_hdr { -u32 offset; -u32 len; -u32 idx; +__le32 offset; +__le32 len; +__le32 idx; };static const char *const brcms_firmwares[MAX_FW_IMAGES ] = {
@@ -243,7 +243,7 @@ static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = { .mcs = { /* placeholders for now */ .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = 500, + .rx_highest = cpu_to_le16(500), .tx_params = IEEE80211_HT_MCS_TX_DEFINED} } };
@@ -265,7 +265,7 @@ static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = { .mcs = { /* placeholders for now */ .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = 500, + .rx_highest = cpu_to_le16(500), .tx_params = IEEE80211_HT_MCS_TX_DEFINED} } };
@@ -1625,7 +1625,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx) "ERROR: fw hdr len\n");return -ENOMSG ; } - *data =le32_to_cpu (*((u32 *) pdata)); + *data =le32_to_cpu (*((__le32 *) pdata));return 0 ; } }
drivers/staging/brcm80211/brcmsmac/main.c +45 -41
174 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/srom.c +2 -2
@@ -822,14 +822,14 @@ static inline void ltoh16_buf(u16 *buf, unsigned int size) { size /=2 ;while (size--) - *(buf + size) =le16_to_cpu (*(buf + size)); + *(buf + size) =le16_to_cpu (*(__le16 *)(buf + size)); }static inline void htol16_buf (u16 *buf,unsigned int size) { size /=2 ;while (size--) - *(buf + size) =cpu_to_le16 (*(buf + size)); + *(__le16 *)(buf + size) =cpu_to_le16 (*(buf + size)); }/* Initialization of varbuf structure */
drivers/staging/brcm80211/brcmsmac/ucode_loader.h +4 -4
@@ -35,10 +35,10 @@ struct brcms_ucode {struct d11init *d11n0absinitvals16;struct d11init *d11n0bsinitvals16;struct d11init *d11n0initvals16; -u32 *bcm43xx_16_mimo; -u32 bcm43xx_16_mimosz; -u32 *bcm43xx_24_lcn; -u32 bcm43xx_24_lcnsz; +__le32 *bcm43xx_16_mimo; +size_t bcm43xx_16_mimosz; +__le32 *bcm43xx_24_lcn; +size_t bcm43xx_24_lcnsz;u32 *bcm43xx_bommajor;u32 *bcm43xx_bomminor; };
Signature · 1 line
1.7.1
PATCH v3 24/25 staging: brcm80211: simple changes to softmac phy variables
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Code cleanup resulting in less sparse warnings.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 14 ------------- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 23 ---------------------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 2 +- 3 files changed, 1 insertions(+), 38 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0 -14
@@ -111,20 +111,6 @@ static struct chan_info_basic chan_info_all[] = { {216, 50800} }; -u16 ltrn_list[PHY_LTRN_LIST_LEN ] = { -0x18f9 ,0x0d01 ,0x00e4 ,0xdef4 ,0x06f1 ,0x0ffc , -0xfa27 ,0x1dff ,0x10f0 ,0x0918 ,0xf20a ,0xe010 , -0x1417 ,0x1104 ,0xf114 ,0xf2fa ,0xf7db ,0xe2fc , -0xe1fb ,0x13ee ,0xff0d ,0xe91c ,0x171a ,0x0318 , -0xda00 ,0x03e8 ,0x17e6 ,0xe9e4 ,0xfff3 ,0x1312 , -0xe105 ,0xe204 ,0xf725 ,0xf206 ,0xf1ec ,0x11fc , -0x14e9 ,0xe0f0 ,0xf2f6 ,0x09e8 ,0x1010 ,0x1d01 , -0xfad9 ,0x0f04 ,0x060f ,0xde0c ,0x001c ,0x0dff , -0x1807 ,0xf61a ,0xe40e ,0x0f16 ,0x05f9 ,0x18ec , -0x0a1b ,0xff1e ,0x2600 ,0xffe2 ,0x0ae5 ,0x1814 , -0x0507 ,0x0fea ,0xe4f2 ,0xf6e6 -}; -const u8 ofdm_rate_lookup[] = {BRCM_RATE_48M ,
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +0 -23
@@ -247,9 +247,6 @@ enum phy_cal_mode {#define PUB_NOT_ASSOC (pi) \ (mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC)) -#define PHY_LTRN_LIST_LEN 64 -extern u16 ltrn_list[PHY_LTRN_LIST_LEN ]; -struct phy_table_info {uint table;int q;
@@ -922,26 +919,6 @@ struct lcnphy_radio_regs {u8 do_init_g; }; -extern struct lcnphy_radio_regs lcnphy_radio_regs_2064[]; -extern struct lcnphy_radio_regs lcnphy_radio_regs_2066[]; - -extern struct radio_regs regs_2055[], regs_SYN_2056[], regs_TX_2056[], - regs_RX_2056[]; -extern struct radio_regs regs_SYN_2056_A1[], regs_TX_2056_A1[], - regs_RX_2056_A1[]; -extern struct radio_regs regs_SYN_2056_rev5[], regs_TX_2056_rev5[], - regs_RX_2056_rev5[]; -extern struct radio_regs regs_SYN_2056_rev6[], regs_TX_2056_rev6[], - regs_RX_2056_rev6[]; -extern struct radio_regs regs_SYN_2056_rev7[], regs_TX_2056_rev7[], - regs_RX_2056_rev7[]; -extern struct radio_regs regs_SYN_2056_rev8[], regs_TX_2056_rev8[], - regs_RX_2056_rev8[]; - -extern struct radio_20xx_regs regs_2057_rev4[], regs_2057_rev5[], - regs_2057_rev5v1[]; -extern struct radio_20xx_regs regs_2057_rev7[], regs_2057_rev8[]; -extern char *phy_getvar (struct brcms_phy *pi,const char *name);extern int phy_getintvar (struct brcms_phy *pi,const char *name);
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +1 -1
@@ -575,7 +575,7 @@ static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, }; -struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { +static struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { {0x00 ,0 ,0 ,0 ,0 }, {0x01 ,0x64 ,0x64 ,0 ,0 }, {0x02, 0x20, 0x20, 0, 0},
Signature · 1 line
1.7.1
Quoted 4 lines · Franky Lin
Code clean up for softmac.
This patch series is in order to replace the following one:
Message-ID: <[email protected]>
All applied.
Please note that my staging git tree moved, and is now public at git.kernel.org, just drop the "-2.6" from your old address.
greg k-h
Quoted 2 lines · Greg KH
Please note that my staging git tree moved, and is now public at git.kernel.org, just drop the "-2.6" from your old address.
Glad to know everything is back on track. Thanks for the heads up.
Franky
Re: [PATCH v3 21/25] staging: brcm80211: use endian annotated structures in brcmsmac
In reply to Franky Lin2011/9/30 Franky Lin <[email protected]>:
Quoted 7 lines
From: Arend van Spriel <[email protected]>
drivers/staging/brcm80211/brcmsmac/d11.h +4
-0+struct d11rxhdr_le { + __le16 RxFrameSize; + u16 PAD; + __le16 PhyRxStatus_0;
drivers/staging/brcm80211/brcmsmac/d11.h struct shm_acparams { · line 1395
Quoted 10 lines
drivers/staging/brcm80211/brcmsmac/d11.h +10
-0+ __le16 PhyRxStatus_1; + __le16 PhyRxStatus_2; + __le16 PhyRxStatus_3; + __le16 PhyRxStatus_4; + __le16 PhyRxStatus_5; + __le16 RxStatus1; + __le16 RxStatus2; + __le16 RxTSFTime; + __le16 RxChan; +} __packed;
So you decided to use __packed here anyway for some reason? ;)
drivers/staging/brcm80211/brcmsmac/d11.h struct d11rxhdr { · line 1410
Quoted 9 lines
struct d11rxhdr {
u16 RxFrameSize;
u16 PAD;drivers/staging/brcm80211/brcmsmac/d11.h +1
-1@@ -1392,20 +1407,18 @@ struct d11rxhdr { u16 RxStatus2; u16 RxTSFTime; u16 RxChan; -} __packed; +};
You should be right, none compiler should break that alignment... still no idea why usage of __packed hurt anyone, made code clear according to me.
Signature · 1 line
Rafał