From 8a9faf3cd08b91aca1502dbe18e3b5063fda2e87 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 21 Dec 2007 03:30:16 -0500 Subject: hostap annotations Signed-off-by: Al Viro Signed-off-by: John W. Linville --- drivers/net/wireless/hostap/hostap_80211.h | 34 ++--- drivers/net/wireless/hostap/hostap_80211_rx.c | 2 +- drivers/net/wireless/hostap/hostap_ap.c | 72 ++++----- drivers/net/wireless/hostap/hostap_common.h | 34 ++--- drivers/net/wireless/hostap/hostap_download.c | 22 ++- drivers/net/wireless/hostap/hostap_hw.c | 10 +- drivers/net/wireless/hostap/hostap_info.c | 4 +- drivers/net/wireless/hostap/hostap_ioctl.c | 66 ++++----- drivers/net/wireless/hostap/hostap_main.c | 6 +- drivers/net/wireless/hostap/hostap_pci.c | 16 +- drivers/net/wireless/hostap/hostap_wlan.h | 202 +++++++++++++------------- 11 files changed, 233 insertions(+), 235 deletions(-) diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h index cc1ee7f4f5f..d6b9362a3d5 100644 --- a/drivers/net/wireless/hostap/hostap_80211.h +++ b/drivers/net/wireless/hostap/hostap_80211.h @@ -5,52 +5,52 @@ #include struct hostap_ieee80211_mgmt { - u16 frame_control; - u16 duration; + __le16 frame_control; + __le16 duration; u8 da[6]; u8 sa[6]; u8 bssid[6]; - u16 seq_ctrl; + __le16 seq_ctrl; union { struct { - u16 auth_alg; - u16 auth_transaction; - u16 status_code; + __le16 auth_alg; + __le16 auth_transaction; + __le16 status_code; /* possibly followed by Challenge text */ u8 variable[0]; } __attribute__ ((packed)) auth; struct { - u16 reason_code; + __le16 reason_code; } __attribute__ ((packed)) deauth; struct { - u16 capab_info; - u16 listen_interval; + __le16 capab_info; + __le16 listen_interval; /* followed by SSID and Supported rates */ u8 variable[0]; } __attribute__ ((packed)) assoc_req; struct { - u16 capab_info; - u16 status_code; - u16 aid; + __le16 capab_info; + __le16 status_code; + __le16 aid; /* followed by Supported rates */ u8 variable[0]; } __attribute__ ((packed)) assoc_resp, reassoc_resp; struct { - u16 capab_info; - u16 listen_interval; + __le16 capab_info; + __le16 listen_interval; u8 current_ap[6]; /* followed by SSID and Supported rates */ u8 variable[0]; } __attribute__ ((packed)) reassoc_req; struct { - u16 reason_code; + __le16 reason_code; } __attribute__ ((packed)) disassoc; struct { } __attribute__ ((packed)) probe_req; struct { u8 timestamp[8]; - u16 beacon_int; - u16 capab_info; + __le16 beacon_int; + __le16 capab_info; /* followed by some of SSID, Supported rates, * FH Params, DS Params, CF Params, IBSS Params, TIM */ u8 variable[0]; diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index ef084df3d48..49978bdb432 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c @@ -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), dst, ETH_ALEN); } else { - u16 len; + __be16 len; /* Leave Ethernet header part of hdr and full payload */ skb_pull(skb, hdrlen); len = htons(skb->len); diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 6bbdb76b32d..ad040a3bb8a 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c @@ -258,7 +258,7 @@ static void ap_handle_timer(unsigned long data) sta->addr, ap->tx_callback_poll); } else { int deauth = sta->timeout_next == STA_DEAUTH; - u16 resp; + __le16 resp; PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s" "(last=%lu, jiffies=%lu)\n", local->dev->name, @@ -300,13 +300,13 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, int resend) { u8 addr[ETH_ALEN]; - u16 resp; + __le16 resp; int i; PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); 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 * 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) int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) { struct sta_info *sta; - u16 resp; + __le16 resp; spin_lock_bh(&ap->sta_table_lock); 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) struct ap_data *ap = data; struct net_device *dev = ap->local->dev; 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; char *txt = NULL; DECLARE_MAC_BUF(mac); @@ -649,7 +650,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) return; } - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); auth_alg = le16_to_cpu(*pos++); auth_transaction = 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) struct ap_data *ap = data; struct net_device *dev = ap->local->dev; struct ieee80211_hdr_4addr *hdr; - u16 fc, *pos, status; + u16 fc, status; + __le16 *pos; struct sta_info *sta = NULL; char *txt = NULL; DECLARE_MAC_BUF(mac); @@ -736,7 +738,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) goto done; } - pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); + pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); pos++; status = le16_to_cpu(*pos++); if (status == WLAN_STATUS_SUCCESS) { @@ -1298,7 +1300,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, struct ap_data *ap = local->ap; char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; 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; struct sta_info *sta = NULL; struct ieee80211_crypt_data *crypt; @@ -1332,7 +1335,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, 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); pos++; auth_transaction = __le16_to_cpu(*pos); @@ -1465,7 +1468,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, } fail: - pos = (u16 *) body; + pos = (__le16 *) body; *pos = cpu_to_le16(auth_alg); pos++; *pos = cpu_to_le16(auth_transaction + 1); @@ -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; char body[12], *p, *lpos; int len, left; - u16 *pos; + __le16 *pos; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; int send_deauth = 0; @@ -1540,7 +1543,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, atomic_inc(&sta->users); 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); pos++; left -= 2; sta->listen_interval = __le16_to_cpu(*pos); @@ -1636,25 +1639,24 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, } fail: - pos = (u16 *) body; + pos = (__le16 *) body; if (send_deauth) { - *pos = __constant_cpu_to_le16( - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); + *pos = cpu_to_le16(WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); pos++; } else { /* FIX: CF-Pollable and CF-PollReq should be set to match the * values in beacons/probe responses */ /* FIX: how about privacy and WEP? */ /* capability */ - *pos = __constant_cpu_to_le16(WLAN_CAPABILITY_ESS); + *pos = cpu_to_le16(WLAN_CAPABILITY_ESS); pos++; /* status_code */ - *pos = __cpu_to_le16(resp); + *pos = cpu_to_le16(resp); 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 */ pos++; @@ -1681,7 +1683,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, 0x96 : 0x16; (*lpos)++; } - pos = (u16 *) p; + pos = (__le16 *) p; } prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | @@ -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; char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); int len; - u16 reason_code, *pos; + u16 reason_code; + __le16 *pos; struct sta_info *sta = NULL; DECLARE_MAC_BUF(mac); @@ -1729,8 +1732,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, return; } - pos = (u16 *) body; - reason_code = __le16_to_cpu(*pos); + pos = (__le16 *) body; + reason_code = le16_to_cpu(*pos); PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " "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, struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; char *body = skb->data + IEEE80211_MGMT_HDR_LEN; int len; - u16 reason_code, *pos; + u16 reason_code; + __le16 *pos; struct sta_info *sta = NULL; DECLARE_MAC_BUF(mac); @@ -1771,8 +1775,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, return; } - pos = (u16 *) body; - reason_code = __le16_to_cpu(*pos); + pos = (__le16 *) body; + reason_code = le16_to_cpu(*pos); PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " "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, { struct net_device *dev = local->dev; struct sta_info *sta; - u16 reason; + __le16 reason; spin_lock_bh(&local->ap->sta_table_lock); sta = ap_get_sta(local->ap, hdr->addr2); @@ -1831,8 +1835,7 @@ static void ap_handle_dropped_data(local_info_t *local, return; } - reason = __constant_cpu_to_le16( - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); + reason = cpu_to_le16(WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), @@ -1892,7 +1895,7 @@ static void handle_pspoll(local_info_t *local, 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))) { PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); return; @@ -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; char *body = skb->data + IEEE80211_MGMT_HDR_LEN; int len, left; - u16 *pos, beacon_int, capability; + u16 beacon_int, capability; + __le16 *pos; char *ssid = NULL; unsigned char *supp_rates = NULL; int ssid_len = 0, supp_rates_len = 0; @@ -2013,16 +2017,16 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb, return; } - pos = (u16 *) body; + pos = (__le16 *) body; left = len; /* Timestamp (8 octets) */ pos += 4; left -= 8; /* Beacon interval (2 octets) */ - beacon_int = __le16_to_cpu(*pos); + beacon_int = le16_to_cpu(*pos); pos++; left -= 2; /* Capability information (2 octets) */ - capability = __le16_to_cpu(*pos); + capability = le16_to_cpu(*pos); pos++; left -= 2; if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h index 517f8984514..b470c743c2d 100644 --- a/drivers/net/wireless/hostap/hostap_common.h +++ b/drivers/net/wireless/hostap/hostap_common.h @@ -188,10 +188,10 @@ struct hfa384x_comp_ident { - u16 id; - u16 variant; - u16 major; - u16 minor; + __le16 id; + __le16 variant; + __le16 major; + __le16 minor; } __attribute__ ((packed)); #define HFA384X_COMP_ID_PRI 0x15 @@ -200,33 +200,33 @@ struct hfa384x_comp_ident struct hfa384x_sup_range { - u16 role; - u16 id; - u16 variant; - u16 bottom; - u16 top; + __le16 role; + __le16 id; + __le16 variant; + __le16 bottom; + __le16 top; } __attribute__ ((packed)); struct hfa384x_build_id { - u16 pri_seq; - u16 sec_seq; + __le16 pri_seq; + __le16 sec_seq; } __attribute__ ((packed)); /* FD01 - Download Buffer */ struct hfa384x_rid_download_buffer { - u16 page; - u16 offset; - u16 length; + __le16 page; + __le16 offset; + __le16 length; } __attribute__ ((packed)); /* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */ struct hfa384x_comms_quality { - u16 comm_qual; /* 0 .. 92 */ - u16 signal_level; /* 27 .. 154 */ - u16 noise_level; /* 27 .. 154 */ + __le16 comm_qual; /* 0 .. 92 */ + __le16 signal_level; /* 27 .. 154 */ + __le16 noise_level; /* 27 .. 154 */ } __attribute__ ((packed)); diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c index c7678e67697..89d3849abfe 100644 --- a/drivers/net/wireless/hostap/hostap_download.c +++ b/drivers/net/wireless/hostap/hostap_download.c @@ -100,7 +100,7 @@ static int hfa384x_from_aux(struct net_device *dev, unsigned int addr, int len, #ifdef PRISM2_PCI { - u16 *pos = (u16 *) buf; + __le16 *pos = (__le16 *) buf; while (len > 0) { *pos++ = HFA384X_INW_DATA(HFA384X_AUXDATA_OFF); len -= 2; @@ -131,7 +131,7 @@ static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len, #ifdef PRISM2_PCI { - u16 *pos = (u16 *) buf; + __le16 *pos = (__le16 *) buf; while (len > 0) { HFA384X_OUTW_DATA(*pos++, HFA384X_AUXDATA_OFF); len -= 2; @@ -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) { - u16 *pda = (u16 *) buf; + __le16 *pda = (__le16 *) buf; int pos; u16 len, pdr; @@ -544,9 +544,9 @@ static int prism2_download_nonvolatile(local_info_t *local, struct net_device *dev = local->dev; int ret = 0, i; struct { - u16 page; - u16 offset; - u16 len; + __le16 page; + __le16 offset; + __le16 len; } dlbuffer; u32 bufaddr; @@ -565,14 +565,12 @@ static int prism2_download_nonvolatile(local_info_t *local, 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", - 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; diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 700a9c34815..77237bb3b2f 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c @@ -1075,7 +1075,7 @@ static int prism2_setup_rids(struct net_device *dev) { struct hostap_interface *iface; local_info_t *local; - u16 tmp; + __le16 tmp; int ret = 0; iface = netdev_priv(dev); @@ -1084,11 +1084,11 @@ static int prism2_setup_rids(struct net_device *dev) hostap_set_word(dev, HFA384X_RID_TICKTIME, 2000); if (!local->fw_ap) { - tmp = hostap_get_porttype(local); - ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp); + u16 tmp1 = hostap_get_porttype(local); + ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp1); if (ret) { printk("%s: Port type setting to %d failed\n", - dev->name, tmp); + dev->name, tmp1); goto fail; } } @@ -1117,7 +1117,7 @@ static int prism2_setup_rids(struct net_device *dev) ret = -EINVAL; goto fail; } - local->channel_mask = __le16_to_cpu(tmp); + local->channel_mask = le16_to_cpu(tmp); if (local->channel < 1 || local->channel > 14 || !(local->channel_mask & (1 << (local->channel - 1)))) { diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c index 636f4b2382e..e559b8d9fca 100644 --- a/drivers/net/wireless/hostap/hostap_info.c +++ b/drivers/net/wireless/hostap/hostap_info.c @@ -303,7 +303,7 @@ static void prism2_info_hostscanresults(local_info_t *local, int i, result_size, copy_len, new_count; struct hfa384x_hostscan_result *results, *prev; unsigned long flags; - u16 *pos; + __le16 *pos; u8 *ptr; wake_up_interruptible(&local->hostscan_wq); @@ -314,7 +314,7 @@ static void prism2_info_hostscanresults(local_info_t *local, return; } - pos = (u16 *) buf; + pos = (__le16 *) buf; copy_len = result_size = le16_to_cpu(*pos); if (result_size == 0) { printk(KERN_DEBUG "%s: invalid result_size (0) in " diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 3a57d48cc36..0ca0bfeb0ad 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c @@ -84,7 +84,7 @@ static int prism2_get_datarates(struct net_device *dev, u8 *rates) if (len < 2) return 0; - val = le16_to_cpu(*(u16 *) buf); /* string length */ + val = le16_to_cpu(*(__le16 *) buf); /* string length */ if (len - 2 < val || val > 10) return 0; @@ -496,7 +496,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 val; + __le16 val; iface = netdev_priv(dev); local = iface->local; @@ -506,7 +506,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, 0) return -EINVAL; - sens->value = __le16_to_cpu(val); + sens->value = le16_to_cpu(val); sens->fixed = 1; return 0; @@ -561,17 +561,17 @@ static int prism2_ioctl_siwrts(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 val; + __le16 val; iface = netdev_priv(dev); local = iface->local; if (rts->disabled) - val = __constant_cpu_to_le16(2347); + val = cpu_to_le16(2347); else if (rts->value < 0 || rts->value > 2347) return -EINVAL; else - val = __cpu_to_le16(rts->value); + val = cpu_to_le16(rts->value); if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || local->func->reset_port(dev)) @@ -588,7 +588,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 val; + __le16 val; iface = netdev_priv(dev); local = iface->local; @@ -597,7 +597,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, 0) return -EINVAL; - rts->value = __le16_to_cpu(val); + rts->value = le16_to_cpu(val); rts->disabled = (rts->value == 2347); rts->fixed = 1; @@ -611,17 +611,17 @@ static int prism2_ioctl_siwfrag(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 val; + __le16 val; iface = netdev_priv(dev); local = iface->local; if (rts->disabled) - val = __constant_cpu_to_le16(2346); + val = cpu_to_le16(2346); else if (rts->value < 256 || rts->value > 2346) return -EINVAL; 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; if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, @@ -638,7 +638,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 val; + __le16 val; iface = netdev_priv(dev); local = iface->local; @@ -647,7 +647,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, &val, 2, 1) < 0) return -EINVAL; - rts->value = __le16_to_cpu(val); + rts->value = le16_to_cpu(val); rts->disabled = (rts->value == 2346); rts->fixed = 1; @@ -718,8 +718,8 @@ static int prism2_ioctl_siwap(struct net_device *dev, if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { struct hfa384x_scan_request scan_req; memset(&scan_req, 0, sizeof(scan_req)); - scan_req.channel_list = __constant_cpu_to_le16(0x3fff); - scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS); + scan_req.channel_list = cpu_to_le16(0x3fff); + scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, &scan_req, sizeof(scan_req))) { printk(KERN_DEBUG "%s: ScanResults request failed - " @@ -812,7 +812,7 @@ static int prism2_ioctl_giwnickn(struct net_device *dev, len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, &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) return -EOPNOTSUPP; @@ -963,7 +963,7 @@ static int prism2_ioctl_giwessid(struct net_device *dev, memset(ssid, 0, sizeof(ssid)); len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, &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) { return -EOPNOTSUPP; } @@ -1319,7 +1319,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, #else /* PRISM2_NO_STATION_MODES */ struct hostap_interface *iface; local_info_t *local; - u16 enable, mcast; + __le16 enable, mcast; iface = netdev_priv(dev); local = iface->local; @@ -1328,7 +1328,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, < 0) return -EINVAL; - if (!__le16_to_cpu(enable)) { + if (!le16_to_cpu(enable)) { rrq->disabled = 1; return 0; } @@ -1336,29 +1336,29 @@ static int prism2_ioctl_giwpower(struct net_device *dev, rrq->disabled = 0; if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - u16 timeout; + __le16 timeout; if (local->func->get_rid(dev, HFA384X_RID_CNFPMHOLDOVERDURATION, &timeout, 2, 1) < 0) return -EINVAL; rrq->flags = IW_POWER_TIMEOUT; - rrq->value = __le16_to_cpu(timeout) * 1024; + rrq->value = le16_to_cpu(timeout) * 1024; } else { - u16 period; + __le16 period; if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, &period, 2, 1) < 0) return -EINVAL; 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, 2, 1) < 0) return -EINVAL; - if (__le16_to_cpu(mcast)) + if (le16_to_cpu(mcast)) rrq->flags |= IW_POWER_ALL_R; else rrq->flags |= IW_POWER_UNICAST_R; @@ -1435,7 +1435,7 @@ static int prism2_ioctl_giwretry(struct net_device *dev, { struct hostap_interface *iface; local_info_t *local; - u16 shortretry, longretry, lifetime, altretry; + __le16 shortretry, longretry, lifetime, altretry; iface = netdev_priv(dev); local = iface->local; @@ -1448,15 +1448,11 @@ static int prism2_ioctl_giwretry(struct net_device *dev, &lifetime, 2, 1) < 0) return -EINVAL; - le16_to_cpus(&shortretry); - le16_to_cpus(&longretry); - le16_to_cpus(&lifetime); - rrq->disabled = 0; if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { rrq->flags = IW_RETRY_LIFETIME; - rrq->value = lifetime * 1024; + rrq->value = le16_to_cpu(lifetime) * 1024; } else { if (local->manual_retry_count >= 0) { rrq->flags = IW_RETRY_LIMIT; @@ -1468,10 +1464,10 @@ static int prism2_ioctl_giwretry(struct net_device *dev, rrq->value = local->manual_retry_count; } else if ((rrq->flags & IW_RETRY_LONG)) { rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - rrq->value = longretry; + rrq->value = le16_to_cpu(longretry); } else { rrq->flags = IW_RETRY_LIMIT; - rrq->value = shortretry; + rrq->value = le16_to_cpu(shortretry); if (shortretry != longretry) rrq->flags |= IW_RETRY_SHORT; } @@ -3101,7 +3097,7 @@ static int prism2_set_genericelement(struct net_device *dev, u8 *elem, if (buf == NULL) return -ENOMEM; - *((u16 *) buf) = cpu_to_le16(len); + *((__le16 *) buf) = cpu_to_le16(len); memcpy(buf + 2, elem, len); kfree(local->generic_elem); @@ -3761,7 +3757,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, struct hostap_interface *iface = netdev_priv(dev); local_info_t *local = iface->local; struct iw_mlme *mlme = (struct iw_mlme *) extra; - u16 reason; + __le16 reason; reason = cpu_to_le16(mlme->reason_code); @@ -3783,7 +3779,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, static int prism2_ioctl_mlme(local_info_t *local, struct prism2_hostapd_param *param) { - u16 reason; + __le16 reason; reason = cpu_to_le16(param->u.mlme.reason_code); switch (param->u.mlme.cmd) { diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 17c58e9bdad..20d387f6658 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c @@ -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) { struct hostap_interface *iface; - u16 tmp = cpu_to_le16(val); + __le16 tmp = cpu_to_le16(val); iface = netdev_priv(dev); return iface->local->func->set_rid(dev, rid, &tmp, 2); } @@ -1095,15 +1095,15 @@ int prism2_sta_deauth(local_info_t *local, u16 reason) { union iwreq_data wrqu; int ret; + __le16 val = cpu_to_le16(reason); if (local->iw_mode != IW_MODE_INFRA || memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 || memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0) return 0; - reason = cpu_to_le16(reason); 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); wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); return ret; diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index fc876ba1857..3a874fc621d 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c @@ -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_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) #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_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw_debug(dev, (a))) +#define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v))) +#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a))) #else /* PRISM2_IO_DEBUG */ @@ -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_OUTW(v,a) hfa384x_outw(dev, (a), (v)) #define HFA384X_INW(a) hfa384x_inw(dev, (a)) -#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), cpu_to_le16((v))) -#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw(dev, (a))) +#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v))) +#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a))) #endif /* PRISM2_IO_DEBUG */ @@ -183,10 +183,10 @@ static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, int len) { u16 d_off; - u16 *pos; + __le16 *pos; d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; + pos = (__le16 *) buf; for ( ; len > 1; len -= 2) *pos++ = HFA384X_INW_DATA(d_off); @@ -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) { u16 d_off; - u16 *pos; + __le16 *pos; d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; + pos = (__le16 *) buf; for ( ; len > 1; len -= 2) HFA384X_OUTW_DATA(*pos++, d_off); diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index e6516a186d0..15445bce2ac 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h @@ -39,20 +39,20 @@ struct linux_wlan_ng_prism_hdr { } __attribute__ ((packed)); struct linux_wlan_ng_cap_hdr { - u32 version; - u32 length; - u64 mactime; - u64 hosttime; - u32 phytype; - u32 channel; - u32 datarate; - u32 antenna; - u32 priority; - u32 ssi_type; - s32 ssi_signal; - s32 ssi_noise; - u32 preamble; - u32 encoding; + __be32 version; + __be32 length; + __be64 mactime; + __be64 hosttime; + __be32 phytype; + __be32 channel; + __be32 datarate; + __be32 antenna; + __be32 priority; + __be32 ssi_type; + __be32 ssi_signal; + __be32 ssi_noise; + __be32 preamble; + __be32 encoding; } __attribute__ ((packed)); #define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ @@ -60,28 +60,28 @@ struct linux_wlan_ng_cap_hdr { struct hfa384x_rx_frame { /* HFA384X RX frame descriptor */ - u16 status; /* HFA384X_RX_STATUS_ flags */ - u32 time; /* timestamp, 1 microsecond resolution */ + __le16 status; /* HFA384X_RX_STATUS_ flags */ + __le32 time; /* timestamp, 1 microsecond resolution */ u8 silence; /* 27 .. 154; seems to be 0 */ u8 signal; /* 27 .. 154 */ u8 rate; /* 10, 20, 55, or 110 */ u8 rxflow; - u32 reserved; + __le32 reserved; /* 802.11 */ - u16 frame_control; - u16 duration_id; + __le16 frame_control; + __le16 duration_id; u8 addr1[6]; u8 addr2[6]; u8 addr3[6]; - u16 seq_ctrl; + __le16 seq_ctrl; u8 addr4[6]; - u16 data_len; + __le16 data_len; /* 802.3 */ u8 dst_addr[6]; u8 src_addr[6]; - u16 len; + __be16 len; /* followed by frame data; max 2304 bytes */ } __attribute__ ((packed)); @@ -89,28 +89,28 @@ struct hfa384x_rx_frame { struct hfa384x_tx_frame { /* HFA384X TX frame descriptor */ - u16 status; /* HFA384X_TX_STATUS_ flags */ - u16 reserved1; - u16 reserved2; - u32 sw_support; + __le16 status; /* HFA384X_TX_STATUS_ flags */ + __le16 reserved1; + __le16 reserved2; + __le32 sw_support; u8 retry_count; /* not yet implemented */ 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 */ - u16 frame_control; /* parts not used */ - u16 duration_id; + __le16 frame_control; /* parts not used */ + __le16 duration_id; u8 addr1[6]; u8 addr2[6]; /* filled by firmware */ u8 addr3[6]; - u16 seq_ctrl; /* filled by firmware */ + __le16 seq_ctrl; /* filled by firmware */ u8 addr4[6]; - u16 data_len; + __le16 data_len; /* 802.3 */ u8 dst_addr[6]; u8 src_addr[6]; - u16 len; + __be16 len; /* followed by frame data; max 2304 bytes */ } __attribute__ ((packed)); @@ -118,8 +118,8 @@ struct hfa384x_tx_frame { struct hfa384x_rid_hdr { - u16 len; - u16 rid; + __le16 len; + __le16 rid; } __attribute__ ((packed)); @@ -130,78 +130,78 @@ struct hfa384x_rid_hdr #define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100 struct hfa384x_scan_request { - u16 channel_list; - u16 txrate; /* HFA384X_RATES_* */ + __le16 channel_list; + __le16 txrate; /* HFA384X_RATES_* */ } __attribute__ ((packed)); struct hfa384x_hostscan_request { - u16 channel_list; - u16 txrate; - u16 target_ssid_len; + __le16 channel_list; + __le16 txrate; + __le16 target_ssid_len; u8 target_ssid[32]; } __attribute__ ((packed)); struct hfa384x_join_request { u8 bssid[6]; - u16 channel; + __le16 channel; } __attribute__ ((packed)); struct hfa384x_info_frame { - u16 len; - u16 type; + __le16 len; + __le16 type; } __attribute__ ((packed)); struct hfa384x_comm_tallies { - u16 tx_unicast_frames; - u16 tx_multicast_frames; - u16 tx_fragments; - u16 tx_unicast_octets; - u16 tx_multicast_octets; - u16 tx_deferred_transmissions; - u16 tx_single_retry_frames; - u16 tx_multiple_retry_frames; - u16 tx_retry_limit_exceeded; - u16 tx_discards; - u16 rx_unicast_frames; - u16 rx_multicast_frames; - u16 rx_fragments; - u16 rx_unicast_octets; - u16 rx_multicast_octets; - u16 rx_fcs_errors; - u16 rx_discards_no_buffer; - u16 tx_discards_wrong_sa; - u16 rx_discards_wep_undecryptable; - u16 rx_message_in_msg_fragments; - u16 rx_message_in_bad_msg_fragments; + __le16 tx_unicast_frames; + __le16 tx_multicast_frames; + __le16 tx_fragments; + __le16 tx_unicast_octets; + __le16 tx_multicast_octets; + __le16 tx_deferred_transmissions; + __le16 tx_single_retry_frames; + __le16 tx_multiple_retry_frames; + __le16 tx_retry_limit_exceeded; + __le16 tx_discards; + __le16 rx_unicast_frames; + __le16 rx_multicast_frames; + __le16 rx_fragments; + __le16 rx_unicast_octets; + __le16 rx_multicast_octets; + __le16 rx_fcs_errors; + __le16 rx_discards_no_buffer; + __le16 tx_discards_wrong_sa; + __le16 rx_discards_wep_undecryptable; + __le16 rx_message_in_msg_fragments; + __le16 rx_message_in_bad_msg_fragments; } __attribute__ ((packed)); struct hfa384x_comm_tallies32 { - u32 tx_unicast_frames; - u32 tx_multicast_frames; - u32 tx_fragments; - u32 tx_unicast_octets; - u32 tx_multicast_octets; - u32 tx_deferred_transmissions; - u32 tx_single_retry_frames; - u32 tx_multiple_retry_frames; - u32 tx_retry_limit_exceeded; - u32 tx_discards; - u32 rx_unicast_frames; - u32 rx_multicast_frames; - u32 rx_fragments; - u32 rx_unicast_octets; - u32 rx_multicast_octets; - u32 rx_fcs_errors; - u32 rx_discards_no_buffer; - u32 tx_discards_wrong_sa; - u32 rx_discards_wep_undecryptable; - u32 rx_message_in_msg_fragments; - u32 rx_message_in_bad_msg_fragments; + __le32 tx_unicast_frames; + __le32 tx_multicast_frames; + __le32 tx_fragments; + __le32 tx_unicast_octets; + __le32 tx_multicast_octets; + __le32 tx_deferred_transmissions; + __le32 tx_single_retry_frames; + __le32 tx_multiple_retry_frames; + __le32 tx_retry_limit_exceeded; + __le32 tx_discards; + __le32 rx_unicast_frames; + __le32 rx_multicast_frames; + __le32 rx_fragments; + __le32 rx_unicast_octets; + __le32 rx_multicast_octets; + __le32 rx_fcs_errors; + __le32 rx_discards_no_buffer; + __le32 tx_discards_wrong_sa; + __le32 rx_discards_wep_undecryptable; + __le32 rx_message_in_msg_fragments; + __le32 rx_message_in_bad_msg_fragments; } __attribute__ ((packed)); struct hfa384x_scan_result_hdr { - u16 reserved; - u16 scan_reason; + __le16 reserved; + __le16 scan_reason; #define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */ #define HFA384X_SCAN_HOST_INITIATED 1 #define HFA384X_SCAN_FIRMWARE_INITIATED 2 @@ -211,30 +211,30 @@ struct hfa384x_scan_result_hdr { #define HFA384X_SCAN_MAX_RESULTS 32 struct hfa384x_scan_result { - u16 chid; - u16 anl; - u16 sl; + __le16 chid; + __le16 anl; + __le16 sl; u8 bssid[6]; - u16 beacon_interval; - u16 capability; - u16 ssid_len; + __le16 beacon_interval; + __le16 capability; + __le16 ssid_len; u8 ssid[32]; u8 sup_rates[10]; - u16 rate; + __le16 rate; } __attribute__ ((packed)); struct hfa384x_hostscan_result { - u16 chid; - u16 anl; - u16 sl; + __le16 chid; + __le16 anl; + __le16 sl; u8 bssid[6]; - u16 beacon_interval; - u16 capability; - u16 ssid_len; + __le16 beacon_interval; + __le16 capability; + __le16 ssid_len; u8 ssid[32]; u8 sup_rates[10]; - u16 rate; - u16 atim; + __le16 rate; + __le16 atim; } __attribute__ ((packed)); struct comm_tallies_sums { -- cgit v1.2.3-70-g09d2