[PATCH2 1/7] staging: brcm80211: cleanup mac80211 callback bss_info_changed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The implementation for bss_info_changed was not handling all
changes as provided by mac80211 module. These have been added
where needed.

Reviewed-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx>
Reviewed-by: Henry Ptasinski <henryp@xxxxxxxxxxxx>
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/brcmsmac/wl_mac80211.c  |   75 +++++++++++++++------
 drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c |   15 +++-
 drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h |   14 ----
 drivers/staging/brcm80211/brcmsmac/wlc_pub.h      |   15 ++++
 4 files changed, 81 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
index 54bfe22..306a6f2 100644
--- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
@@ -328,64 +328,99 @@ wl_ops_bss_info_changed(struct ieee80211_hw *hw,
 	struct wl_info *wl = HW_TO_WL(hw);
 	int val;
 
-
 	if (changed & BSS_CHANGED_ASSOC) {
-		WL_ERROR("Associated:\t%s\n", info->assoc ? "True" : "False");
 		/* association status changed (associated/disassociated)
 		 * also implies a change in the AID.
 		 */
+		WL_NONE("Associated: %s\n", info->assoc ? "true" : "false");
+		wlc_associate_upd(wl->wlc, info->assoc);
 	}
 	if (changed & BSS_CHANGED_ERP_CTS_PROT) {
-		WL_NONE("Use_cts_prot:\t%s Implement me\n",
-			info->use_cts_prot ? "True" : "False");
 		/* CTS protection changed */
+		WL_NONE("Use_cts_prot: %s (implement)\n",
+			info->use_cts_prot ? "true" : "false");
 	}
 	if (changed & BSS_CHANGED_ERP_PREAMBLE) {
-		WL_NONE("Short preamble:\t%s Implement me\n",
-			info->use_short_preamble ? "True" : "False");
 		/* preamble changed */
+		WL_NONE("Short preamble: %s (implement)\n",
+			info->use_short_preamble ? "true" : "false");
 	}
 	if (changed & BSS_CHANGED_ERP_SLOT) {
-		WL_NONE("Changing short slot:\t%s\n",
-			info->use_short_slot ? "True" : "False");
+		/* slot timing changed */
+		WL_NONE("Changing short slot: %s\n",
+			info->use_short_slot ? "true" : "false");
 		if (info->use_short_slot)
 			val = 1;
 		else
 			val = 0;
 		wlc_set(wl->wlc, WLC_SET_SHORTSLOT_OVERRIDE, val);
-		/* slot timing changed */
 	}
 
 	if (changed & BSS_CHANGED_HT) {
-		WL_NONE("%s: HT mode - Implement me\n", __func__);
 		/* 802.11n parameters changed */
+		u16 mode = info->ht_operation_mode;
+		WL_NONE("%s: HT mode: 0x%04X (implement)\n", __func__, mode);
+		wlc_protection_upd(wl->wlc, WLC_PROT_N_CFG,
+			mode & IEEE80211_HT_OP_MODE_PROTECTION);
+		wlc_protection_upd(wl->wlc, WLC_PROT_N_NONGF,
+			mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
+		wlc_protection_upd(wl->wlc, WLC_PROT_N_OBSS,
+			mode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT);
 	}
 	if (changed & BSS_CHANGED_BASIC_RATES) {
-		WL_NONE("Need to change Basic Rates:\t0x%x! Implement me\n",
-			(u32) info->basic_rates);
 		/* Basic rateset changed */
+		WL_NONE("Need to change Basic Rates: 0x%x (implement)\n",
+			(u32) info->basic_rates);
 	}
 	if (changed & BSS_CHANGED_BEACON_INT) {
-		WL_NONE("Beacon Interval:\t%d Implement me\n",
-			info->beacon_int);
 		/* Beacon interval changed */
+		WL_NONE("Beacon Interval: %d\n",
+			info->beacon_int);
+		wlc_set(wl->wlc, WLC_SET_BCNPRD, info->beacon_int);
 	}
 	if (changed & BSS_CHANGED_BSSID) {
-		WL_NONE("new BSSID:\taid %d  bss:%pM\n",
-			info->aid, info->bssid);
 		/* BSSID changed, for whatever reason (IBSS and managed mode) */
-		/* FIXME: need to store bssid in bsscfg */
+		WL_NONE("new BSSID: aid %d  bss:%pM\n",
+			info->aid, info->bssid);
 		wlc_set_addrmatch(wl->wlc, RCM_BSSID_OFFSET,
 				  info->bssid);
 	}
 	if (changed & BSS_CHANGED_BEACON) {
-		WL_ERROR("BSS_CHANGED_BEACON\n");
 		/* Beacon data changed, retrieve new beacon (beaconing modes) */
+		WL_NONE("BSS_CHANGED_BEACON\n");
 	}
 	if (changed & BSS_CHANGED_BEACON_ENABLED) {
-		WL_ERROR("Beacon enabled:\t%s\n",
-			 info->enable_beacon ? "True" : "False");
 		/* Beaconing should be enabled/disabled (beaconing modes) */
+		WL_NONE("Beacon enabled: %s\n",
+			 info->enable_beacon ? "true" : "false");
+	}
+	if (changed & BSS_CHANGED_CQM) {
+		/* Connection quality monitor config changed */
+		WL_NONE("BSS_CHANGED_CQM: threshold %d, hys %d\n",
+			info->cqm_rssi_thold, info->cqm_rssi_hyst);
+	}
+	if (changed & BSS_CHANGED_IBSS) {
+		/* IBSS join status changed */
+		WL_NONE("BSS_CHANGED_IBSS: %s\n",
+			info->ibss_joined ? "true" : "false");
+	}
+	if (changed & BSS_CHANGED_ARP_FILTER) {
+		/* Hardware ARP filter address list or state changed */
+		WL_NONE("BSS_CHANGED_ARP_FILTER: enabled %s, count %d\n",
+			info->arp_filter_enabled ? "true" : "false",
+			info->arp_addr_cnt);
+	}
+	if (changed & BSS_CHANGED_QOS) {
+		/*
+		 * QoS for this association was enabled/disabled.
+		 * Note that it is only ever disabled for station mode.
+		 */
+		 WL_NONE("BSS_CHANGED_QOS: %s\n", info->qos ? "true" : "false");
+	}
+	if (changed & BSS_CHANGED_IDLE) {
+		/* Idle changed for this BSS/interface */
+		WL_NONE("BSS_CHANGED_IDLE: %s\n",
+			info->idle ? "true" : "false");
 	}
 	return;
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
index d64171f..9c2d18b 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
@@ -5742,7 +5742,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
 	/* add Broadcom tx descriptor header */
 	txh = (d11txh_t *) skb_push(p, D11_TXH_LEN);
-	memset((char *)txh, 0, D11_TXH_LEN);
+	memset(txh, 0, D11_TXH_LEN);
 
 	/* setup frameid */
 	if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
@@ -5938,10 +5938,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
 				/* if SGI is selected, then forced mm for single stream */
 				if ((rspec[k] & RSPEC_SHORT_GI)
-				    && IS_SINGLE_STREAM(rspec[k] &
-							RSPEC_RATE_MASK)) {
+				    && IS_SINGLE_STREAM(
+					rspec[k] & RSPEC_RATE_MASK))
 					preamble_type[k] = WLC_MM_PREAMBLE;
-				}
 			}
 
 			/* mimo bw field MUST now be valid in the rspec (it affects duration calculations) */
