diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-12-10 15:33:13 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-12-19 00:19:23 +0100 |
commit | ba2a9506a76450568cbc0d51626d94cf8528c0c7 (patch) | |
tree | 71f548777d889121041d978c7806db22b04235d1 /net/mac802154/cfg.c | |
parent | 7fe9a3882bb37195c41ab125a0f2852398d2646a (diff) |
nl802154: introduce support for cca settings
This patch adds support for setting cca parameters via nl802154.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/cfg.c')
-rw-r--r-- | net/mac802154/cfg.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c index c035708ada16..7d31da503dcf 100644 --- a/net/mac802154/cfg.c +++ b/net/mac802154/cfg.c @@ -87,6 +87,26 @@ ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) } static int +ieee802154_set_cca_mode(struct wpan_phy *wpan_phy, + const struct wpan_phy_cca *cca) +{ + struct ieee802154_local *local = wpan_phy_priv(wpan_phy); + int ret; + + ASSERT_RTNL(); + + /* check if phy support this setting */ + if (!(local->hw.flags & IEEE802154_HW_CCA_MODE)) + return -EOPNOTSUPP; + + ret = drv_set_cca_mode(local, cca); + if (!ret) + wpan_phy->cca = *cca; + + return ret; +} + +static int ieee802154_set_pan_id(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, __le16 pan_id) { @@ -201,6 +221,7 @@ const struct cfg802154_ops mac802154_config_ops = { .add_virtual_intf = ieee802154_add_iface, .del_virtual_intf = ieee802154_del_iface, .set_channel = ieee802154_set_channel, + .set_cca_mode = ieee802154_set_cca_mode, .set_pan_id = ieee802154_set_pan_id, .set_short_addr = ieee802154_set_short_addr, .set_backoff_exponent = ieee802154_set_backoff_exponent, |