Skip to contentSkip to conversation

various cleanup changes for brcmfmac and brcmsmac

PATCH Applied Arend van Spriel 2 participants 28 messages Oct 4, 2011 – Oct 5, 2011 Staging

lore
Share & tools
lore
#0 lore raw

cover various cleanup changes for brcmfmac and brcmsmac

Third attempt as the mailer somehow did not sent these outside the Broadcom intranet. Another series of cleanup changes based on community feedback received on the mainline patch (v2) as sent August 25, 2011.

This series is to be applied to the staging-next branch. There are no pending patches that this series depend on.

Alwin Beukers (15):
staging: brcm80211: fixed checkpatch warnings
staging: brcm80211: removed accessor functions for band type and
etheraddress.
staging: brcm80211: fixed function returns
staging: brcm80211: made NULL ethernet address const
staging: brcm80211: removed empty brcms_c_reset_bmac_done callback
function
staging: brcm80211: decreased indentation level of
brcms_c_wme_setparams function
staging: brcm80211: removed redundant code from brcms_c_set_gmode
staging: brcm80211: cleanup of shared memory related wrapper
functions
staging: brcm80211: cleanup of transmit buffer size related wrapper
function
staging: brcm80211: cleanup of several wrapper functions
staging: brcm80211: removed unneeded call to
brcms_b_tx_fifo_suspended
staging: brcm80211: removed synchronisation of wlc->machwcap field
staging: brcm80211: remove brcms_b_dotxstatus wrapper function
staging: brcm80211: combined if statements
staging: brcm80211: remove N mode validation function

Arend van Spriel (4):
staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START
staging: brcm80211: remove filtering of received frames
staging: brcm80211: remove brcmu_bprintf and related functions
staging: brcm80211: replace brcmu_bitcount with hweight8

Franky Lin (3):
staging: brcm80211: clean up rtnl_lock in fullmac
staging: brcm80211: remove fullmac module_param for intr/poll mode
staging: brcm80211: stop using assigned thread priority in fullmac

Roland Vossen (4):
staging: brcm80211: cleaned up struct brcms_bss_cfg
staging: brcm80211: fullmac: fixed double #include
staging: brcm80211: softmac: added event tracing
staging: brcm80211: smac: fix for 64 bit systems

 drivers/staging/brcm80211/brcmfmac/dhd_linux.c     |    3 +
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c      |   72 +---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c   |   25 +-
 drivers/staging/brcm80211/brcmsmac/Makefile        |    3 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.c       |   14 +-
 drivers/staging/brcm80211/brcmsmac/ampdu.c         |   14 +-
 drivers/staging/brcm80211/brcmsmac/antsel.c        |    4 +-
 .../brcm80211/brcmsmac/brcms_trace_events.c        |   23 +
 .../brcm80211/brcmsmac/brcms_trace_events.h        |   92 ++++
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |   19 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h   |    2 +
 drivers/staging/brcm80211/brcmsmac/main.c          |  525 ++++----------------
 drivers/staging/brcm80211/brcmsmac/main.h          |   50 +--
 drivers/staging/brcm80211/brcmsmac/nicpci.c        |    3 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c   |    7 +-
 drivers/staging/brcm80211/brcmsmac/srom.c          |    3 +-
 drivers/staging/brcm80211/brcmsmac/stf.c           |   10 +-
 drivers/staging/brcm80211/brcmsmac/types.h         |    1 -
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h  |    4 +-
 drivers/staging/brcm80211/brcmutil/utils.c         |   34 --
 drivers/staging/brcm80211/include/brcmu_utils.h    |   15 -
 21 files changed, 252 insertions(+), 671 deletions(-)
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/26 staging: brcm80211: cleaned up struct brcms_bss_cfg

From: Roland Vossen <[email protected]>

Several fields were unused or were only set once. They have been removed. Uncalled functions that relied on these constants have been removed as well.

---
 drivers/staging/brcm80211/brcmsmac/main.c |  132 +----------------------------
 drivers/staging/brcm80211/brcmsmac/main.h |   38 --------
 2 files changed, 3 insertions(+), 167 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +3 -129
index de5f5c0..efc6682 100644
@@ -1741,34 +1741,6 @@ void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw)
 		brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC);
 }
 
-static void
-brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, (len + 3) & ~3,
-				    bcn);
-	/* write beacon length to SCR */
-	brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len);
-	/* mark beacon0 valid */
-	OR_REG(&regs->maccommand, MCMD_BCN0VLD);
-}
-
-static void
-brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, (len + 3) & ~3,
-				    bcn);
-	/* write beacon length to SCR */
-	brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len);
-	/* mark beacon1 valid */
-	OR_REG(&regs->maccommand, MCMD_BCN1VLD);
-}
-
 static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw)
 {
 	u16 v;
@@ -3288,8 +3260,7 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 		if (!cfg->BSS)
 			return false;
 
-		if (!cfg->dtim_programmed)
-			return false;
+		return false;
 	}
 
 	return true;
@@ -3791,9 +3762,6 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	/* update beacon listen interval */
 	brcms_c_bcn_li_upd(wlc);
 
-	/* the world is new again, so is our reported rate */
-	brcms_c_reprate_init(wlc);
-
 	/* write ethernet address to core */
 	brcms_c_set_mac(wlc->bsscfg);
 	brcms_c_set_bssid(wlc->bsscfg);
@@ -4054,17 +4022,12 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,
 static void brcms_c_setband(struct brcms_c_info *wlc,
 					   uint bandunit)
 {
-	struct brcms_bss_cfg *cfg = wlc->bsscfg;
-
 	wlc->band = wlc->bandstate[bandunit];
 
 	if (!wlc->pub->up)
 		return;
 
 	/* wait for at least one beacon before entering sleeping state */
-	if (cfg->associated)
-		cfg->PMawakebcn = true;
-
 	brcms_c_set_ps_ctrl(wlc);
 
 	/* band-specific initializations */
@@ -5357,7 +5320,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 		goto fail;
 	}
 
-	wlc->bsscfg->_idx = 0;
 	wlc->bsscfg->wlc = wlc;
 
 	wlc->mimoft = FT_HT;
@@ -8763,82 +8725,6 @@ int brcms_c_get_header_len(void)
 	return TXOFF;
 }
 
-/* mac is assumed to be suspended at this point */
-static void
-brcms_b_write_hw_bcntemplates(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len, bool both)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	if (both) {
-		brcms_c_write_hw_bcntemplate0(wlc_hw, bcn, len);
-		brcms_c_write_hw_bcntemplate1(wlc_hw, bcn, len);
-	} else {
-		/* bcn 0 */
-		if (!(R_REG(&regs->maccommand) & MCMD_BCN0VLD))
-			brcms_c_write_hw_bcntemplate0(wlc_hw, bcn, len);
-		/* bcn 1 */
-		else if (!
-			 (R_REG(&regs->maccommand) & MCMD_BCN1VLD))
-			brcms_c_write_hw_bcntemplate1(wlc_hw, bcn, len);
-	}
-}
-
-static void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, u16 bcn[],
-					  int len, bool both)
-{
-	brcms_b_write_hw_bcntemplates(wlc->hw, bcn, len, both);
-}
-
-/*
- * Update a beacon for a particular BSS
- * For MBSS, this updates the software template and sets "latest" to
- * the index of the template updated. Otherwise, it updates the hardware
- * template.
- */
-void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
-			       struct brcms_bss_cfg *cfg)
-{
-	int len = BCN_TMPL_LEN;
-
-	/* Clear the soft intmask */
-	wlc->defmacintmask &= ~MI_BCNTPL;
-
-	if (!cfg->up)
-		/* Only allow updates on an UP bss */
-		return;
-
-	/* Optimize:  Some of if/else could be combined */
-	if ((cfg->flags & BRCMS_BSSCFG_HW_BCN) != 0) {
-		/* Hardware beaconing for this config */
-		u16 bcn[BCN_TMPL_LEN / 2];
-		u32 both_valid = MCMD_BCN0VLD | MCMD_BCN1VLD;
-		struct d11regs __iomem *regs = wlc->regs;
-
-		/* Check if both templates are in use, if so sched. an interrupt
-		 *      that will call back into this routine
-		 */
-		if ((R_REG(&regs->maccommand) & both_valid) == both_valid)
-			/* clear any previous status */
-			W_REG(&regs->macintstatus, MI_BCNTPL);
-
-		/* Check that after scheduling the interrupt both of the
-		 *      templates are still busy. if not clear the int. & remask
-		 */
-		if ((R_REG(&regs->maccommand) & both_valid) == both_valid) {
-			wlc->defmacintmask |= MI_BCNTPL;
-			return;
-		}
-
-		wlc->bcn_rspec =
-		    brcms_c_lowest_basic_rspec(wlc, &cfg->current_bss->rateset);
-		/* update the template and ucode shm */
-		brcms_c_bcn_prb_template(wlc, IEEE80211_STYPE_BEACON,
-				     wlc->bcn_rspec, cfg, bcn, &len);
-		brcms_c_write_hw_bcntemplates(wlc, bcn, len, false);
-	}
-}
-
 /*
  * Update all beacons for the system.
  */
