aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2011-11-19 06:04:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-21 16:22:06 -0500
commitcb82a66d0f35eb3f510c3f770d6fbdc3b17ab041 (patch)
tree98bc6f85f7fbd426a26cf546b62ccea8f971d7c9 /drivers
parentef96a84202ccfb48a4569256ffba45e32308f7ee (diff)
rndis_wlan: split getting current channel to separate function
Split getting current channel channel from hardware to separate function as this function will be needed later in patch 'pass channel info to cfg80211_roamed()'. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rndis_wlan.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 620e3c0e88e0..37c4c4087572 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1347,6 +1347,32 @@ static int set_channel(struct usbnet *usbdev, int channel)
1347 return ret; 1347 return ret;
1348} 1348}
1349 1349
1350static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev,
1351 u16 *beacon_interval)
1352{
1353 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
1354 struct ieee80211_channel *channel;
1355 struct ndis_80211_conf config;
1356 int len, ret;
1357
1358 /* Get channel and beacon interval */
1359 len = sizeof(config);
1360 ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
1361 netdev_dbg(usbdev->net, "%s(): OID_802_11_CONFIGURATION -> %d\n",
1362 __func__, ret);
1363 if (ret < 0)
1364 return NULL;
1365
1366 channel = ieee80211_get_channel(priv->wdev.wiphy,
1367 KHZ_TO_MHZ(le32_to_cpu(config.ds_config)));
1368 if (!channel)
1369 return NULL;
1370
1371 if (beacon_interval)
1372 *beacon_interval = le16_to_cpu(config.beacon_period);
1373 return channel;
1374}
1375
1350/* index must be 0 - N, as per NDIS */ 1376/* index must be 0 - N, as per NDIS */
1351static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len, 1377static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len,
1352 int index) 1378 int index)
@@ -2650,13 +2676,12 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
2650{ 2676{
2651 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); 2677 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2652 struct ieee80211_channel *channel; 2678 struct ieee80211_channel *channel;
2653 struct ndis_80211_conf config;
2654 struct ndis_80211_ssid ssid; 2679 struct ndis_80211_ssid ssid;
2655 struct cfg80211_bss *bss; 2680 struct cfg80211_bss *bss;
2656 s32 signal; 2681 s32 signal;
2657 u64 timestamp; 2682 u64 timestamp;
2658 u16 capability; 2683 u16 capability;
2659 u16 beacon_interval; 2684 u16 beacon_interval = 0;
2660 __le32 rssi; 2685 __le32 rssi;
2661 u8 ie_buf[34]; 2686 u8 ie_buf[34];
2662 int len, ret, ie_len; 2687 int len, ret, ie_len;
@@ -2681,22 +2706,10 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
2681 } 2706 }
2682 2707
2683 /* Get channel and beacon interval */ 2708 /* Get channel and beacon interval */
2684 len = sizeof(config); 2709 channel = get_current_channel(usbdev, &beacon_interval);
2685 ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len); 2710 if (!channel) {
2686 netdev_dbg(usbdev->net, "%s(): OID_802_11_CONFIGURATION -> %d\n", 2711 netdev_warn(usbdev->net, "%s(): could not get channel.\n",
2687 __func__, ret); 2712 __func__);
2688 if (ret >= 0) {
2689 beacon_interval = le16_to_cpu(config.beacon_period);
2690 channel = ieee80211_get_channel(priv->wdev.wiphy,
2691 KHZ_TO_MHZ(le32_to_cpu(config.ds_config)));
2692 if (!channel) {
2693 netdev_warn(usbdev->net, "%s(): could not get channel."
2694 "\n", __func__);
2695 return;
2696 }
2697 } else {
2698 netdev_warn(usbdev->net, "%s(): could not get configuration.\n",
2699 __func__);
2700 return; 2713 return;
2701 } 2714 }
2702 2715