core.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __IEEE802154_CORE_H
  2. #define __IEEE802154_CORE_H
  3. #include <net/cfg802154.h>
  4. struct cfg802154_registered_device {
  5. const struct cfg802154_ops *ops;
  6. struct list_head list;
  7. /* wpan_phy index, internal only */
  8. int wpan_phy_idx;
  9. /* also protected by devlist_mtx */
  10. int opencount;
  11. wait_queue_head_t dev_wait;
  12. /* protected by RTNL only */
  13. int num_running_ifaces;
  14. /* associated wpan interfaces, protected by rtnl or RCU */
  15. struct list_head wpan_dev_list;
  16. int devlist_generation, wpan_dev_id;
  17. /* must be last because of the way we do wpan_phy_priv(),
  18. * and it should at least be aligned to NETDEV_ALIGN
  19. */
  20. struct wpan_phy wpan_phy __aligned(NETDEV_ALIGN);
  21. };
  22. static inline struct cfg802154_registered_device *
  23. wpan_phy_to_rdev(struct wpan_phy *wpan_phy)
  24. {
  25. BUG_ON(!wpan_phy);
  26. return container_of(wpan_phy, struct cfg802154_registered_device,
  27. wpan_phy);
  28. }
  29. extern struct list_head cfg802154_rdev_list;
  30. extern int cfg802154_rdev_list_generation;
  31. int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
  32. struct net *net);
  33. /* free object */
  34. void cfg802154_dev_free(struct cfg802154_registered_device *rdev);
  35. struct cfg802154_registered_device *
  36. cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx);
  37. struct wpan_phy *wpan_phy_idx_to_wpan_phy(int wpan_phy_idx);
  38. #endif /* __IEEE802154_CORE_H */