Re: [PATCH V9 1/2] nl80211: add feature for BSS selection support
From: Eliad Peller <hidden>
Date: 2016-02-28 11:35:57
hi Arend, On Fri, Feb 26, 2016 at 10:59 PM, Arend van Spriel [off-list ref] wrote:
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.
[...]
+/**
+ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
+ *
+ * @band: band of BSS that must match for RSSI value adjustment.
+ * @delta: value used to adjust the RSSI value of matching BSS.
+ */
+struct nl80211_bss_select_rssi_adjust {
+ enum nl80211_band band;
+ __s8 delta;
+} __attribute__((packed));
+i think enum can't be considered as fixed-size field, so better use u8 or so.
quoted hunk ↗ jump to hunk
@@ -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; +
worth noting that the "-2" counts for the invalid enum value (at least it wasn't clear to me)
quoted hunk ↗ jump to hunk
@@ -7995,6 +8086,21 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) return -EOPNOTSUPP; } + /* only do bss selection when no BSSID is specified. */ + if (!connect.bssid && wiphy->bss_select_support && + info->attrs[NL80211_ATTR_BSS_SELECT]) {
you don't have to check wiphy->bss_select_support here - we actually want to fail if NL80211_ATTR_BSS_SELECT was given although the driver doesn't support it.
+ err = parse_bss_select(info->attrs[NL80211_ATTR_BSS_SELECT],
+ wiphy, &connect.bss_select);
+ if (err) {
+ kzfree(connkeys);
+ return err;
+ }
+ if (!(wiphy->bss_select_support & BIT(connect.bss_select.behaviour))) {(it will fail here instead) Eliad.