@@ -8847,7 +8733,8 @@ void brcms_c_update_beacon(struct brcms_c_info *wlc)
 	struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
 
 	if (bsscfg->up && !bsscfg->BSS)
-		brcms_c_bss_update_beacon(wlc, bsscfg);
+		/* Clear the soft intmask */
+		wlc->defmacintmask &= ~MI_BCNTPL;
 }
 
 /* Write ssid into shared memory */
@@ -8946,19 +8833,6 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)
 	return 0;
 }
 
-/* init tx reported rate mechanism */
-void brcms_c_reprate_init(struct brcms_c_info *wlc)
-{
-	brcms_c_bsscfg_reprate_init(wlc->bsscfg);
-}
-
-/* per bsscfg init tx reported rate mechanism */
-void brcms_c_bsscfg_reprate_init(struct brcms_bss_cfg *bsscfg)
-{
-	bsscfg->txrspecidx = 0;
-	memset((char *)bsscfg->txrspec, 0, sizeof(bsscfg->txrspec));
-}
-
 void brcms_default_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs)
 {
 	brcms_c_rateset_default(rs, NULL, wlc->band->phytype,
drivers/staging/brcm80211/brcmsmac/main.h +0 -38
index e458916..9e1575c 100644
@@ -634,35 +634,18 @@ struct antsel_info {
  * enable: is this configuration enabled
  * associated: is BSS in ASSOCIATED state
  * BSS: infraustructure or adhoc
- * dtim_programmed:
  * SSID_len: the length of SSID
  * SSID: SSID string
- * bcmc_scb: one bcmc_scb per band
- * _idx: the index of this bsscfg, assigned at wlc_bsscfg_alloc()
  *
  *
  * BSSID: BSSID (associated)
  * cur_etheraddr: h/w address
- * bcmc_fid: the last BCMC FID queued to TX_BCMC_FIFO
- * bcmc_fid_shm: the last BCMC FID written to shared mem
  * flags: BSSCFG flags; see below
- * bcn: AP beacon
- * bcn_len: AP beacon length
- * ar_disassoc: disassociated in associated recreation
  *
  * current_bss: BSS parms in ASSOCIATED state
  *
- * PM states
- * ---------
- * PMawakebcn: bcn recvd during current waking state
- * PMpending: waiting for tx status with PM indicated set
- * priorPMstate: Detecting PM state transitions
- * PSpoll: flags there is an outstanding PS-Poll frame
  *
  * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation
- *
- * txrspecidx: index into tx rate circular buffer
- * txrspec: circular buffer of prev MPDUs tx rates
  */
 struct brcms_bss_cfg {
 	struct brcms_c_info *wlc;
@@ -670,27 +653,11 @@ struct brcms_bss_cfg {
 	bool enable;
 	bool associated;
 	bool BSS;
-	bool dtim_programmed;
 	u8 SSID_len;
 	u8 SSID[IEEE80211_MAX_SSID_LEN];
-	struct scb *bcmc_scb[MAXBANDS];
-	s8 _idx;
 	u8 BSSID[ETH_ALEN];
 	u8 cur_etheraddr[ETH_ALEN];
-	u16 bcmc_fid;
-	u16 bcmc_fid_shm;
-	u32 flags;
-	u8 *bcn;
-	uint bcn_len;
-	bool ar_disassoc;
 	struct brcms_bss_info *current_bss;
-	bool PMawakebcn;
-	bool PMpending;
-	bool priorPMstate;
-	bool PSpoll;
-	u16 ID;
-	uint txrspecidx;
-	u32 txrspec[NTXRATE][2];
 };
 
 extern void brcms_c_fatal_error(struct brcms_c_info *wlc);
@@ -765,9 +732,6 @@ extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
 			       struct ieee80211_sta *sta,
 			       void (*dma_callback_fn));
 
-extern void brcms_c_reprate_init(struct brcms_c_info *wlc);
-extern void brcms_c_bsscfg_reprate_init(struct brcms_bss_cfg *bsscfg);
-
 /* Shared memory access */
 extern void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v);
 extern u16 brcms_c_read_shm(struct brcms_c_info *wlc, uint offset);
@@ -775,8 +739,6 @@ extern void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset,
 			       const void *buf, int len);
 
 extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
-extern void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
-				  struct brcms_bss_cfg *bsscfg);
 
 extern void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend);
 extern void brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/26 staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START

In reply to Arend van Spriel

The ssn should be given a valid value by the driver or it should not override the value. Removed override to zero from the driver.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +0 -5
index 6787498..c5afeaf 100644
@@ -669,11 +669,6 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
 				  tid);
 			return -EINVAL;
 		}
-		/*
-		 * Future improvement:
-		 *   Use the starting sequence number provided ...
-		 */
-		*ssn = 0;
 		ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
 		break;
 
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/26 staging: brcm80211: remove filtering of received frames

In reply to Arend van Spriel

In the receive path of the brcmsmac driver probe request frames and frames with invalid mac address fields are dropped. This is only fine for STA mode. Anticipating coming AP and monitor mode functionality this is unwanted behavior.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   23 +----------------------
 1 files changed, 1 insertions(+), 22 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -22
index efc6682..39b91d6 100644
@@ -8238,29 +8238,8 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
 	if (len < D11_PHY_HDR_LEN + sizeof(h->frame_control))
 		goto toss;
 
+	/* not supporting A-MSDU */
 	is_amsdu = rxh->RxStatus2 & RXS_AMSDU_MASK;
-
-	/* explicitly test bad src address to avoid sending bad deauth */
-	if (!is_amsdu) {
-		/* CTS and ACK CTL frames are w/o a2 */
-
-		if (ieee80211_is_data(h->frame_control) ||
-		    ieee80211_is_mgmt(h->frame_control)) {
-			if ((is_zero_ether_addr(h->addr2) ||
-			     is_multicast_ether_addr(h->addr2))) {
-				wiphy_err(wlc->wiphy, "wl%d: %s: dropping a "
-					  "frame with invalid src mac address,"
-					  " a2: %pM\n",
-					 wlc->pub->unit, __func__, h->addr2);
-				goto toss;
-			}
-		}
-	}
-
-	/* due to sheer numbers, toss out probe reqs for now */
-	if (ieee80211_is_probe_req(h->frame_control))
-		goto toss;
-
 	if (is_amsdu)
 		goto toss;
 
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/26 staging: brcm80211: remove brcmu_bprintf and related functions

In reply to Arend van Spriel

The functions brcmu_bprintf and brcmu_binit could be replaced by snprintf kernel function. These are no longer used in both brcm80211 drivers so they have been removed.

---
 drivers/staging/brcm80211/brcmsmac/types.h      |    1 -
 drivers/staging/brcm80211/brcmutil/utils.c      |   34 -----------------------
 drivers/staging/brcm80211/include/brcmu_utils.h |   15 ----------
 3 files changed, 0 insertions(+), 50 deletions(-)
drivers/staging/brcm80211/brcmsmac/types.h +0 -1
index 23969fe..27a814b 100644
@@ -329,7 +329,6 @@ struct ieee80211_tx_queue_params;
 struct brcms_info;
 struct brcms_c_info;
 struct brcms_hardware;
-struct brcmu_strbuf;
 struct brcms_txq_info;
 struct brcms_band;
 struct dma_pub;
drivers/staging/brcm80211/brcmutil/utils.c +0 -34
index 1fe47fe..62bcc71 100644
@@ -598,37 +598,3 @@ uint brcmu_bitcount(u8 *bitmap, uint length)
 	return bitcount;
 }
 EXPORT_SYMBOL(brcmu_bitcount);
-
-/* Initialization of brcmu_strbuf structure */
-void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size)
-{
-	b->origsize = b->size = size;
-	b->origbuf = b->buf = buf;
-}
-EXPORT_SYMBOL(brcmu_binit);
-
-/* Buffer sprintf wrapper to guard against buffer overflow */
-int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...)
-{
-	va_list ap;
-	int r;
-
-	va_start(ap, fmt);
-	r = vsnprintf(b->buf, b->size, fmt, ap);
-
-	/* Non Ansi C99 compliant returns -1,
-	 * Ansi compliant return r >= b->size,
-	 * stdlib returns 0, handle all
-	 */
-	if ((r == -1) || (r >= (int)b->size) || (r == 0)) {
-		b->size = 0;
-	} else {
-		b->size -= r;
-		b->buf += r;
-	}
-
-	va_end(ap);
-
-	return r;
-}
-EXPORT_SYMBOL(brcmu_bprintf);
drivers/staging/brcm80211/include/brcmu_utils.h +0 -15
index cf34bd3..a7d3df2 100644
@@ -19,18 +19,6 @@
 
 #include <linux/skbuff.h>
 
-/* Buffer structure for collecting string-formatted data
-* using brcmu_bprintf() API.
-* Use brcmu_binit() to initialize before use
-*/
-
-struct brcmu_strbuf {
-	char *buf;	/* pointer to current position in origbuf */
-	unsigned int size;	/* current (residual) size in bytes */
-	char *origbuf;	/* unmodified pointer to orignal buffer */
-	unsigned int origsize;	/* unmodified orignal buffer size in bytes */
-};
-
 /*
  * Spin at most 'us' microseconds while 'exp' is true.
  * Caller should explicitly test 'exp' when this completes
@@ -228,9 +216,6 @@ extern struct brcmu_tlv *brcmu_parse_tlvs(void *buf, int buflen,
 extern u16 brcmu_qdbm_to_mw(u8 qdbm);
 extern u8 brcmu_mw_to_qdbm(u16 mw);
 
-extern void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size);
-extern int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...);
-
 extern uint brcmu_mkiovar(char *name, char *data, uint datalen,
 			  char *buf, uint len);
 extern uint brcmu_bitcount(u8 *bitmap, uint bytelength);
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 5/26 staging: brcm80211: replace brcmu_bitcount with hweight8

In reply to Arend van Spriel

The kernel provides bit operations to replace brcmu_bitcount so using those instead.

---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |    7 +++----
 drivers/staging/brcm80211/brcmsmac/stf.c         |   10 +++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +3 -4
index 45e3b4b..0d3c9d8 100644
@@ -15,6 +15,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/delay.h>
+#include <linux/bitops.h>
 
 #include <brcm_hw_ids.h>
 #include <chipcommon.h>
@@ -2879,8 +2880,7 @@ void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
 	pi->sh->hw_phyrxchain = rxchain;
 	pi->sh->phytxchain = txchain;
 	pi->sh->phyrxchain = rxchain;
-	pi->pubpi.phy_corenum = (u8) brcmu_bitcount((u8 *)&pi->sh->phyrxchain,
-						    sizeof(u8));
+	pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain);
 }
 
 void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
@@ -2892,8 +2892,7 @@ void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
 	if (ISNPHY(pi))
 		wlc_phy_rxcore_setstate_nphy(pih, rxchain);
 
-	pi->pubpi.phy_corenum = (u8) brcmu_bitcount((u8 *)&pi->sh->phyrxchain,
-						    sizeof(u8));
+	pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain);
 }
 
 void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain)
drivers/staging/brcm80211/brcmsmac/stf.c +5 -5
index ba3c3ef..9460cd1 100644
@@ -165,10 +165,10 @@ static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts,
 	BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
 		 wlc->pub->unit, Nsts, core_mask);
 
-	if (BRCMS_BITSCNT(core_mask) > wlc->stf->txstreams)
+	if (hweight8(core_mask) > wlc->stf->txstreams)
 		core_mask = 0;
 
-	if ((BRCMS_BITSCNT(core_mask) == wlc->stf->txstreams) &&
+	if ((hweight8(core_mask) == wlc->stf->txstreams) &&
 	    ((core_mask & ~wlc->stf->txchain)
 	     || !(core_mask & wlc->stf->txchain)))
 		core_mask = wlc->stf->txchain;
@@ -278,7 +278,7 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)
 	 * if nrate override is configured to be non-SISO STF mode, reject
 	 * reducing txchain to 1
 	 */
-	txstreams = (u8) BRCMS_BITSCNT(txchain);
+	txstreams = (u8) hweight8(txchain);
 	if (txstreams > MAX_STREAMS_SUPPORTED)
 		return -EINVAL;
 
@@ -385,7 +385,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
 	}
 
 	wlc->stf->txchain = wlc->stf->hw_txchain;
-	wlc->stf->txstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_txchain);
+	wlc->stf->txstreams = (u8) hweight8(wlc->stf->hw_txchain);
 
 	if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) {
 		if (BRCMS_ISNPHY(wlc->band))
@@ -395,7 +395,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
 	}
 
 	wlc->stf->rxchain = wlc->stf->hw_rxchain;
-	wlc->stf->rxstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_rxchain);
+	wlc->stf->rxstreams = (u8) hweight8(wlc->stf->hw_rxchain);
 
 	/* initialize the txcore table */
 	memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore));
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 6/26 staging: brcm80211: fullmac: fixed double #include

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Fix double include as detected by checkincludes script.

---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +0 -1
index d12aa75..f7b3077 100644
@@ -21,7 +21,6 @@
 #include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
-#include <linux/sched.h>
 #include <linux/bitops.h>
 #include <linux/etherdevice.h>
 #include <linux/ieee80211.h>
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 7/26 staging: brcm80211: clean up rtnl_lock in fullmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

rtnl lock is used improperly in fullmac. This patch intends to clean them up.

---
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c   |    3 ++
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   24 +--------------------
 2 files changed, 5 insertions(+), 22 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +3 -0
index 641cd9c..804b2bc 100644
@@ -32,6 +32,7 @@
 #include <linux/mutex.h>
 #include <linux/wait.h>
 #include <net/cfg80211.h>
+#include <net/rtnetlink.h>
 #include <defs.h>
 #include <brcmu_utils.h>
 #include <brcmu_wifi.h>
@@ -1240,7 +1241,9 @@ void brcmf_detach(struct brcmf_pub *drvr)
 
 			ifp = drvr_priv->iflist[0];
 			if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
+				rtnl_lock();
 				brcmf_netdev_stop(ifp->ndev);
+				rtnl_unlock();
 				unregister_netdev(ifp->ndev);
 			}
 
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +2 -22
index f7b3077..fc643c1 100644
@@ -26,7 +26,6 @@
 #include <linux/ieee80211.h>
 #include <linux/uaccess.h>
 #include <net/cfg80211.h>
-#include <net/rtnetlink.h>
 
 #include <brcmu_utils.h>
 #include <defs.h>
@@ -2223,10 +2222,8 @@ static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 
 	iscan->state = WL_ISCAN_STATE_IDLE;
-	rtnl_lock();
 	brcmf_inform_bss(cfg_priv);
 	brcmf_notify_iscan_complete(iscan, false);
-	rtnl_unlock();
 
 	return err;
 }
@@ -2248,10 +2245,8 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv)
 	struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan;
 	s32 err = 0;
 
-	rtnl_lock();
 	brcmf_inform_bss(cfg_priv);
 	brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE);
-	rtnl_unlock();
 	/* Reschedule the timer */
 	mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
 	iscan->timer_on = 1;
@@ -2265,9 +2260,7 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 
 	iscan->state = WL_ISCAN_STATE_IDLE;
-	rtnl_lock();
 	brcmf_notify_iscan_complete(iscan, true);
-	rtnl_unlock();
 
 	return err;
 }
@@ -2286,12 +2279,10 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
 		iscan->timer_on = 0;
 	}
 
-	rtnl_lock();
 	if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) {
 		status = BRCMF_SCAN_RESULTS_ABORTED;
 		WL_ERR("Abort iscan\n");
 	}
-	rtnl_unlock();
 
 	el->handler[status](cfg_priv);
 }
@@ -2408,9 +2399,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
 		 * generated due to DISASSOC call to the fw to keep
 		 * the state fw and WPA_Supplicant state consistent
 		 */
-		rtnl_unlock();
 		brcmf_delay(500);
-		rtnl_lock();
 	}
 
 	set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
@@ -2978,7 +2967,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
 	u16 flags = be16_to_cpu(e->flags);
 	enum nl80211_key_type key_type;
 
-	rtnl_lock();
 	if (flags & BRCMF_EVENT_MSG_GROUP)
 		key_type = NL80211_KEYTYPE_GROUP;
 	else
@@ -2986,7 +2974,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
 
 	cfg80211_michael_mic_failure(ndev, (u8 *)&e->addr, key_type, -1,
 				     NULL, GFP_KERNEL);
-	rtnl_unlock();
 
 	return 0;
 }
@@ -3563,8 +3550,7 @@ static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv)
 	return wl_update_wiphybands(cfg_priv);
 }
 
-static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
-			       bool need_lock)
+static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
 {
 	struct net_device *ndev;
 	struct wireless_dev *wdev;
@@ -3576,8 +3562,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
 
 	ndev = cfg_to_ndev(cfg_priv);
 	wdev = ndev->ieee80211_ptr;
-	if (need_lock)
-		rtnl_lock();
 
 	brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME,
 			WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME);
@@ -3607,8 +3591,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
 	/* -EINPROGRESS: Call commit handler */
 
 default_conf_out:
-	if (need_lock)
-		rtnl_unlock();
 
 	cfg_priv->dongle_up = true;
 
@@ -3658,7 +3640,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv)
 
 	brcmf_debugfs_add_netdev_params(cfg_priv);
 
-	err = brcmf_config_dongle(cfg_priv, false);
+	err = brcmf_config_dongle(cfg_priv);
 	if (err)
 		return err;
 
@@ -3683,9 +3665,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
 		   generated due to DISASSOC call to the fw to keep
 		   the state fw and WPA_Supplicant state consistent
 		 */
-		rtnl_unlock();
 		brcmf_delay(500);
-		rtnl_lock();
 	}
 
 	set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 8/26 staging: brcm80211: remove fullmac module_param for intr/poll mode

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

Use constant for interrupt/polling mode configuration.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +2 -10
index 5423280..6c2391b 100644
@@ -725,14 +725,6 @@ module_param(brcmf_dpc_prio, int, 0);
 
 #define SDIO_DRIVE_STRENGTH	6	/* in milliamps */
 
-/* Use polling */
-uint brcmf_poll;
-module_param(brcmf_poll, uint, 0);
-
-/* Use interrupts */
-uint brcmf_intr = true;
-module_param(brcmf_intr, uint, 0);
-
 #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
 
 /* Retry count for register access failures */
@@ -4324,8 +4316,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
 				    BRCMF_SDALIGN);
 
 	/* Set the poll and/or interrupt flags */
-	bus->intr = (bool) brcmf_intr;
-	bus->poll = (bool) brcmf_poll;
+	bus->intr = true;
+	bus->poll = false;
 	if (bus->poll)
 		bus->pollrate = 1;
 
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH 9/26 staging: brcm80211: stop using assigned thread priority in fullmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

Stop assigning priority to watchdog and dpc threads. Remove related code.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   60 ++----------------------
 1 files changed, 5 insertions(+), 55 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +5 -55
index 6c2391b..f3e6249 100644
@@ -715,14 +715,6 @@ static int qcount[NUMPRIO];
 static int tx_packets[NUMPRIO];
 #endif				/* BCMDBG */
 
-/* Watchdog thread priority, -1 to use kernel timer */
-int brcmf_watchdog_prio = 97;
-module_param(brcmf_watchdog_prio, int, 0);
-
-/* DPC thread priority, -1 to use tasklet */
-int brcmf_dpc_prio = 98;
-module_param(brcmf_dpc_prio, int, 0);
-
 #define SDIO_DRIVE_STRENGTH	6	/* in milliamps */
 
 #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
@@ -2692,16 +2684,6 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *) data;
 
-	/* This thread doesn't need any user-level access,
-	 * so get rid of all our resources
-	 */
-	if (brcmf_dpc_prio > 0) {
-		struct sched_param param;
-		param.sched_priority = (brcmf_dpc_prio < MAX_RT_PRIO) ?
-				       brcmf_dpc_prio : (MAX_RT_PRIO - 1);
-		sched_setscheduler(current, SCHED_FIFO, &param);
-	}
-
 	allow_signal(SIGTERM);
 	/* Run until signal received */
 	while (1) {
@@ -4364,16 +4346,6 @@ brcmf_sdbrcm_watchdog_thread(void *data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *)data;
 
-	/* This thread doesn't need any user-level access,
-	* so get rid of all our resources
-	*/
-	if (brcmf_watchdog_prio > 0) {
-		struct sched_param param;
-		param.sched_priority = (brcmf_watchdog_prio < MAX_RT_PRIO) ?
-				       brcmf_watchdog_prio : (MAX_RT_PRIO - 1);
-		sched_setscheduler(current, SCHED_FIFO, &param);
-	}
-
 	allow_signal(SIGTERM);
 	/* Run until signal received */
 	while (1) {
@@ -4394,7 +4366,7 @@ brcmf_sdbrcm_watchdog(unsigned long data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *)data;
 
-	if (brcmf_watchdog_prio >= 0) {
+	if (bus->threads_only) {
 		if (bus->watchdog_tsk)
 			complete(&bus->watchdog_wait);
 		else
@@ -4493,6 +4465,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 	bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
 	bus->usebufpool = false;	/* Use bufpool if allocated,
 					 else use locally malloced rxbuf */
+	bus->threads_only = true;
 
 	/* attempt to attach to the dongle */
 	if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) {
@@ -4510,14 +4483,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 	bus->timer.function = brcmf_sdbrcm_watchdog;
 
 	/* Initialize thread based operation and lock */
-	if ((brcmf_watchdog_prio >= 0) && (brcmf_dpc_prio >= 0)) {
-		bus->threads_only = true;
+	if (bus->threads_only) {
 		sema_init(&bus->sdsem, 1);
-	} else {
-		bus->threads_only = false;
-	}
 
-	if (brcmf_dpc_prio >= 0) {
 		/* Initialize watchdog thread */
 		init_completion(&bus->watchdog_wait);
 		bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread,
@@ -4527,11 +4495,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 			       "brcmf_watchdog thread failed to start\n");
 			bus->watchdog_tsk = NULL;
 		}
-	} else
-		bus->watchdog_tsk = NULL;
-
-	/* Set up the bottom half handler */
-	if (brcmf_dpc_prio >= 0) {
 		/* Initialize DPC thread */
 		init_completion(&bus->dpc_wait);
 		bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread,
@@ -4542,9 +4505,10 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 			bus->dpc_tsk = NULL;
 		}
 	} else {
+		bus->watchdog_tsk = NULL;
+		bus->dpc_tsk = NULL;
 		tasklet_init(&bus->tasklet, brcmf_sdbrcm_dpc_tasklet,
 			     (unsigned long)bus);
-		bus->dpc_tsk = NULL;
 	}
 
 	/* Attach to the brcmf/OS/network interface */
@@ -4613,20 +4577,6 @@ int brcmf_bus_register(void)
 {
 	brcmf_dbg(TRACE, "Enter\n");
 
-	/* Sanity check on the module parameters */
-	do {
-		/* Both watchdog and DPC as tasklets are ok */
-		if ((brcmf_watchdog_prio < 0) && (brcmf_dpc_prio < 0))
-			break;
-
-		/* If both watchdog and DPC are threads, TX must be deferred */
-		if (brcmf_watchdog_prio >= 0 && brcmf_dpc_prio >= 0)
-			break;
-
-		brcmf_dbg(ERROR, "Invalid module parameters.\n");
-		return -EINVAL;
-	} while (0);
-
 	return brcmf_sdio_register();
 }
 
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH 10/26 staging: brcm80211: fixed checkpatch warnings

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |   14 ++++++--------
 drivers/staging/brcm80211/brcmsmac/main.c    |    3 +--
 drivers/staging/brcm80211/brcmsmac/nicpci.c  |    3 +--
 drivers/staging/brcm80211/brcmsmac/srom.c    |    3 +--
 4 files changed, 9 insertions(+), 14 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +6 -8
index 0b3ba6a..8d4024e 100644
@@ -1054,9 +1054,8 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	cc = (struct chipcregs __iomem *) regs;
 
 	/* bus/core/clk setup for register access */
-	if (!ai_buscore_prep(sii)) {
+	if (!ai_buscore_prep(sii))
 		return NULL;
-	}
 
 	/*
 	 * ChipID recognition.
@@ -1084,19 +1083,18 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		return NULL;
 	}
 	/* no cores found, bail out */
-	if (sii->numcores == 0) {
+	if (sii->numcores == 0)
 		return NULL;
-	}
+
 	/* bus/core/clk setup */
 	origidx = SI_CC_IDX;
-	if (!ai_buscore_setup(sii, savewin, &origidx)) {
+	if (!ai_buscore_setup(sii, savewin, &origidx))
 		goto exit;
-	}
 
 	/* Init nvram from sprom/otp if they exist */
-	if (srom_var_init(&sii->pub, cc, vars, varsz)) {
+	if (srom_var_init(&sii->pub, cc, vars, varsz))
 		goto exit;
-	}
+
 	pvars = vars ? *vars : NULL;
 	ai_nvram_process(sii, pvars);
 
drivers/staging/brcm80211/brcmsmac/main.c +1 -2
index 39b91d6..db05521 100644
@@ -5995,9 +5995,8 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 	 * If we are switching to gmode == GMODE_LEGACY_B,
 	 * clean up rate info that may refer to OFDM rates.
 	 */
-	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B)) {
+	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B))
 		band->gmode = gmode;
