Commit 8a9faf3c authored by Al Viro's avatar Al Viro Committed by David S. Miller

hostap annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3eb9b41f
...@@ -5,52 +5,52 @@ ...@@ -5,52 +5,52 @@
#include <net/ieee80211_crypt.h> #include <net/ieee80211_crypt.h>
struct hostap_ieee80211_mgmt { struct hostap_ieee80211_mgmt {
u16 frame_control; __le16 frame_control;
u16 duration; __le16 duration;
u8 da[6]; u8 da[6];
u8 sa[6]; u8 sa[6];
u8 bssid[6]; u8 bssid[6];
u16 seq_ctrl; __le16 seq_ctrl;
union { union {
struct { struct {
u16 auth_alg; __le16 auth_alg;
u16 auth_transaction; __le16 auth_transaction;
u16 status_code; __le16 status_code;
/* possibly followed by Challenge text */ /* possibly followed by Challenge text */
u8 variable[0]; u8 variable[0];
} __attribute__ ((packed)) auth; } __attribute__ ((packed)) auth;
struct { struct {
u16 reason_code; __le16 reason_code;
} __attribute__ ((packed)) deauth; } __attribute__ ((packed)) deauth;
struct { struct {
u16 capab_info; __le16 capab_info;
u16 listen_interval; __le16 listen_interval;
/* followed by SSID and Supported rates */ /* followed by SSID and Supported rates */
u8 variable[0]; u8 variable[0];
} __attribute__ ((packed)) assoc_req; } __attribute__ ((packed)) assoc_req;
struct { struct {
u16 capab_info; __le16 capab_info;
u16 status_code; __le16 status_code;
u16 aid; __le16 aid;
/* followed by Supported rates */ /* followed by Supported rates */
u8 variable[0]; u8 variable[0];
} __attribute__ ((packed)) assoc_resp, reassoc_resp; } __attribute__ ((packed)) assoc_resp, reassoc_resp;
struct { struct {
u16 capab_info; __le16 capab_info;
u16 listen_interval; __le16 listen_interval;
u8 current_ap[6]; u8 current_ap[6];
/* followed by SSID and Supported rates */ /* followed by SSID and Supported rates */
u8 variable[0]; u8 variable[0];
} __attribute__ ((packed)) reassoc_req; } __attribute__ ((packed)) reassoc_req;
struct { struct {
u16 reason_code; __le16 reason_code;
} __attribute__ ((packed)) disassoc; } __attribute__ ((packed)) disassoc;
struct { struct {
} __attribute__ ((packed)) probe_req; } __attribute__ ((packed)) probe_req;
struct { struct {
u8 timestamp[8]; u8 timestamp[8];
u16 beacon_int; __le16 beacon_int;
u16 capab_info; __le16 capab_info;
/* followed by some of SSID, Supported rates, /* followed by some of SSID, Supported rates,
* FH Params, DS Params, CF Params, IBSS Params, TIM */ * FH Params, DS Params, CF Params, IBSS Params, TIM */
u8 variable[0]; u8 variable[0];
......
...@@ -1039,7 +1039,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -1039,7 +1039,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
} else { } else {
u16 len; __be16 len;
/* Leave Ethernet header part of hdr and full payload */ /* Leave Ethernet header part of hdr and full payload */
skb_pull(skb, hdrlen); skb_pull(skb, hdrlen);
len = htons(skb->len); len = htons(skb->len);
......
...@@ -258,7 +258,7 @@ static void ap_handle_timer(unsigned long data) ...@@ -258,7 +258,7 @@ static void ap_handle_timer(unsigned long data)
sta->addr, ap->tx_callback_poll); sta->addr, ap->tx_callback_poll);
} else { } else {
int deauth = sta->timeout_next == STA_DEAUTH; int deauth = sta->timeout_next == STA_DEAUTH;
u16 resp; __le16 resp;
PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s" PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s"
"(last=%lu, jiffies=%lu)\n", "(last=%lu, jiffies=%lu)\n",
local->dev->name, local->dev->name,
...@@ -300,13 +300,13 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, ...@@ -300,13 +300,13 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
int resend) int resend)
{ {
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
u16 resp; __le16 resp;
int i; int i;
PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name);
memset(addr, 0xff, ETH_ALEN); memset(addr, 0xff, ETH_ALEN);
resp = __constant_cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
/* deauth message sent; try to resend it few times; the message is /* deauth message sent; try to resend it few times; the message is
* broadcast, so it may be delayed until next DTIM; there is not much * broadcast, so it may be delayed until next DTIM; there is not much
...@@ -462,7 +462,7 @@ void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) ...@@ -462,7 +462,7 @@ void ap_control_flush_macs(struct mac_restrictions *mac_restrictions)
int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac)
{ {
struct sta_info *sta; struct sta_info *sta;
u16 resp; __le16 resp;
spin_lock_bh(&ap->sta_table_lock); spin_lock_bh(&ap->sta_table_lock);
sta = ap_get_sta(ap, mac); sta = ap_get_sta(ap, mac);
...@@ -628,7 +628,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) ...@@ -628,7 +628,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
struct ap_data *ap = data; struct ap_data *ap = data;
struct net_device *dev = ap->local->dev; struct net_device *dev = ap->local->dev;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr_4addr *hdr;
u16 fc, *pos, auth_alg, auth_transaction, status; u16 fc, auth_alg, auth_transaction, status;
__le16 *pos;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
char *txt = NULL; char *txt = NULL;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -649,7 +650,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) ...@@ -649,7 +650,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
return; return;
} }
pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
auth_alg = le16_to_cpu(*pos++); auth_alg = le16_to_cpu(*pos++);
auth_transaction = le16_to_cpu(*pos++); auth_transaction = le16_to_cpu(*pos++);
status = le16_to_cpu(*pos++); status = le16_to_cpu(*pos++);
...@@ -698,7 +699,8 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) ...@@ -698,7 +699,8 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
struct ap_data *ap = data; struct ap_data *ap = data;
struct net_device *dev = ap->local->dev; struct net_device *dev = ap->local->dev;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr_4addr *hdr;
u16 fc, *pos, status; u16 fc, status;
__le16 *pos;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
char *txt = NULL; char *txt = NULL;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -736,7 +738,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) ...@@ -736,7 +738,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
goto done; goto done;
} }
pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
pos++; pos++;
status = le16_to_cpu(*pos++); status = le16_to_cpu(*pos++);
if (status == WLAN_STATUS_SUCCESS) { if (status == WLAN_STATUS_SUCCESS) {
...@@ -1298,7 +1300,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, ...@@ -1298,7 +1300,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
struct ap_data *ap = local->ap; struct ap_data *ap = local->ap;
char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL;
int len, olen; int len, olen;
u16 auth_alg, auth_transaction, status_code, *pos; u16 auth_alg, auth_transaction, status_code;
__le16 *pos;
u16 resp = WLAN_STATUS_SUCCESS, fc; u16 resp = WLAN_STATUS_SUCCESS, fc;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
struct ieee80211_crypt_data *crypt; struct ieee80211_crypt_data *crypt;
...@@ -1332,7 +1335,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, ...@@ -1332,7 +1335,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
crypt = local->crypt[idx]; crypt = local->crypt[idx];
} }
pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
auth_alg = __le16_to_cpu(*pos); auth_alg = __le16_to_cpu(*pos);
pos++; pos++;
auth_transaction = __le16_to_cpu(*pos); auth_transaction = __le16_to_cpu(*pos);
...@@ -1465,7 +1468,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, ...@@ -1465,7 +1468,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
} }
fail: fail:
pos = (u16 *) body; pos = (__le16 *) body;
*pos = cpu_to_le16(auth_alg); *pos = cpu_to_le16(auth_alg);
pos++; pos++;
*pos = cpu_to_le16(auth_transaction + 1); *pos = cpu_to_le16(auth_transaction + 1);
...@@ -1510,7 +1513,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, ...@@ -1510,7 +1513,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
char body[12], *p, *lpos; char body[12], *p, *lpos;
int len, left; int len, left;
u16 *pos; __le16 *pos;
u16 resp = WLAN_STATUS_SUCCESS; u16 resp = WLAN_STATUS_SUCCESS;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
int send_deauth = 0; int send_deauth = 0;
...@@ -1540,7 +1543,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, ...@@ -1540,7 +1543,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
atomic_inc(&sta->users); atomic_inc(&sta->users);
spin_unlock_bh(&local->ap->sta_table_lock); spin_unlock_bh(&local->ap->sta_table_lock);
pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
sta->capability = __le16_to_cpu(*pos); sta->capability = __le16_to_cpu(*pos);
pos++; left -= 2; pos++; left -= 2;
sta->listen_interval = __le16_to_cpu(*pos); sta->listen_interval = __le16_to_cpu(*pos);
...@@ -1636,25 +1639,24 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, ...@@ -1636,25 +1639,24 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
} }
fail: fail:
pos = (u16 *) body; pos = (__le16 *) body;
if (send_deauth) { if (send_deauth) {
*pos = __constant_cpu_to_le16( *pos = cpu_to_le16(WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH);
WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH);
pos++; pos++;
} else { } else {
/* FIX: CF-Pollable and CF-PollReq should be set to match the /* FIX: CF-Pollable and CF-PollReq should be set to match the
* values in beacons/probe responses */ * values in beacons/probe responses */
/* FIX: how about privacy and WEP? */ /* FIX: how about privacy and WEP? */
/* capability */ /* capability */
*pos = __constant_cpu_to_le16(WLAN_CAPABILITY_ESS); *pos = cpu_to_le16(WLAN_CAPABILITY_ESS);
pos++; pos++;
/* status_code */ /* status_code */
*pos = __cpu_to_le16(resp); *pos = cpu_to_le16(resp);
pos++; pos++;
*pos = __cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | *pos = cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) |
BIT(14) | BIT(15)); /* AID */ BIT(14) | BIT(15)); /* AID */
pos++; pos++;
...@@ -1681,7 +1683,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, ...@@ -1681,7 +1683,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
0x96 : 0x16; 0x96 : 0x16;
(*lpos)++; (*lpos)++;
} }
pos = (u16 *) p; pos = (__le16 *) p;
} }
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
...@@ -1718,7 +1720,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, ...@@ -1718,7 +1720,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN);
int len; int len;
u16 reason_code, *pos; u16 reason_code;
__le16 *pos;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -1729,8 +1732,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, ...@@ -1729,8 +1732,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
return; return;
} }
pos = (u16 *) body; pos = (__le16 *) body;
reason_code = __le16_to_cpu(*pos); reason_code = le16_to_cpu(*pos);
PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, "
"reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len,
...@@ -1760,7 +1763,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, ...@@ -1760,7 +1763,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
char *body = skb->data + IEEE80211_MGMT_HDR_LEN; char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
int len; int len;
u16 reason_code, *pos; u16 reason_code;
__le16 *pos;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -1771,8 +1775,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, ...@@ -1771,8 +1775,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
return; return;
} }
pos = (u16 *) body; pos = (__le16 *) body;
reason_code = __le16_to_cpu(*pos); reason_code = le16_to_cpu(*pos);
PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, "
"reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len,
...@@ -1817,7 +1821,7 @@ static void ap_handle_dropped_data(local_info_t *local, ...@@ -1817,7 +1821,7 @@ static void ap_handle_dropped_data(local_info_t *local,
{ {
struct net_device *dev = local->dev; struct net_device *dev = local->dev;
struct sta_info *sta; struct sta_info *sta;
u16 reason; __le16 reason;
spin_lock_bh(&local->ap->sta_table_lock); spin_lock_bh(&local->ap->sta_table_lock);
sta = ap_get_sta(local->ap, hdr->addr2); sta = ap_get_sta(local->ap, hdr->addr2);
...@@ -1831,8 +1835,7 @@ static void ap_handle_dropped_data(local_info_t *local, ...@@ -1831,8 +1835,7 @@ static void ap_handle_dropped_data(local_info_t *local,
return; return;
} }
reason = __constant_cpu_to_le16( reason = cpu_to_le16(WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ?
IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC),
...@@ -1892,7 +1895,7 @@ static void handle_pspoll(local_info_t *local, ...@@ -1892,7 +1895,7 @@ static void handle_pspoll(local_info_t *local,
return; return;
} }
aid = __le16_to_cpu(hdr->duration_id); aid = le16_to_cpu(hdr->duration_id);
if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) { if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) {
PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n");
return; return;
...@@ -1998,7 +2001,8 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb, ...@@ -1998,7 +2001,8 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb,
struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
char *body = skb->data + IEEE80211_MGMT_HDR_LEN; char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
int len, left; int len, left;
u16 *pos, beacon_int, capability; u16 beacon_int, capability;
__le16 *pos;
char *ssid = NULL; char *ssid = NULL;
unsigned char *supp_rates = NULL; unsigned char *supp_rates = NULL;
int ssid_len = 0, supp_rates_len = 0; int ssid_len = 0, supp_rates_len = 0;
...@@ -2013,16 +2017,16 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb, ...@@ -2013,16 +2017,16 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb,
return; return;
} }
pos = (u16 *) body; pos = (__le16 *) body;
left = len; left = len;
/* Timestamp (8 octets) */ /* Timestamp (8 octets) */
pos += 4; left -= 8; pos += 4; left -= 8;
/* Beacon interval (2 octets) */ /* Beacon interval (2 octets) */
beacon_int = __le16_to_cpu(*pos); beacon_int = le16_to_cpu(*pos);
pos++; left -= 2; pos++; left -= 2;
/* Capability information (2 octets) */ /* Capability information (2 octets) */
capability = __le16_to_cpu(*pos); capability = le16_to_cpu(*pos);
pos++; left -= 2; pos++; left -= 2;
if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS &&
......
...@@ -188,10 +188,10 @@ ...@@ -188,10 +188,10 @@
struct hfa384x_comp_ident struct hfa384x_comp_ident
{ {
u16 id; __le16 id;
u16 variant; __le16 variant;
u16 major; __le16 major;
u16 minor; __le16 minor;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define HFA384X_COMP_ID_PRI 0x15 #define HFA384X_COMP_ID_PRI 0x15
...@@ -200,33 +200,33 @@ struct hfa384x_comp_ident ...@@ -200,33 +200,33 @@ struct hfa384x_comp_ident
struct hfa384x_sup_range struct hfa384x_sup_range
{ {
u16 role; __le16 role;
u16 id; __le16 id;
u16 variant; __le16 variant;
u16 bottom; __le16 bottom;
u16 top; __le16 top;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_build_id struct hfa384x_build_id
{ {
u16 pri_seq; __le16 pri_seq;
u16 sec_seq; __le16 sec_seq;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* FD01 - Download Buffer */ /* FD01 - Download Buffer */
struct hfa384x_rid_download_buffer struct hfa384x_rid_download_buffer
{ {
u16 page; __le16 page;
u16 offset; __le16 offset;
u16 length; __le16 length;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */ /* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */
struct hfa384x_comms_quality { struct hfa384x_comms_quality {
u16 comm_qual; /* 0 .. 92 */ __le16 comm_qual; /* 0 .. 92 */
u16 signal_level; /* 27 .. 154 */ __le16 signal_level; /* 27 .. 154 */
u16 noise_level; /* 27 .. 154 */ __le16 noise_level; /* 27 .. 154 */
} __attribute__ ((packed)); } __attribute__ ((packed));
......
...@@ -100,7 +100,7 @@ static int hfa384x_from_aux(struct net_device *dev, unsigned int addr, int len, ...@@ -100,7 +100,7 @@ static int hfa384x_from_aux(struct net_device *dev, unsigned int addr, int len,
#ifdef PRISM2_PCI #ifdef PRISM2_PCI
{ {
u16 *pos = (u16 *) buf; __le16 *pos = (__le16 *) buf;
while (len > 0) { while (len > 0) {
*pos++ = HFA384X_INW_DATA(HFA384X_AUXDATA_OFF); *pos++ = HFA384X_INW_DATA(HFA384X_AUXDATA_OFF);
len -= 2; len -= 2;
...@@ -131,7 +131,7 @@ static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len, ...@@ -131,7 +131,7 @@ static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len,
#ifdef PRISM2_PCI #ifdef PRISM2_PCI
{ {
u16 *pos = (u16 *) buf; __le16 *pos = (__le16 *) buf;
while (len > 0) { while (len > 0) {
HFA384X_OUTW_DATA(*pos++, HFA384X_AUXDATA_OFF); HFA384X_OUTW_DATA(*pos++, HFA384X_AUXDATA_OFF);
len -= 2; len -= 2;
...@@ -147,7 +147,7 @@ static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len, ...@@ -147,7 +147,7 @@ static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len,
static int prism2_pda_ok(u8 *buf) static int prism2_pda_ok(u8 *buf)
{ {
u16 *pda = (u16 *) buf; __le16 *pda = (__le16 *) buf;
int pos; int pos;
u16 len, pdr; u16 len, pdr;
...@@ -544,9 +544,9 @@ static int prism2_download_nonvolatile(local_info_t *local, ...@@ -544,9 +544,9 @@ static int prism2_download_nonvolatile(local_info_t *local,
struct net_device *dev = local->dev; struct net_device *dev = local->dev;
int ret = 0, i; int ret = 0, i;
struct { struct {
u16 page; __le16 page;
u16 offset; __le16 offset;
u16 len; __le16 len;
} dlbuffer; } dlbuffer;
u32 bufaddr; u32 bufaddr;
...@@ -565,14 +565,12 @@ static int prism2_download_nonvolatile(local_info_t *local, ...@@ -565,14 +565,12 @@ static int prism2_download_nonvolatile(local_info_t *local,
goto out; goto out;
} }
dlbuffer.page = le16_to_cpu(dlbuffer.page);
dlbuffer.offset = le16_to_cpu(dlbuffer.offset);
dlbuffer.len = le16_to_cpu(dlbuffer.len);
printk(KERN_DEBUG "Download buffer: %d bytes at 0x%04x:0x%04x\n", printk(KERN_DEBUG "Download buffer: %d bytes at 0x%04x:0x%04x\n",
dlbuffer.len, dlbuffer.page, dlbuffer.offset); le16_to_cpu(dlbuffer.len),
le16_to_cpu(dlbuffer.page),
le16_to_cpu(dlbuffer.offset));
bufaddr = (dlbuffer.page << 7) + dlbuffer.offset; bufaddr = (le16_to_cpu(dlbuffer.page) << 7) + le16_to_cpu(dlbuffer.offset);
local->hw_downloading = 1; local->hw_downloading = 1;
......
...@@ -1075,7 +1075,7 @@ static int prism2_setup_rids(struct net_device *dev) ...@@ -1075,7 +1075,7 @@ static int prism2_setup_rids(struct net_device *dev)
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 tmp; __le16 tmp;
int ret = 0; int ret = 0;
iface = netdev_priv(dev); iface = netdev_priv(dev);
...@@ -1084,11 +1084,11 @@ static int prism2_setup_rids(struct net_device *dev) ...@@ -1084,11 +1084,11 @@ static int prism2_setup_rids(struct net_device *dev)
hostap_set_word(dev, HFA384X_RID_TICKTIME, 2000); hostap_set_word(dev, HFA384X_RID_TICKTIME, 2000);
if (!local->fw_ap) { if (!local->fw_ap) {
tmp = hostap_get_porttype(local); u16 tmp1 = hostap_get_porttype(local);
ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp); ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp1);
if (ret) { if (ret) {
printk("%s: Port type setting to %d failed\n", printk("%s: Port type setting to %d failed\n",
dev->name, tmp); dev->name, tmp1);
goto fail; goto fail;
} }
} }
...@@ -1117,7 +1117,7 @@ static int prism2_setup_rids(struct net_device *dev) ...@@ -1117,7 +1117,7 @@ static int prism2_setup_rids(struct net_device *dev)
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
} }
local->channel_mask = __le16_to_cpu(tmp); local->channel_mask = le16_to_cpu(tmp);
if (local->channel < 1 || local->channel > 14 || if (local->channel < 1 || local->channel > 14 ||
!(local->channel_mask & (1 << (local->channel - 1)))) { !(local->channel_mask & (1 << (local->channel - 1)))) {
......
...@@ -303,7 +303,7 @@ static void prism2_info_hostscanresults(local_info_t *local, ...@@ -303,7 +303,7 @@ static void prism2_info_hostscanresults(local_info_t *local,
int i, result_size, copy_len, new_count; int i, result_size, copy_len, new_count;
struct hfa384x_hostscan_result *results, *prev; struct hfa384x_hostscan_result *results, *prev;
unsigned long flags; unsigned long flags;
u16 *pos; __le16 *pos;
u8 *ptr; u8 *ptr;
wake_up_interruptible(&local->hostscan_wq); wake_up_interruptible(&local->hostscan_wq);
...@@ -314,7 +314,7 @@ static void prism2_info_hostscanresults(local_info_t *local, ...@@ -314,7 +314,7 @@ static void prism2_info_hostscanresults(local_info_t *local,
return; return;
} }
pos = (u16 *) buf; pos = (__le16 *) buf;
copy_len = result_size = le16_to_cpu(*pos); copy_len = result_size = le16_to_cpu(*pos);
if (result_size == 0) { if (result_size == 0) {
printk(KERN_DEBUG "%s: invalid result_size (0) in " printk(KERN_DEBUG "%s: invalid result_size (0) in "
......
...@@ -84,7 +84,7 @@ static int prism2_get_datarates(struct net_device *dev, u8 *rates) ...@@ -84,7 +84,7 @@ static int prism2_get_datarates(struct net_device *dev, u8 *rates)
if (len < 2) if (len < 2)
return 0; return 0;
val = le16_to_cpu(*(u16 *) buf); /* string length */ val = le16_to_cpu(*(__le16 *) buf); /* string length */
if (len - 2 < val || val > 10) if (len - 2 < val || val > 10)
return 0; return 0;
...@@ -496,7 +496,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, ...@@ -496,7 +496,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 val; __le16 val;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -506,7 +506,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, ...@@ -506,7 +506,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev,
0) 0)
return -EINVAL; return -EINVAL;
sens->value = __le16_to_cpu(val); sens->value = le16_to_cpu(val);
sens->fixed = 1; sens->fixed = 1;
return 0; return 0;
...@@ -561,17 +561,17 @@ static int prism2_ioctl_siwrts(struct net_device *dev, ...@@ -561,17 +561,17 @@ static int prism2_ioctl_siwrts(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 val; __le16 val;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
if (rts->disabled) if (rts->disabled)
val = __constant_cpu_to_le16(2347); val = cpu_to_le16(2347);
else if (rts->value < 0 || rts->value > 2347) else if (rts->value < 0 || rts->value > 2347)
return -EINVAL; return -EINVAL;
else else
val = __cpu_to_le16(rts->value); val = cpu_to_le16(rts->value);
if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) ||
local->func->reset_port(dev)) local->func->reset_port(dev))
...@@ -588,7 +588,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, ...@@ -588,7 +588,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 val; __le16 val;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -597,7 +597,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, ...@@ -597,7 +597,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev,
0) 0)
return -EINVAL; return -EINVAL;
rts->value = __le16_to_cpu(val); rts->value = le16_to_cpu(val);
rts->disabled = (rts->value == 2347); rts->disabled = (rts->value == 2347);
rts->fixed = 1; rts->fixed = 1;
...@@ -611,17 +611,17 @@ static int prism2_ioctl_siwfrag(struct net_device *dev, ...@@ -611,17 +611,17 @@ static int prism2_ioctl_siwfrag(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 val; __le16 val;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
if (rts->disabled) if (rts->disabled)
val = __constant_cpu_to_le16(2346); val = cpu_to_le16(2346);
else if (rts->value < 256 || rts->value > 2346) else if (rts->value < 256 || rts->value > 2346)
return -EINVAL; return -EINVAL;
else else
val = __cpu_to_le16(rts->value & ~0x1); /* even numbers only */ val = cpu_to_le16(rts->value & ~0x1); /* even numbers only */
local->fragm_threshold = rts->value & ~0x1; local->fragm_threshold = rts->value & ~0x1;
if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val,
...@@ -638,7 +638,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, ...@@ -638,7 +638,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 val; __le16 val;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -647,7 +647,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, ...@@ -647,7 +647,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev,
&val, 2, 1) < 0) &val, 2, 1) < 0)
return -EINVAL; return -EINVAL;
rts->value = __le16_to_cpu(val); rts->value = le16_to_cpu(val);
rts->disabled = (rts->value == 2346); rts->disabled = (rts->value == 2346);
rts->fixed = 1; rts->fixed = 1;
...@@ -718,8 +718,8 @@ static int prism2_ioctl_siwap(struct net_device *dev, ...@@ -718,8 +718,8 @@ static int prism2_ioctl_siwap(struct net_device *dev,
if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) {
struct hfa384x_scan_request scan_req; struct hfa384x_scan_request scan_req;
memset(&scan_req, 0, sizeof(scan_req)); memset(&scan_req, 0, sizeof(scan_req));
scan_req.channel_list = __constant_cpu_to_le16(0x3fff); scan_req.channel_list = cpu_to_le16(0x3fff);
scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS); scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS);
if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST,
&scan_req, sizeof(scan_req))) { &scan_req, sizeof(scan_req))) {
printk(KERN_DEBUG "%s: ScanResults request failed - " printk(KERN_DEBUG "%s: ScanResults request failed - "
...@@ -812,7 +812,7 @@ static int prism2_ioctl_giwnickn(struct net_device *dev, ...@@ -812,7 +812,7 @@ static int prism2_ioctl_giwnickn(struct net_device *dev,
len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME,
&name, MAX_NAME_LEN + 2, 0); &name, MAX_NAME_LEN + 2, 0);
val = __le16_to_cpu(*(u16 *) name); val = le16_to_cpu(*(__le16 *) name);
if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN) if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -963,7 +963,7 @@ static int prism2_ioctl_giwessid(struct net_device *dev, ...@@ -963,7 +963,7 @@ static int prism2_ioctl_giwessid(struct net_device *dev,
memset(ssid, 0, sizeof(ssid)); memset(ssid, 0, sizeof(ssid));
len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID,
&ssid, MAX_SSID_LEN + 2, 0); &ssid, MAX_SSID_LEN + 2, 0);
val = __le16_to_cpu(*(u16 *) ssid); val = le16_to_cpu(*(__le16 *) ssid);
if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) { if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1319,7 +1319,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, ...@@ -1319,7 +1319,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
#else /* PRISM2_NO_STATION_MODES */ #else /* PRISM2_NO_STATION_MODES */
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 enable, mcast; __le16 enable, mcast;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -1328,7 +1328,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, ...@@ -1328,7 +1328,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
< 0) < 0)
return -EINVAL; return -EINVAL;
if (!__le16_to_cpu(enable)) { if (!le16_to_cpu(enable)) {
rrq->disabled = 1; rrq->disabled = 1;
return 0; return 0;
} }
...@@ -1336,29 +1336,29 @@ static int prism2_ioctl_giwpower(struct net_device *dev, ...@@ -1336,29 +1336,29 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
rrq->disabled = 0; rrq->disabled = 0;
if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
u16 timeout; __le16 timeout;
if (local->func->get_rid(dev, if (local->func->get_rid(dev,
HFA384X_RID_CNFPMHOLDOVERDURATION, HFA384X_RID_CNFPMHOLDOVERDURATION,
&timeout, 2, 1) < 0) &timeout, 2, 1) < 0)
return -EINVAL; return -EINVAL;
rrq->flags = IW_POWER_TIMEOUT; rrq->flags = IW_POWER_TIMEOUT;
rrq->value = __le16_to_cpu(timeout) * 1024; rrq->value = le16_to_cpu(timeout) * 1024;
} else { } else {
u16 period; __le16 period;
if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION,
&period, 2, 1) < 0) &period, 2, 1) < 0)
return -EINVAL; return -EINVAL;
rrq->flags = IW_POWER_PERIOD; rrq->flags = IW_POWER_PERIOD;
rrq->value = __le16_to_cpu(period) * 1024; rrq->value = le16_to_cpu(period) * 1024;
} }
if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast, if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast,
2, 1) < 0) 2, 1) < 0)
return -EINVAL; return -EINVAL;
if (__le16_to_cpu(mcast)) if (le16_to_cpu(mcast))
rrq->flags |= IW_POWER_ALL_R; rrq->flags |= IW_POWER_ALL_R;
else else
rrq->flags |= IW_POWER_UNICAST_R; rrq->flags |= IW_POWER_UNICAST_R;
...@@ -1435,7 +1435,7 @@ static int prism2_ioctl_giwretry(struct net_device *dev, ...@@ -1435,7 +1435,7 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
u16 shortretry, longretry, lifetime, altretry; __le16 shortretry, longretry, lifetime, altretry;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -1448,15 +1448,11 @@ static int prism2_ioctl_giwretry(struct net_device *dev, ...@@ -1448,15 +1448,11 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
&lifetime, 2, 1) < 0) &lifetime, 2, 1) < 0)
return -EINVAL; return -EINVAL;
le16_to_cpus(&shortretry);
le16_to_cpus(&longretry);
le16_to_cpus(&lifetime);
rrq->disabled = 0; rrq->disabled = 0;
if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
rrq->flags = IW_RETRY_LIFETIME; rrq->flags = IW_RETRY_LIFETIME;
rrq->value = lifetime * 1024; rrq->value = le16_to_cpu(lifetime) * 1024;
} else { } else {
if (local->manual_retry_count >= 0) { if (local->manual_retry_count >= 0) {
rrq->flags = IW_RETRY_LIMIT; rrq->flags = IW_RETRY_LIMIT;
...@@ -1468,10 +1464,10 @@ static int prism2_ioctl_giwretry(struct net_device *dev, ...@@ -1468,10 +1464,10 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
rrq->value = local->manual_retry_count; rrq->value = local->manual_retry_count;
} else if ((rrq->flags & IW_RETRY_LONG)) { } else if ((rrq->flags & IW_RETRY_LONG)) {
rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
rrq->value = longretry; rrq->value = le16_to_cpu(longretry);
} else { } else {
rrq->flags = IW_RETRY_LIMIT; rrq->flags = IW_RETRY_LIMIT;
rrq->value = shortretry; rrq->value = le16_to_cpu(shortretry);
if (shortretry != longretry) if (shortretry != longretry)
rrq->flags |= IW_RETRY_SHORT; rrq->flags |= IW_RETRY_SHORT;
} }
...@@ -3101,7 +3097,7 @@ static int prism2_set_genericelement(struct net_device *dev, u8 *elem, ...@@ -3101,7 +3097,7 @@ static int prism2_set_genericelement(struct net_device *dev, u8 *elem,
if (buf == NULL) if (buf == NULL)
return -ENOMEM; return -ENOMEM;
*((u16 *) buf) = cpu_to_le16(len); *((__le16 *) buf) = cpu_to_le16(len);
memcpy(buf + 2, elem, len); memcpy(buf + 2, elem, len);
kfree(local->generic_elem); kfree(local->generic_elem);
...@@ -3761,7 +3757,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, ...@@ -3761,7 +3757,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
struct hostap_interface *iface = netdev_priv(dev); struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
struct iw_mlme *mlme = (struct iw_mlme *) extra; struct iw_mlme *mlme = (struct iw_mlme *) extra;
u16 reason; __le16 reason;
reason = cpu_to_le16(mlme->reason_code); reason = cpu_to_le16(mlme->reason_code);
...@@ -3783,7 +3779,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, ...@@ -3783,7 +3779,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
static int prism2_ioctl_mlme(local_info_t *local, static int prism2_ioctl_mlme(local_info_t *local,
struct prism2_hostapd_param *param) struct prism2_hostapd_param *param)
{ {
u16 reason; __le16 reason;
reason = cpu_to_le16(param->u.mlme.reason_code); reason = cpu_to_le16(param->u.mlme.reason_code);
switch (param->u.mlme.cmd) { switch (param->u.mlme.cmd) {
......
...@@ -296,7 +296,7 @@ int hostap_tx_callback_unregister(local_info_t *local, u16 idx) ...@@ -296,7 +296,7 @@ int hostap_tx_callback_unregister(local_info_t *local, u16 idx)
int hostap_set_word(struct net_device *dev, int rid, u16 val) int hostap_set_word(struct net_device *dev, int rid, u16 val)
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
u16 tmp = cpu_to_le16(val); __le16 tmp = cpu_to_le16(val);
iface = netdev_priv(dev); iface = netdev_priv(dev);
return iface->local->func->set_rid(dev, rid, &tmp, 2); return iface->local->func->set_rid(dev, rid, &tmp, 2);
} }
...@@ -1095,15 +1095,15 @@ int prism2_sta_deauth(local_info_t *local, u16 reason) ...@@ -1095,15 +1095,15 @@ int prism2_sta_deauth(local_info_t *local, u16 reason)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
int ret; int ret;
__le16 val = cpu_to_le16(reason);
if (local->iw_mode != IW_MODE_INFRA || if (local->iw_mode != IW_MODE_INFRA ||
memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 || memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 ||
memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0) memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0)
return 0; return 0;
reason = cpu_to_le16(reason);
ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH,
(u8 *) &reason, 2); (u8 *) &val, 2);
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
return ret; return ret;
......
...@@ -128,8 +128,8 @@ static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) ...@@ -128,8 +128,8 @@ static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a)) #define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) #define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a)) #define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
#define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), cpu_to_le16((v))) #define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v)))
#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw_debug(dev, (a))) #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a)))
#else /* PRISM2_IO_DEBUG */ #else /* PRISM2_IO_DEBUG */
...@@ -173,8 +173,8 @@ static inline u16 hfa384x_inw(struct net_device *dev, int a) ...@@ -173,8 +173,8 @@ static inline u16 hfa384x_inw(struct net_device *dev, int a)
#define HFA384X_INB(a) hfa384x_inb(dev, (a)) #define HFA384X_INB(a) hfa384x_inb(dev, (a))
#define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v)) #define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v))
#define HFA384X_INW(a) hfa384x_inw(dev, (a)) #define HFA384X_INW(a) hfa384x_inw(dev, (a))
#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), cpu_to_le16((v))) #define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v)))
#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw(dev, (a))) #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a)))
#endif /* PRISM2_IO_DEBUG */ #endif /* PRISM2_IO_DEBUG */
...@@ -183,10 +183,10 @@ static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, ...@@ -183,10 +183,10 @@ static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
int len) int len)
{ {
u16 d_off; u16 d_off;
u16 *pos; __le16 *pos;
d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
pos = (u16 *) buf; pos = (__le16 *) buf;
for ( ; len > 1; len -= 2) for ( ; len > 1; len -= 2)
*pos++ = HFA384X_INW_DATA(d_off); *pos++ = HFA384X_INW_DATA(d_off);
...@@ -201,10 +201,10 @@ static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, ...@@ -201,10 +201,10 @@ static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
{ {
u16 d_off; u16 d_off;
u16 *pos; __le16 *pos;
d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
pos = (u16 *) buf; pos = (__le16 *) buf;
for ( ; len > 1; len -= 2) for ( ; len > 1; len -= 2)
HFA384X_OUTW_DATA(*pos++, d_off); HFA384X_OUTW_DATA(*pos++, d_off);
......
...@@ -39,20 +39,20 @@ struct linux_wlan_ng_prism_hdr { ...@@ -39,20 +39,20 @@ struct linux_wlan_ng_prism_hdr {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct linux_wlan_ng_cap_hdr { struct linux_wlan_ng_cap_hdr {
u32 version; __be32 version;
u32 length; __be32 length;
u64 mactime; __be64 mactime;
u64 hosttime; __be64 hosttime;
u32 phytype; __be32 phytype;
u32 channel; __be32 channel;
u32 datarate; __be32 datarate;
u32 antenna; __be32 antenna;
u32 priority; __be32 priority;
u32 ssi_type; __be32 ssi_type;
s32 ssi_signal; __be32 ssi_signal;
s32 ssi_noise; __be32 ssi_noise;
u32 preamble; __be32 preamble;
u32 encoding; __be32 encoding;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ #define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
...@@ -60,28 +60,28 @@ struct linux_wlan_ng_cap_hdr { ...@@ -60,28 +60,28 @@ struct linux_wlan_ng_cap_hdr {
struct hfa384x_rx_frame { struct hfa384x_rx_frame {
/* HFA384X RX frame descriptor */ /* HFA384X RX frame descriptor */
u16 status; /* HFA384X_RX_STATUS_ flags */ __le16 status; /* HFA384X_RX_STATUS_ flags */
u32 time; /* timestamp, 1 microsecond resolution */ __le32 time; /* timestamp, 1 microsecond resolution */
u8 silence; /* 27 .. 154; seems to be 0 */ u8 silence; /* 27 .. 154; seems to be 0 */
u8 signal; /* 27 .. 154 */ u8 signal; /* 27 .. 154 */
u8 rate; /* 10, 20, 55, or 110 */ u8 rate; /* 10, 20, 55, or 110 */
u8 rxflow; u8 rxflow;
u32 reserved; __le32 reserved;
/* 802.11 */ /* 802.11 */
u16 frame_control; __le16 frame_control;
u16 duration_id; __le16 duration_id;
u8 addr1[6]; u8 addr1[6];
u8 addr2[6]; u8 addr2[6];
u8 addr3[6]; u8 addr3[6];
u16 seq_ctrl; __le16 seq_ctrl;
u8 addr4[6]; u8 addr4[6];
u16 data_len; __le16 data_len;
/* 802.3 */ /* 802.3 */
u8 dst_addr[6]; u8 dst_addr[6];
u8 src_addr[6]; u8 src_addr[6];
u16 len; __be16 len;
/* followed by frame data; max 2304 bytes */ /* followed by frame data; max 2304 bytes */
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -89,28 +89,28 @@ struct hfa384x_rx_frame { ...@@ -89,28 +89,28 @@ struct hfa384x_rx_frame {
struct hfa384x_tx_frame { struct hfa384x_tx_frame {
/* HFA384X TX frame descriptor */ /* HFA384X TX frame descriptor */
u16 status; /* HFA384X_TX_STATUS_ flags */ __le16 status; /* HFA384X_TX_STATUS_ flags */
u16 reserved1; __le16 reserved1;
u16 reserved2; __le16 reserved2;
u32 sw_support; __le32 sw_support;
u8 retry_count; /* not yet implemented */ u8 retry_count; /* not yet implemented */
u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */ u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */
u16 tx_control; /* HFA384X_TX_CTRL_ flags */ __le16 tx_control; /* HFA384X_TX_CTRL_ flags */
/* 802.11 */ /* 802.11 */
u16 frame_control; /* parts not used */ __le16 frame_control; /* parts not used */
u16 duration_id; __le16 duration_id;
u8 addr1[6]; u8 addr1[6];
u8 addr2[6]; /* filled by firmware */ u8 addr2[6]; /* filled by firmware */
u8 addr3[6]; u8 addr3[6];
u16 seq_ctrl; /* filled by firmware */ __le16 seq_ctrl; /* filled by firmware */
u8 addr4[6]; u8 addr4[6];
u16 data_len; __le16 data_len;
/* 802.3 */ /* 802.3 */
u8 dst_addr[6]; u8 dst_addr[6];
u8 src_addr[6]; u8 src_addr[6];
u16 len; __be16 len;
/* followed by frame data; max 2304 bytes */ /* followed by frame data; max 2304 bytes */
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -118,8 +118,8 @@ struct hfa384x_tx_frame { ...@@ -118,8 +118,8 @@ struct hfa384x_tx_frame {
struct hfa384x_rid_hdr struct hfa384x_rid_hdr
{ {
u16 len; __le16 len;
u16 rid; __le16 rid;
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -130,78 +130,78 @@ struct hfa384x_rid_hdr ...@@ -130,78 +130,78 @@ struct hfa384x_rid_hdr
#define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100 #define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100
struct hfa384x_scan_request { struct hfa384x_scan_request {
u16 channel_list; __le16 channel_list;
u16 txrate; /* HFA384X_RATES_* */ __le16 txrate; /* HFA384X_RATES_* */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_hostscan_request { struct hfa384x_hostscan_request {
u16 channel_list; __le16 channel_list;
u16 txrate; __le16 txrate;
u16 target_ssid_len; __le16 target_ssid_len;
u8 target_ssid[32]; u8 target_ssid[32];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_join_request { struct hfa384x_join_request {
u8 bssid[6]; u8 bssid[6];
u16 channel; __le16 channel;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_info_frame { struct hfa384x_info_frame {
u16 len; __le16 len;
u16 type; __le16 type;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_comm_tallies { struct hfa384x_comm_tallies {
u16 tx_unicast_frames; __le16 tx_unicast_frames;
u16 tx_multicast_frames; __le16 tx_multicast_frames;
u16 tx_fragments; __le16 tx_fragments;
u16 tx_unicast_octets; __le16 tx_unicast_octets;
u16 tx_multicast_octets; __le16 tx_multicast_octets;
u16 tx_deferred_transmissions; __le16 tx_deferred_transmissions;
u16 tx_single_retry_frames; __le16 tx_single_retry_frames;
u16 tx_multiple_retry_frames; __le16 tx_multiple_retry_frames;
u16 tx_retry_limit_exceeded; __le16 tx_retry_limit_exceeded;
u16 tx_discards; __le16 tx_discards;
u16 rx_unicast_frames; __le16 rx_unicast_frames;
u16 rx_multicast_frames; __le16 rx_multicast_frames;
u16 rx_fragments; __le16 rx_fragments;
u16 rx_unicast_octets; __le16 rx_unicast_octets;
u16 rx_multicast_octets; __le16 rx_multicast_octets;
u16 rx_fcs_errors; __le16 rx_fcs_errors;
u16 rx_discards_no_buffer; __le16 rx_discards_no_buffer;
u16 tx_discards_wrong_sa; __le16 tx_discards_wrong_sa;
u16 rx_discards_wep_undecryptable; __le16 rx_discards_wep_undecryptable;
u16 rx_message_in_msg_fragments; __le16 rx_message_in_msg_fragments;
u16 rx_message_in_bad_msg_fragments; __le16 rx_message_in_bad_msg_fragments;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_comm_tallies32 { struct hfa384x_comm_tallies32 {
u32 tx_unicast_frames; __le32 tx_unicast_frames;
u32 tx_multicast_frames; __le32 tx_multicast_frames;
u32 tx_fragments; __le32 tx_fragments;
u32 tx_unicast_octets; __le32 tx_unicast_octets;
u32 tx_multicast_octets; __le32 tx_multicast_octets;
u32 tx_deferred_transmissions; __le32 tx_deferred_transmissions;
u32 tx_single_retry_frames; __le32 tx_single_retry_frames;
u32 tx_multiple_retry_frames; __le32 tx_multiple_retry_frames;
u32 tx_retry_limit_exceeded; __le32 tx_retry_limit_exceeded;
u32 tx_discards; __le32 tx_discards;
u32 rx_unicast_frames; __le32 rx_unicast_frames;
u32 rx_multicast_frames; __le32 rx_multicast_frames;
u32 rx_fragments; __le32 rx_fragments;
u32 rx_unicast_octets; __le32 rx_unicast_octets;
u32 rx_multicast_octets; __le32 rx_multicast_octets;
u32 rx_fcs_errors; __le32 rx_fcs_errors;
u32 rx_discards_no_buffer; __le32 rx_discards_no_buffer;
u32 tx_discards_wrong_sa; __le32 tx_discards_wrong_sa;
u32 rx_discards_wep_undecryptable; __le32 rx_discards_wep_undecryptable;
u32 rx_message_in_msg_fragments; __le32 rx_message_in_msg_fragments;
u32 rx_message_in_bad_msg_fragments; __le32 rx_message_in_bad_msg_fragments;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_scan_result_hdr { struct hfa384x_scan_result_hdr {
u16 reserved; __le16 reserved;
u16 scan_reason; __le16 scan_reason;
#define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */ #define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */
#define HFA384X_SCAN_HOST_INITIATED 1 #define HFA384X_SCAN_HOST_INITIATED 1
#define HFA384X_SCAN_FIRMWARE_INITIATED 2 #define HFA384X_SCAN_FIRMWARE_INITIATED 2
...@@ -211,30 +211,30 @@ struct hfa384x_scan_result_hdr { ...@@ -211,30 +211,30 @@ struct hfa384x_scan_result_hdr {
#define HFA384X_SCAN_MAX_RESULTS 32 #define HFA384X_SCAN_MAX_RESULTS 32
struct hfa384x_scan_result { struct hfa384x_scan_result {
u16 chid; __le16 chid;
u16 anl; __le16 anl;
u16 sl; __le16 sl;
u8 bssid[6]; u8 bssid[6];
u16 beacon_interval; __le16 beacon_interval;
u16 capability; __le16 capability;
u16 ssid_len; __le16 ssid_len;
u8 ssid[32]; u8 ssid[32];
u8 sup_rates[10]; u8 sup_rates[10];
u16 rate; __le16 rate;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct hfa384x_hostscan_result { struct hfa384x_hostscan_result {
u16 chid; __le16 chid;
u16 anl; __le16 anl;
u16 sl; __le16 sl;
u8 bssid[6]; u8 bssid[6];
u16 beacon_interval; __le16 beacon_interval;
u16 capability; __le16 capability;
u16 ssid_len; __le16 ssid_len;
u8 ssid[32]; u8 ssid[32];
u8 sup_rates[10]; u8 sup_rates[10];
u16 rate; __le16 rate;
u16 atim; __le16 atim;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct comm_tallies_sums { struct comm_tallies_sums {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment