cfg80211: basic support for PBSS network type
PATCH 1/1 cfg80211: basic support for PBSS network type
PBSS (Personal Basic Service Set) is a new BSS type for DMG networks. It is similar to infrastructure BSS, having an AP-like entity called PCP (PBSS Control Point), but it has few differences. PBSS support is mandatory for 11ad devices.
Add support for PBSS by introducing a new PBSS flag attribute. The PBSS flag is used in the START_AP command to request starting a PCP instead of an AP, and in the CONNECT command to request connecting to a PCP instead of an AP.
--- include/net/cfg80211.h | 8 ++++++++ include/uapi/linux/nl80211.h | 6 ++++++ net/wireless/nl80211.c | 5 +++++ net/wireless/sme.c | 9 ++++++--- 4 files changed, 25 insertions(+), 3 deletions(-)
include/net/cfg80211.h +8 -0
@@ -712,6 +712,8 @@ struct cfg80211_acl_data {* @p2p_opp_ps: P2P opportunistic PS * @acl: ACL configuration used by the drivers which has support for * MAC address based access control +* @pbss: If set, start as a PCP instead of AP. Relevant for DMG +* networks. */ struct cfg80211_ap_settings {struct cfg80211_chan_def chandef;
@@ -730,6 +732,7 @@ struct cfg80211_ap_settings {u8 p2p_ctwindow;bool p2p_opp_ps;const struct cfg80211_acl_data *acl; +bool pbss; };/**
@@ -1888,6 +1891,8 @@ struct cfg80211_ibss_params {* @ht_capa_mask: The bits of ht_capa which are to be used. * @vht_capa: VHT Capability overrides * @vht_capa_mask: The bits of vht_capa which are to be used. +* @pbss: if set, connect to a PCP instead of AP. Valid for DMG +* networks. */ struct cfg80211_connect_params {struct ieee80211_channel *channel;
@@ -1910,6 +1915,7 @@ struct cfg80211_connect_params {struct ieee80211_ht_cap ht_capa_mask;struct ieee80211_vht_cap vht_capa;struct ieee80211_vht_cap vht_capa_mask; +bool pbss; };/**
@@ -3489,6 +3495,7 @@ struct cfg80211_cached_keys;* registered for unexpected class 3 frames (AP mode) * @conn: (private) cfg80211 software SME connection state machine data * @connect_keys: (private) keys to set after connection is established +* @conn_bss_type: connecting/connected BSS type * @ibss_fixed: (private) IBSS is using fixed BSSID * @ibss_dfs_possible: (private) IBSS may change to a DFS channel * @event_list: (private) list for internal event processing
@@ -3519,6 +3526,7 @@ struct wireless_dev {u8 ssid_len, mesh_id_len, mesh_id_up_len;struct cfg80211_conn *conn;struct cfg80211_cached_keys *connect_keys; +enum ieee80211_bss_type conn_bss_type;struct list_head event_list;spinlock_t event_lock;
include/uapi/linux/nl80211.h +6 -0
@@ -1789,6 +1789,10 @@ enum nl80211_commands {* thus it must not specify the number of iterations, only the interval * between scans. The scan plans are executed sequentially. * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. +* @NL80211_ATTR_PBSS: flag attribute. If set it means operate +* in a PBSS. Specified in %NL80211_CMD_CONNECT to request +* connecting to a PCP, and in %NL80211_CMD_START_AP to start +* a PCP instead of AP. Relevant for DMG networks only. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2164,6 +2168,8 @@ enum nl80211_attrs {NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS ,NL80211_ATTR_SCHED_SCAN_PLANS , +NL80211_ATTR_PBSS , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +5 -0
@@ -401,6 +401,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 }, [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 }, [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG }, + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG }, };/* policy for the key attributes */
@@ -3461,6 +3462,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)return PTR_ERR (params.acl); } + params.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +wdev_lock (wdev); err =rdev_start_ap (rdev, dev, ¶ms);if (!err) {
@@ -7980,6 +7983,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) connect.flags |=ASSOC_REQ_USE_RRM ; } + connect.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +wdev_lock (dev->ieee80211_ptr); err =cfg80211_connect (rdev, dev, &connect, connkeys,NULL );wdev_unlock (dev->ieee80211_ptr);
net/wireless/sme.c +6 -3
@@ -264,7 +264,7 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) wdev->conn->params.bssid, wdev->conn->params.ssid, wdev->conn->params.ssid_len, -IEEE80211_BSS_TYPE_ESS , + wdev->conn_bss_type, IEEE80211_PRIVACY(wdev->conn->params.privacy));if (!bss)return NULL ;
@@ -687,7 +687,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,WARN_ON_ONCE (!wiphy_to_rdev (wdev->wiphy)->ops->connect); bss =cfg80211_get_bss (wdev->wiphy,NULL , bssid, wdev->ssid, wdev->ssid_len, -IEEE80211_BSS_TYPE_ESS , + wdev->conn_bss_type,IEEE80211_PRIVACY_ANY );if (bss)cfg80211_hold_bss (bss_from_pub (bss));
@@ -846,7 +846,7 @@ void cfg80211_roamed(struct net_device *dev, bss =cfg80211_get_bss (wdev->wiphy, channel, bssid, wdev->ssid, wdev->ssid_len, -IEEE80211_BSS_TYPE_ESS ,IEEE80211_PRIVACY_ANY ); + wdev->conn_bss_type,IEEE80211_PRIVACY_ANY );if (WARN_ON (!bss))return ;
@@ -1017,6 +1017,9 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,memcpy (wdev->ssid, connect->ssid, connect->ssid_len); wdev->ssid_len = connect->ssid_len; + wdev->conn_bss_type = connect->pbss ?IEEE80211_BSS_TYPE_PBSS : +IEEE80211_BSS_TYPE_ESS ; +if (!rdev->ops->connect) err =cfg80211_sme_connect (wdev, connect, prev_bssid);else
Signature · 1 line
1.8.2.1
Johannes Berg
maintainerQuoted 5 lines · Lior David
+ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
+ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
+ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
+ * a PCP instead of AP. Relevant for DMG networks only.
I'm continually confused by this; is it possible for DMG devices to be a "real" AP rather than a PCP?
Quoted 9 lines
net/wireless/nl80211.c +0
-0@@ -3461,6 +3462,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return PTR_ERR(params.acl); }net/wireless/nl80211.c +2
-0+ params.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +
wdev_lock(wdev);
err =rdev_start_ap(rdev, dev, ¶ms);
if (!err) {
This, and the corresponding code in nl80211_connect, really ought to check that the device is a DMG device and able to do this.
Perhaps this even needs a capability check, or do we assume that all devices/drivers will be able to do this (or should reject it?)
If you want to rely on drivers though you need to have (in this patch!) a small change to the existing driver to reject the operations if pbss==true since obviously it cannot be doing the right thing right now without further changes. That reject would then of course be removed again with the driver update.
johannes
Quoted 10 lines · Johannes Berg
Quoted 5 lines · Lior David
+ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
+ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
+ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
+ * a PCP instead of AP. Relevant for DMG networks only.I'm continually confused by this; is it possible for DMG devices to be a "real" AP rather than a PCP?
Yes, DMG devices can function as a full AP in addition to PCP.
Quoted 13 lines
net/wireless/nl80211.c static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · line 3469
Quoted 9 lines
net/wireless/nl80211.c +2
-0@@ -3461,6 +3462,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)return PTR_ERR (params.acl); } + params.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +wdev_lock (wdev); err =rdev_start_ap (rdev, dev, ¶ms);if (!err) {This, and the corresponding code in
nl80211_connect, really ought to check that the device is a DMG device and able to do this.
Quoted 3 lines
Perhaps this even needs a capability check, or do we assume that all devices/drivers will be able to do this (or should reject it?)
Certified 11ad devices must support PBSS, but in theory you can have 11ad drivers that do not support it. 11ac devices cannot support it and currently will just ignore this flag, so I think I will add a feature flag (something like NL80211_EXT_FEATURE_PBSS) and return an error if the driver does not support this feature.
Quoted 5 lines
If you want to rely on drivers though you need to have (in this patch!) a small change to the existing driver to reject the operations if pbss==true since obviously it cannot be doing the right thing right now without further changes. That reject would then of course be removed again with the driver update.
I have a patch for the wil6210 driver that uses this feature. Do you prefer that I add the wil6210 driver changes to this patch?
Thanks,
Lior
Johannes Berg
maintainerQuoted 2 lines
Yes, DMG devices can function as a full AP in addition to PCP.
Ok. I'll try to remember :)
Quoted 5 lines
Certified 11ad devices must support PBSS, but in theory you can have 11ad drivers that do not support it. 11ac devices cannot support it and currently will just ignore this flag, so I think I will add a feature flag (something like
NL80211_EXT_FEATURE_PBSS) and return an error if the driver does not support this feature.
I'd rather return an error when the device isn't 11ad.
If it's basically a requirement then I don't think we really need a feature flag, but can just have the driver reject the flag in the meantime. I do want to avoid having a situation where userspace specified PBSS and it gets ignored entirely though.
Quoted 2 lines
I have a patch for the wil6210 driver that uses this feature. Do you prefer that I add the wil6210 driver changes to this patch?
Great. No, I don't want bigger wil6210 changes in this patch, so I'd prefer you add a few lines to this patch that make wil6210 reject the configuration with PBSS, and then obviously in the real wil6210 patch remove that again.
johannes
PATCH v2 1/1 cfg80211: basic support for PBSS network type
PBSS (Personal Basic Service Set) is a new BSS type for DMG networks. It is similar to infrastructure BSS, having an AP-like entity called PCP (PBSS Control Point), but it has few differences. PBSS support is mandatory for 11ad devices.
Add support for PBSS by introducing a new PBSS flag attribute. The PBSS flag is used in the START_AP command to request starting a PCP instead of an AP, and in the CONNECT command to request connecting to a PCP instead of an AP.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 10 ++++++++++ include/net/cfg80211.h | 8 ++++++++ include/uapi/linux/nl80211.h | 6 ++++++ net/wireless/nl80211.c | 11 +++++++++++ net/wireless/sme.c | 9 ++++++--- 5 files changed, 41 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +10 -0
@@ -422,6 +422,11 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,if (sme->privacy && !rsn_eid)wil_info (wil,"WSC connection\n" ); +if (sme->pbss) { +wil_err (wil,"connect - PBSS not yet supported\n" ); +return -EOPNOTSUPP ; + } + bss =cfg80211_get_bss (wiphy, sme->channel, sme->bssid, sme->ssid, sme->ssid_len,IEEE80211_BSS_TYPE_ESS ,IEEE80211_PRIVACY_ANY );
@@ -870,6 +875,11 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,return -EINVAL ; } +if (info->pbss) { +wil_err (wil,"AP: PBSS not yet supported\n" ); +return -EOPNOTSUPP ; + } +switch (info->hidden_ssid) {case NL80211_HIDDEN_SSID_NOT_IN_USE : hidden_ssid =WMI_HIDDEN_SSID_DISABLED ;
include/net/cfg80211.h +8 -0
@@ -712,6 +712,8 @@ struct cfg80211_acl_data {* @p2p_opp_ps: P2P opportunistic PS * @acl: ACL configuration used by the drivers which has support for * MAC address based access control +* @pbss: If set, start as a PCP instead of AP. Relevant for DMG +* networks. */ struct cfg80211_ap_settings {struct cfg80211_chan_def chandef;
@@ -730,6 +732,7 @@ struct cfg80211_ap_settings {u8 p2p_ctwindow;bool p2p_opp_ps;const struct cfg80211_acl_data *acl; +bool pbss; };/**
@@ -1888,6 +1891,8 @@ struct cfg80211_ibss_params {* @ht_capa_mask: The bits of ht_capa which are to be used. * @vht_capa: VHT Capability overrides * @vht_capa_mask: The bits of vht_capa which are to be used. +* @pbss: if set, connect to a PCP instead of AP. Valid for DMG +* networks. */ struct cfg80211_connect_params {struct ieee80211_channel *channel;
@@ -1910,6 +1915,7 @@ struct cfg80211_connect_params {struct ieee80211_ht_cap ht_capa_mask;struct ieee80211_vht_cap vht_capa;struct ieee80211_vht_cap vht_capa_mask; +bool pbss; };/**
@@ -3489,6 +3495,7 @@ struct cfg80211_cached_keys;* registered for unexpected class 3 frames (AP mode) * @conn: (private) cfg80211 software SME connection state machine data * @connect_keys: (private) keys to set after connection is established +* @conn_bss_type: connecting/connected BSS type * @ibss_fixed: (private) IBSS is using fixed BSSID * @ibss_dfs_possible: (private) IBSS may change to a DFS channel * @event_list: (private) list for internal event processing
@@ -3519,6 +3526,7 @@ struct wireless_dev {u8 ssid_len, mesh_id_len, mesh_id_up_len;struct cfg80211_conn *conn;struct cfg80211_cached_keys *connect_keys; +enum ieee80211_bss_type conn_bss_type;struct list_head event_list;spinlock_t event_lock;
include/uapi/linux/nl80211.h +6 -0
@@ -1789,6 +1789,10 @@ enum nl80211_commands {* thus it must not specify the number of iterations, only the interval * between scans. The scan plans are executed sequentially. * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. +* @NL80211_ATTR_PBSS: flag attribute. If set it means operate +* in a PBSS. Specified in %NL80211_CMD_CONNECT to request +* connecting to a PCP, and in %NL80211_CMD_START_AP to start +* a PCP instead of AP. Relevant for DMG networks only. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2164,6 +2168,8 @@ enum nl80211_attrs {NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS ,NL80211_ATTR_SCHED_SCAN_PLANS , +NL80211_ATTR_PBSS , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +11 -0
@@ -401,6 +401,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 }, [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 }, [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG }, + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG }, };/* policy for the key attributes */
@@ -3461,6 +3462,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)return PTR_ERR (params.acl); } + params.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +if (params.pbss && !rdev->wiphy.bands[IEEE80211_BAND_60GHZ ]) +return -EOPNOTSUPP ; +wdev_lock (wdev); err =rdev_start_ap (rdev, dev, ¶ms);if (!err) {
@@ -7980,6 +7985,12 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) connect.flags |=ASSOC_REQ_USE_RRM ; } + connect.pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]); +if (connect.pbss && !rdev->wiphy.bands[IEEE80211_BAND_60GHZ ]) { +kzfree (connkeys); +return -EOPNOTSUPP ; + } +wdev_lock (dev->ieee80211_ptr); err =cfg80211_connect (rdev, dev, &connect, connkeys,NULL );wdev_unlock (dev->ieee80211_ptr);
net/wireless/sme.c +6 -3
@@ -264,7 +264,7 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) wdev->conn->params.bssid, wdev->conn->params.ssid, wdev->conn->params.ssid_len, -IEEE80211_BSS_TYPE_ESS , + wdev->conn_bss_type, IEEE80211_PRIVACY(wdev->conn->params.privacy));if (!bss)return NULL ;
@@ -687,7 +687,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,WARN_ON_ONCE (!wiphy_to_rdev (wdev->wiphy)->ops->connect); bss =cfg80211_get_bss (wdev->wiphy,NULL , bssid, wdev->ssid, wdev->ssid_len, -IEEE80211_BSS_TYPE_ESS , + wdev->conn_bss_type,IEEE80211_PRIVACY_ANY );if (bss)cfg80211_hold_bss (bss_from_pub (bss));
@@ -846,7 +846,7 @@ void cfg80211_roamed(struct net_device *dev, bss =cfg80211_get_bss (wdev->wiphy, channel, bssid, wdev->ssid, wdev->ssid_len, -IEEE80211_BSS_TYPE_ESS ,IEEE80211_PRIVACY_ANY ); + wdev->conn_bss_type,IEEE80211_PRIVACY_ANY );if (WARN_ON (!bss))return ;
@@ -1017,6 +1017,9 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,memcpy (wdev->ssid, connect->ssid, connect->ssid_len); wdev->ssid_len = connect->ssid_len; + wdev->conn_bss_type = connect->pbss ?IEEE80211_BSS_TYPE_PBSS : +IEEE80211_BSS_TYPE_ESS ; +if (!rdev->ops->connect) err =cfg80211_sme_connect (wdev, connect, prev_bssid);else
Signature · 1 line
1.8.2.1
Quoted 10 lines · Lior David
PBSS (Personal Basic Service Set) is a new BSS type for DMG networks. It is similar to infrastructure BSS, having an AP-like entity called PCP (PBSS Control Point), but it has few differences. PBSS support is mandatory for 11ad devices.
Add support for PBSS by introducing a new PBSS flag attribute. The PBSS flag is used in the
START_APcommand to request starting a PCP instead of an AP, and in the CONNECT command to request connecting to a PCP instead of an AP.
Applied.
johannes
Johannes Berg
maintainerQuoted 6 lines · Johannes Berg
Quoted 5 lines · Lior David
PBSS (Personal Basic Service Set) is a new BSS type for DMG networks. It is similar to infrastructure BSS, having an AP-like entity called PCP (PBSS Control Point), but it has few differences. PBSS support is mandatory for 11ad devices.
Quoted 7 lines
Quoted 5 lines
Add support for PBSS by introducing a new PBSS flag attribute. The PBSS flag is used in the
START_APcommand to request starting a PCP instead of an AP, and in the CONNECT command to request connecting to a PCP instead of an AP.Applied.
Actually, one more question: Why does the kernel have to know at *connect* time that it should be a PBSS? It could tell that from the scan results, by looking for PBSS if it can't find AP in there, no?
johannes
On 2/2/2016 5:10 PM, Johannes Berg wrote:
......
Quoted 4 lines
Actually, one more question: Why does the kernel have to know at *connect* time that it should be a PBSS? It could tell that from the scan results, by looking for PBSS if it can't find AP in there, no?
Yes it can be implemented that way. However we wanted user space to be able to specify exactly whether to connect to an AP or PCP. Since PBSS is a separate network type and we don't want clients to get an unexpected connection to a PCP. We also don't want to support roaming between a PCP and AP (it is not covered by the spec at this time)
Thanks,
Lior
Johannes Berg
maintainerQuoted 8 lines · Lior David
On 2/2/2016 5:10 PM, Johannes Berg wrote:
......Quoted 5 lines
Actually, one more question: Why does the kernel have to know at *connect* time that it should be a PBSS? It could tell that from the
scan results, by looking for PBSS if it can't find AP in there, no?
Quoted 10 lines
Yes it can be implemented that way. However we wanted user space to be able
to specify exactly whether to connect to an AP or PCP. Since PBSS is a separate
network type and we don't want clients to get an unexpected connection to
a PCP. We also don't want to support roaming between a PCP and AP (it is not
covered by the spec at this time)
ok, fair enough.
johannes