[PATCH 1/8] staging: brcm80211: implement mac80211 callback set_rts_threshold

Arend van Spriel arend at broadcom.com
Tue Feb 8 13:39:13 UTC 2011


adds implementation for allowing configuration of dot11RTSThreshold
as defined in the 802.11 standards. The mac80211 module will use
callback set_rts_threshold to configure this in the driver.

Reviewed-by: Roland Vossen <rvossen at broadcom.com>
Reviewed-by: Brett Rudley <brudley at broadcom.com>
Reviewed-by: Henry Ptasinski <henryp at broadcom.com>
Signed-off-by: Arend van Spriel <arend at broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/wl_mac80211.c  |    6 +++++-
 drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c |   18 ++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
index a95be68..745c887 100644
--- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
@@ -469,7 +469,11 @@ wl_ops_get_stats(struct ieee80211_hw *hw,
 
 static int wl_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
-	WL_ERROR("%s: Enter\n", __func__);
+	struct wl_info *wl = hw->priv;
+
+	WL_LOCK(wl);
+	wlc_iovar_setint(wl->wlc, "rtsthresh", value & 0xFFFF);
+	WL_UNLOCK(wl);
 	return 0;
 }
 
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
index b32c3c4..3f7f93e 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
@@ -140,16 +140,17 @@ static struct wlc_info *wlc_info_dbg = (struct wlc_info *) (NULL);
  */
 enum {
 	IOV_MPC = 1,
+	IOV_RTSTHRESH,
 	IOV_QTXPOWER,
 	IOV_BCN_LI_BCN,		/* Beacon listen interval in # of beacons */
 	IOV_LAST		/* In case of a need to check max ID number */
 };
 
 const bcm_iovar_t wlc_iovars[] = {
-	{"mpc", IOV_MPC, (IOVF_OPEN_ALLOW), IOVT_BOOL, 0},
-	{"qtxpower", IOV_QTXPOWER, (IOVF_WHL | IOVF_OPEN_ALLOW), IOVT_UINT32,
-	 0},
-	{"bcn_li_bcn", IOV_BCN_LI_BCN, 0, IOVT_UINT8, 0},
+	{"mpc", IOV_MPC, (0), IOVT_BOOL, 0},
+	{"rtsthresh", IOV_RTSTHRESH, (IOVF_WHL), IOVT_UINT16, 0},
+	{"qtxpower", IOV_QTXPOWER, (IOVF_WHL), IOVT_UINT32, 0},
+	{"bcn_li_bcn", IOV_BCN_LI_BCN, (0), IOVT_UINT8, 0},
 	{NULL, 0, 0, 0, 0}
 };
 
@@ -239,6 +240,7 @@ static u16 BCMFASTPATH wlc_d11hdrs_mac80211(struct wlc_info *wlc,
 					       wsec_key_t *key,
 					       ratespec_t rspec_override);
 
+static void wlc_ctrupd_cache(u16 cur_stat, u16 *macstat_snapshot, u32 *macstat);
 static void wlc_bss_default_init(struct wlc_info *wlc);
 static void wlc_ucode_mac_upd(struct wlc_info *wlc);
 static ratespec_t mac80211_wlc_set_nrate(struct wlc_info *wlc,
@@ -4577,6 +4579,9 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid,
 		 wlc->pub->unit, __func__, IOV_ID(actionid));
 	/* Do the actual parameter implementation */
 	switch (actionid) {
+	case IOV_SVAL(IOV_RTSTHRESH):
+		wlc->RTSThresh = int_val;
+		break;
 
 	case IOV_GVAL(IOV_QTXPOWER):{
 			uint qdbm;
@@ -5970,6 +5975,11 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 	txrate[0]->count = 0;
 	txrate[1]->count = 0;
 
+	/* (2) PROTECTION, may change rspec */
+	if ((ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) &&
+	    (phylen > wlc->RTSThresh) && !is_multicast_ether_addr(h->addr1))
+		use_rts = true;
+
 	/* (3) PLCP: determine PLCP header and MAC duration, fill d11txh_t */
 	wlc_compute_plcp(wlc, rspec[0], phylen, plcp);
 	wlc_compute_plcp(wlc, rspec[1], phylen, plcp_fallback);
-- 
1.7.1





More information about the devel mailing list