summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKanchanapally, Vidyullatha <vkanchan@qti.qualcomm.com>2016-05-16 10:41:04 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-07-28 22:24:57 -0700
commit33ec44fb7e4c7b7375adab1f812df958051f021e (patch)
tree786da413742193dfadff0330e615ebe564925451 /net
parent956d9b1ab3db6c7fef95964f7f6be8860433b74e (diff)
cfg80211: Advertise extended capabilities per interface type to userspace
The driver extended capabilities may differ for different interface types which the userspace needs to know (for example the fine timing measurement initiator and responder bits might differ for a station and AP). Add a new nl80211 attribute to provide extended capabilities per interface type to userspace. Signed-off-by: Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com> Reviewed-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Git-commit: 019ae3a918811715192b22c400ac78d54acc26a9 Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git CRs-fixed: 1030694 Change-Id: I816b21d8433aea9407a14a8c8a5098701ee53b8c [pkushwah@codeaurora.org: backport to 4.4-This commit includes the changes from following commits in include/uapi/linux/nl80211.h to compile for msm-4.4. 38de03d2a28925b489c11546804e2f5418cc17a4 : nl80211: add feature for BSS selection support. 17b942478643c5a90c06d978479bd326040bfa19 : cfg80211: allow userspace to specify client P2P PS support. 9b95fe59b18bcc891a6c60ae11d725c9c679574b : nl80211: add missing kerneldoc for new *_PAD attributes. 2dad624e6dd65c6048a9bbe0e16559fce182c87c : wireless: use nla_put_u64_64bit().] Signed-off-by: Purushottam Kushwaha <pkushwah@codeaurora.org>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/core.c30
-rw-r--r--net/wireless/nl80211.c43
2 files changed, 72 insertions, 1 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 7426ab13cede..6d3402434a63 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -730,6 +730,36 @@ int wiphy_register(struct wiphy *wiphy)
nl80211_send_reg_change_event(&request);
}
+ /* Check that nobody globally advertises any capabilities they do not
+ * advertise on all possible interface types.
+ */
+ if (wiphy->extended_capabilities_len &&
+ wiphy->num_iftype_ext_capab &&
+ wiphy->iftype_ext_capab) {
+ u8 supported_on_all, j;
+ const struct wiphy_iftype_ext_capab *capab;
+
+ capab = wiphy->iftype_ext_capab;
+ for (j = 0; j < wiphy->extended_capabilities_len; j++) {
+ if (capab[0].extended_capabilities_len > j)
+ supported_on_all =
+ capab[0].extended_capabilities[j];
+ else
+ supported_on_all = 0x00;
+ for (i = 1; i < wiphy->num_iftype_ext_capab; i++) {
+ if (j >= capab[i].extended_capabilities_len) {
+ supported_on_all = 0x00;
+ break;
+ }
+ supported_on_all &=
+ capab[i].extended_capabilities[j];
+ }
+ if (WARN_ON(wiphy->extended_capabilities[j] &
+ ~supported_on_all))
+ break;
+ }
+ }
+
rdev->wiphy.registered = true;
rtnl_unlock();
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ad4b729262fd..30f54d1fc841 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1253,7 +1253,7 @@ nl80211_send_mgmt_stypes(struct sk_buff *msg,
struct nl80211_dump_wiphy_state {
s64 filter_wiphy;
long start;
- long split_start, band_start, chan_start;
+ long split_start, band_start, chan_start, capa_start;
bool split;
};
@@ -1731,6 +1731,47 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
rdev->wiphy.ext_features))
goto nla_put_failure;
+ state->split_start++;
+ break;
+ case 13:
+ if (rdev->wiphy.num_iftype_ext_capab &&
+ rdev->wiphy.iftype_ext_capab) {
+ struct nlattr *nested_ext_capab, *nested;
+
+ nested = nla_nest_start(msg,
+ NL80211_ATTR_IFTYPE_EXT_CAPA);
+ if (!nested)
+ goto nla_put_failure;
+
+ for (i = state->capa_start;
+ i < rdev->wiphy.num_iftype_ext_capab; i++) {
+ const struct wiphy_iftype_ext_capab *capab;
+
+ capab = &rdev->wiphy.iftype_ext_capab[i];
+
+ nested_ext_capab = nla_nest_start(msg, i);
+ if (!nested_ext_capab ||
+ nla_put_u32(msg, NL80211_ATTR_IFTYPE,
+ capab->iftype) ||
+ nla_put(msg, NL80211_ATTR_EXT_CAPA,
+ capab->extended_capabilities_len,
+ capab->extended_capabilities) ||
+ nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
+ capab->extended_capabilities_len,
+ capab->extended_capabilities_mask))
+ goto nla_put_failure;
+
+ nla_nest_end(msg, nested_ext_capab);
+ if (state->split)
+ break;
+ }
+ nla_nest_end(msg, nested);
+ if (i < rdev->wiphy.num_iftype_ext_capab) {
+ state->capa_start = i + 1;
+ break;
+ }
+ }
+
/* done */
state->split_start = 0;
break;