Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / net / ieee802154 / core.h
blob1c19f575d574d051784ac6070c6b9e651c57f4cd
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __IEEE802154_CORE_H
3 #define __IEEE802154_CORE_H
5 #include <net/cfg802154.h>
7 struct cfg802154_registered_device {
8 const struct cfg802154_ops *ops;
9 struct list_head list;
11 /* wpan_phy index, internal only */
12 int wpan_phy_idx;
14 /* also protected by devlist_mtx */
15 int opencount;
16 wait_queue_head_t dev_wait;
18 /* protected by RTNL only */
19 int num_running_ifaces;
21 /* associated wpan interfaces, protected by rtnl or RCU */
22 struct list_head wpan_dev_list;
23 int devlist_generation, wpan_dev_id;
25 /* must be last because of the way we do wpan_phy_priv(),
26 * and it should at least be aligned to NETDEV_ALIGN
28 struct wpan_phy wpan_phy __aligned(NETDEV_ALIGN);
31 static inline struct cfg802154_registered_device *
32 wpan_phy_to_rdev(struct wpan_phy *wpan_phy)
34 BUG_ON(!wpan_phy);
35 return container_of(wpan_phy, struct cfg802154_registered_device,
36 wpan_phy);
39 extern struct list_head cfg802154_rdev_list;
40 extern int cfg802154_rdev_list_generation;
42 int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
43 struct net *net);
44 /* free object */
45 void cfg802154_dev_free(struct cfg802154_registered_device *rdev);
46 struct cfg802154_registered_device *
47 cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx);
48 struct wpan_phy *wpan_phy_idx_to_wpan_phy(int wpan_phy_idx);
50 #endif /* __IEEE802154_CORE_H */