Skip to contentSkip to conversation

cfg80211: Add support for ACS offloading

PATCH In review Kyeyoon Park 3 participants 6 messages Oct 3, 2014 – Oct 9, 2014 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: Add support for ACS offloading

From: Peng Xu <[email protected]>

Add support for offloading ACS functionality to the driver. A new feature flag NL80211_FEATURE_AP_ACS_OFFLOAD was added to support ACS (Automatic Channel Selection) offload functionality. This flag allows the driver to advertise its ACS capability.

When hostapd starts with the "channel" configuration set to 0, it will check whether the driver has the capability of doing the ACS on its own. If the driver has such capability, then the channel selection will be done in the driver. The kernel will skip the channel information validation since it would initially be NULL when this feature is enabled. After the channel is selected by the driver, a channel change event will be sent from the driver to the kernel which updates the channel information it maintains. This event is in turn sent to hostapd and the channel information in hostapd will get updated as well.

---
 include/uapi/linux/nl80211.h |  3 +++
 net/wireless/nl80211.c       | 15 +++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
include/uapi/linux/nl80211.h +3 -0
index 4b28dc0..73c0950 100644
@@ -4042,6 +4042,8 @@ enum nl80211_ap_sme_features {
  *	multiplexing powersave, ie. can turn off all but one chain
  *	and then wake the rest up as required after, for example,
  *	rts/cts handshake.
+ * @NL80211_FEATURE_AP_ACS_OFFLOAD: This driver supports ACS (Automatic Channel
+ *     Selection) during AP starting time.
  */
 enum nl80211_feature_flags {
 	NL80211_FEATURE_SK_TX_STATUS			= 1 << 0,
@@ -4070,6 +4072,7 @@ enum nl80211_feature_flags {
 	NL80211_FEATURE_ACKTO_ESTIMATION		= 1 << 23,
 	NL80211_FEATURE_STATIC_SMPS			= 1 << 24,
 	NL80211_FEATURE_DYNAMIC_SMPS			= 1 << 25,
+	NL80211_FEATURE_AP_ACS_OFFLOAD			= 1 << 26,
 };
 
 /**
net/wireless/nl80211.c +11 -4
index cb9f5a4..846860d 100644
@@ -1990,7 +1990,8 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
 			}
 
 			/* Only allow dynamic channel width changes */
-			if (chandef.chan != wdev->preset_chandef.chan) {
+			if ((wdev->preset_chandef.chan != NULL) &&
+			    chandef.chan != wdev->preset_chandef.chan) {
 				result = -EBUSY;
 				break;
 			}
@@ -3220,6 +3221,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 	struct net_device *dev = info->user_ptr[1];
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct cfg80211_ap_settings params;
+	bool acs_offload = false;
 	int err;
 
 	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
@@ -3333,10 +3335,15 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 			return err;
 	} else if (wdev->preset_chandef.chan) {
 		params.chandef = wdev->preset_chandef;
-	} else if (!nl80211_get_ap_channel(rdev, &params))
-		return -EINVAL;
+	} else if (!nl80211_get_ap_channel(rdev, &params)) {
+		if (rdev->wiphy.features & NL80211_FEATURE_AP_ACS_OFFLOAD)
+			acs_offload = true;
+		else
+			return -EINVAL;
+	}
 
-	if (!cfg80211_reg_can_beacon(&rdev->wiphy, &params.chandef,
+	if (!acs_offload &&
+	    !cfg80211_reg_can_beacon(&rdev->wiphy, &params.chandef,
 				     wdev->iftype))
 		return -EINVAL;
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 7 lines · Kyeyoon Park

From: Peng Xu <[email protected]>

Add support for offloading ACS functionality to the driver. A new feature flag NL80211_FEATURE_AP_ACS_OFFLOAD was added to support ACS (Automatic Channel Selection) offload functionality. This flag allows the driver to advertise its ACS capability.

Quoted 9 lines

When hostapd starts with the "channel" configuration set to 0, it will check whether the driver has the capability of doing the ACS on its own. If the driver has such capability, then the channel selection will be done in the driver. The kernel will skip the channel information validation since it would initially be NULL when this feature is enabled. After the channel is selected by the driver, a channel change event will be sent from the driver to the kernel which updates the channel information it maintains. This event is in turn sent to hostapd and the channel information in hostapd will get updated as well.

Is this design required? That seems a bit strange because you'd start the AP with ... invalid beacon information? Invalid probe response, and all that? Even an invalid channel reported to other userspace.

I'd much prefer offloading this as a separate operation, with the device reporting back the best channel (configuration) to use, and hostapd then using that to start up its operation.

johannes

#2 lore raw

SGkgSm9oYW5uZXMsDQpUaGlzIGNoYW5nZSBpcyBvcmlnaW5hdGVkIGZyb20gYSBwcm9ibGVtIGNh dXNlZCBieSBPQlNTIHNjYW4gYW5kIEFDUyBmZWF0dXJlIGluIHRoZSBkcml2ZXIuIFdoZW4gU0FQ IGlzIHN0YXJ0ZWQsIGhvc3RhcGQgd2lsbCBkbyBhbiBPQlNTIHNjYW4gYmFzZWQgb24gdGhlIGNo YW5uZWwgc2V0dGluZyBpbiBob3N0YXBkLmNvbmYsIGlmIHRoZSB3bGFuIGRyaXZlciBoYXMgdGhl IEFDUyBjYXBhYmlsaXR5LCBpdCBtYXkgY2hvb3NlIGEgZGlmZmVyZW50IGNoYW5uZWwuIEV2ZW4g aXQgbm90aWZpZXMgaG9zdGFwZCBhYm91dCB0aGUgY2hhbm5lbCBzZWxlY3Rpb24sIHRoZSBPQlNT IHNjYW4gcmVzdWx0ICBtYXkgYmVjb21lIGludmFsaWQgaWYgYSBkaWZmZXJlbnQgY2hhbm5lbCBp cyBzZWxlY3RlZCBhbmQgU0FQIG1heSBlbmQgdXAgb3BlcmF0aW5nIGluIG5vdCBkZXNpcmVkIG1v ZGUuDQpUaGlzIGNoYW5nZSB3aWxsIGFsbG93IHRoZSB3bGFuIGRyaXZlciBkbyB0aGUgQUNTIGFu ZCBkZWNpZGUgYSBjaGFubmVsLCBvbmNlIGhvc3RhcGQgaXMgbm90aWZpZWQsIGl0IGNhbiB0aGVu IGRvIE9CU1Mgc2NhbiB1c2luZyB0aGF0IGNoYW5uZWwuIEFDUyBvcGVyYXRpb24gaXMgZG9uZSBk dXJpbmcgU0FQIHN0YXJ0aW5nIHVwLCBiZWFjb24gaXMgc2VudCBhZnRlciBjaGFubmVsIGlzIHNl bGVjdGVkIGJ5IGRyaXZlci4gDQoNClRoYW5rcywNClBlbmcNC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0aGUgZGV2aWNlIHJlcG9ydGluZyBiYWNrIHRoZSBiZXN0IGNoYW5uZWwgKGNv bmZpZ3VyYXRpb24pIHRvIHVzZSwgYW5kIGhvc3RhcGQgdGhlbiB1c2luZyB0aGF0IHRvIHN0YXJ0 IHVwIGl0cyBvcGVyYXRpb24uDQoNCmpvaGFubmVzDQoNCg0K

maintainer
#3 lore raw
Quoted 11 lines · Peng

This change is originated from a problem caused by OBSS scan and ACS feature in the driver. When SAP is started, hostapd will do an OBSS scan based on the channel setting in hostapd.conf, if the wlan driver has the ACS capability, it may choose a different channel. Even it notifies hostapd about the channel selection, the OBSS scan result may become invalid if a different channel is selected and SAP may end up operating in not desired mode.
This change will allow the wlan driver do the ACS and decide a channel, once hostapd is notified, it can then do OBSS scan using that channel. ACS operation is done during SAP starting up, beacon is sent after channel is selected by driver.

All of this may be true, but I was asking why this has to be part of START_AP, and that's not answering that question.

johannes

#4 lore raw

DQpIaSBKb2hhbm5lcywNClRoaXMgaXMgYmVjYXVzZSB0aGF0IE9CU1Mgc2NhbiBoYXBwZW5zIGJl Zm9yZSBzdGFydGluZyBBUCBhbmQgQUNTIGhhcHBlbnMgd2l0aGluIHN0YXJ0X2FwLg0KDQpUaGFu a3MsDQpQZW5nDQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBKb2hhbm5lcyBC ZXJnIFttYWlsdG86am9oYW5uZXNAc2lwc29sdXRpb25zLm5ldF0gDQpTZW50OiBUaHVyc2RheSwg T2N0b2JlciAwOSwgMjAxNCAxMTo0MSBBTQ0KVG86IFh1LCBQZW5nDQpDYzogUGFyaywgS3lleW9v bjsgY2ZnODAyMTFtYWM4MDIxMTsgbGludXgtd2lyZWxlc3NAdmdlci5rZXJuZWwub3JnDQpTdWJq ZWN0OiBSZTogW1BBVENIXSBjZmc4MDIxMTogQWRkIHN1cHBvcnQgZm9yIEFDUyBvZmZsb2FkaW5n DQoNCk9uIFRodSwgMjAxNC0xMC0wOSB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gYmUgdHJ1ZSwgYnV0IEkgd2FzIGFza2luZyB3aHkgdGhpcyBoYXMgdG8gYmUgcGFydCBv ZiBTVEFSVF9BUCwgYW5kIHRoYXQncyBub3QgYW5zd2VyaW5nIHRoYXQgcXVlc3Rpb24uDQoNCmpv aGFubmVzDQoNCg==

maintainer
#5 lore raw
Quoted 3 lines · Peng

Hi Johannes,
This is because that OBSS scan happens before starting AP and ACS happens within start_ap.

So you're saying your patch doesn't work?

And it would actually be better to do what I suggested; namely:
1) ask the device to do ACS
2) do OBSS scan
3) start AP

I can also ask another way: please explain the design decisions in your patch.

johannes