@@ -8255,6 +8254,8 @@ wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset,
 		  const u8 *addr)
 {
 	wlc_bmac_set_addrmatch(wlc->hw, match_reg_offset, addr);
+	if (match_reg_offset == RCM_BSSID_OFFSET)
+		bcopy(addr, wlc->cfg->BSSID, ETH_ALEN);
 }
 
 void wlc_set_rcmta(struct wlc_info *wlc, int idx, const u8 *addr)
@@ -8490,3 +8491,9 @@ static void wlc_txq_free(struct wlc_info *wlc, struct osl_info *osh,
 
 	kfree(qi);
 }
+
+void wlc_associate_upd(struct wlc_info *wlc, bool state)
+{
+	wlc->pub->associated = state;
+	wlc->cfg->associated = state;
+}
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
index 5817a49..0aeb9c6 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
@@ -29,19 +29,6 @@
 #define	MAXCOREREV		28	/* max # supported core revisions (0 .. MAXCOREREV - 1) */
 #define WLC_MAXMODULES		22	/* max #  wlc_module_register() calls */
 
-/* network protection config */
-#define	WLC_PROT_G_SPEC		1	/* SPEC g protection */
-#define	WLC_PROT_G_OVR		2	/* SPEC g prot override */
-#define	WLC_PROT_G_USER		3	/* gmode specified by user */
-#define	WLC_PROT_OVERLAP	4	/* overlap */
-#define	WLC_PROT_N_USER		10	/* nmode specified by user */
-#define	WLC_PROT_N_CFG		11	/* n protection */
-#define	WLC_PROT_N_CFG_OVR	12	/* n protection override */
-#define	WLC_PROT_N_NONGF	13	/* non-GF protection */
-#define	WLC_PROT_N_NONGF_OVR	14	/* non-GF protection override */
-#define	WLC_PROT_N_PAM_OVR	15	/* n preamble override */
-#define	WLC_PROT_N_OBSS		16	/* non-HT OBSS present */
-
 #define WLC_BITSCNT(x)	bcm_bitcount((u8 *)&(x), sizeof(u8))
 
 /* Maximum wait time for a MAC suspend */
