aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJouni Malinen <jkmaline@cc.hut.fi>2005-08-15 00:00:01 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-15 00:29:20 -0400
commitb2f4a2e3b1620667da9654f9e220c92ea52bdbe4 (patch)
treedb5e024ea15f6d78f373074d6d32a726db736633 /drivers
parente313087e42da177df00652d03be9afccf25f9545 (diff)
[PATCH] hostap: Replace WLAN_FC_ defines with ieee80211 ones
Replace remaining WLAN_FC_* defines with the ones used in ieee80211 header file. This completes the move from hostap version of frame control field processing to ieee80211 version. Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/hostap/hostap.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c61
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c20
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c24
-rw-r--r--drivers/net/wireless/hostap/hostap_common.h10
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c7
6 files changed, 65 insertions, 67 deletions
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
index 9ce18b6d6cb8..e7f5821b4942 100644
--- a/drivers/net/wireless/hostap/hostap.c
+++ b/drivers/net/wireless/hostap/hostap.c
@@ -597,8 +597,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
597 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, 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 & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
601 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 601 fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
602 602
603 printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" 603 printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4="
604 MACSTR "\n", 604 MACSTR "\n",
@@ -626,8 +626,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
626 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, 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 & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
630 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 630 fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
631 631
632 printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" 632 printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4="
633 MACSTR "\n", 633 MACSTR "\n",
@@ -668,7 +668,7 @@ int hostap_80211_get_hdrlen(u16 fc)
668 668
669 switch (WLAN_FC_GET_TYPE(fc)) { 669 switch (WLAN_FC_GET_TYPE(fc)) {
670 case IEEE80211_FTYPE_DATA: 670 case IEEE80211_FTYPE_DATA:
671 if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) 671 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
672 hdrlen = 30; /* Addr4 */ 672 hdrlen = 30; /* Addr4 */
673 break; 673 break;
674 case IEEE80211_FTYPE_CTL: 674 case IEEE80211_FTYPE_CTL:
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 3752a677abb6..051a59075ea8 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -22,8 +22,8 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
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, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, 24 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
25 fc & WLAN_FC_TODS ? " [ToDS]" : "", 25 fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
26 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 26 fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
27 27
28 if (skb->len < IEEE80211_DATA_HDR3_LEN) { 28 if (skb->len < IEEE80211_DATA_HDR3_LEN) {
29 printk("\n"); 29 printk("\n");
@@ -73,9 +73,9 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
73 hdr = (struct ieee80211_hdr *) skb->data; 73 hdr = (struct ieee80211_hdr *) skb->data;
74 fc = le16_to_cpu(hdr->frame_ctl); 74 fc = le16_to_cpu(hdr->frame_ctl);
75 75
76 if (type == PRISM2_RX_MGMT && (fc & WLAN_FC_PVER)) { 76 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
77 printk(KERN_DEBUG "%s: dropped management frame with header " 77 printk(KERN_DEBUG "%s: dropped management frame with header "
78 "version %d\n", dev->name, fc & WLAN_FC_PVER); 78 "version %d\n", dev->name, fc & IEEE80211_FCTL_VERS);
79 dev_kfree_skb_any(skb); 79 dev_kfree_skb_any(skb);
80 return 0; 80 return 0;
81 } 81 }
@@ -525,9 +525,9 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
525{ 525{
526 /* FIX: is this really supposed to accept WDS frames only in Master 526 /* FIX: is this really supposed to accept WDS frames only in Master
527 * mode? What about Repeater or Managed with WDS frames? */ 527 * mode? What about Repeater or Managed with WDS frames? */
528 if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) != 528 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) !=
529 (WLAN_FC_TODS | WLAN_FC_FROMDS) && 529 (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS) &&
530 (local->iw_mode != IW_MODE_MASTER || !(fc & WLAN_FC_TODS))) 530 (local->iw_mode != IW_MODE_MASTER || !(fc & IEEE80211_FCTL_TODS)))
531 return 0; /* not a WDS frame */ 531 return 0; /* not a WDS frame */
532 532
533 /* Possible WDS frame: either IEEE 802.11 compliant (if FromDS) 533 /* Possible WDS frame: either IEEE 802.11 compliant (if FromDS)
@@ -539,14 +539,15 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
539 /* RA (or BSSID) is not ours - drop */ 539 /* RA (or BSSID) is not ours - drop */
540 PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with " 540 PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with "
541 "not own or broadcast %s=" MACSTR "\n", 541 "not own or broadcast %s=" MACSTR "\n",
542 local->dev->name, fc & WLAN_FC_FROMDS ? "RA" : "BSSID", 542 local->dev->name,
543 fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
543 MAC2STR(hdr->addr1)); 544 MAC2STR(hdr->addr1));
544 return -1; 545 return -1;
545 } 546 }
546 547
547 /* check if the frame came from a registered WDS connection */ 548 /* check if the frame came from a registered WDS connection */
548 *wds = prism2_rx_get_wds(local, hdr->addr2); 549 *wds = prism2_rx_get_wds(local, hdr->addr2);
549 if (*wds == NULL && fc & WLAN_FC_FROMDS && 550 if (*wds == NULL && fc & IEEE80211_FCTL_FROMDS &&
550 (local->iw_mode != IW_MODE_INFRA || 551 (local->iw_mode != IW_MODE_INFRA ||
551 !(local->wds_type & HOSTAP_WDS_AP_CLIENT) || 552 !(local->wds_type & HOSTAP_WDS_AP_CLIENT) ||
552 memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) { 553 memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) {
@@ -560,7 +561,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
560 return -1; 561 return -1;
561 } 562 }
562 563
563 if (*wds && !(fc & WLAN_FC_FROMDS) && local->ap && 564 if (*wds && !(fc & IEEE80211_FCTL_FROMDS) && local->ap &&
564 hostap_is_sta_assoc(local->ap, hdr->addr2)) { 565 hostap_is_sta_assoc(local->ap, hdr->addr2)) {
565 /* STA is actually associated with us even though it has a 566 /* STA is actually associated with us even though it has a
566 * registered WDS link. Assume it is in 'AP client' mode. 567 * registered WDS link. Assume it is in 'AP client' mode.
@@ -588,11 +589,13 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
588 fc = le16_to_cpu(hdr->frame_ctl); 589 fc = le16_to_cpu(hdr->frame_ctl);
589 590
590 /* check that the frame is unicast frame to us */ 591 /* check that the frame is unicast frame to us */
591 if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS && 592 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
593 IEEE80211_FCTL_TODS &&
592 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && 594 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&
593 memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 595 memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
594 /* ToDS frame with own addr BSSID and DA */ 596 /* ToDS frame with own addr BSSID and DA */
595 } else if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS && 597 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
598 IEEE80211_FCTL_FROMDS &&
596 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { 599 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
597 /* FromDS frame with own addr as DA */ 600 /* FromDS frame with own addr as DA */
598 } else 601 } else
@@ -770,7 +773,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
770 crypt->ops->decrypt_mpdu == NULL)) 773 crypt->ops->decrypt_mpdu == NULL))
771 crypt = NULL; 774 crypt = NULL;
772 775
773 if (!crypt && (fc & WLAN_FC_ISWEP)) { 776 if (!crypt && (fc & IEEE80211_FCTL_WEP)) {
774#if 0 777#if 0
775 /* This seems to be triggered by some (multicast?) 778 /* This seems to be triggered by some (multicast?)
776 * frames from other than current BSS, so just drop the 779 * frames from other than current BSS, so just drop the
@@ -788,7 +791,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
788 if (type != IEEE80211_FTYPE_DATA) { 791 if (type != IEEE80211_FTYPE_DATA) {
789 if (type == IEEE80211_FTYPE_MGMT && 792 if (type == IEEE80211_FTYPE_MGMT &&
790 stype == IEEE80211_STYPE_AUTH && 793 stype == IEEE80211_STYPE_AUTH &&
791 fc & WLAN_FC_ISWEP && local->host_decrypt && 794 fc & IEEE80211_FCTL_WEP && local->host_decrypt &&
792 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 795 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
793 { 796 {
794 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 797 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
@@ -809,16 +812,16 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
809 if (skb->len < IEEE80211_DATA_HDR3_LEN) 812 if (skb->len < IEEE80211_DATA_HDR3_LEN)
810 goto rx_dropped; 813 goto rx_dropped;
811 814
812 switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) { 815 switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
813 case WLAN_FC_FROMDS: 816 case IEEE80211_FCTL_FROMDS:
814 memcpy(dst, hdr->addr1, ETH_ALEN); 817 memcpy(dst, hdr->addr1, ETH_ALEN);
815 memcpy(src, hdr->addr3, ETH_ALEN); 818 memcpy(src, hdr->addr3, ETH_ALEN);
816 break; 819 break;
817 case WLAN_FC_TODS: 820 case IEEE80211_FCTL_TODS:
818 memcpy(dst, hdr->addr3, ETH_ALEN); 821 memcpy(dst, hdr->addr3, ETH_ALEN);
819 memcpy(src, hdr->addr2, ETH_ALEN); 822 memcpy(src, hdr->addr2, ETH_ALEN);
820 break; 823 break;
821 case WLAN_FC_FROMDS | WLAN_FC_TODS: 824 case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS:
822 if (skb->len < IEEE80211_DATA_HDR4_LEN) 825 if (skb->len < IEEE80211_DATA_HDR4_LEN)
823 goto rx_dropped; 826 goto rx_dropped;
824 memcpy(dst, hdr->addr3, ETH_ALEN); 827 memcpy(dst, hdr->addr3, ETH_ALEN);
@@ -838,7 +841,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
838 } 841 }
839 842
840 if (local->iw_mode == IW_MODE_MASTER && !wds && 843 if (local->iw_mode == IW_MODE_MASTER && !wds &&
841 (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS && 844 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
845 IEEE80211_FCTL_FROMDS &&
842 local->stadev && 846 local->stadev &&
843 memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) { 847 memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) {
844 /* Frame from BSSID of the AP for which we are a client */ 848 /* Frame from BSSID of the AP for which we are a client */
@@ -882,22 +886,22 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
882 886
883 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ 887 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
884 888
885 if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && 889 if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
886 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 890 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
887 goto rx_dropped; 891 goto rx_dropped;
888 hdr = (struct ieee80211_hdr *) skb->data; 892 hdr = (struct ieee80211_hdr *) skb->data;
889 893
890 /* skb: hdr + (possibly fragmented) plaintext payload */ 894 /* skb: hdr + (possibly fragmented) plaintext payload */
891 895
892 if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && 896 if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
893 (frag != 0 || (fc & WLAN_FC_MOREFRAG))) { 897 (frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
894 int flen; 898 int flen;
895 struct sk_buff *frag_skb = 899 struct sk_buff *frag_skb =
896 prism2_frag_cache_get(local, hdr); 900 prism2_frag_cache_get(local, hdr);
897 if (!frag_skb) { 901 if (!frag_skb) {
898 printk(KERN_DEBUG "%s: Rx cannot get skb from " 902 printk(KERN_DEBUG "%s: Rx cannot get skb from "
899 "fragment cache (morefrag=%d seq=%u frag=%u)\n", 903 "fragment cache (morefrag=%d seq=%u frag=%u)\n",
900 dev->name, (fc & WLAN_FC_MOREFRAG) != 0, 904 dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0,
901 WLAN_GET_SEQ_SEQ(sc) >> 4, frag); 905 WLAN_GET_SEQ_SEQ(sc) >> 4, frag);
902 goto rx_dropped; 906 goto rx_dropped;
903 } 907 }
@@ -927,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
927 dev_kfree_skb(skb); 931 dev_kfree_skb(skb);
928 skb = NULL; 932 skb = NULL;
929 933
930 if (fc & WLAN_FC_MOREFRAG) { 934 if (fc & IEEE80211_FCTL_MOREFRAGS) {
931 /* more fragments expected - leave the skb in fragment 935 /* more fragments expected - leave the skb in fragment
932 * cache for now; it will be delivered to upper layers 936 * cache for now; it will be delivered to upper layers
933 * after all fragments have been received */ 937 * after all fragments have been received */
@@ -944,12 +948,12 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
944 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still 948 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
945 * encrypted/authenticated */ 949 * encrypted/authenticated */
946 950
947 if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && 951 if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
948 hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) 952 hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt))
949 goto rx_dropped; 953 goto rx_dropped;
950 954
951 hdr = (struct ieee80211_hdr *) skb->data; 955 hdr = (struct ieee80211_hdr *) skb->data;
952 if (crypt && !(fc & WLAN_FC_ISWEP) && !local->open_wep) { 956 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !local->open_wep) {
953 if (local->ieee_802_1x && 957 if (local->ieee_802_1x &&
954 hostap_is_eapol_frame(local, skb)) { 958 hostap_is_eapol_frame(local, skb)) {
955 /* pass unencrypted EAPOL frames even if encryption is 959 /* pass unencrypted EAPOL frames even if encryption is
@@ -964,7 +968,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
964 } 968 }
965 } 969 }
966 970
967 if (local->drop_unencrypted && !(fc & WLAN_FC_ISWEP) && 971 if (local->drop_unencrypted && !(fc & IEEE80211_FCTL_WEP) &&
968 !hostap_is_eapol_frame(local, skb)) { 972 !hostap_is_eapol_frame(local, skb)) {
969 if (net_ratelimit()) { 973 if (net_ratelimit()) {
970 printk(KERN_DEBUG "%s: dropped unencrypted RX data " 974 printk(KERN_DEBUG "%s: dropped unencrypted RX data "
@@ -1023,7 +1027,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
1023 memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); 1027 memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
1024 } 1028 }
1025 1029
1026 if (wds && ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS) && 1030 if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
1031 IEEE80211_FCTL_TODS) &&
1027 skb->len >= ETH_HLEN + ETH_ALEN) { 1032 skb->len >= ETH_HLEN + ETH_ALEN) {
1028 /* Non-standard frame: get addr4 from its bogus location after 1033 /* Non-standard frame: get addr4 from its bogus location after
1029 * the payload */ 1034 * the payload */
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 79cf55338d88..fb378046ab39 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -14,8 +14,8 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
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, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, 16 fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
17 fc & WLAN_FC_TODS ? " [ToDS]" : "", 17 fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
18 fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); 18 fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
19 19
20 if (skb->len < IEEE80211_DATA_HDR3_LEN) { 20 if (skb->len < IEEE80211_DATA_HDR3_LEN) {
21 printk("\n"); 21 printk("\n");
@@ -128,7 +128,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
128 * frame format */ 128 * frame format */
129 129
130 if (use_wds == WDS_COMPLIANT_FRAME) { 130 if (use_wds == WDS_COMPLIANT_FRAME) {
131 fc |= WLAN_FC_FROMDS | WLAN_FC_TODS; 131 fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS;
132 /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, 132 /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA,
133 * Addr4 = SA */ 133 * Addr4 = SA */
134 memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); 134 memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
@@ -136,7 +136,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
136 } else { 136 } else {
137 /* bogus 4-addr format to workaround Prism2 station 137 /* bogus 4-addr format to workaround Prism2 station
138 * f/w bug */ 138 * f/w bug */
139 fc |= WLAN_FC_TODS; 139 fc |= IEEE80211_FCTL_TODS;
140 /* From DS: Addr1 = DA (used as RA), 140 /* From DS: Addr1 = DA (used as RA),
141 * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA), 141 * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA),
142 */ 142 */
@@ -161,13 +161,13 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
161 memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); 161 memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
162 memcpy(&hdr.addr3, skb->data, ETH_ALEN); 162 memcpy(&hdr.addr3, skb->data, ETH_ALEN);
163 } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { 163 } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) {
164 fc |= WLAN_FC_FROMDS; 164 fc |= IEEE80211_FCTL_FROMDS;
165 /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ 165 /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */
166 memcpy(&hdr.addr1, skb->data, ETH_ALEN); 166 memcpy(&hdr.addr1, skb->data, ETH_ALEN);
167 memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); 167 memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
168 memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); 168 memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN);
169 } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { 169 } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) {
170 fc |= WLAN_FC_TODS; 170 fc |= IEEE80211_FCTL_TODS;
171 /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ 171 /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */
172 memcpy(&hdr.addr1, to_assoc_ap ? 172 memcpy(&hdr.addr1, to_assoc_ap ?
173 local->assoc_ap_addr : local->bssid, ETH_ALEN); 173 local->assoc_ap_addr : local->bssid, ETH_ALEN);
@@ -439,12 +439,12 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
439 /* Request TX callback if protocol version is 2 in 802.11 header; 439 /* Request TX callback if protocol version is 2 in 802.11 header;
440 * this version 2 is a special case used between hostapd and kernel 440 * this version 2 is a special case used between hostapd and kernel
441 * driver */ 441 * driver */
442 if (((fc & WLAN_FC_PVER) == BIT(1)) && 442 if (((fc & IEEE80211_FCTL_VERS) == BIT(1)) &&
443 local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) { 443 local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) {
444 meta->tx_cb_idx = local->ap->tx_callback_idx; 444 meta->tx_cb_idx = local->ap->tx_callback_idx;
445 445
446 /* remove special version from the frame header */ 446 /* remove special version from the frame header */
447 fc &= ~WLAN_FC_PVER; 447 fc &= ~IEEE80211_FCTL_VERS;
448 hdr->frame_ctl = cpu_to_le16(fc); 448 hdr->frame_ctl = cpu_to_le16(fc);
449 } 449 }
450 450
@@ -454,7 +454,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
454 } 454 }
455 455
456 if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt && 456 if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt &&
457 !(fc & WLAN_FC_ISWEP)) { 457 !(fc & IEEE80211_FCTL_VERS)) {
458 no_encrypt = 1; 458 no_encrypt = 1;
459 PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing " 459 PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing "
460 "unencrypted EAPOL frame\n", dev->name); 460 "unencrypted EAPOL frame\n", dev->name);
@@ -466,7 +466,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
466 else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) { 466 else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) {
467 /* Add ISWEP flag both for firmware and host based encryption 467 /* Add ISWEP flag both for firmware and host based encryption
468 */ 468 */
469 fc |= WLAN_FC_ISWEP; 469 fc |= IEEE80211_FCTL_WEP;
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 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && 472 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 596c4dde079d..2c6ea796e00e 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -604,7 +604,7 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data)
604 /* Pass the TX callback frame to the hostapd; use 802.11 header version 604 /* Pass the TX callback frame to the hostapd; use 802.11 header version
605 * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ 605 * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */
606 606
607 fc &= ~WLAN_FC_PVER; 607 fc &= ~IEEE80211_FCTL_VERS;
608 fc |= ok ? BIT(1) : BIT(0); 608 fc |= ok ? BIT(1) : BIT(0);
609 hdr->frame_ctl = cpu_to_le16(fc); 609 hdr->frame_ctl = cpu_to_le16(fc);
610 610
@@ -956,7 +956,7 @@ static void prism2_send_mgmt(struct net_device *dev,
956 956
957 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ 957 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */
958 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { 958 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
959 fc |= WLAN_FC_FROMDS; 959 fc |= IEEE80211_FCTL_FROMDS;
960 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ 960 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */
961 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ 961 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
962 } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { 962 } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
@@ -1436,7 +1436,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1436 challenge == NULL || 1436 challenge == NULL ||
1437 memcmp(sta->u.sta.challenge, challenge, 1437 memcmp(sta->u.sta.challenge, challenge,
1438 WLAN_AUTH_CHALLENGE_LEN) != 0 || 1438 WLAN_AUTH_CHALLENGE_LEN) != 0 ||
1439 !(fc & WLAN_FC_ISWEP)) { 1439 !(fc & IEEE80211_FCTL_WEP)) {
1440 txt = "challenge response incorrect"; 1440 txt = "challenge response incorrect";
1441 resp = WLAN_STATUS_CHALLENGE_FAIL; 1441 resp = WLAN_STATUS_CHALLENGE_FAIL;
1442 goto fail; 1442 goto fail;
@@ -1871,7 +1871,7 @@ static void handle_pspoll(local_info_t *local,
1871 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR 1871 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR
1872 " PWRMGT=%d\n", 1872 " PWRMGT=%d\n",
1873 MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), 1873 MAC2STR(hdr->addr1), MAC2STR(hdr->addr2),
1874 !!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT)); 1874 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
1875 1875
1876 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 1876 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
1877 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR 1877 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR
@@ -2150,7 +2150,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2150 if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { 2150 if (!local->hostapd && type == IEEE80211_FTYPE_DATA) {
2151 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); 2151 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n");
2152 2152
2153 if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { 2153 if (!(fc & IEEE80211_FCTL_TODS) ||
2154 (fc & IEEE80211_FCTL_FROMDS)) {
2154 if (stype == IEEE80211_STYPE_NULLFUNC) { 2155 if (stype == IEEE80211_STYPE_NULLFUNC) {
2155 /* no ToDS nullfunc seems to be used to check 2156 /* no ToDS nullfunc seems to be used to check
2156 * AP association; so send reject message to 2157 * AP association; so send reject message to
@@ -2746,7 +2747,8 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2746 2747
2747 if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { 2748 if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) {
2748 /* indicate to STA that more frames follow */ 2749 /* indicate to STA that more frames follow */
2749 hdr->frame_ctl |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); 2750 hdr->frame_ctl |=
2751 __constant_cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2750 } 2752 }
2751 2753
2752 if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { 2754 if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) {
@@ -2905,7 +2907,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
2905 return -1; 2907 return -1;
2906 2908
2907 fc = le16_to_cpu(hdr->frame_ctl); 2909 fc = le16_to_cpu(hdr->frame_ctl);
2908 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, 2910 hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM,
2909 WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); 2911 WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
2910 2912
2911 atomic_dec(&sta->users); 2913 atomic_dec(&sta->users);
@@ -2946,7 +2948,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2946 ret = AP_RX_CONTINUE; 2948 ret = AP_RX_CONTINUE;
2947 2949
2948 2950
2949 if (fc & WLAN_FC_TODS) { 2951 if (fc & IEEE80211_FCTL_TODS) {
2950 if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) { 2952 if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) {
2951 if (local->hostapd) { 2953 if (local->hostapd) {
2952 prism2_rx_80211(local->apdev, skb, rx_stats, 2954 prism2_rx_80211(local->apdev, skb, rx_stats,
@@ -2964,7 +2966,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2964 ret = AP_RX_EXIT; 2966 ret = AP_RX_EXIT;
2965 goto out; 2967 goto out;
2966 } 2968 }
2967 } else if (fc & WLAN_FC_FROMDS) { 2969 } else if (fc & IEEE80211_FCTL_FROMDS) {
2968 if (!wds) { 2970 if (!wds) {
2969 /* FromDS frame - not for us; probably 2971 /* FromDS frame - not for us; probably
2970 * broadcast/multicast in another BSS - drop */ 2972 * broadcast/multicast in another BSS - drop */
@@ -3019,7 +3021,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3019 } 3021 }
3020 3022
3021 if (sta) { 3023 if (sta) {
3022 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, 3024 hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM,
3023 type, stype); 3025 type, stype);
3024 3026
3025 sta->rx_packets++; 3027 sta->rx_packets++;
@@ -3028,7 +3030,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3028 } 3030 }
3029 3031
3030 if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && 3032 if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC &&
3031 fc & WLAN_FC_TODS) { 3033 fc & IEEE80211_FCTL_TODS) {
3032 if (local->hostapd) { 3034 if (local->hostapd) {
3033 prism2_rx_80211(local->apdev, skb, rx_stats, 3035 prism2_rx_80211(local->apdev, skb, rx_stats,
3034 PRISM2_RX_NULLFUNC_ACK); 3036 PRISM2_RX_NULLFUNC_ACK);
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index e0ce34f165e0..6f4fa9dc308f 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -9,16 +9,6 @@
9 9
10/* IEEE 802.11 defines */ 10/* IEEE 802.11 defines */
11 11
12#define WLAN_FC_PVER (BIT(1) | BIT(0))
13#define WLAN_FC_TODS BIT(8)
14#define WLAN_FC_FROMDS BIT(9)
15#define WLAN_FC_MOREFRAG BIT(10)
16#define WLAN_FC_RETRY BIT(11)
17#define WLAN_FC_PWRMGT BIT(12)
18#define WLAN_FC_MOREDATA BIT(13)
19#define WLAN_FC_ISWEP BIT(14)
20#define WLAN_FC_ORDER BIT(15)
21
22/* Information Element IDs */ 12/* Information Element IDs */
23#define WLAN_EID_SSID 0 13#define WLAN_EID_SSID 0
24#define WLAN_EID_SUPP_RATES 1 14#define WLAN_EID_SUPP_RATES 1
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 34037b599ebc..e533a663deda 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -1844,7 +1844,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
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 (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_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 & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) &&
1848 skb->len >= 30) {
1848 /* Addr4 */ 1849 /* Addr4 */
1849 memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); 1850 memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
1850 hdr_len += ETH_ALEN; 1851 hdr_len += ETH_ALEN;
@@ -2399,8 +2400,8 @@ static void prism2_txexc(local_info_t *local)
2399 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", 2400 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "",
2400 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", 2401 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "",
2401 WLAN_FC_GET_STYPE(fc) >> 4, 2402 WLAN_FC_GET_STYPE(fc) >> 4,
2402 fc & WLAN_FC_TODS ? " ToDS" : "", 2403 fc & IEEE80211_FCTL_TODS ? " ToDS" : "",
2403 fc & WLAN_FC_FROMDS ? " FromDS" : ""); 2404 fc & IEEE80211_FCTL_FROMDS ? " FromDS" : "");
2404 PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3=" 2405 PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
2405 MACSTR " A4=" MACSTR "\n", 2406 MACSTR " A4=" MACSTR "\n",
2406 MAC2STR(txdesc.addr1), MAC2STR(txdesc.addr2), 2407 MAC2STR(txdesc.addr1), MAC2STR(txdesc.addr2),