xref: /linux/net/ieee802154/rdev-ops.h (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1 #ifndef __CFG802154_RDEV_OPS
2 #define __CFG802154_RDEV_OPS
3 
4 #include <net/cfg802154.h>
5 
6 #include "core.h"
7 
8 static inline struct net_device *
9 rdev_add_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
10 				 const char *name, int type)
11 {
12 	return rdev->ops->add_virtual_intf_deprecated(&rdev->wpan_phy, name,
13 						      type);
14 }
15 
16 static inline void
17 rdev_del_virtual_intf_deprecated(struct cfg802154_registered_device *rdev,
18 				 struct net_device *dev)
19 {
20 	rdev->ops->del_virtual_intf_deprecated(&rdev->wpan_phy, dev);
21 }
22 
23 static inline int
24 rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name,
25 		      enum nl802154_iftype type, __le64 extended_addr)
26 {
27 	return rdev->ops->add_virtual_intf(&rdev->wpan_phy, name, type,
28 					   extended_addr);
29 }
30 
31 static inline int
32 rdev_del_virtual_intf(struct cfg802154_registered_device *rdev,
33 		      struct wpan_dev *wpan_dev)
34 {
35 	return rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev);
36 }
37 
38 static inline int
39 rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel)
40 {
41 	return rdev->ops->set_channel(&rdev->wpan_phy, page, channel);
42 }
43 
44 static inline int
45 rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
46 		  const struct wpan_phy_cca *cca)
47 {
48 	return rdev->ops->set_cca_mode(&rdev->wpan_phy, cca);
49 }
50 
51 static inline int
52 rdev_set_pan_id(struct cfg802154_registered_device *rdev,
53 		struct wpan_dev *wpan_dev, __le16 pan_id)
54 {
55 	return rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
56 }
57 
58 static inline int
59 rdev_set_short_addr(struct cfg802154_registered_device *rdev,
60 		    struct wpan_dev *wpan_dev, __le16 short_addr)
61 {
62 	return rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
63 }
64 
65 static inline int
66 rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
67 			  struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
68 {
69 	return rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
70 					       min_be, max_be);
71 }
72 
73 static inline int
74 rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
75 			   struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
76 {
77 	return rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev,
78 						max_csma_backoffs);
79 }
80 
81 static inline int
82 rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
83 			   struct wpan_dev *wpan_dev, s8 max_frame_retries)
84 {
85 	return rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
86 						max_frame_retries);
87 }
88 
89 static inline int
90 rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
91 		  struct wpan_dev *wpan_dev, bool mode)
92 {
93 	return rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
94 }
95 
96 #endif /* __CFG802154_RDEV_OPS */
97