Commit 65318680 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

ieee802154: add iftypes capability

This patch adds capability flags for supported interface types.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent edea8f7c
...@@ -80,7 +80,7 @@ wpan_phy_supported_bool(bool b, enum nl802154_supported_bool_states st) ...@@ -80,7 +80,7 @@ wpan_phy_supported_bool(bool b, enum nl802154_supported_bool_states st)
struct wpan_phy_supported { struct wpan_phy_supported {
u32 channels[IEEE802154_MAX_PAGE + 1], u32 channels[IEEE802154_MAX_PAGE + 1],
cca_modes, cca_opts; cca_modes, cca_opts, iftypes;
enum nl802154_supported_bool_states lbt; enum nl802154_supported_bool_states lbt;
u8 min_minbe, max_minbe, min_maxbe, max_maxbe, u8 min_minbe, max_minbe, min_maxbe, max_maxbe,
min_csma_backoffs, max_csma_backoffs; min_csma_backoffs, max_csma_backoffs;
......
...@@ -579,7 +579,8 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info) ...@@ -579,7 +579,8 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL802154_ATTR_IFTYPE]) { if (info->attrs[NL802154_ATTR_IFTYPE]) {
type = nla_get_u32(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; return -EINVAL;
} }
......
...@@ -116,6 +116,9 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops) ...@@ -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.max_csma_backoffs = 5;
phy->supported.lbt = NL802154_SUPPORTED_BOOL_FALSE; phy->supported.lbt = NL802154_SUPPORTED_BOOL_FALSE;
/* always supported */
phy->supported.iftypes = BIT(NL802154_IFTYPE_NODE);
return &local->hw; return &local->hw;
} }
EXPORT_SYMBOL(ieee802154_alloc_hw); EXPORT_SYMBOL(ieee802154_alloc_hw);
...@@ -181,6 +184,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) ...@@ -181,6 +184,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
local->phy->supported.max_frame_retries = -1; 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); rc = wpan_phy_register(local->phy);
if (rc < 0) if (rc < 0)
goto out_wq; goto out_wq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment