core.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. /* free object */
  32. void cfg802154_dev_free(struct cfg802154_registered_device *rdev);
  33. struct cfg802154_registered_device *
  34. cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx);
  35. #endif /* __IEEE802154_CORE_H */