-	}
 
 	band->gmode = gmode;
 
drivers/staging/brcm80211/brcmsmac/nicpci.c +1 -2
index e3cce29..460b105 100644
@@ -394,9 +394,8 @@ static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk)
 		i++;
 	}
 
-	if (i >= pcie_serdes_spinwait) {
+	if (i >= pcie_serdes_spinwait)
 		return false;
-	}
 
 	return true;
 }
drivers/staging/brcm80211/brcmsmac/srom.c +1 -2
index 6f3b12c..13d17eb 100644
@@ -1175,8 +1175,7 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap,
 			if (sromrev == 0x10)
 				sromrev = 1;
 		}
-	}
-	else {
+	} else {
 		/* Use OTP if SPROM not available */
 		err = otp_read_pci(sih, srom, SROM_MAX);
 		if (err == 0)
Signature · 1 line
1.7.4.1
#11 lore raw

PATCH 11/26 staging: brcm80211: removed accessor functions for band type and etheraddress.

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

Functions were trivial so not really adding value.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +5 -16
index db05521..b6c4361 100644
@@ -1369,16 +1369,6 @@ static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw)
 		  DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly);
 }
 
-static void brcms_b_hw_etheraddr(struct brcms_hardware *wlc_hw, u8 *ea)
-{
-	memcpy(ea, wlc_hw->etheraddr, ETH_ALEN);
-}
-
-static int brcms_b_bandtype(struct brcms_hardware *wlc_hw)
-{
-	return wlc_hw->band->bandtype;
-}
-
 /* control chip clock to save power, enable dynamic clock or force fast clock */
 static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode)
 {
@@ -3939,7 +3929,7 @@ static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot)
 {
 	wlc_hw->shortslot = shortslot;
 
-	if (brcms_b_bandtype(wlc_hw) == BRCM_BAND_2G && wlc_hw->up) {
+	if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) {
 		brcms_c_suspend_mac_and_wait(wlc_hw->wlc);
 		brcms_b_update_slot_timing(wlc_hw, shortslot);
 		brcms_c_enable_mac(wlc_hw->wlc);
@@ -4854,8 +4844,8 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 		/* Get a phy for this band */
 		wlc_hw->band->pi =
 			wlc_phy_attach(wlc_hw->phy_sh, regs,
-				       brcms_b_bandtype(wlc_hw), vars,
-				       wlc->wiphy);
+					wlc_hw->band->bandtype, vars,
+					wlc->wiphy);
 		if (wlc_hw->band->pi == NULL) {
 			wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_"
 				  "attach failed\n", unit);
@@ -5235,9 +5225,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	for (i = 0; i < NFIFO; i++)
 		wlc->core->txavail[i] = wlc->hw->txavail[i];
 
-	brcms_b_hw_etheraddr(wlc->hw, wlc->perm_etheraddr);
-
-	memcpy(&pub->cur_etheraddr, &wlc->perm_etheraddr, ETH_ALEN);
+	memcpy(&wlc->perm_etheraddr, &wlc->hw->etheraddr, ETH_ALEN);
+	memcpy(&pub->cur_etheraddr, &wlc->hw->etheraddr, ETH_ALEN);
 
 	for (j = 0; j < wlc->pub->_nbands; j++) {
 		wlc->band = wlc->bandstate[j];
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 12/26 staging: brcm80211: fixed function returns

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed unneeded return statements at end of functions.
- changed return value of brcms_c_radio_monitor_start to void.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   23 ++---------------------
 1 files changed, 2 insertions(+), 21 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +2 -21
index b6c4361..dc95ba0 100644
@@ -1572,8 +1572,6 @@ void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw,
 
 	brcms_c_mctrl_write(wlc_hw);
 	brcms_b_wait_for_wake(wlc_hw);
-
-	return;
 }
 
 void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
@@ -1585,8 +1583,6 @@ void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
 		return;
 
 	brcms_c_mctrl_write(wlc_hw);
-
-	return;
 }
 
 /* When driver needs ucode to stop beaconing, it has to make sure that
@@ -1607,8 +1603,6 @@ static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw)
 		return;
 
 	brcms_c_mctrl_write(wlc_hw);
-
-	return;
 }
 
 /* Clear the override on AP and INFRA bits */
@@ -3217,8 +3211,6 @@ static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit)
 				brcms_b_xtal(wlc_hw, OFF);
 		}
 	}
-
-	return;
 }
 
 static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)
@@ -4308,17 +4300,16 @@ static void brcms_c_down_led_upd(struct brcms_c_info *wlc)
 	brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
 }
 
-static bool brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
+static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
 {
 	/* Don't start the timer if HWRADIO feature is disabled */
 	if (wlc->radio_monitor)
-		return true;
+		return;
 
 	wlc->radio_monitor = true;
 	brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_RADIO_MON);
 	brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK,
 			true);
-	return true;
 }
 
 void brcms_c_radio_disable(struct brcms_c_info *wlc)
@@ -6123,8 +6114,6 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)
 		r = wlc->default_bss->rateset.rates[0];
 
 	wlc_phy_ofdm_rateset_war(wlc->band->pi, war);
-
-	return;
 }
 
 int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel)
@@ -7785,8 +7774,6 @@ brcms_c_compute_ofdm_plcp(u32 rspec, u32 length, u8 *plcp)
 	plcp[2] |= (tmp >> 16) & 0xff;
 	plcp[1] |= (tmp >> 8) & 0xff;
 	plcp[0] |= tmp & 0xff;
-
-	return;
 }
 
 /* Rate: 802.11 rate code, length: PSDU length in octets */
@@ -7808,7 +7795,6 @@ brcms_c_compute_plcp(struct brcms_c_info *wlc, u32 rspec,
 		brcms_c_compute_ofdm_plcp(rspec, length, plcp);
 	else
 		brcms_c_compute_cck_plcp(wlc, rspec, length, plcp);
-	return;
 }
 
 /* brcms_c_compute_rtscts_dur()
@@ -7997,8 +7983,6 @@ brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr,
 	/* read the tsf timer low, then high to get an atomic read */
 	*tsf_l_ptr = R_REG(&regs->tsf_timerlow);
 	*tsf_h_ptr = R_REG(&regs->tsf_timerhigh);
-
-	return;
 }
 
 /*
@@ -8175,7 +8159,6 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
 
 	memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
 	ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
-	return;
 }
 
 /* Process received frames */
@@ -8683,8 +8666,6 @@ brcms_c_bcn_prb_template(struct brcms_c_info *wlc, u16 type,
 	memcpy(&h->bssid, &cfg->BSSID, ETH_ALEN);
 
 	/* SEQ filled in by MAC */
-
-	return;
 }
 
 int brcms_c_get_header_len(void)
Signature · 1 line
1.7.4.1
#13 lore raw

PATCH 13/26 staging: brcm80211: made NULL ethernet address const

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

---
 drivers/staging/brcm80211/brcmsmac/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
index dc95ba0..6a0a5d0 100644
@@ -2646,7 +2646,7 @@ static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw,
 
 static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags)
 {
-	u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
+	const u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 
 	if (on) {
 		/* suspend tx fifos */
Signature · 1 line
1.7.4.1
#14 lore raw

PATCH 14/26 staging: brcm80211: removed empty brcms_c_reset_bmac_done callback function

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

Empty functions are good candidates for removal.

---
 drivers/staging/brcm80211/brcmsmac/main.c |    6 ------
 drivers/staging/brcm80211/brcmsmac/main.h |    1 -
 2 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -6
index 6a0a5d0..d75756d 100644
@@ -3258,8 +3258,6 @@ static void brcms_b_reset(struct brcms_hardware *wlc_hw)
 
 	/* purge the dma rings */
 	brcms_c_flushqueues(wlc_hw->wlc);
-
-	brcms_c_reset_bmac_done(wlc_hw->wlc);
 }
 
 void brcms_c_reset(struct brcms_c_info *wlc)
@@ -8868,10 +8866,6 @@ void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit)
 	brcms_b_pllreq(wlc->hw, set, req_bit);
 }
 
