Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __IEEE802154_CORE_H
0003 #define __IEEE802154_CORE_H
0004 
0005 #include <net/cfg802154.h>
0006 
0007 struct cfg802154_registered_device {
0008     const struct cfg802154_ops *ops;
0009     struct list_head list;
0010 
0011     /* wpan_phy index, internal only */
0012     int wpan_phy_idx;
0013 
0014     /* also protected by devlist_mtx */
0015     int opencount;
0016     wait_queue_head_t dev_wait;
0017 
0018     /* protected by RTNL only */
0019     int num_running_ifaces;
0020 
0021     /* associated wpan interfaces, protected by rtnl or RCU */
0022     struct list_head wpan_dev_list;
0023     int devlist_generation, wpan_dev_id;
0024 
0025     /* must be last because of the way we do wpan_phy_priv(),
0026      * and it should at least be aligned to NETDEV_ALIGN
0027      */
0028     struct wpan_phy wpan_phy __aligned(NETDEV_ALIGN);
0029 };
0030 
0031 static inline struct cfg802154_registered_device *
0032 wpan_phy_to_rdev(struct wpan_phy *wpan_phy)
0033 {
0034     BUG_ON(!wpan_phy);
0035     return container_of(wpan_phy, struct cfg802154_registered_device,
0036                 wpan_phy);
0037 }
0038 
0039 extern struct list_head cfg802154_rdev_list;
0040 extern int cfg802154_rdev_list_generation;
0041 
0042 int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
0043                struct net *net);
0044 /* free object */
0045 void cfg802154_dev_free(struct cfg802154_registered_device *rdev);
0046 struct cfg802154_registered_device *
0047 cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx);
0048 struct wpan_phy *wpan_phy_idx_to_wpan_phy(int wpan_phy_idx);
0049 
0050 #endif /* __IEEE802154_CORE_H */