diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2010-12-21 15:44:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-22 15:43:31 -0500 |
commit | 40d70dd12200ffeacfe9caaa8242e3ad2995bb5d (patch) | |
tree | 62fc52c4fbd9a09c5adead0c1fd9ffab3ff03210 /drivers/net | |
parent | 49b35bd3f5bbc6997b24b04e9d4896f00cee3528 (diff) |
rndis_wlan: add support for set_power_mgmt
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 0cd971a4dd94..848cc2cce247 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -129,6 +129,7 @@ MODULE_PARM_DESC(workaround_interval, | |||
129 | #define OID_802_11_RTS_THRESHOLD cpu_to_le32(0x0d01020a) | 129 | #define OID_802_11_RTS_THRESHOLD cpu_to_le32(0x0d01020a) |
130 | #define OID_802_11_SUPPORTED_RATES cpu_to_le32(0x0d01020e) | 130 | #define OID_802_11_SUPPORTED_RATES cpu_to_le32(0x0d01020e) |
131 | #define OID_802_11_CONFIGURATION cpu_to_le32(0x0d010211) | 131 | #define OID_802_11_CONFIGURATION cpu_to_le32(0x0d010211) |
132 | #define OID_802_11_POWER_MODE cpu_to_le32(0x0d010216) | ||
132 | #define OID_802_11_BSSID_LIST cpu_to_le32(0x0d010217) | 133 | #define OID_802_11_BSSID_LIST cpu_to_le32(0x0d010217) |
133 | 134 | ||
134 | 135 | ||
@@ -239,6 +240,12 @@ enum ndis_80211_addwep_bits { | |||
239 | NDIS_80211_ADDWEP_TRANSMIT_KEY = cpu_to_le32(1 << 31) | 240 | NDIS_80211_ADDWEP_TRANSMIT_KEY = cpu_to_le32(1 << 31) |
240 | }; | 241 | }; |
241 | 242 | ||
243 | enum ndis_80211_power_mode { | ||
244 | NDIS_80211_POWER_MODE_CAM, | ||
245 | NDIS_80211_POWER_MODE_MAX_PSP, | ||
246 | NDIS_80211_POWER_MODE_FAST_PSP, | ||
247 | }; | ||
248 | |||
242 | struct ndis_80211_auth_request { | 249 | struct ndis_80211_auth_request { |
243 | __le32 length; | 250 | __le32 length; |
244 | u8 bssid[6]; | 251 | u8 bssid[6]; |
@@ -503,6 +510,7 @@ struct rndis_wlan_private { | |||
503 | 510 | ||
504 | /* hardware state */ | 511 | /* hardware state */ |
505 | bool radio_on; | 512 | bool radio_on; |
513 | int power_mode; | ||
506 | int infra_mode; | 514 | int infra_mode; |
507 | bool connected; | 515 | bool connected; |
508 | u8 bssid[ETH_ALEN]; | 516 | u8 bssid[ETH_ALEN]; |
@@ -572,6 +580,9 @@ static int rndis_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, | |||
572 | 580 | ||
573 | static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev); | 581 | static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev); |
574 | 582 | ||
583 | static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | ||
584 | bool enabled, int timeout); | ||
585 | |||
575 | static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, | 586 | static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, |
576 | struct net_device *dev, | 587 | struct net_device *dev, |
577 | s32 rssi_thold, u32 rssi_hyst); | 588 | s32 rssi_thold, u32 rssi_hyst); |
@@ -595,6 +606,7 @@ static const struct cfg80211_ops rndis_config_ops = { | |||
595 | .set_pmksa = rndis_set_pmksa, | 606 | .set_pmksa = rndis_set_pmksa, |
596 | .del_pmksa = rndis_del_pmksa, | 607 | .del_pmksa = rndis_del_pmksa, |
597 | .flush_pmksa = rndis_flush_pmksa, | 608 | .flush_pmksa = rndis_flush_pmksa, |
609 | .set_power_mgmt = rndis_set_power_mgmt, | ||
598 | .set_cqm_rssi_config = rndis_set_cqm_rssi_config, | 610 | .set_cqm_rssi_config = rndis_set_cqm_rssi_config, |
599 | }; | 611 | }; |
600 | 612 | ||
@@ -694,6 +706,7 @@ static const char *oid_to_string(__le32 oid) | |||
694 | OID_STR(OID_802_11_ADD_KEY); | 706 | OID_STR(OID_802_11_ADD_KEY); |
695 | OID_STR(OID_802_11_REMOVE_KEY); | 707 | OID_STR(OID_802_11_REMOVE_KEY); |
696 | OID_STR(OID_802_11_ASSOCIATION_INFORMATION); | 708 | OID_STR(OID_802_11_ASSOCIATION_INFORMATION); |
709 | OID_STR(OID_802_11_CAPABILITY); | ||
697 | OID_STR(OID_802_11_PMKID); | 710 | OID_STR(OID_802_11_PMKID); |
698 | OID_STR(OID_802_11_NETWORK_TYPES_SUPPORTED); | 711 | OID_STR(OID_802_11_NETWORK_TYPES_SUPPORTED); |
699 | OID_STR(OID_802_11_NETWORK_TYPE_IN_USE); | 712 | OID_STR(OID_802_11_NETWORK_TYPE_IN_USE); |
@@ -704,6 +717,7 @@ static const char *oid_to_string(__le32 oid) | |||
704 | OID_STR(OID_802_11_RTS_THRESHOLD); | 717 | OID_STR(OID_802_11_RTS_THRESHOLD); |
705 | OID_STR(OID_802_11_SUPPORTED_RATES); | 718 | OID_STR(OID_802_11_SUPPORTED_RATES); |
706 | OID_STR(OID_802_11_CONFIGURATION); | 719 | OID_STR(OID_802_11_CONFIGURATION); |
720 | OID_STR(OID_802_11_POWER_MODE); | ||
707 | OID_STR(OID_802_11_BSSID_LIST); | 721 | OID_STR(OID_802_11_BSSID_LIST); |
708 | #undef OID_STR | 722 | #undef OID_STR |
709 | } | 723 | } |
@@ -2574,6 +2588,38 @@ static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) | |||
2574 | return rndis_set_oid(usbdev, OID_802_11_PMKID, &pmkid, sizeof(pmkid)); | 2588 | return rndis_set_oid(usbdev, OID_802_11_PMKID, &pmkid, sizeof(pmkid)); |
2575 | } | 2589 | } |
2576 | 2590 | ||
2591 | static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | ||
2592 | bool enabled, int timeout) | ||
2593 | { | ||
2594 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | ||
2595 | struct usbnet *usbdev = priv->usbdev; | ||
2596 | int power_mode; | ||
2597 | __le32 mode; | ||
2598 | int ret; | ||
2599 | |||
2600 | netdev_dbg(usbdev->net, "%s(): %s, %d\n", __func__, | ||
2601 | enabled ? "enabled" : "disabled", | ||
2602 | timeout); | ||
2603 | |||
2604 | if (enabled) | ||
2605 | power_mode = NDIS_80211_POWER_MODE_FAST_PSP; | ||
2606 | else | ||
2607 | power_mode = NDIS_80211_POWER_MODE_CAM; | ||
2608 | |||
2609 | if (power_mode == priv->power_mode) | ||
2610 | return 0; | ||
2611 | |||
2612 | priv->power_mode = power_mode; | ||
2613 | |||
2614 | mode = cpu_to_le32(power_mode); | ||
2615 | ret = rndis_set_oid(usbdev, OID_802_11_POWER_MODE, &mode, sizeof(mode)); | ||
2616 | |||
2617 | netdev_dbg(usbdev->net, "%s(): OID_802_11_POWER_MODE -> %d\n", | ||
2618 | __func__, ret); | ||
2619 | |||
2620 | return ret; | ||
2621 | } | ||
2622 | |||
2577 | static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, | 2623 | static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, |
2578 | struct net_device *dev, | 2624 | struct net_device *dev, |
2579 | s32 rssi_thold, u32 rssi_hyst) | 2625 | s32 rssi_thold, u32 rssi_hyst) |
@@ -3441,6 +3487,8 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) | |||
3441 | 3487 | ||
3442 | set_default_iw_params(usbdev); | 3488 | set_default_iw_params(usbdev); |
3443 | 3489 | ||
3490 | priv->power_mode = -1; | ||
3491 | |||
3444 | /* set default rts/frag */ | 3492 | /* set default rts/frag */ |
3445 | rndis_set_wiphy_params(wiphy, | 3493 | rndis_set_wiphy_params(wiphy, |
3446 | WIPHY_PARAM_FRAG_THRESHOLD | WIPHY_PARAM_RTS_THRESHOLD); | 3494 | WIPHY_PARAM_FRAG_THRESHOLD | WIPHY_PARAM_RTS_THRESHOLD); |