aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-02-05 17:57:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-02-17 08:16:59 -0500
commit4861dd79c1724f37e36d66cc4b3454803aec3f93 (patch)
tree46efc932a35ff49c8b3b723b650ec0b1832706d8 /drivers/net/wireless
parent4ddc1651cee0143eeddbe043ccd66bb87072e279 (diff)
[PATCH] wireless/atmel: convert constants to ieee80211 layer equivalents
This patch converts the Atmel driver-only IEEE 802.11 constants to their equivalents from the kernel's ieee80211 layer headers. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/atmel.c110
1 files changed, 36 insertions, 74 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index dfc24016ba8..87afa6878f2 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -137,44 +137,6 @@ static struct {
137#define MAC_BOOT_COMPLETE 0x0010 // MAC boot has been completed 137#define MAC_BOOT_COMPLETE 0x0010 // MAC boot has been completed
138#define MAC_INIT_OK 0x0002 // MAC boot has been completed 138#define MAC_INIT_OK 0x0002 // MAC boot has been completed
139 139
140#define C80211_SUBTYPE_MGMT_ASS_REQUEST 0x00
141#define C80211_SUBTYPE_MGMT_ASS_RESPONSE 0x10
142#define C80211_SUBTYPE_MGMT_REASS_REQUEST 0x20
143#define C80211_SUBTYPE_MGMT_REASS_RESPONSE 0x30
144#define C80211_SUBTYPE_MGMT_ProbeRequest 0x40
145#define C80211_SUBTYPE_MGMT_ProbeResponse 0x50
146#define C80211_SUBTYPE_MGMT_BEACON 0x80
147#define C80211_SUBTYPE_MGMT_ATIM 0x90
148#define C80211_SUBTYPE_MGMT_DISASSOSIATION 0xA0
149#define C80211_SUBTYPE_MGMT_Authentication 0xB0
150#define C80211_SUBTYPE_MGMT_Deauthentication 0xC0
151
152#define C80211_MGMT_AAN_OPENSYSTEM 0x0000
153#define C80211_MGMT_AAN_SHAREDKEY 0x0001
154
155#define C80211_MGMT_CAPABILITY_ESS 0x0001 // see 802.11 p.58
156#define C80211_MGMT_CAPABILITY_IBSS 0x0002 // - " -
157#define C80211_MGMT_CAPABILITY_CFPollable 0x0004 // - " -
158#define C80211_MGMT_CAPABILITY_CFPollRequest 0x0008 // - " -
159#define C80211_MGMT_CAPABILITY_Privacy 0x0010 // - " -
160
161#define C80211_MGMT_SC_Success 0
162#define C80211_MGMT_SC_Unspecified 1
163#define C80211_MGMT_SC_SupportCapabilities 10
164#define C80211_MGMT_SC_ReassDenied 11
165#define C80211_MGMT_SC_AssDenied 12
166#define C80211_MGMT_SC_AuthAlgNotSupported 13
167#define C80211_MGMT_SC_AuthTransSeqNumError 14
168#define C80211_MGMT_SC_AuthRejectChallenge 15
169#define C80211_MGMT_SC_AuthRejectTimeout 16
170#define C80211_MGMT_SC_AssDeniedHandleAP 17
171#define C80211_MGMT_SC_AssDeniedBSSRate 18
172
173#define C80211_MGMT_ElementID_SSID 0
174#define C80211_MGMT_ElementID_SupportedRates 1
175#define C80211_MGMT_ElementID_ChallengeText 16
176#define C80211_MGMT_CAPABILITY_ShortPreamble 0x0020
177
178#define MIB_MAX_DATA_BYTES 212 140#define MIB_MAX_DATA_BYTES 212
179#define MIB_HEADER_SIZE 4 /* first four fields */ 141#define MIB_HEADER_SIZE 4 /* first four fields */
180 142
@@ -2835,7 +2797,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability,
2835 u8 channel) 2797 u8 channel)
2836{ 2798{
2837 int rejoin = 0; 2799 int rejoin = 0;
2838 int new = capability & C80211_MGMT_CAPABILITY_ShortPreamble ? 2800 int new = capability & MFIE_TYPE_POWER_CONSTRAINT ?
2839 SHORT_PREAMBLE : LONG_PREAMBLE; 2801 SHORT_PREAMBLE : LONG_PREAMBLE;
2840 2802
2841 if (priv->preamble != new) { 2803 if (priv->preamble != new) {
@@ -2921,11 +2883,11 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
2921 memcpy(header.addr2, priv->dev->dev_addr, 6); 2883 memcpy(header.addr2, priv->dev->dev_addr, 6);
2922 memcpy(header.addr3, priv->CurrentBSSID, 6); 2884 memcpy(header.addr3, priv->CurrentBSSID, 6);
2923 2885
2924 body.capability = cpu_to_le16(C80211_MGMT_CAPABILITY_ESS); 2886 body.capability = cpu_to_le16(WLAN_CAPABILITY_ESS);
2925 if (priv->wep_is_on) 2887 if (priv->wep_is_on)
2926 body.capability |= cpu_to_le16(C80211_MGMT_CAPABILITY_Privacy); 2888 body.capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
2927 if (priv->preamble == SHORT_PREAMBLE) 2889 if (priv->preamble == SHORT_PREAMBLE)
2928 body.capability |= cpu_to_le16(C80211_MGMT_CAPABILITY_ShortPreamble); 2890 body.capability |= cpu_to_le16(MFIE_TYPE_POWER_CONSTRAINT);
2929 2891
2930 body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period); 2892 body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period);
2931 2893
@@ -2939,10 +2901,10 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
2939 bodysize = 12 + priv->SSID_size; 2901 bodysize = 12 + priv->SSID_size;
2940 } 2902 }
2941 2903
2942 ssid_el_p[0] = C80211_MGMT_ElementID_SSID; 2904 ssid_el_p[0] = MFIE_TYPE_SSID;
2943 ssid_el_p[1] = priv->SSID_size; 2905 ssid_el_p[1] = priv->SSID_size;
2944 memcpy(ssid_el_p + 2, priv->SSID, priv->SSID_size); 2906 memcpy(ssid_el_p + 2, priv->SSID, priv->SSID_size);
2945 ssid_el_p[2 + priv->SSID_size] = C80211_MGMT_ElementID_SupportedRates; 2907 ssid_el_p[2 + priv->SSID_size] = MFIE_TYPE_RATES;
2946 ssid_el_p[3 + priv->SSID_size] = 4; /* len of suported rates */ 2908 ssid_el_p[3 + priv->SSID_size] = 4; /* len of suported rates */
2947 memcpy(ssid_el_p + 4 + priv->SSID_size, atmel_basic_rates, 4); 2909 memcpy(ssid_el_p + 4 + priv->SSID_size, atmel_basic_rates, 4);
2948 2910
@@ -3004,7 +2966,7 @@ static void store_bss_info(struct atmel_private *priv,
3004 u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len, 2966 u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len,
3005 u8 *ssid, int is_beacon) 2967 u8 *ssid, int is_beacon)
3006{ 2968{
3007 u8 *bss = capability & C80211_MGMT_CAPABILITY_ESS ? header->addr2 : header->addr3; 2969 u8 *bss = capability & WLAN_CAPABILITY_ESS ? header->addr2 : header->addr3;
3008 int i, index; 2970 int i, index;
3009 2971
3010 for (index = -1, i = 0; i < priv->BSS_list_entries; i++) 2972 for (index = -1, i = 0; i < priv->BSS_list_entries; i++)
@@ -3030,16 +2992,16 @@ static void store_bss_info(struct atmel_private *priv,
3030 2992
3031 priv->BSSinfo[index].channel = channel; 2993 priv->BSSinfo[index].channel = channel;
3032 priv->BSSinfo[index].beacon_period = beacon_period; 2994 priv->BSSinfo[index].beacon_period = beacon_period;
3033 priv->BSSinfo[index].UsingWEP = capability & C80211_MGMT_CAPABILITY_Privacy; 2995 priv->BSSinfo[index].UsingWEP = capability & WLAN_CAPABILITY_PRIVACY;
3034 memcpy(priv->BSSinfo[index].SSID, ssid, ssid_len); 2996 memcpy(priv->BSSinfo[index].SSID, ssid, ssid_len);
3035 priv->BSSinfo[index].SSIDsize = ssid_len; 2997 priv->BSSinfo[index].SSIDsize = ssid_len;
3036 2998
3037 if (capability & C80211_MGMT_CAPABILITY_IBSS) 2999 if (capability & WLAN_CAPABILITY_IBSS)
3038 priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; 3000 priv->BSSinfo[index].BSStype = IW_MODE_ADHOC;
3039 else if (capability & C80211_MGMT_CAPABILITY_ESS) 3001 else if (capability & WLAN_CAPABILITY_ESS)
3040 priv->BSSinfo[index].BSStype =IW_MODE_INFRA; 3002 priv->BSSinfo[index].BSStype =IW_MODE_INFRA;
3041 3003
3042 priv->BSSinfo[index].preamble = capability & C80211_MGMT_CAPABILITY_ShortPreamble ? 3004 priv->BSSinfo[index].preamble = capability & MFIE_TYPE_POWER_CONSTRAINT ?
3043 SHORT_PREAMBLE : LONG_PREAMBLE; 3005 SHORT_PREAMBLE : LONG_PREAMBLE;
3044} 3006}
3045 3007
@@ -3050,7 +3012,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
3050 u16 trans_seq_no = le16_to_cpu(auth->trans_seq); 3012 u16 trans_seq_no = le16_to_cpu(auth->trans_seq);
3051 u16 system = le16_to_cpu(auth->alg); 3013 u16 system = le16_to_cpu(auth->alg);
3052 3014
3053 if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { 3015 if (status == WLAN_STATUS_SUCCESS && !priv->wep_is_on) {
3054 /* no WEP */ 3016 /* no WEP */
3055 if (priv->station_was_associated) { 3017 if (priv->station_was_associated) {
3056 atmel_enter_state(priv, STATION_STATE_REASSOCIATING); 3018 atmel_enter_state(priv, STATION_STATE_REASSOCIATING);
@@ -3063,19 +3025,19 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
3063 } 3025 }
3064 } 3026 }
3065 3027
3066 if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { 3028 if (status == WLAN_STATUS_SUCCESS && priv->wep_is_on) {
3067 int should_associate = 0; 3029 int should_associate = 0;
3068 /* WEP */ 3030 /* WEP */
3069 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) 3031 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum)
3070 return; 3032 return;
3071 3033
3072 if (system == C80211_MGMT_AAN_OPENSYSTEM) { 3034 if (system == WLAN_AUTH_OPEN) {
3073 if (trans_seq_no == 0x0002) { 3035 if (trans_seq_no == 0x0002) {
3074 should_associate = 1; 3036 should_associate = 1;
3075 } 3037 }
3076 } else if (system == C80211_MGMT_AAN_SHAREDKEY) { 3038 } else if (system == WLAN_AUTH_SHARED_KEY) {
3077 if (trans_seq_no == 0x0002 && 3039 if (trans_seq_no == 0x0002 &&
3078 auth->el_id == C80211_MGMT_ElementID_ChallengeText) { 3040 auth->el_id == MFIE_TYPE_CHALLENGE) {
3079 send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); 3041 send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
3080 return; 3042 return;
3081 } else if (trans_seq_no == 0x0004) { 3043 } else if (trans_seq_no == 0x0004) {
@@ -3140,8 +3102,8 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
3140 if (frame_len < 8 + rates_len) 3102 if (frame_len < 8 + rates_len)
3141 return; 3103 return;
3142 3104
3143 if (status == C80211_MGMT_SC_Success) { 3105 if (status == WLAN_STATUS_SUCCESS) {
3144 if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE) 3106 if (subtype == IEEE80211_STYPE_ASSOC_RESP)
3145 priv->AssociationRequestRetryCnt = 0; 3107 priv->AssociationRequestRetryCnt = 0;
3146 else 3108 else
3147 priv->ReAssociationRequestRetryCnt = 0; 3109 priv->ReAssociationRequestRetryCnt = 0;
@@ -3178,9 +3140,9 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
3178 return; 3140 return;
3179 } 3141 }
3180 3142
3181 if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE && 3143 if (subtype == IEEE80211_STYPE_ASSOC_RESP &&
3182 status != C80211_MGMT_SC_AssDeniedBSSRate && 3144 status != WLAN_STATUS_ASSOC_DENIED_RATES &&
3183 status != C80211_MGMT_SC_SupportCapabilities && 3145 status != WLAN_STATUS_CAPS_UNSUPPORTED &&
3184 priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { 3146 priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {
3185 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3147 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3186 priv->AssociationRequestRetryCnt++; 3148 priv->AssociationRequestRetryCnt++;
@@ -3188,9 +3150,9 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
3188 return; 3150 return;
3189 } 3151 }
3190 3152
3191 if (subtype == C80211_SUBTYPE_MGMT_REASS_RESPONSE && 3153 if (subtype == IEEE80211_STYPE_REASSOC_RESP &&
3192 status != C80211_MGMT_SC_AssDeniedBSSRate && 3154 status != WLAN_STATUS_ASSOC_DENIED_RATES &&
3193 status != C80211_MGMT_SC_SupportCapabilities && 3155 status != WLAN_STATUS_CAPS_UNSUPPORTED &&
3194 priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { 3156 priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {
3195 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3157 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3196 priv->ReAssociationRequestRetryCnt++; 3158 priv->ReAssociationRequestRetryCnt++;
@@ -3325,8 +3287,8 @@ static void atmel_management_frame(struct atmel_private *priv,
3325 3287
3326 subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE; 3288 subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE;
3327 switch (subtype) { 3289 switch (subtype) {
3328 case C80211_SUBTYPE_MGMT_BEACON: 3290 case IEEE80211_STYPE_BEACON:
3329 case C80211_SUBTYPE_MGMT_ProbeResponse: 3291 case IEEE80211_STYPE_PROBE_RESP:
3330 3292
3331 /* beacon frame has multiple variable-length fields - 3293 /* beacon frame has multiple variable-length fields -
3332 never let an engineer loose with a data structure design. */ 3294 never let an engineer loose with a data structure design. */
@@ -3384,19 +3346,19 @@ static void atmel_management_frame(struct atmel_private *priv,
3384 beacon_interval, channel, rssi, 3346 beacon_interval, channel, rssi,
3385 ssid_length, 3347 ssid_length,
3386 &beacon->rates_el_id, 3348 &beacon->rates_el_id,
3387 subtype == C80211_SUBTYPE_MGMT_BEACON); 3349 subtype == IEEE80211_STYPE_BEACON);
3388 } 3350 }
3389 break; 3351 break;
3390 3352
3391 case C80211_SUBTYPE_MGMT_Authentication: 3353 case IEEE80211_STYPE_AUTH:
3392 3354
3393 if (priv->station_state == STATION_STATE_AUTHENTICATING) 3355 if (priv->station_state == STATION_STATE_AUTHENTICATING)
3394 authenticate(priv, frame_len); 3356 authenticate(priv, frame_len);
3395 3357
3396 break; 3358 break;
3397 3359
3398 case C80211_SUBTYPE_MGMT_ASS_RESPONSE: 3360 case IEEE80211_STYPE_ASSOC_RESP:
3399 case C80211_SUBTYPE_MGMT_REASS_RESPONSE: 3361 case IEEE80211_STYPE_REASSOC_RESP:
3400 3362
3401 if (priv->station_state == STATION_STATE_ASSOCIATING || 3363 if (priv->station_state == STATION_STATE_ASSOCIATING ||
3402 priv->station_state == STATION_STATE_REASSOCIATING) 3364 priv->station_state == STATION_STATE_REASSOCIATING)
@@ -3404,7 +3366,7 @@ static void atmel_management_frame(struct atmel_private *priv,
3404 3366
3405 break; 3367 break;
3406 3368
3407 case C80211_SUBTYPE_MGMT_DISASSOSIATION: 3369 case IEEE80211_STYPE_DISASSOC:
3408 if (priv->station_is_associated && 3370 if (priv->station_is_associated &&
3409 priv->operating_mode == IW_MODE_INFRA && 3371 priv->operating_mode == IW_MODE_INFRA &&
3410 is_frame_from_current_bss(priv, header)) { 3372 is_frame_from_current_bss(priv, header)) {
@@ -3417,7 +3379,7 @@ static void atmel_management_frame(struct atmel_private *priv,
3417 3379
3418 break; 3380 break;
3419 3381
3420 case C80211_SUBTYPE_MGMT_Deauthentication: 3382 case IEEE80211_STYPE_DEAUTH:
3421 if (priv->operating_mode == IW_MODE_INFRA && 3383 if (priv->operating_mode == IW_MODE_INFRA &&
3422 is_frame_from_current_bss(priv, header)) { 3384 is_frame_from_current_bss(priv, header)) {
3423 priv->station_was_associated = 0; 3385 priv->station_was_associated = 0;
@@ -3453,12 +3415,12 @@ static void atmel_management_timer(u_long a)
3453 priv->AuthenticationRequestRetryCnt = 0; 3415 priv->AuthenticationRequestRetryCnt = 0;
3454 restart_search(priv); 3416 restart_search(priv);
3455 } else { 3417 } else {
3456 int auth = C80211_MGMT_AAN_OPENSYSTEM; 3418 int auth = WLAN_AUTH_OPEN;
3457 priv->AuthenticationRequestRetryCnt++; 3419 priv->AuthenticationRequestRetryCnt++;
3458 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3420 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3459 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3421 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3460 if (priv->wep_is_on && priv->exclude_unencrypted) 3422 if (priv->wep_is_on && priv->exclude_unencrypted)
3461 auth = C80211_MGMT_AAN_SHAREDKEY; 3423 auth = WLAN_AUTH_SHARED_KEY;
3462 send_authentication_request(priv, auth, NULL, 0); 3424 send_authentication_request(priv, auth, NULL, 0);
3463 } 3425 }
3464 break; 3426 break;
@@ -3558,14 +3520,14 @@ static void atmel_command_irq(struct atmel_private *priv)
3558 priv->station_was_associated = priv->station_is_associated; 3520 priv->station_was_associated = priv->station_is_associated;
3559 atmel_enter_state(priv, STATION_STATE_READY); 3521 atmel_enter_state(priv, STATION_STATE_READY);
3560 } else { 3522 } else {
3561 int auth = C80211_MGMT_AAN_OPENSYSTEM; 3523 int auth = WLAN_AUTH_OPEN;
3562 priv->AuthenticationRequestRetryCnt = 0; 3524 priv->AuthenticationRequestRetryCnt = 0;
3563 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); 3525 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING);
3564 3526
3565 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3527 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3566 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3528 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3567 if (priv->wep_is_on && priv->exclude_unencrypted) 3529 if (priv->wep_is_on && priv->exclude_unencrypted)
3568 auth = C80211_MGMT_AAN_SHAREDKEY; 3530 auth = WLAN_AUTH_SHARED_KEY;
3569 send_authentication_request(priv, auth, NULL, 0); 3531 send_authentication_request(priv, auth, NULL, 0);
3570 } 3532 }
3571 return; 3533 return;