Linux 4.1.16
[linux/fpc-iii.git] / net / ieee802154 / rdev-ops.h
blob7b5a9dd94fe5a2b55d01103aa529261141ece521
1 #ifndef __CFG802154_RDEV_OPS
2 #define __CFG802154_RDEV_OPS
4 #include <net/cfg802154.h>
6 #include "core.h"
7 #include "trace.h"
9 static inline struct net_device *
10 rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
11 const char *name,
12 unsigned char name_assign_type,
13 int type)
15 return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name,
16 name_assign_type, type);
19 static inline void
20 rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
21 struct net_device *dev)
23 rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev);
26 static inline int
27 rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name,
28 unsigned char name_assign_type,
29 enum nl802154_iftype type, __le64 extended_addr)
31 int ret;
33 trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type,
34 extended_addr);
35 ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name,
36 name_assign_type, type,
37 extended_addr);
38 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
39 return ret;
42 static inline int
43 rdev_del_virtual_intf(struct cfg802154_registered_device *rdev,
44 struct wpan_dev *wpan_dev)
46 int ret;
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;
54 static inline int
55 rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel)
57 int ret;
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;
65 static inline int
66 rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
67 const struct wpan_phy_cca *cca)
69 int ret;
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;
77 static inline int
78 rdev_set_pan_id(struct cfg802154_registered_device *rdev,
79 struct wpan_dev *wpan_dev, __le16 pan_id)
81 int ret;
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;
89 static inline int
90 rdev_set_short_addr(struct cfg802154_registered_device *rdev,
91 struct wpan_dev *wpan_dev, __le16 short_addr)
93 int ret;
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;
101 static inline int
102 rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
103 struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
105 int ret;
107 trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
108 min_be, max_be);
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;
115 static inline int
116 rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
117 struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
119 int ret;
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;
129 static inline int
130 rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
131 struct wpan_dev *wpan_dev, s8 max_frame_retries)
133 int ret;
135 trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
136 max_frame_retries);
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;
143 static inline int
144 rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
145 struct wpan_dev *wpan_dev, bool mode)
147 int ret;
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;
155 #endif /* __CFG802154_RDEV_OPS */