if_hsr.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_IF_HSR_H_
  3. #define _LINUX_IF_HSR_H_
  4. #include <linux/types.h>
  5. struct net_device;
  6. /* used to differentiate various protocols */
  7. enum hsr_version {
  8. HSR_V0 = 0,
  9. HSR_V1,
  10. PRP_V1,
  11. };
  12. /* HSR Tag.
  13. * As defined in IEC-62439-3:2010, the HSR tag is really { ethertype = 0x88FB,
  14. * path, LSDU_size, sequence Nr }. But we let eth_header() create { h_dest,
  15. * h_source, h_proto = 0x88FB }, and add { path, LSDU_size, sequence Nr,
  16. * encapsulated protocol } instead.
  17. *
  18. * Field names as defined in the IEC:2010 standard for HSR.
  19. */
  20. struct hsr_tag {
  21. __be16 path_and_LSDU_size;
  22. __be16 sequence_nr;
  23. __be16 encap_proto;
  24. } __packed;
  25. #define HSR_HLEN 6
  26. #if IS_ENABLED(CONFIG_HSR)
  27. extern bool is_hsr_master(struct net_device *dev);
  28. extern int hsr_get_version(struct net_device *dev, enum hsr_version *ver);
  29. #else
  30. static inline bool is_hsr_master(struct net_device *dev)
  31. {
  32. return false;
  33. }
  34. static inline int hsr_get_version(struct net_device *dev,
  35. enum hsr_version *ver)
  36. {
  37. return -EINVAL;
  38. }
  39. #endif /* CONFIG_HSR */
  40. #endif /*_LINUX_IF_HSR_H_*/