From 374fdfbc67837c1f4369eedb0f371ce3e6cce832 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 12 Dec 2007 10:25:07 -0500 Subject: introduce WEXT scan capabilities Introduce scan capabilities to WEXT so that userspace can do intelligent things with scan behavior such as handling hidden SSIDs more gracefully. If the driver reports a specific scan capability, the driver must respect the options specified in the iw_scan_req structure when handling the SIOCSIWSCAN call, unless it's mode or state does not allow it to do so, in which case it must return an error. This version switches to Dave Kilroy's suggestion of claiming unused padding space for the scan_capa field. Signed-off-by: Dan Williams Signed-off-by: John W. Linville Signed-off-by: David S. Miller --- drivers/net/wireless/hostap/hostap_ioctl.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c') diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index d8f5efcfcab9..3a57d48cc360 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c @@ -1089,6 +1089,9 @@ static int prism2_ioctl_giwrange(struct net_device *dev, range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) + range->scan_capa = IW_SCAN_CAPA_ESSID; + return 0; } -- cgit v1.2.3 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_ioctl.c | 66 ++++++++++++++---------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c') diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 3a57d48cc360..0ca0bfeb0ada 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) { -- cgit v1.2.3