~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/ieee802154/rdev-ops.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __CFG802154_RDEV_OPS
  3 #define __CFG802154_RDEV_OPS
  4 
  5 #include <net/cfg802154.h>
  6 
  7 #include "core.h"
  8 #include "trace.h"
  9 
 10 static inline struct net_device *
 11 rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
 12                                  const char *name,
 13                                  unsigned char name_assign_type,
 14                                  int type)
 15 {
 16         return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name,
 17                                                       name_assign_type, type);
 18 }
 19 
 20 static inline void
 21 rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
 22                                  struct net_device *dev)
 23 {
 24         rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev);
 25 }
 26 
 27 static inline int
 28 rdev_suspend(struct cfg802154_registered_device *rdev)
 29 {
 30         int ret;
 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);
 34         return ret;
 35 }
 36 
 37 static inline int
 38 rdev_resume(struct cfg802154_registered_device *rdev)
 39 {
 40         int ret;
 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);
 44         return ret;
 45 }
 46 
 47 static inline int
 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)
 51 {
 52         int ret;
 53 
 54         trace_802154_rdev_add_virtual_intf(&rdev->wpan_phy, name, type,
 55                                            extended_addr);
 56         ret = rdev->ops->add_virtual_intf(&rdev->wpan_phy, name,
 57                                           name_assign_type, type,
 58                                           extended_addr);
 59         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
 60         return ret;
 61 }
 62 
 63 static inline int
 64 rdev_del_virtual_intf(struct cfg802154_registered_device *rdev,
 65                       struct wpan_dev *wpan_dev)
 66 {
 67         int ret;
 68 
 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);
 72         return ret;
 73 }
 74 
 75 static inline int
 76 rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel)
 77 {
 78         int ret;
 79 
 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);
 83         return ret;
 84 }
 85 
 86 static inline int
 87 rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
 88                   const struct wpan_phy_cca *cca)
 89 {
 90         int ret;
 91 
 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);
 95         return ret;
 96 }
 97 
 98 static inline int
 99 rdev_set_cca_ed_level(struct cfg802154_registered_device *rdev, s32 ed_level)
100 {
101         int ret;
102 
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);
106         return ret;
107 }
108 
109 static inline int
110 rdev_set_tx_power(struct cfg802154_registered_device *rdev,
111                   s32 power)
112 {
113         int ret;
114 
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);
118         return ret;
119 }
120 
121 static inline int
122 rdev_set_pan_id(struct cfg802154_registered_device *rdev,
123                 struct wpan_dev *wpan_dev, __le16 pan_id)
124 {
125         int ret;
126 
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);
130         return ret;
131 }
132 
133 static inline int
134 rdev_set_short_addr(struct cfg802154_registered_device *rdev,
135                     struct wpan_dev *wpan_dev, __le16 short_addr)
136 {
137         int ret;
138 
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);
142         return ret;
143 }
144 
145 static inline int
146 rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
147                           struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
148 {
149         int ret;
150 
151         trace_802154_rdev_set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
152                                                min_be, max_be);
153         ret = rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
154                                               min_be, max_be);
155         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
156         return ret;
157 }
158 
159 static inline int
160 rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
161                            struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
162 {
163         int ret;
164 
165         trace_802154_rdev_set_csma_backoffs(&rdev->wpan_phy, wpan_dev,
166                                             max_csma_backoffs);
167         ret = rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev,
168                                                max_csma_backoffs);
169         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
170         return ret;
171 }
172 
173 static inline int
174 rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
175                            struct wpan_dev *wpan_dev, s8 max_frame_retries)
176 {
177         int ret;
178 
179         trace_802154_rdev_set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
180                                                 max_frame_retries);
181         ret = rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
182                                                max_frame_retries);
183         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
184         return ret;
185 }
186 
187 static inline int
188 rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
189                   struct wpan_dev *wpan_dev, bool mode)
190 {
191         int ret;
192 
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);
196         return ret;
197 }
198 
199 static inline int
200 rdev_set_ackreq_default(struct cfg802154_registered_device *rdev,
201                         struct wpan_dev *wpan_dev, bool ackreq)
202 {
203         int ret;
204 
205         trace_802154_rdev_set_ackreq_default(&rdev->wpan_phy, wpan_dev,
206                                              ackreq);
207         ret = rdev->ops->set_ackreq_default(&rdev->wpan_phy, wpan_dev, ackreq);
208         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
209         return ret;
210 }
211 
212 static inline int rdev_trigger_scan(struct cfg802154_registered_device *rdev,
213                                     struct cfg802154_scan_request *request)
214 {
215         int ret;
216 
217         if (!rdev->ops->trigger_scan)
218                 return -EOPNOTSUPP;
219 
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);
223         return ret;
224 }
225 
226 static inline int rdev_abort_scan(struct cfg802154_registered_device *rdev,
227                                   struct wpan_dev *wpan_dev)
228 {
229         int ret;
230 
231         if (!rdev->ops->abort_scan)
232                 return -EOPNOTSUPP;
233 
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);
237         return ret;
238 }
239 
240 static inline int rdev_send_beacons(struct cfg802154_registered_device *rdev,
241                                     struct cfg802154_beacon_request *request)
242 {
243         int ret;
244 
245         if (!rdev->ops->send_beacons)
246                 return -EOPNOTSUPP;
247 
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);
251         return ret;
252 }
253 
254 static inline int rdev_stop_beacons(struct cfg802154_registered_device *rdev,
255                                     struct wpan_dev *wpan_dev)
256 {
257         int ret;
258 
259         if (!rdev->ops->stop_beacons)
260                 return -EOPNOTSUPP;
261 
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);
265         return ret;
266 }
267 
268 static inline int rdev_associate(struct cfg802154_registered_device *rdev,
269                                  struct wpan_dev *wpan_dev,
270                                  struct ieee802154_addr *coord)
271 {
272         int ret;
273 
274         if (!rdev->ops->associate)
275                 return -EOPNOTSUPP;
276 
277         trace_802154_rdev_associate(&rdev->wpan_phy, wpan_dev, coord);
278         ret = rdev->ops->associate(&rdev->wpan_phy, wpan_dev, coord);
279         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
280         return ret;
281 }
282 
283 static inline int rdev_disassociate(struct cfg802154_registered_device *rdev,
284                                     struct wpan_dev *wpan_dev,
285                                     struct ieee802154_addr *target)
286 {
287         int ret;
288 
289         if (!rdev->ops->disassociate)
290                 return -EOPNOTSUPP;
291 
292         trace_802154_rdev_disassociate(&rdev->wpan_phy, wpan_dev, target);
293         ret = rdev->ops->disassociate(&rdev->wpan_phy, wpan_dev, target);
294         trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
295         return ret;
296 }
297 
298 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
299 /* TODO this is already a nl802154, so move into ieee802154 */
300 static inline void
301 rdev_get_llsec_table(struct cfg802154_registered_device *rdev,
302                      struct wpan_dev *wpan_dev,
303                      struct ieee802154_llsec_table **table)
304 {
305         rdev->ops->get_llsec_table(&rdev->wpan_phy, wpan_dev, table);
306 }
307 
308 static inline void
309 rdev_lock_llsec_table(struct cfg802154_registered_device *rdev,
310                       struct wpan_dev *wpan_dev)
311 {
312         rdev->ops->lock_llsec_table(&rdev->wpan_phy, wpan_dev);
313 }
314 
315 static inline void
316 rdev_unlock_llsec_table(struct cfg802154_registered_device *rdev,
317                         struct wpan_dev *wpan_dev)
318 {
319         rdev->ops->unlock_llsec_table(&rdev->wpan_phy, wpan_dev);
320 }
321 
322 static inline int
323 rdev_get_llsec_params(struct cfg802154_registered_device *rdev,
324                       struct wpan_dev *wpan_dev,
325                       struct ieee802154_llsec_params *params)
326 {
327         return rdev->ops->get_llsec_params(&rdev->wpan_phy, wpan_dev, params);
328 }
329 
330 static inline int
331 rdev_set_llsec_params(struct cfg802154_registered_device *rdev,
332                       struct wpan_dev *wpan_dev,
333                       const struct ieee802154_llsec_params *params,
334                       u32 changed)
335 {
336         return rdev->ops->set_llsec_params(&rdev->wpan_phy, wpan_dev, params,
337                                            changed);
338 }
339 
340 static inline int
341 rdev_add_llsec_key(struct cfg802154_registered_device *rdev,
342                    struct wpan_dev *wpan_dev,
343                    const struct ieee802154_llsec_key_id *id,
344                    const struct ieee802154_llsec_key *key)
345 {
346         return rdev->ops->add_llsec_key(&rdev->wpan_phy, wpan_dev, id, key);
347 }
348 
349 static inline int
350 rdev_del_llsec_key(struct cfg802154_registered_device *rdev,
351                    struct wpan_dev *wpan_dev,
352                    const struct ieee802154_llsec_key_id *id)
353 {
354         return rdev->ops->del_llsec_key(&rdev->wpan_phy, wpan_dev, id);
355 }
356 
357 static inline int
358 rdev_add_seclevel(struct cfg802154_registered_device *rdev,
359                   struct wpan_dev *wpan_dev,
360                   const struct ieee802154_llsec_seclevel *sl)
361 {
362         return rdev->ops->add_seclevel(&rdev->wpan_phy, wpan_dev, sl);
363 }
364 
365 static inline int
366 rdev_del_seclevel(struct cfg802154_registered_device *rdev,
367                   struct wpan_dev *wpan_dev,
368                   const struct ieee802154_llsec_seclevel *sl)
369 {
370         return rdev->ops->del_seclevel(&rdev->wpan_phy, wpan_dev, sl);
371 }
372 
373 static inline int
374 rdev_add_device(struct cfg802154_registered_device *rdev,
375                 struct wpan_dev *wpan_dev,
376                 const struct ieee802154_llsec_device *dev_desc)
377 {
378         return rdev->ops->add_device(&rdev->wpan_phy, wpan_dev, dev_desc);
379 }
380 
381 static inline int
382 rdev_del_device(struct cfg802154_registered_device *rdev,
383                 struct wpan_dev *wpan_dev, __le64 extended_addr)
384 {
385         return rdev->ops->del_device(&rdev->wpan_phy, wpan_dev, extended_addr);
386 }
387 
388 static inline int
389 rdev_add_devkey(struct cfg802154_registered_device *rdev,
390                 struct wpan_dev *wpan_dev, __le64 extended_addr,
391                 const struct ieee802154_llsec_device_key *devkey)
392 {
393         return rdev->ops->add_devkey(&rdev->wpan_phy, wpan_dev, extended_addr,
394                                      devkey);
395 }
396 
397 static inline int
398 rdev_del_devkey(struct cfg802154_registered_device *rdev,
399                 struct wpan_dev *wpan_dev, __le64 extended_addr,
400                 const struct ieee802154_llsec_device_key *devkey)
401 {
402         return rdev->ops->del_devkey(&rdev->wpan_phy, wpan_dev, extended_addr,
403                                      devkey);
404 }
405 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
406 
407 #endif /* __CFG802154_RDEV_OPS */
408 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php