diff mbox

cfg80211: Allow GO concurrent relaxation after BSS disconnetion

Message ID 1427720905-30872-1-git-send-email-emmanuel.grumbach@intel.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Emmanuel Grumbach March 30, 2015, 1:08 p.m. UTC
From: Avraham Stern <avraham.stern@intel.com>

If P2P GO was allowed on a channel because of the GO concurrent
relaxation and additional station interface associated to an AP on
the same channel or the same UNII band, and the station interface
disconnected from the AP, allow the P2P GO to stay on that channel
unless the channel is marked as indoor only and the device is not
operating in an indoor environment.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/wireless/chan.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

Comments

Johannes Berg April 24, 2015, 10:32 a.m. UTC | #1
On Mon, 2015-03-30 at 16:08 +0300, Emmanuel Grumbach wrote:
> From: Avraham Stern <avraham.stern@intel.com>
> 
> If P2P GO was allowed on a channel because of the GO concurrent
> relaxation and additional station interface associated to an AP on
> the same channel or the same UNII band, and the station interface
> disconnected from the AP, allow the P2P GO to stay on that channel
> unless the channel is marked as indoor only and the device is not
> operating in an indoor environment.

I'm not really sure what to do with this - this neither explains why
this is needed nor why it's actually allowed to do it.

> +               if (wdev->iftype == NL80211_IFTYPE_STATION &&
> +                   netif_running(wdev->netdev) && wdev->current_bss)

having a current_bss implies running

> +               if (wdev->iftype == NL80211_IFTYPE_P2P_GO &&
> wdev->netdev &&
> +                   netif_running(wdev->netdev) &&
> wdev->beacon_interval &&
> +                   !(chan->flags & IEEE80211_CHAN_INDOOR_ONLY))
> +                       other_chan = wdev->chandef.chan;

that "wdev->netdev" check is also useless, iftype==P2P_GO must have a
netdev.
netif_running() is probably also useless since wdev->beacon_interval
implies it.

This patch also doesn't really do exactly what you said it does - it
doesn't just allow that GO to be running but it also allows more to be
started up there... Not sure if that's desired, but it should be
documented (again, with the reasons for it)

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/net/wireless/chan.c b/net/wireless/chan.c
index 7aaf741..fc3ec42 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -709,7 +709,7 @@  EXPORT_SYMBOL(cfg80211_chandef_usable);
 static bool cfg80211_go_permissive_chan(struct cfg80211_registered_device *rdev,
 					struct ieee80211_channel *chan)
 {
-	struct wireless_dev *wdev_iter;
+	struct wireless_dev *wdev;
 	struct wiphy *wiphy = wiphy_idx_to_wiphy(rdev->wiphy_idx);
 
 	ASSERT_RTNL();
@@ -732,18 +732,27 @@  static bool cfg80211_go_permissive_chan(struct cfg80211_registered_device *rdev,
 	 * and thus fail the GO instantiation, consider only the interfaces of
 	 * the current registered device.
 	 */
-	list_for_each_entry(wdev_iter, &rdev->wdev_list, list) {
+	list_for_each_entry(wdev, &rdev->wdev_list, list) {
 		struct ieee80211_channel *other_chan = NULL;
 		int r1, r2;
 
-		if (wdev_iter->iftype != NL80211_IFTYPE_STATION ||
-		    !netif_running(wdev_iter->netdev))
-			continue;
-
-		wdev_lock(wdev_iter);
-		if (wdev_iter->current_bss)
-			other_chan = wdev_iter->current_bss->pub.channel;
-		wdev_unlock(wdev_iter);
+		wdev_lock(wdev);
+		if (wdev->iftype == NL80211_IFTYPE_STATION &&
+		    netif_running(wdev->netdev) && wdev->current_bss)
+			other_chan = wdev->current_bss->pub.channel;
+
+		/*
+		 * If a GO already operates on the same GO_CONCURRENT channel,
+		 * this one (maybe the same one) can beacon as well. We allow
+		 * the operation even if the station we relied on with
+		 * GO_CONCURRENT is disconnected now. But then we must make sure
+		 * we're not outdoor on an indoor-only channel.
+		 */
+		if (wdev->iftype == NL80211_IFTYPE_P2P_GO && wdev->netdev &&
+		    netif_running(wdev->netdev) && wdev->beacon_interval &&
+		    !(chan->flags & IEEE80211_CHAN_INDOOR_ONLY))
+			other_chan = wdev->chandef.chan;
+		wdev_unlock(wdev);
 
 		if (!other_chan)
 			continue;