Alexander Aring | 4a9a816 | 2014-11-02 04:18:38 +0100 | [diff] [blame] | 1 | #ifndef __CFG802154_RDEV_OPS |
| 2 | #define __CFG802154_RDEV_OPS |
| 3 | |
| 4 | #include <net/cfg802154.h> |
| 5 | |
| 6 | #include "core.h" |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 7 | #include "trace.h" |
Alexander Aring | 4a9a816 | 2014-11-02 04:18:38 +0100 | [diff] [blame] | 8 | |
| 9 | static inline struct net_device * |
| 10 | rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev, |
Varka Bhadram | 5b4a1039 | 2015-04-30 17:44:57 +0200 | [diff] [blame] | 11 | const char *name, |
| 12 | unsigned char name_assign_type, |
| 13 | int type) |
Alexander Aring | 4a9a816 | 2014-11-02 04:18:38 +0100 | [diff] [blame] | 14 | { |
| 15 | return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name, |
Varka Bhadram | 5b4a1039 | 2015-04-30 17:44:57 +0200 | [diff] [blame] | 16 | name_assign_type, type); |
Alexander Aring | 4a9a816 | 2014-11-02 04:18:38 +0100 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | static inline void |
| 20 | rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev, |
| 21 | struct net_device *dev) |
| 22 | { |
| 23 | rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev); |
| 24 | } |
| 25 | |
Alexander Aring | ab0bd56 | 2014-11-12 03:36:55 +0100 | [diff] [blame] | 26 | static inline int |
Alexander Aring | f3ea5e4 | 2014-11-17 08:20:51 +0100 | [diff] [blame] | 27 | rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name, |
Varka Bhadram | 5b4a1039 | 2015-04-30 17:44:57 +0200 | [diff] [blame] | 28 | unsigned char name_assign_type, |
Alexander Aring | 0e57547 | 2014-11-17 08:20:52 +0100 | [diff] [blame] | 29 | enum nl802154_iftype type, __le64 extended_addr) |
Alexander Aring | f3ea5e4 | 2014-11-17 08:20:51 +0100 | [diff] [blame] | 30 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 31 | int ret; |
| 32 | |
| 33 | trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type, |
Alexander Aring | 0e57547 | 2014-11-17 08:20:52 +0100 | [diff] [blame] | 34 | extended_addr); |
Varka Bhadram | 5b4a1039 | 2015-04-30 17:44:57 +0200 | [diff] [blame] | 35 | ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name, |
| 36 | name_assign_type, type, |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 37 | extended_addr); |
| 38 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 39 | return ret; |
Alexander Aring | f3ea5e4 | 2014-11-17 08:20:51 +0100 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | static inline int |
Alexander Aring | b821ecd | 2014-11-17 08:20:53 +0100 | [diff] [blame] | 43 | rdev_del_virtual_intf(struct cfg802154_registered_device *rdev, |
| 44 | struct wpan_dev *wpan_dev) |
| 45 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 46 | int ret; |
| 47 | |
| 48 | trace_802154_rdev_del_virtual_intf(&rdev->wpan_phy, wpan_dev); |
| 49 | ret = rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev); |
| 50 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 51 | return ret; |
Alexander Aring | b821ecd | 2014-11-17 08:20:53 +0100 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | static inline int |
Alexander Aring | 628b1e1 | 2014-11-17 08:20:47 +0100 | [diff] [blame] | 55 | rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel) |
Alexander Aring | ab0bd56 | 2014-11-12 03:36:55 +0100 | [diff] [blame] | 56 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 57 | int ret; |
| 58 | |
| 59 | trace_802154_rdev_set_channel(&rdev->wpan_phy, page, channel); |
| 60 | ret = rdev->ops->set_channel(&rdev->wpan_phy, page, channel); |
| 61 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 62 | return ret; |
Alexander Aring | ab0bd56 | 2014-11-12 03:36:55 +0100 | [diff] [blame] | 63 | } |
| 64 | |
Alexander Aring | 702bf37 | 2014-11-12 03:36:57 +0100 | [diff] [blame] | 65 | static inline int |
Alexander Aring | ba2a950 | 2014-12-10 15:33:13 +0100 | [diff] [blame] | 66 | rdev_set_cca_mode(struct cfg802154_registered_device *rdev, |
| 67 | const struct wpan_phy_cca *cca) |
| 68 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 69 | int ret; |
| 70 | |
| 71 | trace_802154_rdev_set_cca_mode(&rdev->wpan_phy, cca); |
| 72 | ret = rdev->ops->set_cca_mode(&rdev->wpan_phy, cca); |
| 73 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 74 | return ret; |
Alexander Aring | ba2a950 | 2014-12-10 15:33:13 +0100 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | static inline int |
Alexander Aring | 702bf37 | 2014-11-12 03:36:57 +0100 | [diff] [blame] | 78 | rdev_set_pan_id(struct cfg802154_registered_device *rdev, |
Alexander Aring | ee7b905 | 2014-11-17 08:20:55 +0100 | [diff] [blame] | 79 | struct wpan_dev *wpan_dev, __le16 pan_id) |
Alexander Aring | 702bf37 | 2014-11-12 03:36:57 +0100 | [diff] [blame] | 80 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 81 | int ret; |
| 82 | |
| 83 | trace_802154_rdev_set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id); |
| 84 | ret = rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id); |
| 85 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 86 | return ret; |
Alexander Aring | 702bf37 | 2014-11-12 03:36:57 +0100 | [diff] [blame] | 87 | } |
| 88 | |
Alexander Aring | 9830c62 | 2014-11-12 03:36:58 +0100 | [diff] [blame] | 89 | static inline int |
| 90 | rdev_set_short_addr(struct cfg802154_registered_device *rdev, |
Alexander Aring | ee7b905 | 2014-11-17 08:20:55 +0100 | [diff] [blame] | 91 | struct wpan_dev *wpan_dev, __le16 short_addr) |
Alexander Aring | 9830c62 | 2014-11-12 03:36:58 +0100 | [diff] [blame] | 92 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 93 | int ret; |
| 94 | |
| 95 | trace_802154_rdev_set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr); |
| 96 | ret = rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr); |
| 97 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 98 | return ret; |
Alexander Aring | 9830c62 | 2014-11-12 03:36:58 +0100 | [diff] [blame] | 99 | } |
| 100 | |
Alexander Aring | 656a999 | 2014-11-12 03:36:59 +0100 | [diff] [blame] | 101 | static inline int |
| 102 | rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev, |
Alexander Aring | 628b1e1 | 2014-11-17 08:20:47 +0100 | [diff] [blame] | 103 | struct wpan_dev *wpan_dev, u8 min_be, u8 max_be) |
Alexander Aring | 656a999 | 2014-11-12 03:36:59 +0100 | [diff] [blame] | 104 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 105 | int ret; |
| 106 | |
| 107 | trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev, |
Alexander Aring | 656a999 | 2014-11-12 03:36:59 +0100 | [diff] [blame] | 108 | min_be, max_be); |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 109 | ret = rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev, |
| 110 | min_be, max_be); |
| 111 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 112 | return ret; |
Alexander Aring | 656a999 | 2014-11-12 03:36:59 +0100 | [diff] [blame] | 113 | } |
| 114 | |
Alexander Aring | a01ba76 | 2014-11-12 03:37:01 +0100 | [diff] [blame] | 115 | static inline int |
| 116 | rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev, |
Alexander Aring | 628b1e1 | 2014-11-17 08:20:47 +0100 | [diff] [blame] | 117 | struct wpan_dev *wpan_dev, u8 max_csma_backoffs) |
Alexander Aring | a01ba76 | 2014-11-12 03:37:01 +0100 | [diff] [blame] | 118 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 119 | int ret; |
| 120 | |
| 121 | trace_802154_rdev_set_csma_backoffs(&rdev->wpan_phy, wpan_dev, |
| 122 | max_csma_backoffs); |
| 123 | ret = rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev, |
| 124 | max_csma_backoffs); |
| 125 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 126 | return ret; |
Alexander Aring | a01ba76 | 2014-11-12 03:37:01 +0100 | [diff] [blame] | 127 | } |
| 128 | |
Alexander Aring | 17a3a46 | 2014-11-12 03:37:03 +0100 | [diff] [blame] | 129 | static inline int |
| 130 | rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev, |
Alexander Aring | 628b1e1 | 2014-11-17 08:20:47 +0100 | [diff] [blame] | 131 | struct wpan_dev *wpan_dev, s8 max_frame_retries) |
Alexander Aring | 17a3a46 | 2014-11-12 03:37:03 +0100 | [diff] [blame] | 132 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 133 | int ret; |
| 134 | |
| 135 | trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev, |
Alexander Aring | 17a3a46 | 2014-11-12 03:37:03 +0100 | [diff] [blame] | 136 | max_frame_retries); |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 137 | ret = rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev, |
| 138 | max_frame_retries); |
| 139 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 140 | return ret; |
Alexander Aring | 17a3a46 | 2014-11-12 03:37:03 +0100 | [diff] [blame] | 141 | } |
| 142 | |
Alexander Aring | c8937a1d | 2014-11-12 03:37:05 +0100 | [diff] [blame] | 143 | static inline int |
| 144 | rdev_set_lbt_mode(struct cfg802154_registered_device *rdev, |
Alexander Aring | 628b1e1 | 2014-11-17 08:20:47 +0100 | [diff] [blame] | 145 | struct wpan_dev *wpan_dev, bool mode) |
Alexander Aring | c8937a1d | 2014-11-12 03:37:05 +0100 | [diff] [blame] | 146 | { |
Guido Günther | 1cc800e | 2015-04-30 17:44:55 +0200 | [diff] [blame] | 147 | int ret; |
| 148 | |
| 149 | trace_802154_rdev_set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode); |
| 150 | ret = rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode); |
| 151 | trace_802154_rdev_return_int(&rdev->wpan_phy, ret); |
| 152 | return ret; |
Alexander Aring | c8937a1d | 2014-11-12 03:37:05 +0100 | [diff] [blame] | 153 | } |
| 154 | |
Alexander Aring | 4a9a816 | 2014-11-02 04:18:38 +0100 | [diff] [blame] | 155 | #endif /* __CFG802154_RDEV_OPS */ |