xref: /openbmc/linux/net/ieee802154/rdev-ops.h (revision 867a0e05)
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_pan_id(struct cfg802154_registered_device *rdev,
46 		struct wpan_dev *wpan_dev, __le16 pan_id)
47 {
48 	return rdev->ops->set_pan_id(&rdev->wpan_phy, wpan_dev, pan_id);
49 }
50 
51 static inline int
52 rdev_set_short_addr(struct cfg802154_registered_device *rdev,
53 		    struct wpan_dev *wpan_dev, __le16 short_addr)
54 {
55 	return rdev->ops->set_short_addr(&rdev->wpan_phy, wpan_dev, short_addr);
56 }
57 
58 static inline int
59 rdev_set_backoff_exponent(struct cfg802154_registered_device *rdev,
60 			  struct wpan_dev *wpan_dev, u8 min_be, u8 max_be)
61 {
62 	return rdev->ops->set_backoff_exponent(&rdev->wpan_phy, wpan_dev,
63 					       min_be, max_be);
64 }
65 
66 static inline int
67 rdev_set_max_csma_backoffs(struct cfg802154_registered_device *rdev,
68 			   struct wpan_dev *wpan_dev, u8 max_csma_backoffs)
69 {
70 	return rdev->ops->set_max_csma_backoffs(&rdev->wpan_phy, wpan_dev,
71 						max_csma_backoffs);
72 }
73 
74 static inline int
75 rdev_set_max_frame_retries(struct cfg802154_registered_device *rdev,
76 			   struct wpan_dev *wpan_dev, s8 max_frame_retries)
77 {
78 	return rdev->ops->set_max_frame_retries(&rdev->wpan_phy, wpan_dev,
79 						max_frame_retries);
80 }
81 
82 static inline int
83 rdev_set_lbt_mode(struct cfg802154_registered_device *rdev,
84 		  struct wpan_dev *wpan_dev, bool mode)
85 {
86 	return rdev->ops->set_lbt_mode(&rdev->wpan_phy, wpan_dev, mode);
87 }
88 
89 #endif /* __CFG802154_RDEV_OPS */
90