PERFORCE change 148624 for review

Sam Leffler sam at FreeBSD.org
Wed Aug 27 16:04:32 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=148624

Change 148624 by sam at sam_ebb on 2008/08/27 16:03:35

	fix channel width handling for sta's associating to an ap; this
	was broken when ieee80211_parse_htcap was changed to only parse
	ie's and push state to the node; we need to also update ni_chw
	to reflect htcap contents because no htinfo state is provided
	in an AssocReq frame

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_hostap.c#24 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ht.c#39 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ht.h#19 edit
.. //depot/projects/vap/sys/net80211/ieee80211_sta.c#15 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_hostap.c#24 (text+ko) ====

@@ -2039,7 +2039,7 @@
 				return;
 			}
 			ieee80211_ht_node_init(ni);
-			ieee80211_parse_htcap(ni, htcap);
+			ieee80211_ht_updatehtcap(ni, htcap);
 		} else if (ni->ni_flags & IEEE80211_NODE_HT)
 			ieee80211_ht_node_cleanup(ni);
 		/*

==== //depot/projects/vap/sys/net80211/ieee80211_ht.c#39 (text+ko) ====

@@ -1196,24 +1196,13 @@
  * parsing the contents of a beacon frame).
  */
 static void
-htinfo_update_chw(struct ieee80211_node *ni,
-	const struct ieee80211_ie_htinfo *htinfo)
+htinfo_update_chw(struct ieee80211_node *ni, int htflags)
 {
 	struct ieee80211com *ic = ni->ni_ic;
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211_channel *c;
-	int htflags, chanflags;
+	int chanflags;
 
-	/* NB: honor operating mode constraint */
-	htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
-	    IEEE80211_CHAN_HT20 : 0;
-	if ((htinfo->hi_byte1 & IEEE80211_HTINFO_TXWIDTH_2040) &&
-	    (vap->iv_flags_ext & IEEE80211_FEXT_USEHT40)) {
-		if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_ABOVE)
-			htflags = IEEE80211_CHAN_HT40U;
-		else if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_BELOW)
-			htflags = IEEE80211_CHAN_HT40D;
-	}
 	chanflags = (ni->ni_chan->ic_flags &~ IEEE80211_CHAN_HT) | htflags;
 	if (chanflags != ni->ni_chan->ic_flags) {
 		/* XXX not right for ht40- */
@@ -1254,11 +1243,53 @@
 ieee80211_ht_updateparams(struct ieee80211_node *ni,
 	const uint8_t *htcapie, const uint8_t *htinfoie)
 {
+	struct ieee80211vap *vap = ni->ni_vap;
+	const struct ieee80211_ie_htinfo *htinfo;
+	int htflags;
+
 	ieee80211_parse_htcap(ni, htcapie);
 	if (htinfoie[0] == IEEE80211_ELEMID_VENDOR)
 		htinfoie += 4;
-	htinfo_parse(ni, (const struct ieee80211_ie_htinfo *) htinfoie);
-	htinfo_update_chw(ni, (const struct ieee80211_ie_htinfo *) htinfoie);
+	htinfo = (const struct ieee80211_ie_htinfo *) htinfoie;
+	htinfo_parse(ni, htinfo);
+
+	htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
+	    IEEE80211_CHAN_HT20 : 0;
+	/* NB: honor operating mode constraint */
+	if ((htinfo->hi_byte1 & IEEE80211_HTINFO_TXWIDTH_2040) &&
+	    (vap->iv_flags_ext & IEEE80211_FEXT_USEHT40)) {
+		if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_ABOVE)
+			htflags = IEEE80211_CHAN_HT40U;
+		else if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_BELOW)
+			htflags = IEEE80211_CHAN_HT40D;
+	}
+	htinfo_update_chw(ni, htflags);
+}
+
+/*
+ * Parse and update HT-related state extracted from the HT cap ie
+ * for a station joining an HT BSS.
+ */
+void
+ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
+{
+	struct ieee80211vap *vap = ni->ni_vap;
+	int htflags;
+
+	ieee80211_parse_htcap(ni, htcapie);
+
+	/* NB: honor operating mode constraint */
+	/* XXX 40 MHZ intolerant */
+	htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
+	    IEEE80211_CHAN_HT20 : 0;
+	if ((ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40) &&
+	    (vap->iv_flags_ext & IEEE80211_FEXT_USEHT40)) {
+		if (IEEE80211_IS_CHAN_HT40U(vap->iv_bss->ni_chan))
+			htflags = IEEE80211_CHAN_HT40U;
+		else if (IEEE80211_IS_CHAN_HT40D(vap->iv_bss->ni_chan))
+			htflags = IEEE80211_CHAN_HT40D;
+	}
+	htinfo_update_chw(ni, htflags);
 }
 
 /*

==== //depot/projects/vap/sys/net80211/ieee80211_ht.h#19 (text+ko) ====

@@ -180,6 +180,7 @@
 void	ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);
 void	ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,
 		const uint8_t *);
+void	ieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *);
 void	ieee80211_recv_action(struct ieee80211_node *,
 		const uint8_t *, const uint8_t *);
 int	ieee80211_ampdu_request(struct ieee80211_node *,

==== //depot/projects/vap/sys/net80211/ieee80211_sta.c#15 (text+ko) ====

@@ -1268,7 +1268,8 @@
 				ieee80211_wme_updateparams(vap);
 			if (scan.ath != NULL)
 				ieee80211_parse_athparams(ni, scan.ath, wh);
-			if (scan.htcap != NULL && scan.htinfo != NULL) {
+			if (scan.htcap != NULL && scan.htinfo != NULL &&
+			    (vap->iv_flags_ext & IEEE80211_FEXT_HT)) {
 				ieee80211_ht_updateparams(ni,
 				    scan.htcap, scan.htinfo);
 				/* XXX state changes? */


More information about the p4-projects mailing list