Commit | Line | Data |
---|---|---|
1802d0be | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2bfb1070 DES |
2 | /* |
3 | * Copyright (C) 2007, 2008, 2009 Siemens AG | |
4 | * | |
2bfb1070 DES |
5 | * Written by: |
6 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | |
7 | */ | |
8 | ||
5ad60d36 AA |
9 | #ifndef __NET_CFG802154_H |
10 | #define __NET_CFG802154_H | |
2bfb1070 | 11 | |
cb41c8dd | 12 | #include <linux/ieee802154.h> |
2bfb1070 | 13 | #include <linux/netdevice.h> |
20a19d1d | 14 | #include <linux/spinlock.h> |
187f1882 | 15 | #include <linux/bug.h> |
2bfb1070 | 16 | |
f3ea5e44 AA |
17 | #include <net/nl802154.h> |
18 | ||
a5dd1d72 | 19 | struct wpan_phy; |
ba2a9506 | 20 | struct wpan_phy_cca; |
ed3557c9 | 21 | struct cfg802154_scan_request; |
9bc11450 | 22 | struct cfg802154_beacon_request; |
a5dd1d72 | 23 | |
a26c5fd7 AA |
24 | #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL |
25 | struct ieee802154_llsec_device_key; | |
26 | struct ieee802154_llsec_seclevel; | |
27 | struct ieee802154_llsec_params; | |
28 | struct ieee802154_llsec_device; | |
29 | struct ieee802154_llsec_table; | |
30 | struct ieee802154_llsec_key_id; | |
31 | struct ieee802154_llsec_key; | |
32 | #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ | |
33 | ||
a5dd1d72 | 34 | struct cfg802154_ops { |
4a9a816a AA |
35 | struct net_device * (*add_virtual_intf_deprecated)(struct wpan_phy *wpan_phy, |
36 | const char *name, | |
5b4a1039 | 37 | unsigned char name_assign_type, |
4a9a816a | 38 | int type); |
9d30a8cf AA |
39 | void (*del_virtual_intf_deprecated)(struct wpan_phy *wpan_phy, |
40 | struct net_device *dev); | |
a6cb869b VB |
41 | int (*suspend)(struct wpan_phy *wpan_phy); |
42 | int (*resume)(struct wpan_phy *wpan_phy); | |
f3ea5e44 AA |
43 | int (*add_virtual_intf)(struct wpan_phy *wpan_phy, |
44 | const char *name, | |
5b4a1039 | 45 | unsigned char name_assign_type, |
0e57547e AA |
46 | enum nl802154_iftype type, |
47 | __le64 extended_addr); | |
b821ecd4 AA |
48 | int (*del_virtual_intf)(struct wpan_phy *wpan_phy, |
49 | struct wpan_dev *wpan_dev); | |
ab0bd561 | 50 | int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel); |
ba2a9506 AA |
51 | int (*set_cca_mode)(struct wpan_phy *wpan_phy, |
52 | const struct wpan_phy_cca *cca); | |
b69644c1 | 53 | int (*set_cca_ed_level)(struct wpan_phy *wpan_phy, s32 ed_level); |
0f999b09 | 54 | int (*set_tx_power)(struct wpan_phy *wpan_phy, s32 power); |
702bf371 | 55 | int (*set_pan_id)(struct wpan_phy *wpan_phy, |
ee7b9053 | 56 | struct wpan_dev *wpan_dev, __le16 pan_id); |
9830c62a | 57 | int (*set_short_addr)(struct wpan_phy *wpan_phy, |
ee7b9053 | 58 | struct wpan_dev *wpan_dev, __le16 short_addr); |
656a999e AA |
59 | int (*set_backoff_exponent)(struct wpan_phy *wpan_phy, |
60 | struct wpan_dev *wpan_dev, u8 min_be, | |
61 | u8 max_be); | |
a01ba765 AA |
62 | int (*set_max_csma_backoffs)(struct wpan_phy *wpan_phy, |
63 | struct wpan_dev *wpan_dev, | |
64 | u8 max_csma_backoffs); | |
17a3a46b AA |
65 | int (*set_max_frame_retries)(struct wpan_phy *wpan_phy, |
66 | struct wpan_dev *wpan_dev, | |
67 | s8 max_frame_retries); | |
c8937a1d AA |
68 | int (*set_lbt_mode)(struct wpan_phy *wpan_phy, |
69 | struct wpan_dev *wpan_dev, bool mode); | |
c91208d8 AA |
70 | int (*set_ackreq_default)(struct wpan_phy *wpan_phy, |
71 | struct wpan_dev *wpan_dev, bool ackreq); | |
ed3557c9 MR |
72 | int (*trigger_scan)(struct wpan_phy *wpan_phy, |
73 | struct cfg802154_scan_request *request); | |
74 | int (*abort_scan)(struct wpan_phy *wpan_phy, | |
75 | struct wpan_dev *wpan_dev); | |
9bc11450 MR |
76 | int (*send_beacons)(struct wpan_phy *wpan_phy, |
77 | struct cfg802154_beacon_request *request); | |
78 | int (*stop_beacons)(struct wpan_phy *wpan_phy, | |
79 | struct wpan_dev *wpan_dev); | |
a26c5fd7 AA |
80 | #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL |
81 | void (*get_llsec_table)(struct wpan_phy *wpan_phy, | |
82 | struct wpan_dev *wpan_dev, | |
83 | struct ieee802154_llsec_table **table); | |
84 | void (*lock_llsec_table)(struct wpan_phy *wpan_phy, | |
85 | struct wpan_dev *wpan_dev); | |
86 | void (*unlock_llsec_table)(struct wpan_phy *wpan_phy, | |
87 | struct wpan_dev *wpan_dev); | |
88 | /* TODO remove locking/get table callbacks, this is part of the | |
89 | * nl802154 interface and should be accessible from ieee802154 layer. | |
90 | */ | |
91 | int (*get_llsec_params)(struct wpan_phy *wpan_phy, | |
92 | struct wpan_dev *wpan_dev, | |
93 | struct ieee802154_llsec_params *params); | |
94 | int (*set_llsec_params)(struct wpan_phy *wpan_phy, | |
95 | struct wpan_dev *wpan_dev, | |
96 | const struct ieee802154_llsec_params *params, | |
97 | int changed); | |
98 | int (*add_llsec_key)(struct wpan_phy *wpan_phy, | |
99 | struct wpan_dev *wpan_dev, | |
100 | const struct ieee802154_llsec_key_id *id, | |
101 | const struct ieee802154_llsec_key *key); | |
102 | int (*del_llsec_key)(struct wpan_phy *wpan_phy, | |
103 | struct wpan_dev *wpan_dev, | |
104 | const struct ieee802154_llsec_key_id *id); | |
105 | int (*add_seclevel)(struct wpan_phy *wpan_phy, | |
106 | struct wpan_dev *wpan_dev, | |
107 | const struct ieee802154_llsec_seclevel *sl); | |
108 | int (*del_seclevel)(struct wpan_phy *wpan_phy, | |
109 | struct wpan_dev *wpan_dev, | |
110 | const struct ieee802154_llsec_seclevel *sl); | |
111 | int (*add_device)(struct wpan_phy *wpan_phy, | |
112 | struct wpan_dev *wpan_dev, | |
113 | const struct ieee802154_llsec_device *dev); | |
114 | int (*del_device)(struct wpan_phy *wpan_phy, | |
115 | struct wpan_dev *wpan_dev, __le64 extended_addr); | |
116 | int (*add_devkey)(struct wpan_phy *wpan_phy, | |
117 | struct wpan_dev *wpan_dev, | |
118 | __le64 extended_addr, | |
119 | const struct ieee802154_llsec_device_key *key); | |
120 | int (*del_devkey)(struct wpan_phy *wpan_phy, | |
121 | struct wpan_dev *wpan_dev, | |
122 | __le64 extended_addr, | |
123 | const struct ieee802154_llsec_device_key *key); | |
124 | #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ | |
a5dd1d72 AA |
125 | }; |
126 | ||
fea3318d AA |
127 | static inline bool |
128 | wpan_phy_supported_bool(bool b, enum nl802154_supported_bool_states st) | |
129 | { | |
130 | switch (st) { | |
131 | case NL802154_SUPPORTED_BOOL_TRUE: | |
132 | return b; | |
133 | case NL802154_SUPPORTED_BOOL_FALSE: | |
134 | return !b; | |
135 | case NL802154_SUPPORTED_BOOL_BOTH: | |
136 | return true; | |
137 | default: | |
138 | WARN_ON(1); | |
139 | } | |
140 | ||
141 | return false; | |
142 | } | |
143 | ||
72f655e4 | 144 | struct wpan_phy_supported { |
fea3318d | 145 | u32 channels[IEEE802154_MAX_PAGE + 1], |
65318680 | 146 | cca_modes, cca_opts, iftypes; |
fea3318d AA |
147 | enum nl802154_supported_bool_states lbt; |
148 | u8 min_minbe, max_minbe, min_maxbe, max_maxbe, | |
149 | min_csma_backoffs, max_csma_backoffs; | |
150 | s8 min_frame_retries, max_frame_retries; | |
151 | size_t tx_powers_size, cca_ed_levels_size; | |
152 | const s32 *tx_powers, *cca_ed_levels; | |
72f655e4 AA |
153 | }; |
154 | ||
7fe9a388 AA |
155 | struct wpan_phy_cca { |
156 | enum nl802154_cca_modes mode; | |
157 | enum nl802154_cca_opts opt; | |
158 | }; | |
159 | ||
791021bf AA |
160 | static inline bool |
161 | wpan_phy_cca_cmp(const struct wpan_phy_cca *a, const struct wpan_phy_cca *b) | |
162 | { | |
163 | if (a->mode != b->mode) | |
164 | return false; | |
165 | ||
166 | if (a->mode == NL802154_CCA_ENERGY_CARRIER) | |
167 | return a->opt == b->opt; | |
168 | ||
169 | return true; | |
170 | } | |
171 | ||
edea8f7c AA |
172 | /** |
173 | * @WPAN_PHY_FLAG_TRANSMIT_POWER: Indicates that transceiver will support | |
174 | * transmit power setting. | |
175 | * @WPAN_PHY_FLAG_CCA_ED_LEVEL: Indicates that transceiver will support cca ed | |
176 | * level setting. | |
177 | * @WPAN_PHY_FLAG_CCA_MODE: Indicates that transceiver will support cca mode | |
178 | * setting. | |
2b13db13 MR |
179 | * @WPAN_PHY_FLAG_STATE_QUEUE_STOPPED: Indicates that the transmit queue was |
180 | * temporarily stopped. | |
edea8f7c AA |
181 | */ |
182 | enum wpan_phy_flags { | |
183 | WPAN_PHY_FLAG_TXPOWER = BIT(1), | |
184 | WPAN_PHY_FLAG_CCA_ED_LEVEL = BIT(2), | |
185 | WPAN_PHY_FLAG_CCA_MODE = BIT(3), | |
2b13db13 | 186 | WPAN_PHY_FLAG_STATE_QUEUE_STOPPED = BIT(4), |
edea8f7c AA |
187 | }; |
188 | ||
2bfb1070 | 189 | struct wpan_phy { |
6322d50d AA |
190 | /* If multiple wpan_phys are registered and you're handed e.g. |
191 | * a regular netdev with assigned ieee802154_ptr, you won't | |
192 | * know whether it points to a wpan_phy your driver has registered | |
193 | * or not. Assign this to something global to your driver to | |
194 | * help determine whether you own this wpan_phy or not. | |
195 | */ | |
196 | const void *privid; | |
197 | ||
2b13db13 | 198 | unsigned long flags; |
edea8f7c | 199 | |
2bfb1070 | 200 | /* |
9b2777d6 | 201 | * This is a PIB according to 802.15.4-2011. |
2bfb1070 DES |
202 | * We do not provide timing-related variables, as they |
203 | * aren't used outside of driver | |
204 | */ | |
205 | u8 current_channel; | |
206 | u8 current_page; | |
72f655e4 | 207 | struct wpan_phy_supported supported; |
e2eb173a | 208 | /* current transmit_power in mBm */ |
1a19cb68 | 209 | s32 transmit_power; |
7fe9a388 | 210 | struct wpan_phy_cca cca; |
dee56d14 AA |
211 | |
212 | __le64 perm_extended_addr; | |
2bfb1070 | 213 | |
32b23550 | 214 | /* current cca ed threshold in mBm */ |
6ca00197 | 215 | s32 cca_ed_level; |
84dda3c6 | 216 | |
61f2dcba AA |
217 | /* PHY depended MAC PIB values */ |
218 | ||
731cddce MR |
219 | /* 802.15.4 acronym: Tdsym in nsec */ |
220 | u32 symbol_duration; | |
61f2dcba AA |
221 | /* lifs and sifs periods timing */ |
222 | u16 lifs_period; | |
223 | u16 sifs_period; | |
224 | ||
2bfb1070 | 225 | struct device dev; |
2bfb1070 | 226 | |
66e5c267 AA |
227 | /* the network namespace this phy lives in currently */ |
228 | possible_net_t _net; | |
229 | ||
20a19d1d MR |
230 | /* Transmission monitoring and control */ |
231 | spinlock_t queue_lock; | |
bde000ae | 232 | atomic_t ongoing_txs; |
20a19d1d | 233 | atomic_t hold_txs; |
f0feb349 | 234 | wait_queue_head_t sync_txq; |
bde000ae | 235 | |
ac8037c3 AA |
236 | /* Current filtering level on reception. |
237 | * Only allowed to be changed if phy is not operational. | |
238 | */ | |
239 | enum ieee802154_filtering_level filtering; | |
240 | ||
53cb2cfa | 241 | char priv[] __aligned(NETDEV_ALIGN); |
2bfb1070 DES |
242 | }; |
243 | ||
66e5c267 AA |
244 | static inline struct net *wpan_phy_net(struct wpan_phy *wpan_phy) |
245 | { | |
246 | return read_pnet(&wpan_phy->_net); | |
247 | } | |
248 | ||
249 | static inline void wpan_phy_net_set(struct wpan_phy *wpan_phy, struct net *net) | |
250 | { | |
251 | write_pnet(&wpan_phy->_net, net); | |
252 | } | |
253 | ||
d2aaf2a0 MR |
254 | static inline bool ieee802154_chan_is_valid(struct wpan_phy *phy, |
255 | u8 page, u8 channel) | |
256 | { | |
257 | if (page > IEEE802154_MAX_PAGE || | |
258 | channel > IEEE802154_MAX_CHANNEL || | |
259 | !(phy->supported.channels[page] & BIT(channel))) | |
260 | return false; | |
261 | ||
262 | return true; | |
263 | } | |
264 | ||
02b2a91c DG |
265 | /** |
266 | * struct ieee802154_addr - IEEE802.15.4 device address | |
267 | * @mode: Address mode from frame header. Can be one of: | |
268 | * - @IEEE802154_ADDR_NONE | |
269 | * - @IEEE802154_ADDR_SHORT | |
270 | * - @IEEE802154_ADDR_LONG | |
271 | * @pan_id: The PAN ID this address belongs to | |
272 | * @short_addr: address if @mode is @IEEE802154_ADDR_SHORT | |
273 | * @extended_addr: address if @mode is @IEEE802154_ADDR_LONG | |
274 | */ | |
838b83d6 AA |
275 | struct ieee802154_addr { |
276 | u8 mode; | |
277 | __le16 pan_id; | |
278 | union { | |
279 | __le16 short_addr; | |
280 | __le64 extended_addr; | |
281 | }; | |
282 | }; | |
283 | ||
51147284 MR |
284 | /** |
285 | * struct ieee802154_coord_desc - Coordinator descriptor | |
286 | * @addr: PAN ID and coordinator address | |
287 | * @page: page this coordinator is using | |
288 | * @channel: channel this coordinator is using | |
289 | * @superframe_spec: SuperFrame specification as received | |
290 | * @link_quality: link quality indicator at which the beacon was received | |
291 | * @gts_permit: the coordinator accepts GTS requests | |
292 | */ | |
293 | struct ieee802154_coord_desc { | |
294 | struct ieee802154_addr addr; | |
295 | u8 page; | |
296 | u8 channel; | |
297 | u16 superframe_spec; | |
298 | u8 link_quality; | |
299 | bool gts_permit; | |
300 | }; | |
301 | ||
ed3557c9 MR |
302 | /** |
303 | * struct cfg802154_scan_request - Scan request | |
304 | * | |
305 | * @type: type of scan to be performed | |
306 | * @page: page on which to perform the scan | |
307 | * @channels: channels in te %page to be scanned | |
308 | * @duration: time spent on each channel, calculated with: | |
309 | * aBaseSuperframeDuration * (2 ^ duration + 1) | |
310 | * @wpan_dev: the wpan device on which to perform the scan | |
311 | * @wpan_phy: the wpan phy on which to perform the scan | |
312 | */ | |
313 | struct cfg802154_scan_request { | |
314 | enum nl802154_scan_types type; | |
315 | u8 page; | |
316 | u32 channels; | |
317 | u8 duration; | |
318 | struct wpan_dev *wpan_dev; | |
319 | struct wpan_phy *wpan_phy; | |
320 | }; | |
321 | ||
9bc11450 MR |
322 | /** |
323 | * struct cfg802154_beacon_request - Beacon request descriptor | |
324 | * | |
325 | * @interval: interval n between sendings, in multiple order of the super frame | |
326 | * duration: aBaseSuperframeDuration * (2^n) unless the interval | |
327 | * order is greater or equal to 15, in this case beacons won't be | |
328 | * passively sent out at a fixed rate but instead inform the device | |
329 | * that it should answer beacon requests as part of active scan | |
330 | * procedures | |
331 | * @wpan_dev: the concerned wpan device | |
332 | * @wpan_phy: the wpan phy this was for | |
333 | */ | |
334 | struct cfg802154_beacon_request { | |
335 | u8 interval; | |
336 | struct wpan_dev *wpan_dev; | |
337 | struct wpan_phy *wpan_phy; | |
338 | }; | |
339 | ||
57588c71 MR |
340 | /** |
341 | * struct cfg802154_mac_pkt - MAC packet descriptor (beacon/command) | |
342 | * @node: MAC packets to process list member | |
343 | * @skb: the received sk_buff | |
344 | * @sdata: the interface on which @skb was received | |
345 | * @page: page configuration when @skb was received | |
346 | * @channel: channel configuration when @skb was received | |
347 | */ | |
348 | struct cfg802154_mac_pkt { | |
349 | struct list_head node; | |
350 | struct sk_buff *skb; | |
351 | struct ieee802154_sub_if_data *sdata; | |
352 | u8 page; | |
353 | u8 channel; | |
354 | }; | |
355 | ||
a26c5fd7 AA |
356 | struct ieee802154_llsec_key_id { |
357 | u8 mode; | |
358 | u8 id; | |
359 | union { | |
360 | struct ieee802154_addr device_addr; | |
361 | __le32 short_source; | |
362 | __le64 extended_source; | |
363 | }; | |
364 | }; | |
365 | ||
366 | #define IEEE802154_LLSEC_KEY_SIZE 16 | |
367 | ||
368 | struct ieee802154_llsec_key { | |
369 | u8 frame_types; | |
370 | u32 cmd_frame_ids; | |
371 | /* TODO replace with NL802154_KEY_SIZE */ | |
372 | u8 key[IEEE802154_LLSEC_KEY_SIZE]; | |
373 | }; | |
374 | ||
375 | struct ieee802154_llsec_key_entry { | |
376 | struct list_head list; | |
377 | ||
378 | struct ieee802154_llsec_key_id id; | |
379 | struct ieee802154_llsec_key *key; | |
380 | }; | |
381 | ||
382 | struct ieee802154_llsec_params { | |
383 | bool enabled; | |
384 | ||
385 | __be32 frame_counter; | |
386 | u8 out_level; | |
387 | struct ieee802154_llsec_key_id out_key; | |
388 | ||
389 | __le64 default_key_source; | |
390 | ||
391 | __le16 pan_id; | |
392 | __le64 hwaddr; | |
393 | __le64 coord_hwaddr; | |
394 | __le16 coord_shortaddr; | |
395 | }; | |
396 | ||
397 | struct ieee802154_llsec_table { | |
398 | struct list_head keys; | |
399 | struct list_head devices; | |
400 | struct list_head security_levels; | |
401 | }; | |
402 | ||
403 | struct ieee802154_llsec_seclevel { | |
404 | struct list_head list; | |
405 | ||
406 | u8 frame_type; | |
407 | u8 cmd_frame_id; | |
408 | bool device_override; | |
409 | u32 sec_levels; | |
410 | }; | |
411 | ||
412 | struct ieee802154_llsec_device { | |
413 | struct list_head list; | |
414 | ||
415 | __le16 pan_id; | |
416 | __le16 short_addr; | |
417 | __le64 hwaddr; | |
418 | u32 frame_counter; | |
419 | bool seclevel_exempt; | |
420 | ||
421 | u8 key_mode; | |
422 | struct list_head keys; | |
423 | }; | |
424 | ||
425 | struct ieee802154_llsec_device_key { | |
426 | struct list_head list; | |
427 | ||
428 | struct ieee802154_llsec_key_id key_id; | |
429 | u32 frame_counter; | |
430 | }; | |
431 | ||
838b83d6 AA |
432 | struct wpan_dev_header_ops { |
433 | /* TODO create callback currently assumes ieee802154_mac_cb inside | |
434 | * skb->cb. This should be changed to give these information as | |
435 | * parameter. | |
436 | */ | |
437 | int (*create)(struct sk_buff *skb, struct net_device *dev, | |
438 | const struct ieee802154_addr *daddr, | |
439 | const struct ieee802154_addr *saddr, | |
440 | unsigned int len); | |
441 | }; | |
442 | ||
d5ae67ba AA |
443 | struct wpan_dev { |
444 | struct wpan_phy *wpan_phy; | |
190ac1ca | 445 | int iftype; |
863e88f2 | 446 | |
fcf39e6e AA |
447 | /* the remainder of this struct should be private to cfg802154 */ |
448 | struct list_head list; | |
449 | struct net_device *netdev; | |
450 | ||
838b83d6 AA |
451 | const struct wpan_dev_header_ops *header_ops; |
452 | ||
51e0e5d8 AA |
453 | /* lowpan interface, set when the wpan_dev belongs to one lowpan_dev */ |
454 | struct net_device *lowpan_dev; | |
455 | ||
fcf39e6e AA |
456 | u32 identifier; |
457 | ||
863e88f2 AA |
458 | /* MAC PIB */ |
459 | __le16 pan_id; | |
460 | __le16 short_addr; | |
461 | __le64 extended_addr; | |
462 | ||
463 | /* MAC BSN field */ | |
344f8c11 | 464 | atomic_t bsn; |
863e88f2 | 465 | /* MAC DSN field */ |
344f8c11 | 466 | atomic_t dsn; |
863e88f2 AA |
467 | |
468 | u8 min_be; | |
469 | u8 max_be; | |
470 | u8 csma_retries; | |
471 | s8 frame_retries; | |
472 | ||
473 | bool lbt; | |
474 | ||
c91208d8 AA |
475 | /* fallback for acknowledgment bit setting */ |
476 | bool ackreq; | |
d5ae67ba AA |
477 | }; |
478 | ||
42723448 DES |
479 | #define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) |
480 | ||
c304eddc | 481 | #if IS_ENABLED(CONFIG_IEEE802154) || IS_ENABLED(CONFIG_6LOWPAN) |
838b83d6 AA |
482 | static inline int |
483 | wpan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |
484 | const struct ieee802154_addr *daddr, | |
485 | const struct ieee802154_addr *saddr, | |
486 | unsigned int len) | |
487 | { | |
488 | struct wpan_dev *wpan_dev = dev->ieee802154_ptr; | |
489 | ||
490 | return wpan_dev->header_ops->create(skb, dev, daddr, saddr, len); | |
491 | } | |
c304eddc | 492 | #endif |
838b83d6 | 493 | |
a5dd1d72 | 494 | struct wpan_phy * |
f601379f | 495 | wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size); |
e9cf356c DES |
496 | static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) |
497 | { | |
498 | phy->dev.parent = dev; | |
499 | } | |
e72740d0 | 500 | |
e9cf356c | 501 | int wpan_phy_register(struct wpan_phy *phy); |
2bfb1070 DES |
502 | void wpan_phy_unregister(struct wpan_phy *phy); |
503 | void wpan_phy_free(struct wpan_phy *phy); | |
1c889f4d DES |
504 | /* Same semantics as for class_for_each_device */ |
505 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); | |
2bfb1070 DES |
506 | |
507 | static inline void *wpan_phy_priv(struct wpan_phy *phy) | |
508 | { | |
509 | BUG_ON(!phy); | |
510 | return &phy->priv; | |
511 | } | |
512 | ||
513 | struct wpan_phy *wpan_phy_find(const char *str); | |
69d9ab96 DES |
514 | |
515 | static inline void wpan_phy_put(struct wpan_phy *phy) | |
516 | { | |
517 | put_device(&phy->dev); | |
518 | } | |
519 | ||
2bfb1070 DES |
520 | static inline const char *wpan_phy_name(struct wpan_phy *phy) |
521 | { | |
522 | return dev_name(&phy->dev); | |
523 | } | |
5ad60d36 | 524 | |
5755cd4d MR |
525 | void ieee802154_configure_durations(struct wpan_phy *phy, |
526 | unsigned int page, unsigned int channel); | |
781830c8 | 527 | |
5ad60d36 | 528 | #endif /* __NET_CFG802154_H */ |