summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 15:44:46 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 05:44:42 -0400
commitedea8f7c75ec6c238130bd7e74d9f6f4c26e97b0 (patch)
treed195877b5647f91cd83399f4f8b1462e7f19d24e /net/ieee802154
parent8329fcf11f5c2ae2fb7b1f56f05b0bb899babc85 (diff)
cfg802154: introduce wpan phy flags
This patch introduce a flag property for the wpan phy structure. The current flag settings in ieee802154_hw are accessable in mac802154 layer only which is okay for flags which indicates MAC handling which are done by phy. For real PHY layer settings like cca mode, transmit power, cca energy detection level. The difference between these flags are that the MAC handling flags are only handled in mac802154/HardMac layer e.g. on an interface up. The phy settings are direct netlink calls from nl802154 into the driver layer and the nl802154 need to have a chance to check if the driver supports this handling before sending to the next layer. We also check now on PHY flags while dumping and setting pib attributes. In comparing with MIB attributes the 802.15.4 gives us an default value which we assume when a transceiver implement less functionality. In case of MIB settings the nl802154 layer doesn't need to check on the ieee802154_hw flags then. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/nl802154.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index fa0c4048b0e8..40fb0be009b2 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -291,19 +291,23 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
291 goto nla_put_failure; 291 goto nla_put_failure;
292 292
293 /* cca mode */ 293 /* cca mode */
294 if (nla_put_u32(msg, NL802154_ATTR_CCA_MODE, 294 if (rdev->wpan_phy.flags & WPAN_PHY_FLAG_CCA_MODE) {
295 rdev->wpan_phy.cca.mode)) 295 if (nla_put_u32(msg, NL802154_ATTR_CCA_MODE,
296 goto nla_put_failure; 296 rdev->wpan_phy.cca.mode))
297
298 if (rdev->wpan_phy.cca.mode == NL802154_CCA_ENERGY_CARRIER) {
299 if (nla_put_u32(msg, NL802154_ATTR_CCA_OPT,
300 rdev->wpan_phy.cca.opt))
301 goto nla_put_failure; 297 goto nla_put_failure;
298
299 if (rdev->wpan_phy.cca.mode == NL802154_CCA_ENERGY_CARRIER) {
300 if (nla_put_u32(msg, NL802154_ATTR_CCA_OPT,
301 rdev->wpan_phy.cca.opt))
302 goto nla_put_failure;
303 }
302 } 304 }
303 305
304 if (nla_put_s32(msg, NL802154_ATTR_TX_POWER, 306 if (rdev->wpan_phy.flags & WPAN_PHY_FLAG_TXPOWER) {
305 rdev->wpan_phy.transmit_power)) 307 if (nla_put_s32(msg, NL802154_ATTR_TX_POWER,
306 goto nla_put_failure; 308 rdev->wpan_phy.transmit_power))
309 goto nla_put_failure;
310 }
307 311
308finish: 312finish:
309 genlmsg_end(msg, hdr); 313 genlmsg_end(msg, hdr);
@@ -637,6 +641,9 @@ static int nl802154_set_cca_mode(struct sk_buff *skb, struct genl_info *info)
637 struct cfg802154_registered_device *rdev = info->user_ptr[0]; 641 struct cfg802154_registered_device *rdev = info->user_ptr[0];
638 struct wpan_phy_cca cca; 642 struct wpan_phy_cca cca;
639 643
644 if (rdev->wpan_phy.flags & WPAN_PHY_FLAG_CCA_MODE)
645 return -EOPNOTSUPP;
646
640 if (!info->attrs[NL802154_ATTR_CCA_MODE]) 647 if (!info->attrs[NL802154_ATTR_CCA_MODE])
641 return -EINVAL; 648 return -EINVAL;
642 649