aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rndis_wlan.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2010-03-04 11:27:24 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-03-10 17:44:27 -0500
commit0308383f9591c991b3eb865c4f5ea2a87242afac (patch)
tree52b3569a3e829652e94fcd70c2b2238de2f6b40a /drivers/net/wireless/rndis_wlan.c
parentea29d65ea4e7585a5ac94f7ec0069d384315bd77 (diff)
rndis_wlan: get max_num_pmkids from device
Extend rndis_wlan_get_caps() to get 802.11 capabilities and maximum supported number of PMKIDs by device. v2: fixed to use new netdev_dbg/warn/etc instead of old devdbg/warn/etc Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r--drivers/net/wireless/rndis_wlan.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 15bae0a68054..3433461995a7 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -117,6 +117,7 @@ MODULE_PARM_DESC(workaround_interval,
117#define OID_802_11_ADD_KEY cpu_to_le32(0x0d01011d) 117#define OID_802_11_ADD_KEY cpu_to_le32(0x0d01011d)
118#define OID_802_11_REMOVE_KEY cpu_to_le32(0x0d01011e) 118#define OID_802_11_REMOVE_KEY cpu_to_le32(0x0d01011e)
119#define OID_802_11_ASSOCIATION_INFORMATION cpu_to_le32(0x0d01011f) 119#define OID_802_11_ASSOCIATION_INFORMATION cpu_to_le32(0x0d01011f)
120#define OID_802_11_CAPABILITY cpu_to_le32(0x0d010122)
120#define OID_802_11_PMKID cpu_to_le32(0x0d010123) 121#define OID_802_11_PMKID cpu_to_le32(0x0d010123)
121#define OID_802_11_NETWORK_TYPES_SUPPORTED cpu_to_le32(0x0d010203) 122#define OID_802_11_NETWORK_TYPES_SUPPORTED cpu_to_le32(0x0d010203)
122#define OID_802_11_NETWORK_TYPE_IN_USE cpu_to_le32(0x0d010204) 123#define OID_802_11_NETWORK_TYPE_IN_USE cpu_to_le32(0x0d010204)
@@ -358,6 +359,19 @@ struct ndis_80211_assoc_info {
358 __le32 offset_resp_ies; 359 __le32 offset_resp_ies;
359} __attribute__((packed)); 360} __attribute__((packed));
360 361
362struct ndis_80211_auth_encr_pair {
363 __le32 auth_mode;
364 __le32 encr_mode;
365} __attribute__((packed));
366
367struct ndis_80211_capability {
368 __le32 length;
369 __le32 version;
370 __le32 num_pmkids;
371 __le32 num_auth_encr_pair;
372 struct ndis_80211_auth_encr_pair auth_encr_pair[0];
373} __attribute__((packed));
374
361/* 375/*
362 * private data 376 * private data
363 */ 377 */
@@ -2520,12 +2534,14 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen)
2520 } 2534 }
2521} 2535}
2522 2536
2523static int rndis_wlan_get_caps(struct usbnet *usbdev) 2537static int rndis_wlan_get_caps(struct usbnet *usbdev, struct wiphy *wiphy)
2524{ 2538{
2525 struct { 2539 struct {
2526 __le32 num_items; 2540 __le32 num_items;
2527 __le32 items[8]; 2541 __le32 items[8];
2528 } networks_supported; 2542 } networks_supported;
2543 struct ndis_80211_capability *caps;
2544 u8 caps_buf[sizeof(*caps) + sizeof(caps->auth_encr_pair) * 16];
2529 int len, retval, i, n; 2545 int len, retval, i, n;
2530 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); 2546 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2531 2547
@@ -2553,6 +2569,21 @@ static int rndis_wlan_get_caps(struct usbnet *usbdev)
2553 } 2569 }
2554 } 2570 }
2555 2571
2572 /* get device 802.11 capabilities, number of PMKIDs */
2573 caps = (struct ndis_80211_capability *)caps_buf;
2574 len = sizeof(caps_buf);
2575 retval = rndis_query_oid(usbdev, OID_802_11_CAPABILITY, caps, &len);
2576 if (retval >= 0) {
2577 netdev_dbg(usbdev->net, "OID_802_11_CAPABILITY -> len %d, "
2578 "ver %d, pmkids %d, auth-encr-pairs %d\n",
2579 le32_to_cpu(caps->length),
2580 le32_to_cpu(caps->version),
2581 le32_to_cpu(caps->num_pmkids),
2582 le32_to_cpu(caps->num_auth_encr_pair));
2583 wiphy->max_num_pmkids = le32_to_cpu(caps->num_pmkids);
2584 } else
2585 wiphy->max_num_pmkids = 0;
2586
2556 return retval; 2587 return retval;
2557} 2588}
2558 2589
@@ -2800,7 +2831,7 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
2800 wiphy->max_scan_ssids = 1; 2831 wiphy->max_scan_ssids = 1;
2801 2832
2802 /* TODO: fill-out band/encr information based on priv->caps */ 2833 /* TODO: fill-out band/encr information based on priv->caps */
2803 rndis_wlan_get_caps(usbdev); 2834 rndis_wlan_get_caps(usbdev, wiphy);
2804 2835
2805 memcpy(priv->channels, rndis_channels, sizeof(rndis_channels)); 2836 memcpy(priv->channels, rndis_channels, sizeof(rndis_channels));
2806 memcpy(priv->rates, rndis_rates, sizeof(rndis_rates)); 2837 memcpy(priv->rates, rndis_rates, sizeof(rndis_rates));