ncsi.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef __NET_NCSI_H
  2. #define __NET_NCSI_H
  3. /*
  4. * The NCSI device states seen from external. More NCSI device states are
  5. * only visible internally (in net/ncsi/internal.h). When the NCSI device
  6. * is registered, it's in ncsi_dev_state_registered state. The state
  7. * ncsi_dev_state_start is used to drive to choose active package and
  8. * channel. After that, its state is changed to ncsi_dev_state_functional.
  9. *
  10. * The state ncsi_dev_state_stop helps to shut down the currently active
  11. * package and channel while ncsi_dev_state_config helps to reconfigure
  12. * them.
  13. */
  14. enum {
  15. ncsi_dev_state_registered = 0x0000,
  16. ncsi_dev_state_functional = 0x0100,
  17. ncsi_dev_state_probe = 0x0200,
  18. ncsi_dev_state_config = 0x0300,
  19. ncsi_dev_state_suspend = 0x0400,
  20. };
  21. struct ncsi_dev {
  22. int state;
  23. int link_up;
  24. struct net_device *dev;
  25. void (*handler)(struct ncsi_dev *ndev);
  26. };
  27. #ifdef CONFIG_NET_NCSI
  28. struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
  29. void (*notifier)(struct ncsi_dev *nd));
  30. int ncsi_start_dev(struct ncsi_dev *nd);
  31. void ncsi_stop_dev(struct ncsi_dev *nd);
  32. void ncsi_unregister_dev(struct ncsi_dev *nd);
  33. #else /* !CONFIG_NET_NCSI */
  34. static inline struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
  35. void (*notifier)(struct ncsi_dev *nd))
  36. {
  37. return NULL;
  38. }
  39. static inline int ncsi_start_dev(struct ncsi_dev *nd)
  40. {
  41. return -ENOTTY;
  42. }
  43. static void ncsi_stop_dev(struct ncsi_dev *nd)
  44. {
  45. }
  46. static inline void ncsi_unregister_dev(struct ncsi_dev *nd)
  47. {
  48. }
  49. #endif /* CONFIG_NET_NCSI */
  50. #endif /* __NET_NCSI_H */