Alexander Aring | a5dd1d7 | 2014-11-02 04:18:35 +0100 | [diff] [blame] | 1 | #ifndef __IEEE802154_CORE_H |
| 2 | #define __IEEE802154_CORE_H |
| 3 | |
| 4 | #include <net/cfg802154.h> |
| 5 | |
| 6 | struct cfg802154_registered_device { |
| 7 | const struct cfg802154_ops *ops; |
Alexander Aring | f3ada64 | 2014-11-09 08:36:48 +0100 | [diff] [blame] | 8 | struct list_head list; |
Alexander Aring | a5dd1d7 | 2014-11-02 04:18:35 +0100 | [diff] [blame] | 9 | |
Alexander Aring | 53f9ee61 | 2014-11-05 20:51:12 +0100 | [diff] [blame] | 10 | /* wpan_phy index, internal only */ |
| 11 | int wpan_phy_idx; |
| 12 | |
Alexander Aring | fcf39e6 | 2014-11-09 08:36:50 +0100 | [diff] [blame] | 13 | /* also protected by devlist_mtx */ |
| 14 | int opencount; |
| 15 | wait_queue_head_t dev_wait; |
| 16 | |
| 17 | /* protected by RTNL only */ |
| 18 | int num_running_ifaces; |
| 19 | |
| 20 | /* associated wpan interfaces, protected by rtnl or RCU */ |
| 21 | struct list_head wpan_dev_list; |
| 22 | int devlist_generation, wpan_dev_id; |
| 23 | |
Alexander Aring | a5dd1d7 | 2014-11-02 04:18:35 +0100 | [diff] [blame] | 24 | /* must be last because of the way we do wpan_phy_priv(), |
| 25 | * and it should at least be aligned to NETDEV_ALIGN |
| 26 | */ |
| 27 | struct wpan_phy wpan_phy __aligned(NETDEV_ALIGN); |
| 28 | }; |
| 29 | |
Alexander Aring | ea4dcd3 | 2014-11-02 04:18:37 +0100 | [diff] [blame] | 30 | static inline struct cfg802154_registered_device * |
| 31 | wpan_phy_to_rdev(struct wpan_phy *wpan_phy) |
| 32 | { |
| 33 | BUG_ON(!wpan_phy); |
| 34 | return container_of(wpan_phy, struct cfg802154_registered_device, |
| 35 | wpan_phy); |
| 36 | } |
| 37 | |
Alexander Aring | 79fe1a2 | 2014-11-09 08:36:53 +0100 | [diff] [blame] | 38 | extern struct list_head cfg802154_rdev_list; |
Alexander Aring | ca20ce20 | 2014-11-09 08:36:54 +0100 | [diff] [blame] | 39 | extern int cfg802154_rdev_list_generation; |
Alexander Aring | 79fe1a2 | 2014-11-09 08:36:53 +0100 | [diff] [blame] | 40 | |
Alexander Aring | 66e5c26 | 2016-06-18 10:45:34 +0200 | [diff] [blame] | 41 | int cfg802154_switch_netns(struct cfg802154_registered_device *rdev, |
| 42 | struct net *net); |
Alexander Aring | a5dd1d7 | 2014-11-02 04:18:35 +0100 | [diff] [blame] | 43 | /* free object */ |
| 44 | void cfg802154_dev_free(struct cfg802154_registered_device *rdev); |
Alexander Aring | 79fe1a2 | 2014-11-09 08:36:53 +0100 | [diff] [blame] | 45 | struct cfg802154_registered_device * |
| 46 | cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx); |
Alexander Aring | a26c5fd | 2015-09-28 09:00:25 +0200 | [diff] [blame] | 47 | struct wpan_phy *wpan_phy_idx_to_wpan_phy(int wpan_phy_idx); |
Alexander Aring | a5dd1d7 | 2014-11-02 04:18:35 +0100 | [diff] [blame] | 48 | |
| 49 | #endif /* __IEEE802154_CORE_H */ |