All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-dev] d80211: Switch d80211_mgmt.h to ieee80211.h style definitions
@ 2006-08-05  8:45 Michael Wu
  2006-08-07 17:20 ` Jouni Malinen
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wu @ 2006-08-05  8:45 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, netdev

[-- Attachment #1: Type: text/plain, Size: 12149 bytes --]

d80211: Switch d80211_mgmt.h to ieee80211.h style definitions

This patch switches a number of defines in d80211_mgmt.h to enums taken from 
ieee80211.h and makes the corresponding changes in net/d80211.

Signed-off-by: Michael Wu <flamingice@sourmilk.net>

---

 include/net/d80211_mgmt.h  |  153 
+++++++++++++++++++++++++-------------------
 net/d80211/ieee80211.c     |    2 -
 net/d80211/ieee80211_sta.c |   50 +++++++-------
 3 files changed, 114 insertions(+), 91 deletions(-)

diff --git a/include/net/d80211_mgmt.h b/include/net/d80211_mgmt.h
index f623db3..44d81de 100644
--- a/include/net/d80211_mgmt.h
+++ b/include/net/d80211_mgmt.h
@@ -119,77 +119,100 @@ #define WLAN_CAPABILITY_SHORT_SLOT_TIME 
 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
 
 /* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-/* 802.11h */
-#define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
-#define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
-#define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
-/* 802.11g */
-#define WLAN_STATUS_ASSOC_DENOED_NO_SHORT_SLOT_TIME 25
-#define WLAN_STATUS_ASSOC_DENOED_NO_ER_PBCC 26
-#define WLAN_STATUS_ASSOC_DENOED_NO_DSSS_OFDM 27
+enum ieee80211_statuscode {
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+};
 
 
 /* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
-/* 802.11h */
-#define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
-#define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
-
-#define WLAN_REASON_MIC_FAILURE 14
+enum ieee80211_reasoncode {
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+};
 
 
 /* Information Element IDs */
-#define WLAN_EID_SSID 0
-#define WLAN_EID_SUPP_RATES 1
-#define WLAN_EID_FH_PARAMS 2
-#define WLAN_EID_DS_PARAMS 3
-#define WLAN_EID_CF_PARAMS 4
-#define WLAN_EID_TIM 5
-#define WLAN_EID_IBSS_PARAMS 6
-#define WLAN_EID_COUNTRY 7
-#define WLAN_EID_CHALLENGE 16
-/* EIDs defined as part fo 11h - starts */
-#define WLAN_EID_PWR_CONSTRAINT	32
-#define WLAN_EID_PWR_CAPABILITY	33
-#define WLAN_EID_TPC_REQUEST	34
-#define WLAN_EID_TPC_REPORT	35
-#define WLAN_EID_SUPPORTED_CHANNELS	36
-#define WLAN_EID_CHANNEL_SWITCH	37
-#define WLAN_EID_MEASURE_REQUEST	38
-#define WLAN_EID_MEASURE_REPORT	39
-#define WLAN_EID_QUITE	40
-#define WLAN_EID_IBSS_DFS	41
-/* EIDs defined as part fo 11h - ends */
-#define WLAN_EID_ERP_INFO 42
-#define WLAN_EID_RSN 48
-#define WLAN_EID_EXT_SUPP_RATES 50
-#define WLAN_EID_WPA 221
-#define WLAN_EID_GENERIC 221
-#define WLAN_EID_VENDOR_SPECIFIC 221
-
+enum ieee80211_mfie {
+	MFIE_TYPE_SSID = 0,
+	MFIE_TYPE_RATES = 1,
+	MFIE_TYPE_FH_SET = 2,
+	MFIE_TYPE_DS_SET = 3,
+	MFIE_TYPE_CF_SET = 4,
+	MFIE_TYPE_TIM = 5,
+	MFIE_TYPE_IBSS_SET = 6,
+	MFIE_TYPE_COUNTRY = 7,
+	MFIE_TYPE_HOP_PARAMS = 8,
+	MFIE_TYPE_HOP_TABLE = 9,
+	MFIE_TYPE_REQUEST = 10,
+	MFIE_TYPE_CHALLENGE = 16,
+	MFIE_TYPE_POWER_CONSTRAINT = 32,
+	MFIE_TYPE_POWER_CAPABILITY = 33,
+	MFIE_TYPE_TPC_REQUEST = 34,
+	MFIE_TYPE_TPC_REPORT = 35,
+	MFIE_TYPE_SUPP_CHANNELS = 36,
+	MFIE_TYPE_CSA = 37,
+	MFIE_TYPE_MEASURE_REQUEST = 38,
+	MFIE_TYPE_MEASURE_REPORT = 39,
+	MFIE_TYPE_QUIET = 40,
+	MFIE_TYPE_IBSS_DFS = 41,
+	MFIE_TYPE_ERP_INFO = 42,
+	MFIE_TYPE_RSN = 48,
+	MFIE_TYPE_RATES_EX = 50,
+	MFIE_TYPE_GENERIC = 221,
+	MFIE_TYPE_QOS_PARAMETER = 222,
+};
 
 
 #define ATHEROS_INFO_USEXR BIT(3)
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index bf0e86b..83738da 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1714,7 +1714,7 @@ static void ieee80211_beacon_add_tim(str
 		bss->dtim_count--;
 
 	tim = pos = (u8 *) skb_put(skb, 6);
-	*pos++ = WLAN_EID_TIM;
+	*pos++ = MFIE_TYPE_TIM;
 	*pos++ = 4;
 	*pos++ = bss->dtim_count;
 	*pos++ = bss->dtim_period;
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..4bbd59b 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -133,39 +133,39 @@ #endif
 		}
 
 		switch (id) {
-		case WLAN_EID_SSID:
+		case MFIE_TYPE_SSID:
 			elems->ssid = pos;
 			elems->ssid_len = elen;
 			break;
-		case WLAN_EID_SUPP_RATES:
+		case MFIE_TYPE_RATES:
 			elems->supp_rates = pos;
 			elems->supp_rates_len = elen;
 			break;
-		case WLAN_EID_FH_PARAMS:
+		case MFIE_TYPE_FH_SET:
 			elems->fh_params = pos;
 			elems->fh_params_len = elen;
 			break;
-		case WLAN_EID_DS_PARAMS:
+		case MFIE_TYPE_DS_SET:
 			elems->ds_params = pos;
 			elems->ds_params_len = elen;
 			break;
-		case WLAN_EID_CF_PARAMS:
+		case MFIE_TYPE_CF_SET:
 			elems->cf_params = pos;
 			elems->cf_params_len = elen;
 			break;
-		case WLAN_EID_TIM:
+		case MFIE_TYPE_TIM:
 			elems->tim = pos;
 			elems->tim_len = elen;
 			break;
-		case WLAN_EID_IBSS_PARAMS:
+		case MFIE_TYPE_IBSS_SET:
 			elems->ibss_params = pos;
 			elems->ibss_params_len = elen;
 			break;
-		case WLAN_EID_CHALLENGE:
+		case MFIE_TYPE_CHALLENGE:
 			elems->challenge = pos;
 			elems->challenge_len = elen;
 			break;
-		case WLAN_EID_WPA:
+		case MFIE_TYPE_GENERIC:
 			if (elen >= 4 && pos[0] == 0x00 && pos[1] == 0x50 &&
 			    pos[2] == 0xf2) {
 				/* Microsoft OUI (00:50:F2) */
@@ -184,15 +184,15 @@ #endif
 				}
 			}
 			break;
-		case WLAN_EID_RSN:
+		case MFIE_TYPE_RSN:
 			elems->rsn = pos;
 			elems->rsn_len = elen;
 			break;
-		case WLAN_EID_ERP_INFO:
+		case MFIE_TYPE_ERP_INFO:
 			elems->erp_info = pos;
 			elems->erp_info_len = elen;
 			break;
-		case WLAN_EID_EXT_SUPP_RATES:
+		case MFIE_TYPE_RATES_EX:
 			elems->ext_supp_rates = pos;
 			elems->ext_supp_rates_len = elen;
 			break;
@@ -524,7 +524,7 @@ static void ieee80211_send_assoc(struct 
 
 	/* SSID */
 	ies = pos = skb_put(skb, 2 + ifsta->ssid_len);
-	*pos++ = WLAN_EID_SSID;
+	*pos++ = MFIE_TYPE_SSID;
 	*pos++ = ifsta->ssid_len;
 	memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
@@ -532,7 +532,7 @@ static void ieee80211_send_assoc(struct 
 	if (len > 8)
 		len = 8;
 	pos = skb_put(skb, len + 2);
-	*pos++ = WLAN_EID_SUPP_RATES;
+	*pos++ = MFIE_TYPE_RATES;
 	*pos++ = len;
 	for (i = 0; i < len; i++) {
 		int rate = local->curr_rates[i].rate;
@@ -543,7 +543,7 @@ static void ieee80211_send_assoc(struct 
 
 	if (local->num_curr_rates > len) {
 		pos = skb_put(skb, local->num_curr_rates - len + 2);
-		*pos++ = WLAN_EID_EXT_SUPP_RATES;
+		*pos++ = MFIE_TYPE_RATES_EX;
 		*pos++ = local->num_curr_rates - len;
 		for (i = len; i < local->num_curr_rates; i++) {
 			int rate = local->curr_rates[i].rate;
@@ -560,7 +560,7 @@ static void ieee80211_send_assoc(struct 
 
 	if (wmm && ifsta->wmm_enabled) {
 		pos = skb_put(skb, 9);
-		*pos++ = WLAN_EID_VENDOR_SPECIFIC;
+		*pos++ = MFIE_TYPE_GENERIC;
 		*pos++ = 7; /* len */
 		*pos++ = 0x00; /* Microsoft OUI 00:50:F2 */
 		*pos++ = 0x50;
@@ -775,12 +775,12 @@ static void ieee80211_send_probe_req(str
 		memset(mgmt->bssid, 0xff, ETH_ALEN);
 	}
 	pos = skb_put(skb, 2 + ssid_len);
-	*pos++ = WLAN_EID_SSID;
+	*pos++ = MFIE_TYPE_SSID;
 	*pos++ = ssid_len;
 	memcpy(pos, ssid, ssid_len);
 
 	supp_rates = skb_put(skb, 2);
-	supp_rates[0] = WLAN_EID_SUPP_RATES;
+	supp_rates[0] = MFIE_TYPE_RATES;
 	supp_rates[1] = 0;
 	for (i = 0; i < local->num_curr_rates; i++) {
 		struct ieee80211_rate *rate = &local->curr_rates[i];
@@ -791,7 +791,7 @@ static void ieee80211_send_probe_req(str
 			esupp_rates[1]++;
 		} else if (supp_rates[1] == 8) {
 			esupp_rates = skb_put(skb, 3);
-			esupp_rates[0] = WLAN_EID_EXT_SUPP_RATES;
+			esupp_rates[0] = MFIE_TYPE_RATES_EX;
 			esupp_rates[1] = 1;
 			pos = &esupp_rates[2];
 		} else {
@@ -1673,7 +1673,7 @@ #endif /* IEEE80211_IBSS_DEBUG */
 
 	end = ((u8 *) mgmt) + len;
 	pos = mgmt->u.probe_req.variable;
-	if (pos[0] != WLAN_EID_SSID ||
+	if (pos[0] != MFIE_TYPE_SSID ||
 	    pos + 2 + pos[1] > end) {
 		if (net_ratelimit()) {
 			printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
@@ -2028,7 +2028,7 @@ static int ieee80211_sta_join_ibss(struc
 		mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability);
 
 		pos = skb_put(skb, 2 + ifsta->ssid_len);
-		*pos++ = WLAN_EID_SSID;
+		*pos++ = MFIE_TYPE_SSID;
 		*pos++ = ifsta->ssid_len;
 		memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
@@ -2036,17 +2036,17 @@ static int ieee80211_sta_join_ibss(struc
 		if (rates > 8)
 			rates = 8;
 		pos = skb_put(skb, 2 + rates);
-		*pos++ = WLAN_EID_SUPP_RATES;
+		*pos++ = MFIE_TYPE_RATES;
 		*pos++ = rates;
 		memcpy(pos, bss->supp_rates, rates);
 
 		pos = skb_put(skb, 2 + 1);
-		*pos++ = WLAN_EID_DS_PARAMS;
+		*pos++ = MFIE_TYPE_DS_SET;
 		*pos++ = 1;
 		*pos++ = bss->channel;
 
 		pos = skb_put(skb, 2 + 2);
-		*pos++ = WLAN_EID_IBSS_PARAMS;
+		*pos++ = MFIE_TYPE_IBSS_SET;
 		*pos++ = 2;
 		/* FIX: set ATIM window based on scan results */
 		*pos++ = 0;
@@ -2055,7 +2055,7 @@ static int ieee80211_sta_join_ibss(struc
 		if (bss->supp_rates_len > 8) {
 			rates = bss->supp_rates_len - 8;
 			pos = skb_put(skb, 2 + rates);
-			*pos++ = WLAN_EID_EXT_SUPP_RATES;
+			*pos++ = MFIE_TYPE_RATES_EX;
 			*pos++ = rates;
 			memcpy(pos, &bss->supp_rates[8], rates);
 		}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH wireless-dev] d80211: Switch d80211_mgmt.h to ieee80211.h style definitions
  2006-08-05  8:45 [PATCH wireless-dev] d80211: Switch d80211_mgmt.h to ieee80211.h style definitions Michael Wu
@ 2006-08-07 17:20 ` Jouni Malinen
  2006-08-07 18:37   ` Michael Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Jouni Malinen @ 2006-08-07 17:20 UTC (permalink / raw)
  To: Michael Wu; +Cc: John Linville, Jiri Benc, netdev

On Sat, Aug 05, 2006 at 01:45:33AM -0700, Michael Wu wrote:
> d80211: Switch d80211_mgmt.h to ieee80211.h style definitions
> 
> This patch switches a number of defines in d80211_mgmt.h to enums taken from 
> ieee80211.h and makes the corresponding changes in net/d80211.

>  include/net/d80211_mgmt.h  |  153 
>  net/d80211/ieee80211.c     |    2 -
>  net/d80211/ieee80211_sta.c |   50 +++++++-------


Is this really needed? Based on the changes here, these are mostly used
internally in net/d80211/ieee80211_sta.c and not in other parts of the
tree. In addition, I would actually like to see ieee80211_sta.c be made
mostly obsolete with a user space implementation of client MLME (e.g.,
the one in wpa_supplicant which is based on this ieee80211_sta.c file).

Changing WLAN_STATUS_* and WLAN_REASON_* to be enum's while keeping
their old names is fine. However, I would rather not change the names of
the information element IDs (WLAN_EID_*) into MFIE_TYPE_*. What is that
'MFIE' anyway? Management Frame IE? These IEs are not limited to
management frames..

In other words, I would skip all the changes into ieee80211_sta.c and
would only change d80211_mgmt.h to use enum's with old names.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH wireless-dev] d80211: Switch d80211_mgmt.h to ieee80211.h style definitions
  2006-08-07 17:20 ` Jouni Malinen
@ 2006-08-07 18:37   ` Michael Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Wu @ 2006-08-07 18:37 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John Linville, Jiri Benc, netdev

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

On Monday 07 August 2006 10:20, Jouni Malinen wrote:
> Changing WLAN_STATUS_* and WLAN_REASON_* to be enum's while keeping
> their old names is fine. However, I would rather not change the names of
> the information element IDs (WLAN_EID_*) into MFIE_TYPE_*. What is that
> 'MFIE' anyway? Management Frame IE? These IEs are not limited to
> management frames..
>
I agree these names aren't that great, but these changes make it easier for 
for existing fullmac drivers to switch to the d80211 headers. That is the 
only reason.

> In other words, I would skip all the changes into ieee80211_sta.c and
> would only change d80211_mgmt.h to use enum's with old names.
Sure.

-Michael Wu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-07 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-05  8:45 [PATCH wireless-dev] d80211: Switch d80211_mgmt.h to ieee80211.h style definitions Michael Wu
2006-08-07 17:20 ` Jouni Malinen
2006-08-07 18:37   ` Michael Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.