-void brcms_c_reset_bmac_done(struct brcms_c_info *wlc)
-{
-}
-
 /* check for the particular priority flow control bit being set */
 bool
 brcms_c_txflowcontrol_prio_isset(struct brcms_c_info *wlc,
drivers/staging/brcm80211/brcmsmac/main.h +0 -1
index 9e1575c..5a2ec53 100644
@@ -677,7 +677,6 @@ extern int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo,
 extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
 				       int len, void *buf);
 extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
-extern void brcms_c_reset_bmac_done(struct brcms_c_info *wlc);
 
 #if defined(BCMDBG)
 extern void brcms_c_print_rxh(struct d11rxhdr *rxh);
Signature · 1 line
1.7.4.1
#15 lore raw

PATCH 15/26 staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

---
 drivers/staging/brcm80211/brcmsmac/main.c |   40 +++++++++++++----------------
 1 files changed, 18 insertions(+), 22 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +18 -22
index d75756d..3349716 100644
@@ -4199,26 +4199,23 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 		return;
 	}
 
-	do {
-		memset((char *)&acp_shm, 0, sizeof(struct shm_acparams));
-		/* fill in shm ac params struct */
-		acp_shm.txop = params->txop;
-		/* convert from units of 32us to us for ucode */
-		wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
-		    EDCF_TXOP2USEC(acp_shm.txop);
-		acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK);
-
-		if (aci == AC_VI && acp_shm.txop == 0
-		    && acp_shm.aifs < EDCF_AIFSN_MAX)
-			acp_shm.aifs++;
-
-		if (acp_shm.aifs < EDCF_AIFSN_MIN
-		    || acp_shm.aifs > EDCF_AIFSN_MAX) {
-			wiphy_err(wlc->wiphy, "wl%d: edcf_setparams: bad "
-				  "aifs %d\n", wlc->pub->unit, acp_shm.aifs);
-			continue;
-		}
-
+	memset((char *)&acp_shm, 0, sizeof(struct shm_acparams));
+	/* fill in shm ac params struct */
+	acp_shm.txop = params->txop;
+	/* convert from units of 32us to us for ucode */
+	wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
+	    EDCF_TXOP2USEC(acp_shm.txop);
+	acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK);
+
+	if (aci == AC_VI && acp_shm.txop == 0
+	    && acp_shm.aifs < EDCF_AIFSN_MAX)
+		acp_shm.aifs++;
+
+	if (acp_shm.aifs < EDCF_AIFSN_MIN
+	    || acp_shm.aifs > EDCF_AIFSN_MAX) {
+		wiphy_err(wlc->wiphy, "wl%d: edcf_setparams: bad "
+			  "aifs %d\n", wlc->pub->unit, acp_shm.aifs);
+	} else {
 		acp_shm.cwmin = params->cw_min;
 		acp_shm.cwmax = params->cw_max;
 		acp_shm.cwcur = acp_shm.cwmin;
@@ -4239,8 +4236,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 					  M_EDCF_QINFO +
 					  wme_ac2fifo[aci] * M_EDCF_QLEN + i,
 					  *shm_entry++);
-
-	} while (0);
+	}
 
 	if (suspend)
 		brcms_c_suspend_mac_and_wait(wlc);
Signature · 1 line
1.7.4.1
#16 lore raw

PATCH 16/26 staging: brcm80211: removed redundant code from brcms_c_set_gmode

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

The comment says the rateset is being cleared when switching to GMODE_LEGACY_B, but the code that follows it does not do so. Besides, the rateset is already valid at this point.

---
 drivers/staging/brcm80211/brcmsmac/main.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -7
index 3349716..9988e03 100644
@@ -5965,13 +5965,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 		return -ENOTSUPP;
 	}
 
-	/*
-	 * If we are switching to gmode == GMODE_LEGACY_B,
-	 * clean up rate info that may refer to OFDM rates.
-	 */
-	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B))
-		band->gmode = gmode;
-
 	band->gmode = gmode;
 
 	wlc->shortslot_override = shortslot;
Signature · 1 line
1.7.4.1
#17 lore raw

PATCH 17/26 staging: brcm80211: cleanup of shared memory related wrapper functions

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed brcms_c_read_shm and brcms_c_write_shm functions.
- removed redundant argument check from brcms_c_copyto_shm function.

---
 drivers/staging/brcm80211/brcmsmac/ampdu.c  |   10 ++--
 drivers/staging/brcm80211/brcmsmac/antsel.c |    4 +-
 drivers/staging/brcm80211/brcmsmac/main.c   |   78 ++++++++++++---------------
 drivers/staging/brcm80211/brcmsmac/main.h   |    2 -
 4 files changed, 41 insertions(+), 53 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +5 -5
index e29c62e..506c392 100644
@@ -369,7 +369,7 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
 	u16 cur_txunfl;
 
 	/* return if we got here for a different reason than underflows */
-	cur_txunfl = brcms_c_read_shm(wlc,
+	cur_txunfl = brcms_b_read_shm(wlc->hw,
 				      M_UCODE_MACSTAT +
 				      offsetof(struct macstat, txfunfl[fid]));
 	new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl);
@@ -1182,11 +1182,11 @@ void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
 	 */
 	if ((ampdu->rx_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) ==
 	    IEEE80211_HT_MAX_AMPDU_64K) {
-		brcms_c_write_shm(wlc, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX);
-		brcms_c_write_shm(wlc, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX);
+		brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX);
+		brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX);
 	} else {
-		brcms_c_write_shm(wlc, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF);
-		brcms_c_write_shm(wlc, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF);
+		brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF);
+		brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF);
 	}
 }
 
drivers/staging/brcm80211/brcmsmac/antsel.c +2 -2
index c61c520..c2aa47b 100644
@@ -206,7 +206,7 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	 */
 	ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
-	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
+	brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
 	/*
 	 * Update driver stats for currently selected
 	 * default tx/rx antenna config
@@ -218,7 +218,7 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	 */
 	ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
-	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
+	brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
 	/*
 	 * Update driver stats for currently selected
 	 * default tx/rx antenna config
drivers/staging/brcm80211/brcmsmac/main.c +34 -44

207 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/main.h +0 -2
index 5a2ec53..6512e7a 100644
@@ -732,8 +732,6 @@ extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
 			       void (*dma_callback_fn));
 
 /* Shared memory access */
-extern void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v);
-extern u16 brcms_c_read_shm(struct brcms_c_info *wlc, uint offset);
 extern void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset,
 			       const void *buf, int len);
 
Signature · 1 line
1.7.4.1
#18 lore raw

PATCH 18/26 staging: brcm80211: cleanup of transmit buffer size related wrapper function

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

Removed brcms_c_xmtfifo_sz_get function.

---
 drivers/staging/brcm80211/brcmsmac/ampdu.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c  |    7 +------
 drivers/staging/brcm80211/brcmsmac/main.h  |    4 ++--
 3 files changed, 4 insertions(+), 9 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +1 -1
index 506c392..fc49900 100644
@@ -383,7 +383,7 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
 		return 1;
 
 	/* check if fifo is big enough */
-	if (brcms_c_xmtfifo_sz_get(wlc, fid, &xmtfifo_sz))
+	if (brcms_b_xmtfifo_sz_get(wlc->hw, fid, &xmtfifo_sz))
 		return -1;
 
 	if ((TXFIFO_SIZE_UNIT * (u32) xmtfifo_sz) <= ampdu->ffpld_rsvd)
drivers/staging/brcm80211/brcmsmac/main.c +1 -6
index 5d3bfda..cbed10c 100644
@@ -8809,7 +8809,7 @@ void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val, int bands)
 	brcms_b_mhf(wlc->hw, idx, mask, val, bands);
 }
 
-static int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
+int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 			   uint *blocks)
 {
 	if (fifo >= NFIFO)
@@ -8820,11 +8820,6 @@ static int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 	return 0;
 }
 
-int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo, uint *blocks)
-{
-	return brcms_b_xmtfifo_sz_get(wlc->hw, fifo, blocks);
-}
-
 void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset, int len,
 			    void *buf)
 {
drivers/staging/brcm80211/brcmsmac/main.h +2 -2
index 6512e7a..a71c509 100644
@@ -672,8 +672,8 @@ extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
 			    struct sk_buff *sdu, uint prec);
 extern void brcms_c_info_init(struct brcms_c_info *wlc, int unit);
 extern void brcms_c_print_txstatus(struct tx_status *txs);
-extern int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo,
-				  uint *blocks);
+extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
+		   uint *blocks);
 extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
 				       int len, void *buf);
 extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
Signature · 1 line
1.7.4.1
#19 lore raw

PATCH 19/26 staging: brcm80211: cleanup of several wrapper functions

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed brcms_c_write_template_ram function.
- removed brcms_c_mctrl function.
- removed brcms_c_pllreq function.
- removed brcms_c_mhf function.
- removed brcms_c_rate_shm_offset function.
- removed brcms_c_write_hw_bcntemplates function.

---
 drivers/staging/brcm80211/brcmsmac/ampdu.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c  |   51 ++++++---------------------
 drivers/staging/brcm80211/brcmsmac/main.h  |    3 --
 3 files changed, 13 insertions(+), 43 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +1 -1
index fc49900..7f27dbd 100644
@@ -1162,7 +1162,7 @@ void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc)
 	/* driver needs to write the ta in the template; ta is at offset 16 */
 	memset(template, 0, sizeof(template));
 	memcpy(template, wlc->pub->cur_etheraddr, ETH_ALEN);
-	brcms_c_write_template_ram(wlc, (T_BA_TPL_BASE + 16),
+	brcms_b_write_template_ram(wlc->hw, (T_BA_TPL_BASE + 16),
 				  (T_RAM_ACCESS_SZ * 2),
 				  template);
 }
drivers/staging/brcm80211/brcmsmac/main.c +12 -39

132 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/main.h +0 -3
index a71c509..99d5c60 100644
@@ -674,9 +674,6 @@ extern void brcms_c_info_init(struct brcms_c_info *wlc, int unit);
 extern void brcms_c_print_txstatus(struct tx_status *txs);
 extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 		   uint *blocks);
-extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
-				       int len, void *buf);
-extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
 
 #if defined(BCMDBG)
 extern void brcms_c_print_rxh(struct d11rxhdr *rxh);
Signature · 1 line
1.7.4.1
#20 lore raw

PATCH 20/26 staging: brcm80211: removed unneeded call to brcms_b_tx_fifo_suspended

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed call to brcms_b_tx_fifo_suspended on receipt of TX FIFO suspend/flush completion signal.
- removed brcms_b_tx_fifo_suspended function as it is not being used elsewhere.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   34 -----------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -34
index bd38f33..175d85e 100644
@@ -1075,36 +1075,6 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 	return morepending;
 }
 
-/* brcms_b_tx_fifo_suspended:
- * Check the MAC's tx suspend status for a tx fifo.
- *
- * When the MAC acknowledges a tx suspend, it indicates that no more
- * packets will be transmitted out the radio. This is independent of
- * DMA channel suspension---the DMA may have finished suspending, or may still
- * be pulling data into a tx fifo, by the time the MAC acks the suspend
- * request.
- */
-static bool brcms_b_tx_fifo_suspended(struct brcms_hardware *wlc_hw,
-				      uint tx_fifo)
-{
-	/* check that a suspend has been requested and is no longer pending */
-
-	/*
-	 * for DMA mode, the suspend request is set in xmtcontrol of the DMA
-	 * engine, and the tx fifo suspend at the lower end of the MAC is
-	 * acknowledged in the chnstatus register.
-	 *
-	 * The tx fifo suspend completion is independent of the DMA suspend
-	 * completion and may be acked before or after the DMA is suspended.
-	 */
-	if (dma_txsuspended(wlc_hw->di[tx_fifo]) &&
-	    (R_REG(&wlc_hw->regs->chnstatus) &
-	     (1 << tx_fifo)) == 0)
-		return true;
-
-	return false;
-}
-
 /* second-level interrupt processing
  *   Return true if another dpc needs to be re-scheduled. false otherwise.
  *   Param 'bounded' indicates if applicable loops should be bounded.
@@ -1161,10 +1131,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 		if (brcms_b_recv(wlc_hw, RX_FIFO, bounded))
 			wlc->macintstatus |= MI_DMAINT;
 
-	/* TX FIFO suspend/flush completion */
-	if (macintstatus & MI_TXSTOP)
-		brcms_b_tx_fifo_suspended(wlc_hw, TX_DATA_FIFO);
-
 	/* noise sample collected */
 	if (macintstatus & MI_BG_NOISE)
 		wlc_phy_noise_sample_intr(wlc_hw->band->pi);
Signature · 1 line
1.7.4.1
#21 lore raw

PATCH 21/26 staging: brcm80211: removed synchronisation of wlc->machwcap field

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed copying field wlc->machwcap from brcms_hardware to brcms_c_info during module attach.
- field wlc->machwcap was written but never read. Therefore it was removed.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   39 +----------------------------
 drivers/staging/brcm80211/brcmsmac/main.h |    2 -
 2 files changed, 1 insertions(+), 40 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +1 -38
index 175d85e..0656d99 100644
@@ -390,13 +390,6 @@ static int brcms_chspec_bw(u16 chanspec)
 	return BRCMS_10_MHZ;
 }
 
-/* dup state between BMAC(struct brcms_hardware) and HIGH(struct brcms_c_info)
-   driver */
-struct brcms_b_state {
-	u32 machwcap;	/* mac hw capibility */
-	u32 preamble_ovr;	/* preamble override */
-};
-
 struct edcf_acparam {
 	u8 ACI;
 	u8 ECW;
@@ -1168,14 +1161,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 	return wlc->macintstatus != 0;
 }
 
-static int brcms_b_state_get(struct brcms_hardware *wlc_hw,
-		      struct brcms_b_state *state)
-{
-	state->machwcap = wlc_hw->machwcap;
-
-	return 0;
-}
-
 /* set initial host flags value */
 static void
 brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init)
@@ -4534,20 +4519,6 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
 	wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
 }
 
-static bool brcms_c_state_bmac_sync(struct brcms_c_info *wlc)
-{
-	struct brcms_b_state state_bmac = {0};
-
-	if (brcms_b_state_get(wlc->hw, &state_bmac) != 0)
-		return false;
-
-	wlc->machwcap = state_bmac.machwcap;
-	brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR,
-			   (s8) state_bmac.preamble_ovr);
-
-	return true;
-}
-
 static uint brcms_c_attach_module(struct brcms_c_info *wlc)
 {
 	uint err = 0;
@@ -5151,15 +5122,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	if (err)
 		goto fail;
 
-	/*
-	 * for some states, due to different info pointer(e,g, wlc, wlc_hw) or
-	 * master/slave split, HIGH driver(both monolithic and HIGH_ONLY) needs
-	 * to sync states FROM BMAC portion driver
-	 */
-	if (!brcms_c_state_bmac_sync(wlc)) {
-		err = 20;
-		goto fail;
-	}
+	brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR, OFF);
 
 	pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band);
 
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
index 99d5c60..441292a 100644
@@ -519,8 +519,6 @@ struct brcms_c_info {
 	u16 deviceid;
 	uint ucode_rev;
 
-	u32 machwcap;
-
 	u8 perm_etheraddr[ETH_ALEN];
 
 	bool bandlocked;
Signature · 1 line
1.7.4.1
#22 lore raw

PATCH 22/26 staging: brcm80211: remove brcms_b_dotxstatus wrapper function

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

- removed brcms_b_dotxstatus
- changed 'fatal' argument of brcms_b_txstatus from INOUT to OUT.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +4 -18
index 0656d99..4e2226e 100644
@@ -995,21 +995,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 
 }
 
-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,
-	 *   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))
-		return false;
-
-	return brcms_c_dotxstatus(wlc_hw->wlc, txs);
-}
-
 /* process tx completion events in BMAC
  * Return true if more tx status need to be processed. false otherwise.
  */
@@ -1032,6 +1017,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 
 	txs = &txstatus;
 	regs = wlc_hw->regs;
+	*fatal = false;
 	while (!(*fatal)
 	       && (s1 = R_REG(&regs->frmtxstatus)) & TXS_V) {
 
@@ -1041,7 +1027,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 			return morepending;
 		}
 
