14a9a816aSAlexander Aring #ifndef __CFG802154_RDEV_OPS 24a9a816aSAlexander Aring #define __CFG802154_RDEV_OPS 34a9a816aSAlexander Aring 44a9a816aSAlexander Aring #include <net/cfg802154.h> 54a9a816aSAlexander Aring 64a9a816aSAlexander Aring #include "core.h" 71cc800e7SGuido Günther #include "trace.h" 84a9a816aSAlexander Aring 94a9a816aSAlexander Aring static inline struct net_device * 104a9a816aSAlexander Aring rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev, 115b4a1039SVarka Bhadram const char *name, 125b4a1039SVarka Bhadram unsigned char name_assign_type, 135b4a1039SVarka Bhadram int type) 144a9a816aSAlexander Aring { 154a9a816aSAlexander Aring return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name, 165b4a1039SVarka Bhadram name_assign_type, type); 174a9a816aSAlexander Aring } 184a9a816aSAlexander Aring 194a9a816aSAlexander Aring static inline void 204a9a816aSAlexander Aring rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev, 214a9a816aSAlexander Aring struct net_device *dev) 224a9a816aSAlexander Aring { 234a9a816aSAlexander Aring rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev); 244a9a816aSAlexander Aring } 254a9a816aSAlexander Aring 26ab0bd561SAlexander Aring static inline int 27f3ea5e44SAlexander Aring rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name, 285b4a1039SVarka Bhadram unsigned char name_assign_type, 290e57547eSAlexander Aring enum nl802154_iftype type, __le64 extended_addr) 30f3ea5e44SAlexander Aring { 311cc800e7SGuido Günther int ret; 321cc800e7SGuido Günther 331cc800e7SGuido Günther trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type, 340e57547eSAlexander Aring extended_addr); 355b4a1039SVarka Bhadram ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name, 365b4a1039SVarka Bhadram name_assign_type, type, 371cc800e7SGuido Günther extended_addr); 381cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 391cc800e7SGuido Günther return ret; 40f3ea5e44SAlexander Aring } 41f3ea5e44SAlexander Aring 42f3ea5e44SAlexander Aring static inline int 43b821ecd4SAlexander Aring rdev_del_virtual_intf(struct cfg802154_registered_device *rdev, 44b821ecd4SAlexander Aring struct wpan_dev *wpan_dev) 45b821ecd4SAlexander Aring { 461cc800e7SGuido Günther int ret; 471cc800e7SGuido Günther 481cc800e7SGuido Günther trace_802154_rdev_del_virtual_intf(&rdev->wpan_phy, wpan_dev); 491cc800e7SGuido Günther ret = rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev); 501cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 511cc800e7SGuido Günther return ret; 52b821ecd4SAlexander Aring } 53b821ecd4SAlexander Aring 54b821ecd4SAlexander Aring static inline int 55628b1e11SAlexander Aring rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel) 56ab0bd561SAlexander Aring { 571cc800e7SGuido Günther int ret; 581cc800e7SGuido Günther 591cc800e7SGuido Günther trace_802154_rdev_set_channel(&rdev->wpan_phy, page, channel); 601cc800e7SGuido Günther ret = rdev->ops->set_channel(&rdev->wpan_phy, page, channel); 611cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 621cc800e7SGuido Günther return ret; 63ab0bd561SAlexander Aring } 64ab0bd561SAlexander Aring 65702bf371SAlexander Aring static inline int 66ba2a9506SAlexander Aring rdev_set_cca_mode(struct cfg802154_registered_device *rdev, 67ba2a9506SAlexander Aring const struct wpan_phy_cca *cca) 68ba2a9506SAlexander Aring { 691cc800e7SGuido Günther int ret; 701cc800e7SGuido Günther 711cc800e7SGuido Günther trace_802154_rdev_set_cca_mode(&rdev->wpan_phy, cca); 721cc800e7SGuido Günther ret = rdev->ops->set_cca_mode(&rdev->wpan_phy, cca); 731cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 741cc800e7SGuido Günther return ret; 75ba2a9506SAlexander Aring } 76ba2a9506SAlexander Aring 77ba2a9506SAlexander Aring static inline int 78b69644c1SAlexander Aring rdev_set_cca_ed_level(struct cfg802154_registered_device *rdev, s32 ed_level) 79b69644c1SAlexander Aring { 80b69644c1SAlexander Aring int ret; 81b69644c1SAlexander Aring 82b69644c1SAlexander Aring trace_802154_rdev_set_cca_ed_level(&rdev->wpan_phy, ed_level); 83b69644c1SAlexander Aring ret = rdev->ops->set_cca_ed_level(&rdev->wpan_phy, ed_level); 84b69644c1SAlexander Aring trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 85b69644c1SAlexander Aring return ret; 86b69644c1SAlexander Aring } 87b69644c1SAlexander Aring 88b69644c1SAlexander Aring static inline int 890f999b09SVarka Bhadram rdev_set_tx_power(struct cfg802154_registered_device *rdev, 900f999b09SVarka Bhadram s32 power) 910f999b09SVarka Bhadram { 920f999b09SVarka Bhadram int ret; 930f999b09SVarka Bhadram 940f999b09SVarka Bhadram trace_802154_rdev_set_tx_power(&rdev->wpan_phy, power); 950f999b09SVarka Bhadram ret = rdev->ops->set_tx_power(&rdev->wpan_phy, power); 960f999b09SVarka Bhadram trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 970f999b09SVarka Bhadram return ret; 980f999b09SVarka Bhadram } 990f999b09SVarka Bhadram 1000f999b09SVarka Bhadram static inline int 101702bf371SAlexander Aring rdev_set_pan_id(struct cfg802154_registered_device *rdev, 102ee7b9053SAlexander Aring struct wpan_dev *wpan_dev, __le16 pan_id) 103702bf371SAlexander Aring { 1041cc800e7SGuido Günther int ret; 1051cc800e7SGuido Günther 1061cc800e7SGuido Günther trace_802154_rdev_set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id); 1071cc800e7SGuido Günther ret = rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id); 1081cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1091cc800e7SGuido Günther return ret; 110702bf371SAlexander Aring } 111702bf371SAlexander Aring 1129830c62aSAlexander Aring static inline int 1139830c62aSAlexander Aring rdev_set_short_addr(struct cfg802154_registered_device *rdev, 114ee7b9053SAlexander Aring struct wpan_dev *wpan_dev, __le16 short_addr) 1159830c62aSAlexander Aring { 1161cc800e7SGuido Günther int ret; 1171cc800e7SGuido Günther 1181cc800e7SGuido Günther trace_802154_rdev_set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr); 1191cc800e7SGuido Günther ret = rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr); 1201cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1211cc800e7SGuido Günther return ret; 1229830c62aSAlexander Aring } 1239830c62aSAlexander Aring 124656a999eSAlexander Aring static inline int 125656a999eSAlexander Aring rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev, 126628b1e11SAlexander Aring struct wpan_dev *wpan_dev, u8 min_be, u8 max_be) 127656a999eSAlexander Aring { 1281cc800e7SGuido Günther int ret; 1291cc800e7SGuido Günther 1301cc800e7SGuido Günther trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev, 131656a999eSAlexander Aring min_be, max_be); 1321cc800e7SGuido Günther ret = rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev, 1331cc800e7SGuido Günther min_be, max_be); 1341cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1351cc800e7SGuido Günther return ret; 136656a999eSAlexander Aring } 137656a999eSAlexander Aring 138a01ba765SAlexander Aring static inline int 139a01ba765SAlexander Aring rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev, 140628b1e11SAlexander Aring struct wpan_dev *wpan_dev, u8 max_csma_backoffs) 141a01ba765SAlexander Aring { 1421cc800e7SGuido Günther int ret; 1431cc800e7SGuido Günther 1441cc800e7SGuido Günther trace_802154_rdev_set_csma_backoffs(&rdev->wpan_phy, wpan_dev, 145a01ba765SAlexander Aring max_csma_backoffs); 1461cc800e7SGuido Günther ret = rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev, 1471cc800e7SGuido Günther max_csma_backoffs); 1481cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1491cc800e7SGuido Günther return ret; 150a01ba765SAlexander Aring } 151a01ba765SAlexander Aring 15217a3a46bSAlexander Aring static inline int 15317a3a46bSAlexander Aring rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev, 154628b1e11SAlexander Aring struct wpan_dev *wpan_dev, s8 max_frame_retries) 15517a3a46bSAlexander Aring { 1561cc800e7SGuido Günther int ret; 1571cc800e7SGuido Günther 1581cc800e7SGuido Günther trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev, 15917a3a46bSAlexander Aring max_frame_retries); 1601cc800e7SGuido Günther ret = rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev, 1611cc800e7SGuido Günther max_frame_retries); 1621cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1631cc800e7SGuido Günther return ret; 16417a3a46bSAlexander Aring } 16517a3a46bSAlexander Aring 166c8937a1dSAlexander Aring static inline int 167c8937a1dSAlexander Aring rdev_set_lbt_mode(struct cfg802154_registered_device *rdev, 168628b1e11SAlexander Aring struct wpan_dev *wpan_dev, bool mode) 169c8937a1dSAlexander Aring { 1701cc800e7SGuido Günther int ret; 1711cc800e7SGuido Günther 1721cc800e7SGuido Günther trace_802154_rdev_set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode); 1731cc800e7SGuido Günther ret = rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode); 1741cc800e7SGuido Günther trace_802154_rdev_return_int(&rdev->wpan_phy, ret); 1751cc800e7SGuido Günther return ret; 176c8937a1dSAlexander Aring } 177c8937a1dSAlexander Aring 1784a9a816aSAlexander Aring #endif /* __CFG802154_RDEV_OPS */ 179