diff options
author | Jouni Malinen <jkmaline@cc.hut.fi> | 2005-08-15 06:08:44 +0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-15 07:07:30 +0400 |
commit | 4339d328631aa815fe2181b9164b3690ca2db4da (patch) | |
tree | 1848ffbf700ccd4e38c70e218f91dd2a7eadf018 /drivers/net/wireless | |
parent | c0f72ca8e4f1b459b5582c1c8dcaf7e53151f069 (diff) | |
download | linux-4339d328631aa815fe2181b9164b3690ca2db4da.tar.xz |
[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')
-rw-r--r-- | drivers/net/wireless/hostap/hostap.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 46 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_tx.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.c | 120 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_common.h | 43 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_hw.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 8 |
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) fc = __le16_to_cpu(rx->frame_control); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " "data_len=%d%s%s\n", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), __le16_to_cpu(rx->data_len), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -623,7 +623,7 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) fc = __le16_to_cpu(tx->frame_control); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " "data_len=%d%s%s\n", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), __le16_to_cpu(tx->data_len), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -666,15 +666,15 @@ int hostap_80211_get_hdrlen(u16 fc) { int hdrlen = 24; - switch (HOSTAP_FC_GET_TYPE(fc)) { - case WLAN_FC_TYPE_DATA: + switch (WLAN_FC_GET_TYPE(fc)) { + case IEEE80211_FTYPE_DATA: if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) hdrlen = 30; /* Addr4 */ break; - case WLAN_FC_TYPE_CTRL: - switch (HOSTAP_FC_GET_STYPE(fc)) { - case WLAN_FC_STYPE_CTS: - case WLAN_FC_STYPE_ACK: + case IEEE80211_FTYPE_CTL: + switch (WLAN_FC_GET_STYPE(fc)) { + case IEEE80211_STYPE_CTS: + case IEEE80211_STYPE_ACK: hdrlen = 10; break; default: @@ -1093,7 +1093,7 @@ int prism2_update_comms_qual(struct net_device *dev) } -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, +int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, u8 *body, size_t bodylen) { struct sk_buff *skb; @@ -1108,8 +1108,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, mgmt = (struct hostap_ieee80211_mgmt *) skb_put(skb, IEEE80211_MGMT_HDR_LEN); memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN); - mgmt->frame_control = - cpu_to_le16((WLAN_FC_TYPE_MGMT << 2) | (stype << 4)); + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); memcpy(mgmt->da, dst, ETH_ALEN); memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); memcpy(mgmt->bssid, dst, ETH_ALEN); @@ -1140,7 +1139,7 @@ int prism2_sta_deauth(local_info_t *local, u16 reason) return 0; reason = cpu_to_le16(reason); - ret = prism2_sta_send_mgmt(local, local->bssid, WLAN_FC_STYPE_DEAUTH, + ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 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, void hostap_remove_interface(struct net_device *dev, int rtnl_locked, int remove_from_list); int prism2_update_comms_qual(struct net_device *dev); -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, +int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, u8 *body, size_t bodylen); int prism2_sta_deauth(local_info_t *local, u16 reason); 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, fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); @@ -445,8 +445,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, skb->data); } - if (local->hostapd && type == WLAN_FC_TYPE_MGMT) { - if (stype == WLAN_FC_STYPE_BEACON && + if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { + if (stype == IEEE80211_STYPE_BEACON && local->iw_mode == IW_MODE_MASTER) { struct sk_buff *skb2; /* Process beacon frames also in kernel driver to @@ -467,23 +467,24 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, } if (local->iw_mode == IW_MODE_MASTER) { - if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { + if (type != IEEE80211_FTYPE_MGMT && + type != IEEE80211_FTYPE_CTL) { printk(KERN_DEBUG "%s: unknown management frame " "(type=0x%02x, stype=0x%02x) dropped\n", - skb->dev->name, type, stype); + skb->dev->name, type >> 2, stype >> 4); return -1; } hostap_rx(skb->dev, skb, rx_stats); return 0; - } else if (type == WLAN_FC_TYPE_MGMT && - (stype == WLAN_FC_STYPE_BEACON || - stype == WLAN_FC_STYPE_PROBE_RESP)) { + } else if (type == IEEE80211_FTYPE_MGMT && + (stype == IEEE80211_STYPE_BEACON || + stype == IEEE80211_STYPE_PROBE_RESP)) { hostap_rx_sta_beacon(local, skb, stype); return -1; - } else if (type == WLAN_FC_TYPE_MGMT && - (stype == WLAN_FC_STYPE_ASSOC_RESP || - stype == WLAN_FC_STYPE_REASSOC_RESP)) { + } else if (type == IEEE80211_FTYPE_MGMT && + (stype == IEEE80211_STYPE_ASSOC_RESP || + stype == IEEE80211_STYPE_REASSOC_RESP)) { /* Ignore (Re)AssocResp silently since these are not currently * needed but are still received when WPA/RSN mode is enabled. */ @@ -491,7 +492,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, } else { printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled" " management frame in non-Host AP mode (type=%d:%d)\n", - skb->dev->name, type, stype); + skb->dev->name, type >> 2, stype >> 4); return -1; } } @@ -719,8 +720,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, goto rx_dropped; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); hdrlen = hostap_80211_get_hdrlen(fc); @@ -784,8 +785,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, } } - if (type != WLAN_FC_TYPE_DATA) { - if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && + if (type != IEEE80211_FTYPE_DATA) { + if (type == IEEE80211_FTYPE_MGMT && + stype == IEEE80211_STYPE_AUTH && fc & WLAN_FC_ISWEP && local->host_decrypt && (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) { @@ -867,14 +869,14 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, /* Nullfunc frames may have PS-bit set, so they must be passed to * hostap_handle_sta_rx() before being dropped here. */ - if (stype != WLAN_FC_STYPE_DATA && - stype != WLAN_FC_STYPE_DATA_CFACK && - stype != WLAN_FC_STYPE_DATA_CFPOLL && - stype != WLAN_FC_STYPE_DATA_CFACKPOLL) { - if (stype != WLAN_FC_STYPE_NULLFUNC) + if (stype != IEEE80211_STYPE_DATA && + stype != IEEE80211_STYPE_DATA_CFACK && + stype != IEEE80211_STYPE_DATA_CFPOLL && + stype != IEEE80211_STYPE_DATA_CFACKPOLL) { + if (stype != IEEE80211_STYPE_NULLFUNC) printk(KERN_DEBUG "%s: RX: dropped data frame " "with no data (type=0x%02x, subtype=0x%02x)\n", - dev->name, type, stype); + dev->name, type >> 2, stype >> 4); goto rx_dropped; } 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) fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); @@ -115,7 +115,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) skip_header_bytes -= 2; } - fc = (WLAN_FC_TYPE_DATA << 2) | (WLAN_FC_STYPE_DATA << 4); + fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; hdr_len = IEEE80211_DATA_HDR3_LEN; if (use_wds != WDS_NO) { @@ -268,8 +268,8 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && - HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && + WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header)]; meta->ethertype = (pos[0] << 8) | pos[1]; @@ -410,7 +410,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) break; case AP_TX_CONTINUE_NOT_AUTHORIZED: if (local->ieee_802_1x && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && meta->ethertype != ETH_P_PAE && !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { 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) hdr->frame_ctl = cpu_to_le16(fc); } - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) { no_encrypt = 1; tx.crypt = NULL; } @@ -469,7 +469,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) fc |= WLAN_FC_ISWEP; hdr->frame_ctl = cpu_to_le16(fc); } else if (local->drop_unencrypted && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && meta->ethertype != ETH_P_PAE) { if (net_ratelimit()) { 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); #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT static void handle_wds_oper_queue(void *data); static void prism2_send_mgmt(struct net_device *dev, - int type, int subtype, char *body, + u16 type_subtype, char *body, int body_len, u8 *addr, u16 tx_cb_idx); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ @@ -237,12 +237,12 @@ static void ap_handle_timer(unsigned long data) } else if (sta->timeout_next == STA_NULLFUNC) { /* send data frame to poll STA and check whether this frame * is ACKed */ - /* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but + /* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but * it is apparently not retried so TX Exc events are not * received for it */ sta->flags |= WLAN_STA_PENDING_POLL; - prism2_send_mgmt(local->dev, WLAN_FC_TYPE_DATA, - WLAN_FC_STYPE_DATA, NULL, 0, + prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA | + IEEE80211_STYPE_DATA, NULL, 0, sta->addr, ap->tx_callback_poll); } else { int deauth = sta->timeout_next == STA_DEAUTH; @@ -255,9 +255,9 @@ static void ap_handle_timer(unsigned long data) resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - prism2_send_mgmt(local->dev, WLAN_FC_TYPE_MGMT, - (deauth ? WLAN_FC_STYPE_DEAUTH : - WLAN_FC_STYPE_DISASSOC), + prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT | + (deauth ? IEEE80211_STYPE_DEAUTH : + IEEE80211_STYPE_DISASSOC), (char *) &resp, 2, sta->addr, 0); } @@ -300,7 +300,8 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, * else we can do at this point since the driver is going to be shut * down */ for (i = 0; i < 5; i++) { - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | + IEEE80211_STYPE_DEAUTH, (char *) &resp, 2, addr, 0); if (!resend || ap->num_sta <= 0) @@ -471,7 +472,7 @@ static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, return -EINVAL; resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH, (char *) &resp, 2, sta->addr, 0); 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) hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || - HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH || + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || + WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || skb->len < IEEE80211_MGMT_HDR_LEN + 6) { printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " "frame\n", dev->name); @@ -703,9 +704,9 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || - (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP && - HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) || + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || + (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && + WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) || skb->len < IEEE80211_MGMT_HDR_LEN + 4) { printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " "frame\n", dev->name); @@ -912,7 +913,7 @@ static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta) /* Called from timer handler and from scheduled AP queue handlers */ static void prism2_send_mgmt(struct net_device *dev, - int type, int subtype, char *body, + u16 type_subtype, char *body, int body_len, u8 *addr, u16 tx_cb_idx) { struct hostap_interface *iface; @@ -941,7 +942,7 @@ static void prism2_send_mgmt(struct net_device *dev, return; } - fc = (type << 2) | (subtype << 4); + fc = type_subtype; hdrlen = hostap_80211_get_hdrlen(fc); hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); if (body) @@ -954,11 +955,11 @@ static void prism2_send_mgmt(struct net_device *dev, memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ - if (type == WLAN_FC_TYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { fc |= WLAN_FC_FROMDS; memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ - } else if (type == WLAN_FC_TYPE_CTRL) { + } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { /* control:ACK does not have addr2 or addr3 */ memset(hdr->addr2, 0, ETH_ALEN); memset(hdr->addr3, 0, ETH_ALEN); @@ -1475,7 +1476,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, olen += 2 + WLAN_AUTH_CHALLENGE_LEN; } - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_AUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH, body, olen, hdr->addr2, ap->tx_callback_auth); if (sta) { @@ -1673,10 +1674,10 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, pos = (u16 *) p; } - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, - (send_deauth ? WLAN_FC_STYPE_DEAUTH : - (reassoc ? WLAN_FC_STYPE_REASSOC_RESP : - WLAN_FC_STYPE_ASSOC_RESP)), + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | + (send_deauth ? IEEE80211_STYPE_DEAUTH : + (reassoc ? IEEE80211_STYPE_REASSOC_RESP : + IEEE80211_STYPE_ASSOC_RESP)), body, (u8 *) pos - (u8 *) body, hdr->addr2, send_deauth ? 0 : local->ap->tx_callback_assoc); @@ -1793,7 +1794,7 @@ static void ap_handle_data_nullfunc(local_info_t *local, * send control::ACK for the data::nullfunc */ printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n"); - prism2_send_mgmt(dev, WLAN_FC_TYPE_CTRL, WLAN_FC_STYPE_ACK, + prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK, NULL, 0, hdr->addr2, 0); } @@ -1820,9 +1821,9 @@ static void ap_handle_dropped_data(local_info_t *local, reason = __constant_cpu_to_le16( WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? - WLAN_FC_STYPE_DEAUTH : WLAN_FC_STYPE_DISASSOC), + IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), (char *) &reason, sizeof(reason), hdr->addr2, 0); if (sta) @@ -2142,15 +2143,15 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, * buffer is long enough */ hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (!local->hostapd && type == WLAN_FC_TYPE_DATA) { + if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { - if (stype == WLAN_FC_STYPE_NULLFUNC) { + if (stype == IEEE80211_STYPE_NULLFUNC) { /* no ToDS nullfunc seems to be used to check * AP association; so send reject message to * speed up re-association */ @@ -2169,20 +2170,21 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, goto done; } - if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC) + if (local->ap->nullfunc_ack && + stype == IEEE80211_STYPE_NULLFUNC) ap_handle_data_nullfunc(local, hdr); else ap_handle_dropped_data(local, hdr); goto done; } - if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) { + if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) { handle_beacon(local, skb, rx_stats); goto done; } #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - if (type == WLAN_FC_TYPE_CTRL && stype == WLAN_FC_STYPE_PSPOLL) { + if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) { handle_pspoll(local, hdr, rx_stats); goto done; } @@ -2194,7 +2196,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, } #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (type != WLAN_FC_TYPE_MGMT) { + if (type != IEEE80211_FTYPE_MGMT) { PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n"); goto done; } @@ -2212,32 +2214,33 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, } switch (stype) { - case WLAN_FC_STYPE_ASSOC_REQ: + case IEEE80211_STYPE_ASSOC_REQ: handle_assoc(local, skb, rx_stats, 0); break; - case WLAN_FC_STYPE_ASSOC_RESP: + case IEEE80211_STYPE_ASSOC_RESP: PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n"); break; - case WLAN_FC_STYPE_REASSOC_REQ: + case IEEE80211_STYPE_REASSOC_REQ: handle_assoc(local, skb, rx_stats, 1); break; - case WLAN_FC_STYPE_REASSOC_RESP: + case IEEE80211_STYPE_REASSOC_RESP: PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n"); break; - case WLAN_FC_STYPE_ATIM: + case IEEE80211_STYPE_ATIM: PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n"); break; - case WLAN_FC_STYPE_DISASSOC: + case IEEE80211_STYPE_DISASSOC: handle_disassoc(local, skb, rx_stats); break; - case WLAN_FC_STYPE_AUTH: + case IEEE80211_STYPE_AUTH: handle_authen(local, skb, rx_stats); break; - case WLAN_FC_STYPE_DEAUTH: + case IEEE80211_STYPE_DEAUTH: handle_deauth(local, skb, rx_stats); break; default: - PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", stype); + PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", + stype >> 4); break; } #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ @@ -2268,8 +2271,8 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, fc = le16_to_cpu(hdr->frame_ctl); if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && - HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON) + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT && + WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON) goto drop; skb->protocol = __constant_htons(ETH_P_HOSTAP); @@ -2302,7 +2305,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta) /* Generate a fake pspoll frame to start packet delivery */ hdr->frame_ctl = __constant_cpu_to_le16( - (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4)); + IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); memcpy(hdr->addr2, sta->addr, ETH_ALEN); 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, sta->flags |= WLAN_STA_PS; PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS " "mode (type=0x%02X, stype=0x%02X)\n", - MAC2STR(sta->addr), type, stype); + MAC2STR(sta->addr), type >> 2, stype >> 4); } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { sta->flags &= ~WLAN_STA_PS; PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use " "PS mode (type=0x%02X, stype=0x%02X)\n", - MAC2STR(sta->addr), type, stype); - if (type != WLAN_FC_TYPE_CTRL || stype != WLAN_FC_STYPE_PSPOLL) + MAC2STR(sta->addr), type >> 2, stype >> 4); + if (type != IEEE80211_FTYPE_CTL || + stype != IEEE80211_STYPE_PSPOLL) schedule_packet_send(local, sta); } } @@ -2902,7 +2906,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) fc = le16_to_cpu(hdr->frame_ctl); hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, - HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc)); + WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); atomic_dec(&sta->users); return 0; @@ -2927,8 +2931,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); spin_lock(&local->ap->sta_table_lock); 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, printk(KERN_DEBUG "%s: dropped received packet" " from non-associated STA " MACSTR " (type=0x%02x, subtype=0x%02x)\n", - dev->name, MAC2STR(hdr->addr2), type, - stype); + dev->name, MAC2STR(hdr->addr2), + type >> 2, stype >> 4); hostap_rx(dev, skb, rx_stats); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ } @@ -2972,7 +2976,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ret = AP_RX_DROP; goto out; } - } else if (stype == WLAN_FC_STYPE_NULLFUNC && sta == NULL && + } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL && memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { if (local->hostapd) { @@ -2994,7 +2998,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, } ret = AP_RX_EXIT; goto out; - } else if (stype == WLAN_FC_STYPE_NULLFUNC) { + } else if (stype == IEEE80211_STYPE_NULLFUNC) { /* At least Lucent cards seem to send periodic nullfunc * frames with ToDS. Let these through to update SQ * 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, printk(KERN_DEBUG "%s: dropped received packet from " MACSTR " with no ToDS flag (type=0x%02x, " "subtype=0x%02x)\n", dev->name, - MAC2STR(hdr->addr2), type, stype); + MAC2STR(hdr->addr2), type >> 2, stype >> 4); hostap_dump_rx_80211(dev->name, skb, rx_stats); } ret = AP_RX_DROP; @@ -3023,7 +3027,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, sta->last_rx = jiffies; } - if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC && + if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && fc & WLAN_FC_TODS) { if (local->hostapd) { 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 @@ #define WLAN_FC_ISWEP BIT(14) #define WLAN_FC_ORDER BIT(15) -/* - * To be replaced with ieee80211.h WLAN_FC_GET_* once HostAP code is updated to - * use the versions without right shift. - */ -#define HOSTAP_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2) -#define HOSTAP_FC_GET_STYPE(fc) \ - (((fc) & (BIT(7) | BIT(6) | BIT(5) | BIT(4))) >> 4) - -#define WLAN_FC_TYPE_MGMT 0 -#define WLAN_FC_TYPE_CTRL 1 -#define WLAN_FC_TYPE_DATA 2 - -/* management */ -#define WLAN_FC_STYPE_ASSOC_REQ 0 -#define WLAN_FC_STYPE_ASSOC_RESP 1 -#define WLAN_FC_STYPE_REASSOC_REQ 2 -#define WLAN_FC_STYPE_REASSOC_RESP 3 -#define WLAN_FC_STYPE_PROBE_REQ 4 -#define WLAN_FC_STYPE_PROBE_RESP 5 -#define WLAN_FC_STYPE_BEACON 8 -#define WLAN_FC_STYPE_ATIM 9 -#define WLAN_FC_STYPE_DISASSOC 10 -#define WLAN_FC_STYPE_AUTH 11 -#define WLAN_FC_STYPE_DEAUTH 12 - -/* control */ -#define WLAN_FC_STYPE_PSPOLL 10 -#define WLAN_FC_STYPE_RTS 11 -#define WLAN_FC_STYPE_CTS 12 -#define WLAN_FC_STYPE_ACK 13 -#define WLAN_FC_STYPE_CFEND 14 -#define WLAN_FC_STYPE_CFENDACK 15 - -/* data */ -#define WLAN_FC_STYPE_DATA 0 -#define WLAN_FC_STYPE_DATA_CFACK 1 -#define WLAN_FC_STYPE_DATA_CFPOLL 2 -#define WLAN_FC_STYPE_DATA_CFACKPOLL 3 -#define WLAN_FC_STYPE_NULLFUNC 4 -#define WLAN_FC_STYPE_CFACK 5 -#define WLAN_FC_STYPE_CFPOLL 6 -#define WLAN_FC_STYPE_CFACKPOLL 7 - #define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS 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) hdr_len = 24; memcpy(&txdesc.frame_control, skb->data, hdr_len); fc = le16_to_cpu(txdesc.frame_control); - if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && (fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) { /* Addr4 */ memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); @@ -2395,10 +2395,10 @@ static void prism2_txexc(local_info_t *local) PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " "(%s%s%s::%d%s%s)\n", txdesc.retry_count, txdesc.tx_rate, fc, - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "", - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "", - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "", - HOSTAP_FC_GET_STYPE(fc), + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "", + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", + WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " ToDS" : "", fc & WLAN_FC_FROMDS ? " FromDS" : ""); 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, switch (mlme->cmd) { case IW_MLME_DEAUTH: return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - WLAN_FC_STYPE_DEAUTH, + IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); case IW_MLME_DISASSOC: return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - WLAN_FC_STYPE_DISASSOC, + IEEE80211_STYPE_DISASSOC, (u8 *) &reason, 2); default: return -EOPNOTSUPP; @@ -3805,11 +3805,11 @@ static int prism2_ioctl_mlme(local_info_t *local, switch (param->u.mlme.cmd) { case MLME_STA_DEAUTH: return prism2_sta_send_mgmt(local, param->sta_addr, - WLAN_FC_STYPE_DEAUTH, + IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); case MLME_STA_DISASSOC: return prism2_sta_send_mgmt(local, param->sta_addr, - WLAN_FC_STYPE_DISASSOC, + IEEE80211_STYPE_DISASSOC, (u8 *) &reason, 2); default: return -EOPNOTSUPP; |