sfp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef SFP_H
  2. #define SFP_H
  3. #include <linux/ethtool.h>
  4. #include <linux/sfp.h>
  5. struct sfp;
  6. struct sfp_quirk {
  7. const char *vendor;
  8. const char *part;
  9. void (*modes)(const struct sfp_eeprom_id *id, unsigned long *modes,
  10. unsigned long *interfaces);
  11. void (*fixup)(struct sfp *sfp);
  12. };
  13. struct sfp_socket_ops {
  14. void (*attach)(struct sfp *sfp);
  15. void (*detach)(struct sfp *sfp);
  16. void (*start)(struct sfp *sfp);
  17. void (*stop)(struct sfp *sfp);
  18. int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo);
  19. int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee,
  20. u8 *data);
  21. int (*module_eeprom_by_page)(struct sfp *sfp,
  22. const struct ethtool_module_eeprom *page,
  23. struct netlink_ext_ack *extack);
  24. };
  25. int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);
  26. void sfp_remove_phy(struct sfp_bus *bus);
  27. void sfp_link_up(struct sfp_bus *bus);
  28. void sfp_link_down(struct sfp_bus *bus);
  29. int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
  30. const struct sfp_quirk *quirk);
  31. void sfp_module_remove(struct sfp_bus *bus);
  32. int sfp_module_start(struct sfp_bus *bus);
  33. void sfp_module_stop(struct sfp_bus *bus);
  34. int sfp_link_configure(struct sfp_bus *bus, const struct sfp_eeprom_id *id);
  35. struct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp,
  36. const struct sfp_socket_ops *ops);
  37. void sfp_unregister_socket(struct sfp_bus *bus);
  38. #endif