@@ -847,7 +834,6 @@ extern void wlc_set_cwmax(struct wlc_info *wlc, u16 newmax);
 extern void wlc_fifoerrors(struct wlc_info *wlc);
 extern void wlc_pllreq(struct wlc_info *wlc, bool set, mbool req_bit);
 extern void wlc_reset_bmac_done(struct wlc_info *wlc);
-extern void wlc_protection_upd(struct wlc_info *wlc, uint idx, int val);
 extern void wlc_hwtimer_gptimer_set(struct wlc_info *wlc, uint us);
 extern void wlc_hwtimer_gptimer_abort(struct wlc_info *wlc);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_pub.h b/drivers/staging/brcm80211/brcmsmac/wlc_pub.h
index 0e39414..ea223b9 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_pub.h
@@ -484,6 +484,19 @@ extern const u8 wme_fifo2ac[];
 #define WLCNTSET(a, value)	/* No stats support */
 #define WLCNTVAL(a)		0	/* No stats support */
 
+/* network protection config */
+#define	WLC_PROT_G_SPEC		1	/* SPEC g protection */
+#define	WLC_PROT_G_OVR		2	/* SPEC g prot override */
+#define	WLC_PROT_G_USER		3	/* gmode specified by user */
+#define	WLC_PROT_OVERLAP	4	/* overlap */
+#define	WLC_PROT_N_USER		10	/* nmode specified by user */
+#define	WLC_PROT_N_CFG		11	/* n protection */
+#define	WLC_PROT_N_CFG_OVR	12	/* n protection override */
+#define	WLC_PROT_N_NONGF	13	/* non-GF protection */
+#define	WLC_PROT_N_NONGF_OVR	14	/* non-GF protection override */
+#define	WLC_PROT_N_PAM_OVR	15	/* n preamble override */
+#define	WLC_PROT_N_OBSS		16	/* non-HT OBSS present */
+
 /* common functions for every port */
 extern void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit,
 			bool piomode, struct osl_info *osh, void *regsva,
@@ -517,6 +530,7 @@ extern int wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len,
 		     struct wlc_if *wlcif);
 /* helper functions */
 extern void wlc_statsupd(struct wlc_info *wlc);
+extern void wlc_protection_upd(struct wlc_info *wlc, uint idx, int val);
 extern int wlc_get_header_len(void);
 extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc);
 extern void wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset,
@@ -566,6 +580,7 @@ extern void wlc_enable_mac(struct wlc_info *wlc);
 extern u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate);
 extern u32 wlc_get_rspec_history(struct wlc_bsscfg *cfg);
 extern u32 wlc_get_current_highest_rate(struct wlc_bsscfg *cfg);
+extern void wlc_associate_upd(struct wlc_info *wlc, bool state);
 
 static inline int wlc_iovar_getuint(struct wlc_info *wlc, const char *name,
 				    uint *arg)
-- 
1.7.1


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux