1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __CFG802154_RDEV_OPS
3 #define __CFG802154_RDEV_OPS
5 #include <net/cfg802154.h>
10 static inline struct net_device *
11 rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
13 unsigned char name_assign_type,
16 return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name,
17 name_assign_type, type);
21 rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
22 struct net_device *dev)
24 rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev);
28 rdev_suspend(struct cfg802154_registered_device *rdev)
31 trace_802154_rdev_suspend(&rdev->wpan_phy);
32 ret = rdev->ops->suspend(&rdev->wpan_phy);
33 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
38 rdev_resume(struct cfg802154_registered_device *rdev)
41 trace_802154_rdev_resume(&rdev->wpan_phy);
42 ret = rdev->ops->resume(&rdev->wpan_phy);
43 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
48 rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name,
49 unsigned char name_assign_type,
50 enum nl802154_iftype type, __le64 extended_addr)
54 trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type,
56 ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name,
57 name_assign_type, type,
59 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
64 rdev_del_virtual_intf(struct cfg802154_registered_device *rdev,
65 struct wpan_dev *wpan_dev)
69 trace_802154_rdev_del_virtual_intf(&rdev->wpan_phy, wpan_dev);
70 ret = rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev);
71 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
76 rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel)
80 trace_802154_rdev_set_channel(&rdev->wpan_phy, page, channel);
81 ret = rdev->ops->set_channel(&rdev->wpan_phy, page, channel);
82 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
87 rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
88 const struct wpan_phy_cca *cca)
92 trace_802154_rdev_set_cca_mode(&rdev->wpan_phy, cca);
93 ret = rdev->ops->set_cca_mode(&rdev->wpan_phy, cca);
94 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
99 rdev_set_cca_ed_level(struct cfg802154_registered_device *rdev, s32 ed_level)
103 trace_802154_rdev_set_cca_ed_level(&rdev->wpan_phy, ed_level);
104 ret = rdev->ops->set_cca_ed_level(&rdev->wpan_phy, ed_level);
105 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
110 rdev_set_tx_power(struct cfg802154_registered_device *rdev,
115 trace_802154_rdev_set_tx_power(&rdev->wpan_phy, power);
116 ret = rdev->ops->set_tx_power(&rdev->wpan_phy, power);
117 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
122 rdev_set_pan_id(struct cfg802154_registered_device *rdev,
123 struct wpan_dev *wpan_dev, __le16 pan_id)
127 trace_802154_rdev_set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
128 ret = rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
129 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
134 rdev_set_short_addr(struct cfg802154_registered_device *rdev,
135 struct wpan_dev *wpan_dev, __le16 short_addr)
139 trace_802154_rdev_set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
140 ret = rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
141 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
146 rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
147 struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
151 trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
153 ret = rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
155 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
160 rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
161 struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
165 trace_802154_rdev_set_csma_backoffs(&rdev->wpan_phy, wpan_dev,
167 ret = rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev,
169 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
174 rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
175 struct wpan_dev *wpan_dev, s8 max_frame_retries)
179 trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
181 ret = rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
183 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
188 rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
189 struct wpan_dev *wpan_dev, bool mode)
193 trace_802154_rdev_set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
194 ret = rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
195 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
200 rdev_set_ackreq_default(struct cfg802154_registered_device *rdev,
201 struct wpan_dev *wpan_dev, bool ackreq)
205 trace_802154_rdev_set_ackreq_default(&rdev->wpan_phy, wpan_dev,
207 ret = rdev->ops->set_ackreq_default(&rdev->wpan_phy, wpan_dev, ackreq);
208 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
212 static inline int rdev_trigger_scan(struct cfg802154_registered_device *rdev,
213 struct cfg802154_scan_request *request)
217 if (!rdev->ops->trigger_scan)
220 trace_802154_rdev_trigger_scan(&rdev->wpan_phy, request);
221 ret = rdev->ops->trigger_scan(&rdev->wpan_phy, request);
222 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
226 static inline int rdev_abort_scan(struct cfg802154_registered_device *rdev,
227 struct wpan_dev *wpan_dev)
231 if (!rdev->ops->abort_scan)
234 trace_802154_rdev_abort_scan(&rdev->wpan_phy, wpan_dev);
235 ret = rdev->ops->abort_scan(&rdev->wpan_phy, wpan_dev);
236 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
240 static inline int rdev_send_beacons(struct cfg802154_registered_device *rdev,
241 struct cfg802154_beacon_request *request)
245 if (!rdev->ops->send_beacons)
248 trace_802154_rdev_send_beacons(&rdev->wpan_phy, request);
249 ret = rdev->ops->send_beacons(&rdev->wpan_phy, request);
250 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
254 static inline int rdev_stop_beacons(struct cfg802154_registered_device *rdev,
255 struct wpan_dev *wpan_dev)
259 if (!rdev->ops->stop_beacons)
262 trace_802154_rdev_stop_beacons(&rdev->wpan_phy, wpan_dev);
263 ret = rdev->ops->stop_beacons(&rdev->wpan_phy, wpan_dev);
264 trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
268 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
269 /* TODO this is already a nl802154, so move into ieee802154 */
271 rdev_get_llsec_table(struct cfg802154_registered_device *rdev,
272 struct wpan_dev *wpan_dev,
273 struct ieee802154_llsec_table **table)
275 rdev->ops->get_llsec_table(&rdev->wpan_phy, wpan_dev, table);
279 rdev_lock_llsec_table(struct cfg802154_registered_device *rdev,
280 struct wpan_dev *wpan_dev)
282 rdev->ops->lock_llsec_table(&rdev->wpan_phy, wpan_dev);
286 rdev_unlock_llsec_table(struct cfg802154_registered_device *rdev,
287 struct wpan_dev *wpan_dev)
289 rdev->ops->unlock_llsec_table(&rdev->wpan_phy, wpan_dev);
293 rdev_get_llsec_params(struct cfg802154_registered_device *rdev,
294 struct wpan_dev *wpan_dev,
295 struct ieee802154_llsec_params *params)
297 return rdev->ops->get_llsec_params(&rdev->wpan_phy, wpan_dev, params);
301 rdev_set_llsec_params(struct cfg802154_registered_device *rdev,
302 struct wpan_dev *wpan_dev,
303 const struct ieee802154_llsec_params *params,
306 return rdev->ops->set_llsec_params(&rdev->wpan_phy, wpan_dev, params,
311 rdev_add_llsec_key(struct cfg802154_registered_device *rdev,
312 struct wpan_dev *wpan_dev,
313 const struct ieee802154_llsec_key_id *id,
314 const struct ieee802154_llsec_key *key)
316 return rdev->ops->add_llsec_key(&rdev->wpan_phy, wpan_dev, id, key);
320 rdev_del_llsec_key(struct cfg802154_registered_device *rdev,
321 struct wpan_dev *wpan_dev,
322 const struct ieee802154_llsec_key_id *id)
324 return rdev->ops->del_llsec_key(&rdev->wpan_phy, wpan_dev, id);
328 rdev_add_seclevel(struct cfg802154_registered_device *rdev,
329 struct wpan_dev *wpan_dev,
330 const struct ieee802154_llsec_seclevel *sl)
332 return rdev->ops->add_seclevel(&rdev->wpan_phy, wpan_dev, sl);
336 rdev_del_seclevel(struct cfg802154_registered_device *rdev,
337 struct wpan_dev *wpan_dev,
338 const struct ieee802154_llsec_seclevel *sl)
340 return rdev->ops->del_seclevel(&rdev->wpan_phy, wpan_dev, sl);
344 rdev_add_device(struct cfg802154_registered_device *rdev,
345 struct wpan_dev *wpan_dev,
346 const struct ieee802154_llsec_device *dev_desc)
348 return rdev->ops->add_device(&rdev->wpan_phy, wpan_dev, dev_desc);
352 rdev_del_device(struct cfg802154_registered_device *rdev,
353 struct wpan_dev *wpan_dev, __le64 extended_addr)
355 return rdev->ops->del_device(&rdev->wpan_phy, wpan_dev, extended_addr);
359 rdev_add_devkey(struct cfg802154_registered_device *rdev,
360 struct wpan_dev *wpan_dev, __le64 extended_addr,
361 const struct ieee802154_llsec_device_key *devkey)
363 return rdev->ops->add_devkey(&rdev->wpan_phy, wpan_dev, extended_addr,
368 rdev_del_devkey(struct cfg802154_registered_device *rdev,
369 struct wpan_dev *wpan_dev, __le64 extended_addr,
370 const struct ieee802154_llsec_device_key *devkey)
372 return rdev->ops->del_devkey(&rdev->wpan_phy, wpan_dev, extended_addr,
375 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
377 #endif /* __CFG802154_RDEV_OPS */