summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 22:44:47 +0300
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 12:44:42 +0300
commit65318680c97cca15e3678148b3a5acaa33e991ec (patch)
tree6a8a0e994ff76c44d6f0d6859885f6bd468f8f5e
parentedea8f7c75ec6c238130bd7e74d9f6f4c26e97b0 (diff)
downloadlinux-65318680c97cca15e3678148b3a5acaa33e991ec.tar.xz
ieee802154: add iftypes capability
This patch adds capability flags for supported interface types. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/cfg802154.h2
-rw-r--r--net/ieee802154/nl802154.c3
-rw-r--r--net/mac802154/main.c6
3 files changed, 9 insertions, 2 deletions
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
index a12c6c5247e9..11bbf17ad865 100644
--- a/include/net/cfg802154.h
+++ b/include/net/cfg802154.h
@@ -80,7 +80,7 @@ wpan_phy_supported_bool(bool b, enum nl802154_supported_bool_states st)
struct wpan_phy_supported {
u32 channels[IEEE802154_MAX_PAGE + 1],
- cca_modes, cca_opts;
+ cca_modes, cca_opts, iftypes;
enum nl802154_supported_bool_states lbt;
u8 min_minbe, max_minbe, min_maxbe, max_maxbe,
min_csma_backoffs, max_csma_backoffs;
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 40fb0be009b2..3afb20e43ff8 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -579,7 +579,8 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL802154_ATTR_IFTYPE]) {
type = nla_get_u32(info->attrs[NL802154_ATTR_IFTYPE]);
- if (type > NL802154_IFTYPE_MAX)
+ if (type > NL802154_IFTYPE_MAX ||
+ !(rdev->wpan_phy.supported.iftypes & BIT(type)))
return -EINVAL;
}
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index ddcd6ff8d39c..356b346e1ee8 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -116,6 +116,9 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops)
phy->supported.max_csma_backoffs = 5;
phy->supported.lbt = NL802154_SUPPORTED_BOOL_FALSE;
+ /* always supported */
+ phy->supported.iftypes = BIT(NL802154_IFTYPE_NODE);
+
return &local->hw;
}
EXPORT_SYMBOL(ieee802154_alloc_hw);
@@ -181,6 +184,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
local->phy->supported.max_frame_retries = -1;
}
+ if (hw->flags & IEEE802154_HW_PROMISCUOUS)
+ local->phy->supported.iftypes |= BIT(NL802154_IFTYPE_MONITOR);
+
rc = wpan_phy_register(local->phy);
if (rc < 0)
goto out_wq;