Skip to contentSkip to conversation

nl80211: add feature for BSS selection support

PATCH Superseded Arend van Spriel 2 participants 2 messages Feb 24, 2016 802.11 (including cfg80211/NL80211)

v8 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 nl80211: add feature for BSS selection support

Introducing a new feature that the driver can use to indicate the driver/firmware supports configuration of BSS selection criteria upon CONNECT command. This can be useful when multiple BSS-es are found belonging to the same ESS, ie. Infra-BSS with same SSID. The criteria can then be used to offload selection of a preferred BSS.

---
V7:
- add validatioin using nla_ok().
V8:
- use IEEE80211_NUM_BANDS.
- add NESTED policy for NL80211_ATTR_BSS_SELECT.
- add braces in for loop.

---
 include/net/cfg80211.h       |  34 ++++++++++++++
 include/uapi/linux/nl80211.h |  51 +++++++++++++++++++++
 net/wireless/core.c          |   4 ++
 net/wireless/nl80211.c       | 106 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 195 insertions(+)
include/net/cfg80211.h +34 -0
index 9e1b24c..1dfb890 100644
@@ -1857,6 +1857,33 @@ struct cfg80211_ibss_params {
 };
 
 /**
+ * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
+ *
+ * @band: band of BSS which should match for RSSI level adjustment.
+ * @delta: value of RSSI level adjustment.
+ */
+struct cfg80211_bss_select_adjust {
+	enum nl80211_band band;
+	s8 delta;
+};
+
+/**
+ * struct cfg80211_bss_selection - connection parameters for BSS selection.
+ *
+ * @behaviour: requested BSS selection behaviour.
+ * @param: parameters for requestion behaviour.
+ * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
+ * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
+ */
+struct cfg80211_bss_selection {
+	enum nl80211_bss_select_attr behaviour;
+	union {
+		enum nl80211_band band_pref;
+		struct cfg80211_bss_select_adjust adjust;
+	} param;
+};
+
+/**
  * struct cfg80211_connect_params - Connection parameters
  *
  * This structure provides information needed to complete IEEE 802.11
@@ -1893,6 +1920,7 @@ struct cfg80211_ibss_params {
  * @vht_capa_mask: The bits of vht_capa which are to be used.
  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
  *	networks.
+ * @bss_select: criteria to be used for BSS selection.
  */
 struct cfg80211_connect_params {
 	struct ieee80211_channel *channel;
@@ -1916,6 +1944,7 @@ struct cfg80211_connect_params {
 	struct ieee80211_vht_cap vht_capa;
 	struct ieee80211_vht_cap vht_capa_mask;
 	bool pbss;
+	struct cfg80211_bss_selection bss_select;
 };
 
 /**
@@ -3184,6 +3213,9 @@ struct wiphy_vendor_command {
  *	low rssi when a frame is heard on different channel, then it should set
  *	this variable to the maximal offset for which it can compensate.
  *	This value should be set in MHz.
+ * @bss_select_support: bitmask indicating the BSS selection criteria supported
+ *	by the driver in the .connect() callback. The bit position maps to the
+ *	attribute indices defined in &enum nl80211_bss_select_attr.
  */
 struct wiphy {
 	/* assign these fields before you register the wiphy */
@@ -3306,6 +3338,8 @@ struct wiphy {
 	u8 max_num_csa_counters;
 	u8 max_adj_channel_rssi_comp;
 
+	u32 bss_select_support;
+
 	char priv[0] __aligned(NETDEV_ALIGN);
 };
 
include/uapi/linux/nl80211.h +51 -0

67 lines not on this page · raw message

net/wireless/core.c +4 -0
index 3a9c41b..1177ec6 100644
@@ -626,6 +626,10 @@ int wiphy_register(struct wiphy *wiphy)
 		     !rdev->ops->set_mac_acl)))
 		return -EINVAL;
 
+	if (WARN_ON(wiphy->bss_select_support &&
+		    (wiphy->bss_select_support & ~(BIT(__NL80211_BSS_SELECT_ATTR_AFTER_LAST) - 2))))
+		return -EINVAL;
+
 	if (wiphy->addresses)
 		memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN);
 
net/wireless/nl80211.c +106 -0

136 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
reproduce:

Hi Arend,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20160223]
[cannot apply to v4.5-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Arend-van-Spriel/nl80211-add-feature-for-BSS-selection-support/20160224-203113
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-x003-201608 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

net/wireless/nl80211.c: In function 'is_band_valid':

>> net/wireless/nl80211.c:5791:11: warning: comparison between 'enum nl80211_band' and 'enum ieee80211_band' [-Wenum-compare]
     return b < IEEE80211_NUM_BANDS && wiphy->bands[b];
              ^

vim +5791 net/wireless/nl80211.c

5775 * and don't require drivers to check that the
5776 * channel list they get isn't longer than what
5777 * they can scan, as long as they can scan all
5778 * the channels they registered at once.
5779 */
5780 nla_for_each_nested(attr2, freqs, tmp2)
5781 if (attr1 != attr2 &&
5782 nla_get_u32(attr1) == nla_get_u32(attr2))
5783 return 0;
5784 }
5785
5786 return n_channels;
5787 }
5788
5789 static bool is_band_valid(struct wiphy *wiphy, enum nl80211_band b)
5790 {

> 5791		return b < IEEE80211_NUM_BANDS && wiphy->bands[b];

5792 }
5793
5794 static int parse_bss_select(struct nlattr *nla, struct wiphy *wiphy,
5795 struct cfg80211_bss_selection *bss_select)
5796 {
5797 struct nlattr *attr[NL80211_BSS_SELECT_ATTR_MAX + 1];
5798 struct nlattr *nest;
5799 int err;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation