aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-14 09:17:28 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-27 05:56:18 -0500
commit53cabad70ecf0c245b41285de64a74a6c3ee9933 (patch)
treefcbae0f72a3afaf57844b8181c87e63914408c89 /net/wireless/nl80211.c
parent5164892184d1b9ce19e45e97e9ca405ea8b9ceb2 (diff)
nl80211: support P2P GO powersave configuration
If a driver supports P2P GO powersave, allow it to set the new feature flags for it and allow userspace to configure the parameters for it. This can be done at GO startup and later changed with SET_BSS. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eb0aa71a02b3..7f53aafd47f7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -363,6 +363,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
363 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, }, 363 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },
364 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN }, 364 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
365 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 }, 365 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
366 [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 },
367 [NL80211_ATTR_P2P_OPPPS] = { .type = NLA_U8 },
366}; 368};
367 369
368/* policy for the key attributes */ 370/* policy for the key attributes */
@@ -2702,6 +2704,32 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
2702 info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]); 2704 info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
2703 } 2705 }
2704 2706
2707 if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
2708 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
2709 return -EINVAL;
2710 params.p2p_ctwindow =
2711 nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
2712 if (params.p2p_ctwindow > 127)
2713 return -EINVAL;
2714 if (params.p2p_ctwindow != 0 &&
2715 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN))
2716 return -EINVAL;
2717 }
2718
2719 if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
2720 u8 tmp;
2721
2722 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
2723 return -EINVAL;
2724 tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
2725 if (tmp > 1)
2726 return -EINVAL;
2727 params.p2p_opp_ps = tmp;
2728 if (params.p2p_opp_ps != 0 &&
2729 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS))
2730 return -EINVAL;
2731 }
2732
2705 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { 2733 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
2706 err = nl80211_parse_chandef(rdev, info, &params.chandef); 2734 err = nl80211_parse_chandef(rdev, info, &params.chandef);
2707 if (err) 2735 if (err)
@@ -3668,6 +3696,8 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
3668 params.use_short_slot_time = -1; 3696 params.use_short_slot_time = -1;
3669 params.ap_isolate = -1; 3697 params.ap_isolate = -1;
3670 params.ht_opmode = -1; 3698 params.ht_opmode = -1;
3699 params.p2p_ctwindow = -1;
3700 params.p2p_opp_ps = -1;
3671 3701
3672 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) 3702 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
3673 params.use_cts_prot = 3703 params.use_cts_prot =
@@ -3690,6 +3720,32 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
3690 params.ht_opmode = 3720 params.ht_opmode =
3691 nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); 3721 nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]);
3692 3722
3723 if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
3724 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
3725 return -EINVAL;
3726 params.p2p_ctwindow =
3727 nla_get_s8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
3728 if (params.p2p_ctwindow < 0)
3729 return -EINVAL;
3730 if (params.p2p_ctwindow != 0 &&
3731 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN))
3732 return -EINVAL;
3733 }
3734
3735 if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
3736 u8 tmp;
3737
3738 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
3739 return -EINVAL;
3740 tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
3741 if (tmp > 1)
3742 return -EINVAL;
3743 params.p2p_opp_ps = tmp;
3744 if (params.p2p_opp_ps &&
3745 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS))
3746 return -EINVAL;
3747 }
3748
3693 if (!rdev->ops->change_bss) 3749 if (!rdev->ops->change_bss)
3694 return -EOPNOTSUPP; 3750 return -EOPNOTSUPP;
3695 3751