aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
diff options
context:
space:
mode:
authorJouni Malinen <jkmaline@cc.hut.fi>2005-08-14 22:08:44 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-14 23:07:30 -0400
commit4339d328631aa815fe2181b9164b3690ca2db4da (patch)
tree1848ffbf700ccd4e38c70e218f91dd2a7eadf018 /drivers/net/wireless/hostap
parentc0f72ca8e4f1b459b5582c1c8dcaf7e53151f069 (diff)
[PATCH] hostap: Use ieee80211 WLAN_FC_GET_{TYPE,STYPE}
Replace temporary HOSTAP_FC_GET_{TYPE,STYPE} macros with the ieee80211 version of WLAN_FC_GET_{TYPE,STYPE}. Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r--drivers/net/wireless/hostap/hostap.c23
-rw-r--r--drivers/net/wireless/hostap/hostap.h2
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c46
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c14
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c120
-rw-r--r--drivers/net/wireless/hostap/hostap_common.h43
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c8
8 files changed, 114 insertions, 152 deletions
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
index 0858eba4575f..9ce18b6d6cb8 100644
--- a/drivers/net/wireless/hostap/hostap.c
+++ b/drivers/net/wireless/hostap/hostap.c
@@ -594,7 +594,7 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
594 fc = __le16_to_cpu(rx->frame_control); 594 fc = __le16_to_cpu(rx->frame_control);
595 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " 595 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
596 "data_len=%d%s%s\n", 596 "data_len=%d%s%s\n",
597 fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), 597 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
598 __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), 598 __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl),
599 __le16_to_cpu(rx->data_len), 599 __le16_to_cpu(rx->data_len),
600 fc & WLAN_FC_TODS ? " [ToDS]" : "", 600 fc & WLAN_FC_TODS ? " [ToDS]" : "",
@@ -623,7 +623,7 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
623 fc = __le16_to_cpu(tx->frame_control); 623 fc = __le16_to_cpu(tx->frame_control);
624 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " 624 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
625 "data_len=%d%s%s\n", 625 "data_len=%d%s%s\n",
626 fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), 626 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
627 __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), 627 __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl),
628 __le16_to_cpu(tx->data_len), 628 __le16_to_cpu(tx->data_len),
629 fc & WLAN_FC_TODS ? " [ToDS]" : "", 629 fc & WLAN_FC_TODS ? " [ToDS]" : "",
@@ -666,15 +666,15 @@ int hostap_80211_get_hdrlen(u16 fc)
666{ 666{
667 int hdrlen = 24; 667 int hdrlen = 24;
668 668
669 switch (HOSTAP_FC_GET_TYPE(fc)) { 669 switch (WLAN_FC_GET_TYPE(fc)) {
670 case WLAN_FC_TYPE_DATA: 670 case IEEE80211_FTYPE_DATA:
671 if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) 671 if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS))
672 hdrlen = 30; /* Addr4 */ 672 hdrlen = 30; /* Addr4 */
673 break; 673 break;
674 case WLAN_FC_TYPE_CTRL: 674 case IEEE80211_FTYPE_CTL:
675 switch (HOSTAP_FC_GET_STYPE(fc)) { 675 switch (WLAN_FC_GET_STYPE(fc)) {
676 case WLAN_FC_STYPE_CTS: 676 case IEEE80211_STYPE_CTS:
677 case WLAN_FC_STYPE_ACK: 677 case IEEE80211_STYPE_ACK:
678 hdrlen = 10; 678 hdrlen = 10;
679 break; 679 break;
680 default: 680 default:
@@ -1093,7 +1093,7 @@ int prism2_update_comms_qual(struct net_device *dev)
1093} 1093}
1094 1094
1095 1095
1096int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, 1096int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype,
1097 u8 *body, size_t bodylen) 1097 u8 *body, size_t bodylen)
1098{ 1098{
1099 struct sk_buff *skb; 1099 struct sk_buff *skb;
@@ -1108,8 +1108,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype,
1108 mgmt = (struct hostap_ieee80211_mgmt *) 1108 mgmt = (struct hostap_ieee80211_mgmt *)
1109 skb_put(skb, IEEE80211_MGMT_HDR_LEN); 1109 skb_put(skb, IEEE80211_MGMT_HDR_LEN);
1110 memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN); 1110 memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN);
1111 mgmt->frame_control = 1111 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype);
1112 cpu_to_le16((WLAN_FC_TYPE_MGMT << 2) | (stype << 4));
1113 memcpy(mgmt->da, dst, ETH_ALEN); 1112 memcpy(mgmt->da, dst, ETH_ALEN);
1114 memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); 1113 memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
1115 memcpy(mgmt->bssid, dst, ETH_ALEN); 1114 memcpy(mgmt->bssid, dst, ETH_ALEN);
@@ -1140,7 +1139,7 @@ int prism2_sta_deauth(local_info_t *local, u16 reason)
1140 return 0; 1139 return 0;
1141 1140
1142 reason = cpu_to_le16(reason); 1141 reason = cpu_to_le16(reason);
1143 ret = prism2_sta_send_mgmt(local, local->bssid, WLAN_FC_STYPE_DEAUTH, 1142 ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH,
1144 (u8 *) &reason, 2); 1143 (u8 *) &reason, 2);
1145 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 1144 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
1146 wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); 1145 wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h
index 2ddcf5fc59c3..5fac89b8ce3a 100644
--- a/drivers/net/wireless/hostap/hostap.h
+++ b/drivers/net/wireless/hostap/hostap.h
@@ -37,7 +37,7 @@ struct net_device * hostap_add_interface(struct local_info *local,
37void hostap_remove_interface(struct net_device *dev, int rtnl_locked, 37void hostap_remove_interface(struct net_device *dev, int rtnl_locked,
38 int remove_from_list); 38 int remove_from_list);
39int prism2_update_comms_qual(struct net_device *dev); 39int prism2_update_comms_qual(struct net_device *dev);
40int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, 40int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype,
41 u8 *body, size_t bodylen); 41 u8 *body, size_t bodylen);
42int prism2_sta_deauth(local_info_t *local, u16 reason); 42int prism2_sta_deauth(local_info_t *local, u16 reason);
43 43
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 5363400a5da2..3752a677abb6 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -21,7 +21,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
21 21
22 fc = le16_to_cpu(hdr->frame_ctl); 22 fc = le16_to_cpu(hdr->frame_ctl);
23 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", 23 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
24 fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), 24 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
25 fc & WLAN_FC_TODS ? " [ToDS]" : "", 25 fc & WLAN_FC_TODS ? " [ToDS]" : "",
26 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 26 fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
27 27
@@ -445,8 +445,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
445 skb->data); 445 skb->data);
446 } 446 }
447 447
448 if (local->hostapd && type == WLAN_FC_TYPE_MGMT) { 448 if (local->hostapd && type == IEEE80211_FTYPE_MGMT) {
449 if (stype == WLAN_FC_STYPE_BEACON && 449 if (stype == IEEE80211_STYPE_BEACON &&
450 local->iw_mode == IW_MODE_MASTER) { 450 local->iw_mode == IW_MODE_MASTER) {
451 struct sk_buff *skb2; 451 struct sk_buff *skb2;
452 /* Process beacon frames also in kernel driver to 452 /* Process beacon frames also in kernel driver to
@@ -467,23 +467,24 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
467 } 467 }
468 468
469 if (local->iw_mode == IW_MODE_MASTER) { 469 if (local->iw_mode == IW_MODE_MASTER) {
470 if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { 470 if (type != IEEE80211_FTYPE_MGMT &&
471 type != IEEE80211_FTYPE_CTL) {
471 printk(KERN_DEBUG "%s: unknown management frame " 472 printk(KERN_DEBUG "%s: unknown management frame "
472 "(type=0x%02x, stype=0x%02x) dropped\n", 473 "(type=0x%02x, stype=0x%02x) dropped\n",
473 skb->dev->name, type, stype); 474 skb->dev->name, type >> 2, stype >> 4);
474 return -1; 475 return -1;
475 } 476 }
476 477
477 hostap_rx(skb->dev, skb, rx_stats); 478 hostap_rx(skb->dev, skb, rx_stats);
478 return 0; 479 return 0;
479 } else if (type == WLAN_FC_TYPE_MGMT && 480 } else if (type == IEEE80211_FTYPE_MGMT &&
480 (stype == WLAN_FC_STYPE_BEACON || 481 (stype == IEEE80211_STYPE_BEACON ||
481 stype == WLAN_FC_STYPE_PROBE_RESP)) { 482 stype == IEEE80211_STYPE_PROBE_RESP)) {
482 hostap_rx_sta_beacon(local, skb, stype); 483 hostap_rx_sta_beacon(local, skb, stype);
483 return -1; 484 return -1;
484 } else if (type == WLAN_FC_TYPE_MGMT && 485 } else if (type == IEEE80211_FTYPE_MGMT &&
485 (stype == WLAN_FC_STYPE_ASSOC_RESP || 486 (stype == IEEE80211_STYPE_ASSOC_RESP ||
486 stype == WLAN_FC_STYPE_REASSOC_RESP)) { 487 stype == IEEE80211_STYPE_REASSOC_RESP)) {
487 /* Ignore (Re)AssocResp silently since these are not currently 488 /* Ignore (Re)AssocResp silently since these are not currently
488 * needed but are still received when WPA/RSN mode is enabled. 489 * needed but are still received when WPA/RSN mode is enabled.
489 */ 490 */
@@ -491,7 +492,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
491 } else { 492 } else {
492 printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled" 493 printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
493 " management frame in non-Host AP mode (type=%d:%d)\n", 494 " management frame in non-Host AP mode (type=%d:%d)\n",
494 skb->dev->name, type, stype); 495 skb->dev->name, type >> 2, stype >> 4);
495 return -1; 496 return -1;
496 } 497 }
497} 498}
@@ -719,8 +720,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
719 goto rx_dropped; 720 goto rx_dropped;
720 721
721 fc = le16_to_cpu(hdr->frame_ctl); 722 fc = le16_to_cpu(hdr->frame_ctl);
722 type = HOSTAP_FC_GET_TYPE(fc); 723 type = WLAN_FC_GET_TYPE(fc);
723 stype = HOSTAP_FC_GET_STYPE(fc); 724 stype = WLAN_FC_GET_STYPE(fc);
724 sc = le16_to_cpu(hdr->seq_ctl); 725 sc = le16_to_cpu(hdr->seq_ctl);
725 frag = WLAN_GET_SEQ_FRAG(sc); 726 frag = WLAN_GET_SEQ_FRAG(sc);
726 hdrlen = hostap_80211_get_hdrlen(fc); 727 hdrlen = hostap_80211_get_hdrlen(fc);
@@ -784,8 +785,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
784 } 785 }
785 } 786 }
786 787
787 if (type != WLAN_FC_TYPE_DATA) { 788 if (type != IEEE80211_FTYPE_DATA) {
788 if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && 789 if (type == IEEE80211_FTYPE_MGMT &&
790 stype == IEEE80211_STYPE_AUTH &&
789 fc & WLAN_FC_ISWEP && local->host_decrypt && 791 fc & WLAN_FC_ISWEP && local->host_decrypt &&
790 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 792 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
791 { 793 {
@@ -867,14 +869,14 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
867 869
868 /* Nullfunc frames may have PS-bit set, so they must be passed to 870 /* Nullfunc frames may have PS-bit set, so they must be passed to
869 * hostap_handle_sta_rx() before being dropped here. */ 871 * hostap_handle_sta_rx() before being dropped here. */
870 if (stype != WLAN_FC_STYPE_DATA && 872 if (stype != IEEE80211_STYPE_DATA &&
871 stype != WLAN_FC_STYPE_DATA_CFACK && 873 stype != IEEE80211_STYPE_DATA_CFACK &&
872 stype != WLAN_FC_STYPE_DATA_CFPOLL && 874 stype != IEEE80211_STYPE_DATA_CFPOLL &&
873 stype != WLAN_FC_STYPE_DATA_CFACKPOLL) { 875 stype != IEEE80211_STYPE_DATA_CFACKPOLL) {
874 if (stype != WLAN_FC_STYPE_NULLFUNC) 876 if (stype != IEEE80211_STYPE_NULLFUNC)
875 printk(KERN_DEBUG "%s: RX: dropped data frame " 877 printk(KERN_DEBUG "%s: RX: dropped data frame "
876 "with no data (type=0x%02x, subtype=0x%02x)\n", 878 "with no data (type=0x%02x, subtype=0x%02x)\n",
877 dev->name, type, stype); 879 dev->name, type >> 2, stype >> 4);
878 goto rx_dropped; 880 goto rx_dropped;
879 } 881 }
880 882
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 2b38a5230992..79cf55338d88 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -13,7 +13,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
13 13
14 fc = le16_to_cpu(hdr->frame_ctl); 14 fc = le16_to_cpu(hdr->frame_ctl);
15 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", 15 printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
16 fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), 16 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
17 fc & WLAN_FC_TODS ? " [ToDS]" : "", 17 fc & WLAN_FC_TODS ? " [ToDS]" : "",
18 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 18 fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
19 19
@@ -115,7 +115,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
115 skip_header_bytes -= 2; 115 skip_header_bytes -= 2;
116 } 116 }
117 117
118 fc = (WLAN_FC_TYPE_DATA << 2) | (WLAN_FC_STYPE_DATA << 4); 118 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
119 hdr_len = IEEE80211_DATA_HDR3_LEN; 119 hdr_len = IEEE80211_DATA_HDR3_LEN;
120 120
121 if (use_wds != WDS_NO) { 121 if (use_wds != WDS_NO) {
@@ -268,8 +268,8 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
268 if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { 268 if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
269 hdr = (struct ieee80211_hdr *) skb->data; 269 hdr = (struct ieee80211_hdr *) skb->data;
270 fc = le16_to_cpu(hdr->frame_ctl); 270 fc = le16_to_cpu(hdr->frame_ctl);
271 if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && 271 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
272 HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) { 272 WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) {
273 u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + 273 u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN +
274 sizeof(rfc1042_header)]; 274 sizeof(rfc1042_header)];
275 meta->ethertype = (pos[0] << 8) | pos[1]; 275 meta->ethertype = (pos[0] << 8) | pos[1];
@@ -410,7 +410,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
410 break; 410 break;
411 case AP_TX_CONTINUE_NOT_AUTHORIZED: 411 case AP_TX_CONTINUE_NOT_AUTHORIZED:
412 if (local->ieee_802_1x && 412 if (local->ieee_802_1x &&
413 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && 413 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
414 meta->ethertype != ETH_P_PAE && 414 meta->ethertype != ETH_P_PAE &&
415 !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { 415 !(meta->flags & HOSTAP_TX_FLAGS_WDS)) {
416 printk(KERN_DEBUG "%s: dropped frame to unauthorized " 416 printk(KERN_DEBUG "%s: dropped frame to unauthorized "
@@ -448,7 +448,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
448 hdr->frame_ctl = cpu_to_le16(fc); 448 hdr->frame_ctl = cpu_to_le16(fc);
449 } 449 }
450 450
451 if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) { 451 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) {
452 no_encrypt = 1; 452 no_encrypt = 1;
453 tx.crypt = NULL; 453 tx.crypt = NULL;
454 } 454 }
@@ -469,7 +469,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
469 fc |= WLAN_FC_ISWEP; 469 fc |= WLAN_FC_ISWEP;
470 hdr->frame_ctl = cpu_to_le16(fc); 470 hdr->frame_ctl = cpu_to_le16(fc);
471 } else if (local->drop_unencrypted && 471 } else if (local->drop_unencrypted &&
472 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && 472 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
473 meta->ethertype != ETH_P_PAE) { 473 meta->ethertype != ETH_P_PAE) {
474 if (net_ratelimit()) { 474 if (net_ratelimit()) {
475 printk(KERN_DEBUG "%s: dropped unencrypted TX data " 475 printk(KERN_DEBUG "%s: dropped unencrypted TX data "
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 5cd8d23c30ee..596c4dde079d 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -46,7 +46,7 @@ static void handle_add_proc_queue(void *data);
46#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 46#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
47static void handle_wds_oper_queue(void *data); 47static void handle_wds_oper_queue(void *data);
48static void prism2_send_mgmt(struct net_device *dev, 48static void prism2_send_mgmt(struct net_device *dev,
49 int type, int subtype, char *body, 49 u16 type_subtype, char *body,
50 int body_len, u8 *addr, u16 tx_cb_idx); 50 int body_len, u8 *addr, u16 tx_cb_idx);
51#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 51#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
52 52
@@ -237,12 +237,12 @@ static void ap_handle_timer(unsigned long data)
237 } else if (sta->timeout_next == STA_NULLFUNC) { 237 } else if (sta->timeout_next == STA_NULLFUNC) {
238 /* send data frame to poll STA and check whether this frame 238 /* send data frame to poll STA and check whether this frame
239 * is ACKed */ 239 * is ACKed */
240 /* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but 240 /* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but
241 * it is apparently not retried so TX Exc events are not 241 * it is apparently not retried so TX Exc events are not
242 * received for it */ 242 * received for it */
243 sta->flags |= WLAN_STA_PENDING_POLL; 243 sta->flags |= WLAN_STA_PENDING_POLL;
244 prism2_send_mgmt(local->dev, WLAN_FC_TYPE_DATA, 244 prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA |
245 WLAN_FC_STYPE_DATA, NULL, 0, 245 IEEE80211_STYPE_DATA, NULL, 0,
246 sta->addr, ap->tx_callback_poll); 246 sta->addr, ap->tx_callback_poll);
247 } else { 247 } else {
248 int deauth = sta->timeout_next == STA_DEAUTH; 248 int deauth = sta->timeout_next == STA_DEAUTH;
@@ -255,9 +255,9 @@ static void ap_handle_timer(unsigned long data)
255 255
256 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : 256 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
257 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); 257 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
258 prism2_send_mgmt(local->dev, WLAN_FC_TYPE_MGMT, 258 prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT |
259 (deauth ? WLAN_FC_STYPE_DEAUTH : 259 (deauth ? IEEE80211_STYPE_DEAUTH :
260 WLAN_FC_STYPE_DISASSOC), 260 IEEE80211_STYPE_DISASSOC),
261 (char *) &resp, 2, sta->addr, 0); 261 (char *) &resp, 2, sta->addr, 0);
262 } 262 }
263 263
@@ -300,7 +300,8 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
300 * else we can do at this point since the driver is going to be shut 300 * else we can do at this point since the driver is going to be shut
301 * down */ 301 * down */
302 for (i = 0; i < 5; i++) { 302 for (i = 0; i < 5; i++) {
303 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, 303 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
304 IEEE80211_STYPE_DEAUTH,
304 (char *) &resp, 2, addr, 0); 305 (char *) &resp, 2, addr, 0);
305 306
306 if (!resend || ap->num_sta <= 0) 307 if (!resend || ap->num_sta <= 0)
@@ -471,7 +472,7 @@ static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev,
471 return -EINVAL; 472 return -EINVAL;
472 473
473 resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); 474 resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
474 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, 475 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH,
475 (char *) &resp, 2, sta->addr, 0); 476 (char *) &resp, 2, sta->addr, 0);
476 477
477 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) 478 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap)
@@ -634,8 +635,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
634 635
635 hdr = (struct ieee80211_hdr *) skb->data; 636 hdr = (struct ieee80211_hdr *) skb->data;
636 fc = le16_to_cpu(hdr->frame_ctl); 637 fc = le16_to_cpu(hdr->frame_ctl);
637 if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || 638 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
638 HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH || 639 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH ||
639 skb->len < IEEE80211_MGMT_HDR_LEN + 6) { 640 skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
640 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " 641 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
641 "frame\n", dev->name); 642 "frame\n", dev->name);
@@ -703,9 +704,9 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
703 704
704 hdr = (struct ieee80211_hdr *) skb->data; 705 hdr = (struct ieee80211_hdr *) skb->data;
705 fc = le16_to_cpu(hdr->frame_ctl); 706 fc = le16_to_cpu(hdr->frame_ctl);
706 if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || 707 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
707 (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP && 708 (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP &&
708 HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) || 709 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) ||
709 skb->len < IEEE80211_MGMT_HDR_LEN + 4) { 710 skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
710 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " 711 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
711 "frame\n", dev->name); 712 "frame\n", dev->name);
@@ -912,7 +913,7 @@ static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta)
912 913
913/* Called from timer handler and from scheduled AP queue handlers */ 914/* Called from timer handler and from scheduled AP queue handlers */
914static void prism2_send_mgmt(struct net_device *dev, 915static void prism2_send_mgmt(struct net_device *dev,
915 int type, int subtype, char *body, 916 u16 type_subtype, char *body,
916 int body_len, u8 *addr, u16 tx_cb_idx) 917 int body_len, u8 *addr, u16 tx_cb_idx)
917{ 918{
918 struct hostap_interface *iface; 919 struct hostap_interface *iface;
@@ -941,7 +942,7 @@ static void prism2_send_mgmt(struct net_device *dev,
941 return; 942 return;
942 } 943 }
943 944
944 fc = (type << 2) | (subtype << 4); 945 fc = type_subtype;
945 hdrlen = hostap_80211_get_hdrlen(fc); 946 hdrlen = hostap_80211_get_hdrlen(fc);
946 hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); 947 hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen);
947 if (body) 948 if (body)
@@ -954,11 +955,11 @@ static void prism2_send_mgmt(struct net_device *dev,
954 955
955 956
956 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ 957 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */
957 if (type == WLAN_FC_TYPE_DATA) { 958 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
958 fc |= WLAN_FC_FROMDS; 959 fc |= WLAN_FC_FROMDS;
959 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ 960 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */
960 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ 961 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
961 } else if (type == WLAN_FC_TYPE_CTRL) { 962 } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
962 /* control:ACK does not have addr2 or addr3 */ 963 /* control:ACK does not have addr2 or addr3 */
963 memset(hdr->addr2, 0, ETH_ALEN); 964 memset(hdr->addr2, 0, ETH_ALEN);
964 memset(hdr->addr3, 0, ETH_ALEN); 965 memset(hdr->addr3, 0, ETH_ALEN);
@@ -1475,7 +1476,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1475 olen += 2 + WLAN_AUTH_CHALLENGE_LEN; 1476 olen += 2 + WLAN_AUTH_CHALLENGE_LEN;
1476 } 1477 }
1477 1478
1478 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_AUTH, 1479 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH,
1479 body, olen, hdr->addr2, ap->tx_callback_auth); 1480 body, olen, hdr->addr2, ap->tx_callback_auth);
1480 1481
1481 if (sta) { 1482 if (sta) {
@@ -1673,10 +1674,10 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1673 pos = (u16 *) p; 1674 pos = (u16 *) p;
1674 } 1675 }
1675 1676
1676 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, 1677 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
1677 (send_deauth ? WLAN_FC_STYPE_DEAUTH : 1678 (send_deauth ? IEEE80211_STYPE_DEAUTH :
1678 (reassoc ? WLAN_FC_STYPE_REASSOC_RESP : 1679 (reassoc ? IEEE80211_STYPE_REASSOC_RESP :
1679 WLAN_FC_STYPE_ASSOC_RESP)), 1680 IEEE80211_STYPE_ASSOC_RESP)),
1680 body, (u8 *) pos - (u8 *) body, 1681 body, (u8 *) pos - (u8 *) body,
1681 hdr->addr2, 1682 hdr->addr2,
1682 send_deauth ? 0 : local->ap->tx_callback_assoc); 1683 send_deauth ? 0 : local->ap->tx_callback_assoc);
@@ -1793,7 +1794,7 @@ static void ap_handle_data_nullfunc(local_info_t *local,
1793 * send control::ACK for the data::nullfunc */ 1794 * send control::ACK for the data::nullfunc */
1794 1795
1795 printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n"); 1796 printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n");
1796 prism2_send_mgmt(dev, WLAN_FC_TYPE_CTRL, WLAN_FC_STYPE_ACK, 1797 prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK,
1797 NULL, 0, hdr->addr2, 0); 1798 NULL, 0, hdr->addr2, 0);
1798} 1799}
1799 1800
@@ -1820,9 +1821,9 @@ static void ap_handle_dropped_data(local_info_t *local,
1820 1821
1821 reason = __constant_cpu_to_le16( 1822 reason = __constant_cpu_to_le16(
1822 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); 1823 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
1823 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, 1824 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
1824 ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? 1825 ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ?
1825 WLAN_FC_STYPE_DEAUTH : WLAN_FC_STYPE_DISASSOC), 1826 IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC),
1826 (char *) &reason, sizeof(reason), hdr->addr2, 0); 1827 (char *) &reason, sizeof(reason), hdr->addr2, 0);
1827 1828
1828 if (sta) 1829 if (sta)
@@ -2142,15 +2143,15 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2142 * buffer is long enough */ 2143 * buffer is long enough */
2143 hdr = (struct ieee80211_hdr *) skb->data; 2144 hdr = (struct ieee80211_hdr *) skb->data;
2144 fc = le16_to_cpu(hdr->frame_ctl); 2145 fc = le16_to_cpu(hdr->frame_ctl);
2145 type = HOSTAP_FC_GET_TYPE(fc); 2146 type = WLAN_FC_GET_TYPE(fc);
2146 stype = HOSTAP_FC_GET_STYPE(fc); 2147 stype = WLAN_FC_GET_STYPE(fc);
2147 2148
2148#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2149#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2149 if (!local->hostapd && type == WLAN_FC_TYPE_DATA) { 2150 if (!local->hostapd && type == IEEE80211_FTYPE_DATA) {
2150 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); 2151 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n");
2151 2152
2152 if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { 2153 if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) {
2153 if (stype == WLAN_FC_STYPE_NULLFUNC) { 2154 if (stype == IEEE80211_STYPE_NULLFUNC) {
2154 /* no ToDS nullfunc seems to be used to check 2155 /* no ToDS nullfunc seems to be used to check
2155 * AP association; so send reject message to 2156 * AP association; so send reject message to
2156 * speed up re-association */ 2157 * speed up re-association */
@@ -2169,20 +2170,21 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2169 goto done; 2170 goto done;
2170 } 2171 }
2171 2172
2172 if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC) 2173 if (local->ap->nullfunc_ack &&
2174 stype == IEEE80211_STYPE_NULLFUNC)
2173 ap_handle_data_nullfunc(local, hdr); 2175 ap_handle_data_nullfunc(local, hdr);
2174 else 2176 else
2175 ap_handle_dropped_data(local, hdr); 2177 ap_handle_dropped_data(local, hdr);
2176 goto done; 2178 goto done;
2177 } 2179 }
2178 2180
2179 if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) { 2181 if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) {
2180 handle_beacon(local, skb, rx_stats); 2182 handle_beacon(local, skb, rx_stats);
2181 goto done; 2183 goto done;
2182 } 2184 }
2183#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2185#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2184 2186
2185 if (type == WLAN_FC_TYPE_CTRL && stype == WLAN_FC_STYPE_PSPOLL) { 2187 if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) {
2186 handle_pspoll(local, hdr, rx_stats); 2188 handle_pspoll(local, hdr, rx_stats);
2187 goto done; 2189 goto done;
2188 } 2190 }
@@ -2194,7 +2196,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2194 } 2196 }
2195 2197
2196#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2198#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2197 if (type != WLAN_FC_TYPE_MGMT) { 2199 if (type != IEEE80211_FTYPE_MGMT) {
2198 PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n"); 2200 PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n");
2199 goto done; 2201 goto done;
2200 } 2202 }
@@ -2212,32 +2214,33 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2212 } 2214 }
2213 2215
2214 switch (stype) { 2216 switch (stype) {
2215 case WLAN_FC_STYPE_ASSOC_REQ: 2217 case IEEE80211_STYPE_ASSOC_REQ:
2216 handle_assoc(local, skb, rx_stats, 0); 2218 handle_assoc(local, skb, rx_stats, 0);
2217 break; 2219 break;
2218 case WLAN_FC_STYPE_ASSOC_RESP: 2220 case IEEE80211_STYPE_ASSOC_RESP:
2219 PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n"); 2221 PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n");
2220 break; 2222 break;
2221 case WLAN_FC_STYPE_REASSOC_REQ: 2223 case IEEE80211_STYPE_REASSOC_REQ:
2222 handle_assoc(local, skb, rx_stats, 1); 2224 handle_assoc(local, skb, rx_stats, 1);
2223 break; 2225 break;
2224 case WLAN_FC_STYPE_REASSOC_RESP: 2226 case IEEE80211_STYPE_REASSOC_RESP:
2225 PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n"); 2227 PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n");
2226 break; 2228 break;
2227 case WLAN_FC_STYPE_ATIM: 2229 case IEEE80211_STYPE_ATIM:
2228 PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n"); 2230 PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n");
2229 break; 2231 break;
2230 case WLAN_FC_STYPE_DISASSOC: 2232 case IEEE80211_STYPE_DISASSOC:
2231 handle_disassoc(local, skb, rx_stats); 2233 handle_disassoc(local, skb, rx_stats);
2232 break; 2234 break;
2233 case WLAN_FC_STYPE_AUTH: 2235 case IEEE80211_STYPE_AUTH:
2234 handle_authen(local, skb, rx_stats); 2236 handle_authen(local, skb, rx_stats);
2235 break; 2237 break;
2236 case WLAN_FC_STYPE_DEAUTH: 2238 case IEEE80211_STYPE_DEAUTH:
2237 handle_deauth(local, skb, rx_stats); 2239 handle_deauth(local, skb, rx_stats);
2238 break; 2240 break;
2239 default: 2241 default:
2240 PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", stype); 2242 PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n",
2243 stype >> 4);
2241 break; 2244 break;
2242 } 2245 }
2243#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2246#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -2268,8 +2271,8 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
2268 fc = le16_to_cpu(hdr->frame_ctl); 2271 fc = le16_to_cpu(hdr->frame_ctl);
2269 2272
2270 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && 2273 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
2271 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && 2274 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT &&
2272 HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON) 2275 WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON)
2273 goto drop; 2276 goto drop;
2274 2277
2275 skb->protocol = __constant_htons(ETH_P_HOSTAP); 2278 skb->protocol = __constant_htons(ETH_P_HOSTAP);
@@ -2302,7 +2305,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2302 2305
2303 /* Generate a fake pspoll frame to start packet delivery */ 2306 /* Generate a fake pspoll frame to start packet delivery */
2304 hdr->frame_ctl = __constant_cpu_to_le16( 2307 hdr->frame_ctl = __constant_cpu_to_le16(
2305 (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4)); 2308 IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
2306 memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); 2309 memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
2307 memcpy(hdr->addr2, sta->addr, ETH_ALEN); 2310 memcpy(hdr->addr2, sta->addr, ETH_ALEN);
2308 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); 2311 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
@@ -2872,13 +2875,14 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
2872 sta->flags |= WLAN_STA_PS; 2875 sta->flags |= WLAN_STA_PS;
2873 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS " 2876 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS "
2874 "mode (type=0x%02X, stype=0x%02X)\n", 2877 "mode (type=0x%02X, stype=0x%02X)\n",
2875 MAC2STR(sta->addr), type, stype); 2878 MAC2STR(sta->addr), type >> 2, stype >> 4);
2876 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { 2879 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
2877 sta->flags &= ~WLAN_STA_PS; 2880 sta->flags &= ~WLAN_STA_PS;
2878 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use " 2881 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use "
2879 "PS mode (type=0x%02X, stype=0x%02X)\n", 2882 "PS mode (type=0x%02X, stype=0x%02X)\n",
2880 MAC2STR(sta->addr), type, stype); 2883 MAC2STR(sta->addr), type >> 2, stype >> 4);
2881 if (type != WLAN_FC_TYPE_CTRL || stype != WLAN_FC_STYPE_PSPOLL) 2884 if (type != IEEE80211_FTYPE_CTL ||
2885 stype != IEEE80211_STYPE_PSPOLL)
2882 schedule_packet_send(local, sta); 2886 schedule_packet_send(local, sta);
2883 } 2887 }
2884} 2888}
@@ -2902,7 +2906,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
2902 2906
2903 fc = le16_to_cpu(hdr->frame_ctl); 2907 fc = le16_to_cpu(hdr->frame_ctl);
2904 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, 2908 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT,
2905 HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc)); 2909 WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
2906 2910
2907 atomic_dec(&sta->users); 2911 atomic_dec(&sta->users);
2908 return 0; 2912 return 0;
@@ -2927,8 +2931,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2927 hdr = (struct ieee80211_hdr *) skb->data; 2931 hdr = (struct ieee80211_hdr *) skb->data;
2928 2932
2929 fc = le16_to_cpu(hdr->frame_ctl); 2933 fc = le16_to_cpu(hdr->frame_ctl);
2930 type = HOSTAP_FC_GET_TYPE(fc); 2934 type = WLAN_FC_GET_TYPE(fc);
2931 stype = HOSTAP_FC_GET_STYPE(fc); 2935 stype = WLAN_FC_GET_STYPE(fc);
2932 2936
2933 spin_lock(&local->ap->sta_table_lock); 2937 spin_lock(&local->ap->sta_table_lock);
2934 sta = ap_get_sta(local->ap, hdr->addr2); 2938 sta = ap_get_sta(local->ap, hdr->addr2);
@@ -2952,8 +2956,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2952 printk(KERN_DEBUG "%s: dropped received packet" 2956 printk(KERN_DEBUG "%s: dropped received packet"
2953 " from non-associated STA " MACSTR 2957 " from non-associated STA " MACSTR
2954 " (type=0x%02x, subtype=0x%02x)\n", 2958 " (type=0x%02x, subtype=0x%02x)\n",
2955 dev->name, MAC2STR(hdr->addr2), type, 2959 dev->name, MAC2STR(hdr->addr2),
2956 stype); 2960 type >> 2, stype >> 4);
2957 hostap_rx(dev, skb, rx_stats); 2961 hostap_rx(dev, skb, rx_stats);
2958#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2962#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2959 } 2963 }
@@ -2972,7 +2976,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2972 ret = AP_RX_DROP; 2976 ret = AP_RX_DROP;
2973 goto out; 2977 goto out;
2974 } 2978 }
2975 } else if (stype == WLAN_FC_STYPE_NULLFUNC && sta == NULL && 2979 } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL &&
2976 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { 2980 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
2977 2981
2978 if (local->hostapd) { 2982 if (local->hostapd) {
@@ -2994,7 +2998,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2994 } 2998 }
2995 ret = AP_RX_EXIT; 2999 ret = AP_RX_EXIT;
2996 goto out; 3000 goto out;
2997 } else if (stype == WLAN_FC_STYPE_NULLFUNC) { 3001 } else if (stype == IEEE80211_STYPE_NULLFUNC) {
2998 /* At least Lucent cards seem to send periodic nullfunc 3002 /* At least Lucent cards seem to send periodic nullfunc
2999 * frames with ToDS. Let these through to update SQ 3003 * frames with ToDS. Let these through to update SQ
3000 * stats and PS state. Nullfunc frames do not contain 3004 * stats and PS state. Nullfunc frames do not contain
@@ -3007,7 +3011,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3007 printk(KERN_DEBUG "%s: dropped received packet from " 3011 printk(KERN_DEBUG "%s: dropped received packet from "
3008 MACSTR " with no ToDS flag (type=0x%02x, " 3012 MACSTR " with no ToDS flag (type=0x%02x, "
3009 "subtype=0x%02x)\n", dev->name, 3013 "subtype=0x%02x)\n", dev->name,
3010 MAC2STR(hdr->addr2), type, stype); 3014 MAC2STR(hdr->addr2), type >> 2, stype >> 4);
3011 hostap_dump_rx_80211(dev->name, skb, rx_stats); 3015 hostap_dump_rx_80211(dev->name, skb, rx_stats);
3012 } 3016 }
3013 ret = AP_RX_DROP; 3017 ret = AP_RX_DROP;
@@ -3023,7 +3027,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3023 sta->last_rx = jiffies; 3027 sta->last_rx = jiffies;
3024 } 3028 }
3025 3029
3026 if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC && 3030 if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC &&
3027 fc & WLAN_FC_TODS) { 3031 fc & WLAN_FC_TODS) {
3028 if (local->hostapd) { 3032 if (local->hostapd) {
3029 prism2_rx_80211(local->apdev, skb, rx_stats, 3033 prism2_rx_80211(local->apdev, skb, rx_stats,
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index 76f5ef1b59d3..199a65841ad3 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -19,49 +19,6 @@
19#define WLAN_FC_ISWEP BIT(14) 19#define WLAN_FC_ISWEP BIT(14)
20#define WLAN_FC_ORDER BIT(15) 20#define WLAN_FC_ORDER BIT(15)
21 21
22/*
23 * To be replaced with ieee80211.h WLAN_FC_GET_* once HostAP code is updated to
24 * use the versions without right shift.
25 */
26#define HOSTAP_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2)
27#define HOSTAP_FC_GET_STYPE(fc) \
28 (((fc) & (BIT(7) | BIT(6) | BIT(5) | BIT(4))) >> 4)
29
30#define WLAN_FC_TYPE_MGMT 0
31#define WLAN_FC_TYPE_CTRL 1
32#define WLAN_FC_TYPE_DATA 2
33
34/* management */
35#define WLAN_FC_STYPE_ASSOC_REQ 0
36#define WLAN_FC_STYPE_ASSOC_RESP 1
37#define WLAN_FC_STYPE_REASSOC_REQ 2
38#define WLAN_FC_STYPE_REASSOC_RESP 3
39#define WLAN_FC_STYPE_PROBE_REQ 4
40#define WLAN_FC_STYPE_PROBE_RESP 5
41#define WLAN_FC_STYPE_BEACON 8
42#define WLAN_FC_STYPE_ATIM 9
43#define WLAN_FC_STYPE_DISASSOC 10
44#define WLAN_FC_STYPE_AUTH 11
45#define WLAN_FC_STYPE_DEAUTH 12
46
47/* control */
48#define WLAN_FC_STYPE_PSPOLL 10
49#define WLAN_FC_STYPE_RTS 11
50#define WLAN_FC_STYPE_CTS 12
51#define WLAN_FC_STYPE_ACK 13
52#define WLAN_FC_STYPE_CFEND 14
53#define WLAN_FC_STYPE_CFENDACK 15
54
55/* data */
56#define WLAN_FC_STYPE_DATA 0
57#define WLAN_FC_STYPE_DATA_CFACK 1
58#define WLAN_FC_STYPE_DATA_CFPOLL 2
59#define WLAN_FC_STYPE_DATA_CFACKPOLL 3
60#define WLAN_FC_STYPE_NULLFUNC 4
61#define WLAN_FC_STYPE_CFACK 5
62#define WLAN_FC_STYPE_CFPOLL 6
63#define WLAN_FC_STYPE_CFACKPOLL 7
64
65#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS 22#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS
66 23
67 24
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 03c81b824242..34037b599ebc 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -1843,7 +1843,7 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
1843 hdr_len = 24; 1843 hdr_len = 24;
1844 memcpy(&txdesc.frame_control, skb->data, hdr_len); 1844 memcpy(&txdesc.frame_control, skb->data, hdr_len);
1845 fc = le16_to_cpu(txdesc.frame_control); 1845 fc = le16_to_cpu(txdesc.frame_control);
1846 if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && 1846 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
1847 (fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) { 1847 (fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) {
1848 /* Addr4 */ 1848 /* Addr4 */
1849 memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); 1849 memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
@@ -2395,10 +2395,10 @@ static void prism2_txexc(local_info_t *local)
2395 PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " 2395 PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x "
2396 "(%s%s%s::%d%s%s)\n", 2396 "(%s%s%s::%d%s%s)\n",
2397 txdesc.retry_count, txdesc.tx_rate, fc, 2397 txdesc.retry_count, txdesc.tx_rate, fc,
2398 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "", 2398 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "",
2399 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "", 2399 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "",
2400 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "", 2400 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "",
2401 HOSTAP_FC_GET_STYPE(fc), 2401 WLAN_FC_GET_STYPE(fc) >> 4,
2402 fc & WLAN_FC_TODS ? " ToDS" : "", 2402 fc & WLAN_FC_TODS ? " ToDS" : "",
2403 fc & WLAN_FC_FROMDS ? " FromDS" : ""); 2403 fc & WLAN_FC_FROMDS ? " FromDS" : "");
2404 PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3=" 2404 PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 267f68b4d7fd..e720369a3515 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -3784,11 +3784,11 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
3784 switch (mlme->cmd) { 3784 switch (mlme->cmd) {
3785 case IW_MLME_DEAUTH: 3785 case IW_MLME_DEAUTH:
3786 return prism2_sta_send_mgmt(local, mlme->addr.sa_data, 3786 return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
3787 WLAN_FC_STYPE_DEAUTH, 3787 IEEE80211_STYPE_DEAUTH,
3788 (u8 *) &reason, 2); 3788 (u8 *) &reason, 2);
3789 case IW_MLME_DISASSOC: 3789 case IW_MLME_DISASSOC:
3790 return prism2_sta_send_mgmt(local, mlme->addr.sa_data, 3790 return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
3791 WLAN_FC_STYPE_DISASSOC, 3791 IEEE80211_STYPE_DISASSOC,
3792 (u8 *) &reason, 2); 3792 (u8 *) &reason, 2);
3793 default: 3793 default:
3794 return -EOPNOTSUPP; 3794 return -EOPNOTSUPP;
@@ -3805,11 +3805,11 @@ static int prism2_ioctl_mlme(local_info_t *local,
3805 switch (param->u.mlme.cmd) { 3805 switch (param->u.mlme.cmd) {
3806 case MLME_STA_DEAUTH: 3806 case MLME_STA_DEAUTH:
3807 return prism2_sta_send_mgmt(local, param->sta_addr, 3807 return prism2_sta_send_mgmt(local, param->sta_addr,
3808 WLAN_FC_STYPE_DEAUTH, 3808 IEEE80211_STYPE_DEAUTH,
3809 (u8 *) &reason, 2); 3809 (u8 *) &reason, 2);
3810 case MLME_STA_DISASSOC: 3810 case MLME_STA_DISASSOC:
3811 return prism2_sta_send_mgmt(local, param->sta_addr, 3811 return prism2_sta_send_mgmt(local, param->sta_addr,
3812 WLAN_FC_STYPE_DISASSOC, 3812 IEEE80211_STYPE_DISASSOC,
3813 (u8 *) &reason, 2); 3813 (u8 *) &reason, 2);
3814 default: 3814 default:
3815 return -EOPNOTSUPP; 3815 return -EOPNOTSUPP;