From patchwork Sun Feb 8 13:52:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dedy Lansky X-Patchwork-Id: 5797501 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7D29C9F3CA for ; Sun, 8 Feb 2015 13:53:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8610820166 for ; Sun, 8 Feb 2015 13:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74B0620173 for ; Sun, 8 Feb 2015 13:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753129AbbBHNx2 (ORCPT ); Sun, 8 Feb 2015 08:53:28 -0500 Received: from smtp.codeaurora.org ([198.145.11.231]:52783 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753012AbbBHNx1 (ORCPT ); Sun, 8 Feb 2015 08:53:27 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 24DEB13FF5C; Sun, 8 Feb 2015 13:53:27 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 181C513FF62; Sun, 8 Feb 2015 13:53:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lx-wigig-78.mea.qualcomm.com (unknown [185.23.60.4]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dlansky@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6E40213FF5C; Sun, 8 Feb 2015 13:53:25 +0000 (UTC) From: Dedy Lansky To: Johannes Berg Cc: Dedy Lansky , linux-wireless@vger.kernel.org, Vladimir Kondratiev Subject: [PATCH v2 2/2] cfg80211: add support for connecting to PBSS network type Date: Sun, 8 Feb 2015 15:52:04 +0200 Message-Id: <1423403524-22540-3-git-send-email-dlansky@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423403524-22540-1-git-send-email-dlansky@codeaurora.org> References: <1423403524-22540-1-git-send-email-dlansky@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- include/net/cfg80211.h | 2 ++ net/wireless/sme.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) 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