cfg80211: PBSS Basic Support
Subsystems (6)
v2 cover cfg80211: PBSS Basic Support
cfg80211: PBSS Basic Support
Dedy Lansky (2):
cfg80211: add bss_type and privacy arguments in cfg80211_get_bss()
cfg80211: add support for connecting to PBSS network type
drivers/net/wireless/ath/ath10k/mac.c | 3 +- drivers/net/wireless/ath/ath6kl/cfg80211.c | 9 +-- drivers/net/wireless/ath/wil6210/cfg80211.c | 2 +- drivers/net/wireless/cw1200/sta.c | 4 +- drivers/net/wireless/libertas/cfg.c | 6 +- drivers/net/wireless/mwifiex/cfg80211.c | 8 +-- include/net/cfg80211.h | 42 +++++++++++++- net/mac80211/ibss.c | 43 ++++----------- net/wireless/ibss.c | 2 +- net/wireless/mlme.c | 6 +- net/wireless/scan.c | 86 ++++++++++++++++++++++++++--- net/wireless/sme.c | 22 ++++---- net/wireless/trace.h | 24 ++++---- 13 files changed, 177 insertions(+), 80 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 cfg80211: add bss_type and privacy arguments in cfg80211_get_bss()
Background: 802.11ad adds new network type (PBSS) and changes "capability" field interpretation for the DMG (60G) band.
Same 2 bits that was interpreted as "ESS" and "IBSS", are re-used as 2-bit field with 3 valid values (and 1 reserved). Valid values are:
"IBSS", "PBSS" (new) and "AP".
New enum added into cfg80211.h - ieee80211_bss_type with valid network types. When searching for particular network type in cfg80211_get_bss, "capa_mask" and "capa_val" would not work due to difference described above. Thus, need to decouple network type (bss_type) and handle it separately.
Remaining bits in "capa_mask" and "capa_val" are used only for PRIVACY matching so replace those two with privacy enum.
--- drivers/net/wireless/ath/ath10k/mac.c | 3 +- drivers/net/wireless/ath/ath6kl/cfg80211.c | 9 +-- drivers/net/wireless/ath/wil6210/cfg80211.c | 2 +- drivers/net/wireless/cw1200/sta.c | 4 +- drivers/net/wireless/libertas/cfg.c | 6 +- drivers/net/wireless/mwifiex/cfg80211.c | 8 +-- include/net/cfg80211.h | 40 +++++++++++++- net/mac80211/ibss.c | 43 ++++----------- net/wireless/ibss.c | 2 +- net/wireless/mlme.c | 6 +- net/wireless/scan.c | 86 ++++++++++++++++++++++++++--- net/wireless/sme.c | 16 ++---- net/wireless/trace.h | 24 ++++---- 13 files changed, 169 insertions(+), 80 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +2 -1
@@ -1206,7 +1206,8 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,lockdep_assert_held (&ar->conf_mutex); bss =cfg80211_get_bss (ar->hw->wiphy, ar->hw->conf.chandef.chan, - info->bssid,NULL ,0 ,0 ,0 ); + info->bssid,NULL ,0 ,IEEE80211_BSS_TYPE_ANY , +IEEE80211_PRIVACY_ANY );if (bss) {const struct cfg80211_bss_ies *ies;
drivers/net/wireless/ath/ath6kl/cfg80211.c +5 -4
@@ -686,20 +686,21 @@ ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, {struct ath6kl *ar = vif->ar;struct cfg80211_bss *bss; -u16 cap_mask, cap_val; +u16 cap_val; +enum ieee80211_bss_type bss_type;u8 *ie;if (nw_type &ADHOC_NETWORK ) { - cap_mask =WLAN_CAPABILITY_IBSS ; cap_val =WLAN_CAPABILITY_IBSS ; + bss_type =IEEE80211_BSS_TYPE_IBSS ; }else { - cap_mask =WLAN_CAPABILITY_ESS ; cap_val =WLAN_CAPABILITY_ESS ; + bss_type =IEEE80211_BSS_TYPE_ESS ; } bss =cfg80211_get_bss (ar->wiphy, chan, bssid, vif->ssid, vif->ssid_len, - cap_mask, cap_val); + bss_type,IEEE80211_PRIVACY_ANY );if (bss ==NULL ) {/* * Since cfg80211 may not yet know about the BSS,
drivers/net/wireless/ath/wil6210/cfg80211.c +1 -1
@@ -370,7 +370,7 @@ static int wil_cfg80211_connect(struct wiphy *wiphy, bss =cfg80211_get_bss (wiphy, sme->channel, sme->bssid, sme->ssid, sme->ssid_len, -WLAN_CAPABILITY_ESS ,WLAN_CAPABILITY_ESS ); +IEEE80211_BSS_TYPE_ESS ,IEEE80211_PRIVACY_ANY );if (!bss) {wil_err (wil,"Unable to find BSS\n" );return -ENOENT ;
drivers/net/wireless/cw1200/sta.c +2 -2
@@ -1240,8 +1240,8 @@ static void cw1200_do_join(struct cw1200_common *priv) bssid = priv->vif->bss_conf.bssid; - bss =cfg80211_get_bss (priv->hw->wiphy, priv->channel, - bssid,NULL ,0 ,0 ,0 ); + bss =cfg80211_get_bss (priv->hw->wiphy, priv->channel, bssid,NULL ,0 , +IEEE80211_BSS_TYPE_ANY ,IEEE80211_PRIVACY_ANY );if (!bss && !conf->ibss_joined) {wsm_unlock_tx (priv);
drivers/net/wireless/libertas/cfg.c +3 -3
@@ -1356,8 +1356,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,/* Find the BSS we want using available scan results */ bss =cfg80211_get_bss (wiphy, sme->channel, sme->bssid, - sme->ssid, sme->ssid_len, -WLAN_CAPABILITY_ESS ,WLAN_CAPABILITY_ESS ); + sme->ssid, sme->ssid_len,IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY_ANY );if (!bss) {wiphy_err (wiphy,"assoc: bss %pM not in scan results\n" , sme->bssid);
@@ -2000,7 +2000,7 @@ static int lbs_join_ibss(struct wiphy *wiphy, struct net_device *dev,* bss list is populated already */ bss =cfg80211_get_bss (wiphy, params->chandef.chan, params->bssid, params->ssid, params->ssid_len, -WLAN_CAPABILITY_IBSS ,WLAN_CAPABILITY_IBSS ); +IEEE80211_BSS_TYPE_IBSS ,IEEE80211_PRIVACY_ANY );if (bss) { ret =lbs_ibss_join_existing (priv, params, bss);
drivers/net/wireless/mwifiex/cfg80211.c +4 -4
@@ -1954,13 +1954,13 @@ done:if (mode ==NL80211_IFTYPE_ADHOC ) bss =cfg80211_get_bss (priv->wdev.wiphy, channel, bssid, ssid, ssid_len, -WLAN_CAPABILITY_IBSS , -WLAN_CAPABILITY_IBSS ); +IEEE80211_BSS_TYPE_IBSS , +IEEE80211_PRIVACY_ANY );else bss =cfg80211_get_bss (priv->wdev.wiphy, channel, bssid, ssid, ssid_len, -WLAN_CAPABILITY_ESS , -WLAN_CAPABILITY_ESS ); +IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY_ANY );if (!bss) {if (is_scanning_required) {
include/net/cfg80211.h +38 -2
@@ -215,6 +215,40 @@ enum ieee80211_rate_flags { };/** +* enum ieee80211_bss_type - BSS type as defined in 80211ad #6.3.3.2 +* +* @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS +* @IEEE80211_BSS_TYPE_PBSS: Personal BSS +* @IEEE80211_BSS_TYPE_IBSS: Independent BSS +* @IEEE80211_BSS_TYPE_MBSS: Mesh BSS +* @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type +*/ +enum ieee80211_bss_type { +IEEE80211_BSS_TYPE_ESS , +IEEE80211_BSS_TYPE_PBSS , +IEEE80211_BSS_TYPE_IBSS , +IEEE80211_BSS_TYPE_MBSS , +IEEE80211_BSS_TYPE_ANY +}; + +/** +* enum ieee80211_privacy - privacy settings +* +* Privacy bit in capability field as defined in 80211 #8.4.1.4 +* +* @IEEE80211_PRIVACY_ON: privacy bit set +* @IEEE80211_PRIVACY_OFF: privacy bit clear +* @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting +*/ +enum ieee80211_privacy { +IEEE80211_PRIVACY_ON , +IEEE80211_PRIVACY_OFF , +IEEE80211_PRIVACY_ANY +}; + +#define IEEE80211_PRIVACY (x) (x ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) + +/** * struct ieee80211_rate - bitrate definition * * This structure describes a bitrate that an 802.11 PHY can
@@ -4012,14 +4046,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, size_t ssid_len, - u16 capa_mask, u16 capa_val); + enum ieee80211_bss_type bss_type, + enum ieee80211_privacy);static inline struct cfg80211_bss *cfg80211_get_ibss (struct wiphy *wiphy,struct ieee80211_channel *channel,const u8 *ssid,size_t ssid_len) {return cfg80211_get_bss (wiphy, channel,NULL , ssid, ssid_len, -WLAN_CAPABILITY_IBSS ,WLAN_CAPABILITY_IBSS ); +IEEE80211_BSS_TYPE_IBSS , +IEEE80211_PRIVACY_ANY ); }/**
net/mac80211/ibss.c +12 -31
100 lines not on this page · raw message
net/wireless/ibss.c +1 -1
@@ -30,7 +30,7 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,return ; bss =cfg80211_get_bss (wdev->wiphy, channel, bssid,NULL ,0 , -WLAN_CAPABILITY_IBSS ,WLAN_CAPABILITY_IBSS ); +IEEE80211_BSS_TYPE_IBSS ,IEEE80211_PRIVACY_ANY );if (WARN_ON (!bss))return ;
net/wireless/mlme.c +4 -2
@@ -229,7 +229,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,return -EALREADY ; req.bss =cfg80211_get_bss (&rdev->wiphy, chan, bssid, ssid, ssid_len, -WLAN_CAPABILITY_ESS ,WLAN_CAPABILITY_ESS ); +IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY_ANY );if (!req.bss)return -ENOENT ;
@@ -296,7 +297,8 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, rdev->wiphy.vht_capa_mod_mask); req->bss =cfg80211_get_bss (&rdev->wiphy, chan, bssid, ssid, ssid_len, -WLAN_CAPABILITY_ESS ,WLAN_CAPABILITY_ESS ); +IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY_ANY );if (!req->bss)return -ENOENT ;
net/wireless/scan.c +78 -8
130 lines not on this page · raw message
net/wireless/sme.c +6 -10
@@ -257,19 +257,15 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) {struct cfg80211_registered_device *rdev =wiphy_to_rdev (wdev->wiphy);struct cfg80211_bss *bss; -u16 capa =WLAN_CAPABILITY_ESS ;ASSERT_WDEV_LOCK (wdev); -if (wdev->conn->params.privacy) - capa |=WLAN_CAPABILITY_PRIVACY ; - bss =cfg80211_get_bss (wdev->wiphy, wdev->conn->params.channel, wdev->conn->params.bssid, wdev->conn->params.ssid, wdev->conn->params.ssid_len, -WLAN_CAPABILITY_ESS |WLAN_CAPABILITY_PRIVACY , - capa); +IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY (wdev->conn->params.privacy));if (!bss)return NULL ;
@@ -637,8 +633,8 @@ 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, -WLAN_CAPABILITY_ESS , -WLAN_CAPABILITY_ESS ); +IEEE80211_BSS_TYPE_ESS , +IEEE80211_PRIVACY_ANY );if (bss)cfg80211_hold_bss (bss_from_pub (bss)); }
@@ -795,8 +791,8 @@ void cfg80211_roamed(struct net_device *dev,struct cfg80211_bss *bss; bss =cfg80211_get_bss (wdev->wiphy, channel, bssid, wdev->ssid, - wdev->ssid_len,WLAN_CAPABILITY_ESS , -WLAN_CAPABILITY_ESS ); + wdev->ssid_len, +IEEE80211_BSS_TYPE_ESS ,IEEE80211_PRIVACY_ANY );if (WARN_ON (!bss))return ;
net/wireless/trace.h +13 -11
@@ -2636,28 +2636,30 @@ DEFINE_EVENT(wiphy_only_evt, cfg80211_sched_scan_stopped,TRACE_EVENT (cfg80211_get_bss, TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, size_t ssid_len, - u16 capa_mask, u16 capa_val), -TP_ARGS (wiphy, channel, bssid, ssid, ssid_len, capa_mask, capa_val), + enum ieee80211_bss_type bss_type, + enum ieee80211_privacy privacy), +TP_ARGS (wiphy, channel, bssid, ssid, ssid_len, bss_type, privacy),TP_STRUCT__entry ( WIPHY_ENTRY CHAN_ENTRY MAC_ENTRY(bssid) __dynamic_array(u8, ssid, ssid_len) - __field(u16, capa_mask) -__field (u16, capa_val) + __field(enum ieee80211_bss_type, bss_type) + __field(enum ieee80211_privacy, privacy) ),TP_fast_assign ( WIPHY_ASSIGN; CHAN_ASSIGN(channel); MAC_ASSIGN(bssid, bssid); memcpy(__get_dynamic_array(ssid), ssid, ssid_len); - __entry->capa_mask = capa_mask; - __entry->capa_val = capa_val; - ), -TP_printk (WIPHY_PR_FMT ", " CHAN_PR_FMT ", " MAC_PR_FMT ", buf: %#.2x, " -"capa_mask: %d, capa_val: %u" ,WIPHY_PR_ARG ,CHAN_PR_ARG , -MAC_PR_ARG (bssid), ((u8 *)__get_dynamic_array (ssid))[0 ], - __entry->capa_mask, __entry->capa_val) + __entry->bss_type = bss_type; + __entry->privacy = privacy; + ), +TP_printk (WIPHY_PR_FMT ", " CHAN_PR_FMT ", " MAC_PR_FMT +", buf: %#.2x, bss_type: %d, privacy: %d" , +WIPHY_PR_ARG ,CHAN_PR_ARG ,MAC_PR_ARG (bssid), + ((u8 *)__get_dynamic_array (ssid))[0 ], __entry->bss_type, + __entry->privacy) ); TRACE_EVENT(cfg80211_inform_bss_width_frame,
Signature · 1 line
1.9.1
Re: [PATCH v2 1/2] cfg80211: add bss_type and privacy arguments in cfg80211_get_bss()
Quoted 6 lines · Dedy Lansky
Background: 802.11ad adds new network type (PBSS) and changes "capability" field interpretation for the DMG (60G) band.
Same 2 bits that was interpreted as "ESS" and "IBSS", are re-used as 2-bit field with 3 valid values (and 1 reserved). Valid values are:
"IBSS", "PBSS" (new) and "AP".
Quoted 7 lines
New enum added into
cfg80211.h-ieee80211_bss_typewith valid network types. When searching for particular network type incfg80211_get_bss, "capa_mask" and "capa_val" would not work due to difference described above. Thus, need to decouple network type (bss_type) and handle it separately.Remaining bits in "
capa_mask" and "capa_val" are used only for PRIVACY matching so replace those two with privacy enum.
Applied, with minor changes.
johannes
PATCH v2 2/2 cfg80211: add support for connecting to PBSS network type
In reply to Dedy Lanskysme.c assumes BSS is of ESS type. With 802.11ad and the new PBSS network type, this is not always true.
On DMG (60GHz) band, P2P connection uses PBSS network. Detect P2P connection for DMG band and adjust BSS type to PBSS.
When connect starts (cfg80211_connect), store the bss type in new field in wdev (conn_bss_type). This field is used later (e.g. in __cfg80211_connect_result) when calling cfg80211_get_bss() for finding the BSS we are connecting to.
--- include/net/cfg80211.h | 2 ++ net/wireless/sme.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
include/net/cfg80211.h +2 -0
@@ -3426,6 +3426,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
@@ -3456,6 +3457,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;
net/wireless/sme.c +9 -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 ;
@@ -633,7 +633,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));
@@ -792,7 +792,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 ;
@@ -961,6 +961,12 @@ 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 =IEEE80211_BSS_TYPE_ESS ; +if (connect->channel && + connect->channel->band ==IEEE80211_BAND_60GHZ && + wdev->iftype ==NL80211_IFTYPE_P2P_CLIENT ) + wdev->conn_bss_type =IEEE80211_BSS_TYPE_PBSS ; +if (!rdev->ops->connect) err =cfg80211_sme_connect (wdev, connect, prev_bssid);else
Signature · 1 line
1.9.1
Johannes Berg
maintainerRe: [PATCH v2 2/2] cfg80211: add support for connecting to PBSS network type
net/wireless/sme.c int cfg80211_connect(struct cfg80211_registered_device *rdev, · line 968
Quoted 9 lines · Dedy Lansky
net/wireless/sme.c +5
-0@@ -961,6 +961,12 @@ 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 =IEEE80211_BSS_TYPE_ESS ; +if (connect->channel && + connect->channel->band ==IEEE80211_BAND_60GHZ && + wdev->iftype ==NL80211_IFTYPE_P2P_CLIENT ) + wdev->conn_bss_type =IEEE80211_BSS_TYPE_PBSS ;
This looks wrong, what if the driver did channel selection? Then all of this breaks.
Perhaps it'd be better to punt this to drivers by introducing cfg80211_connect_result_bss() along with the existing cfg80211_roamed_bss(), so drivers can just look up and pass the correct BSS entry.
johannes