diff mbox

[v2,2/2] cfg80211: add support for connecting to PBSS network type

Message ID 1423403524-22540-3-git-send-email-dlansky@codeaurora.org (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Dedy Lansky Feb. 8, 2015, 1:52 p.m. UTC
sme.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.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
---
 include/net/cfg80211.h |  2 ++
 net/wireless/sme.c     | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

Comments

Johannes Berg March 3, 2015, 9:13 a.m. UTC | #1
On Sun, 2015-02-08 at 15:52 +0200, Dedy Lansky wrote:

> @@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index acf8f09..da346b1 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -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;
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index ea1da66..bf79bf2 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -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