-			s2 = R_REG(&regs->frmtxstatus2);
+		s2 = R_REG(&regs->frmtxstatus2);
 
 		txs->status = s1 & TXS_STATUS_MASK;
 		txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT;
@@ -1049,7 +1035,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);
+		*fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs);
 
 		/* !give others some time to run! */
 		if (++n >= max_tx_num)
@@ -1077,7 +1063,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 	u32 macintstatus;
 	struct brcms_hardware *wlc_hw = wlc->hw;
 	struct d11regs __iomem *regs = wlc_hw->regs;
-	bool fatal = false;
 	struct wiphy *wiphy = wlc->wiphy;
 
 	if (brcms_deviceremoved(wlc)) {
@@ -1098,6 +1083,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 
 	/* tx status */
 	if (macintstatus & MI_TFS) {
+		bool fatal;
 		if (brcms_b_txstatus(wlc->hw, bounded, &fatal))
 			wlc->macintstatus |= MI_TFS;
 		if (fatal) {
Signature · 1 line
1.7.4.1
#23 lore raw

PATCH 23/26 staging: brcm80211: combined if statements

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

Combined if statements in brcms_c_edcf_setparams and brcms_c_wme_setparams functions.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +4 -8
index 4e2226e..30c5573 100644
@@ -4186,12 +4186,10 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 					  *shm_entry++);
 	}
 
-	if (suspend)
+	if (suspend) {
 		brcms_c_suspend_mac_and_wait(wlc);
-
-	if (suspend)
 		brcms_c_enable_mac(wlc);
-
+	}
 }
 
 void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
@@ -4223,12 +4221,10 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
 		brcms_c_wme_setparams(wlc, aci, &txq_pars, suspend);
 	}
 
-	if (suspend)
+	if (suspend) {
 		brcms_c_suspend_mac_and_wait(wlc);
-
-	if (suspend)
 		brcms_c_enable_mac(wlc);
-
+	}
 }
 
 /* maintain LED behavior in down state */
Signature · 1 line
1.7.4.1
#24 lore raw

PATCH 24/26 staging: brcm80211: remove N mode validation function

In reply to Arend van Spriel

From: Alwin Beukers <[email protected]>

Removed the brcms_c_nmode_validate function as it only checks N-mode capability, which should always be true.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -29
index 30c5573..9fa8485 100644
@@ -5912,40 +5912,11 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 	return ret;
 }
 
-static int brcms_c_nmode_validate(struct brcms_c_info *wlc, s32 nmode)
-{
-	int err = 0;
-
-	switch (nmode) {
-
-	case OFF:
-		break;
-
-	case AUTO:
-	case WL_11N_2x2:
-	case WL_11N_3x3:
-		if (!(BRCMS_PHY_11N_CAP(wlc->band)))
-			err = -EINVAL;
-		break;
-
-	default:
-		err = -EINVAL;
-		break;
-	}
-
-	return err;
-}
-
 int brcms_c_set_nmode(struct brcms_c_info *wlc)
 {
 	uint i;
-	int err;
 	s32 nmode = AUTO;
 
-	err = brcms_c_nmode_validate(wlc, nmode);
-	if (err)
-		return err;
-
 	if (wlc->stf->txstreams == WL_11N_3x3)
 		nmode = WL_11N_3x3;
 	else
Signature · 1 line
1.7.4.1
#25 lore raw

PATCH 25/26 staging: brcm80211: softmac: added event tracing

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Dpc and timer events can now be traced. Combined with Mac80211 driver callback tracing, all entry points into the driver can now be traced.

---
 drivers/staging/brcm80211/brcmsmac/Makefile        |    3 +-
 .../brcm80211/brcmsmac/brcms_trace_events.c        |   23 +++++
 .../brcm80211/brcmsmac/brcms_trace_events.h        |   92 ++++++++++++++++++++
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |   10 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h   |    2 +
 5 files changed, 124 insertions(+), 6 deletions(-)
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h
drivers/staging/brcm80211/brcmsmac/Makefile +2 -1
index e44859d..a8a152b 100644
@@ -42,7 +42,8 @@ BRCMSMAC_OFILES := \
 	otp.o \
 	srom.o \
 	dma.o \
-	nicpci.o
+	nicpci.o \
+	brcms_trace_events.o
 
 MODULEPFX := brcmsmac
 
drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c new file +23 -0
new file mode 100644
index 0000000..52fc9ee
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2011 Broadcom Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/module.h> /* bug in tracepoint.h, it should include this */
+
+#ifndef __CHECKER__
+#include "mac80211_if.h"
+#define CREATE_TRACE_POINTS
+#include "brcms_trace_events.h"
+#endif
drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h new file +92 -0

92 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/mac80211_if.c +5 -5
index c5afeaf..fa00ab3 100644
@@ -750,7 +750,7 @@ static int brcms_set_hint(struct brcms_info *wl, char *abbrev)
 	return regulatory_hint(wl->pub->ieee_hw->wiphy, abbrev);
 }
 
-static void brcms_dpc(unsigned long data)
+void brcms_dpc(unsigned long data)
 {
 	struct brcms_info *wl;
 
@@ -1430,7 +1430,7 @@ void brcms_down(struct brcms_info *wl)
 /*
 * precondition: perimeter lock is not acquired
  */
-static void _brcms_timer(struct brcms_timer *t)
+void brcms_timer(struct brcms_timer *t)
 {
 	LOCK(t->wl);
 
@@ -1454,9 +1454,9 @@ static void _brcms_timer(struct brcms_timer *t)
 /*
  * is called by the kernel from software irq context
  */
-static void brcms_timer(unsigned long data)
+static void _brcms_timer(unsigned long data)
 {
-	_brcms_timer((struct brcms_timer *) data);
+	brcms_timer((struct brcms_timer *) data);
 }
 
 /*
@@ -1477,7 +1477,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
 
 	init_timer(&t->timer);
 	t->timer.data = (unsigned long) t;
-	t->timer.function = brcms_timer;
+	t->timer.function = _brcms_timer;
 	t->wl = wl;
 	t->fn = fn;
 	t->arg = arg;
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +2 -0
index 2bdcd4c..92256d0 100644
@@ -101,5 +101,7 @@ extern void brcms_add_timer(struct brcms_info *wl, struct brcms_timer *timer,
 			    uint ms, int periodic);
 extern bool brcms_del_timer(struct brcms_info *wl, struct brcms_timer *timer);
 extern void brcms_msleep(struct brcms_info *wl, uint ms);
+extern void brcms_dpc(unsigned long data);
+extern void brcms_timer(struct brcms_timer *t);
 
 #endif				/* _BRCM_MAC80211_IF_H_ */
Signature · 1 line
1.7.4.1
#26 lore raw

PATCH 26/26 staging: brcm80211: smac: fix for 64 bit systems

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

A bug was introduced by the following commit (Sep 13):

staging: brcm80211: use endian annotated structures in brcmsmac

Result was that 64 bits systems will not be able to acquire an IP address. Also the rmmod crashed. This has been fixed and retested on a Sparc64.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |    4 ++--
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -2
index fa00ab3..ac78052 100644
@@ -1606,7 +1606,7 @@ fail:
  * Precondition: Since this function is called in brcms_pci_probe() context,
  * no locking is required.
  */
-int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx)
+int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx)
 {
 	int i, entry;
 	const u8 *pdata;
@@ -1623,7 +1623,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(*((__le32 *) pdata));
+				*n_bytes = le32_to_cpu(*((__le32 *) pdata));
 				return 0;
 			}
 		}
drivers/staging/brcm80211/brcmsmac/ucode_loader.h +2 -2
index 49d5b7e..18750a8 100644
@@ -50,8 +50,8 @@ extern void brcms_ucode_data_free(struct brcms_ucode *ucode);
 
 extern int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf,
 				unsigned int idx);
-extern int brcms_ucode_init_uint(struct brcms_info *wl, unsigned *data,
-			      unsigned int idx);
+extern int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes,
+				 unsigned int idx);
 extern void brcms_ucode_free_buf(void *);
 extern int  brcms_check_firmwares(struct brcms_info *wl);
 
Signature · 1 line
1.7.4.1
Applied
#27 lore raw
In reply to Arend van Spriel
Quoted 6 lines · Arend van Spriel

Third attempt as the mailer somehow did not sent these outside the Broadcom intranet. Another series of cleanup changes based on community feedback received on the mainline patch (v2) as sent August 25, 2011.

This series is to be applied to the staging-next branch. There are no pending patches that this series depend on.

Applied, thanks.

greg k-h