erspan.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * ERSPAN Tunnel Metadata
  4. *
  5. * Copyright (c) 2018 VMware
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2
  9. * as published by the Free Software Foundation.
  10. *
  11. * Userspace API for metadata mode ERSPAN tunnel
  12. */
  13. #ifndef _UAPI_ERSPAN_H
  14. #define _UAPI_ERSPAN_H
  15. #include <linux/types.h> /* For __beXX in userspace */
  16. #include <asm/byteorder.h>
  17. /* ERSPAN version 2 metadata header */
  18. struct erspan_md2 {
  19. __be32 timestamp;
  20. __be16 sgt; /* security group tag */
  21. #if defined(__LITTLE_ENDIAN_BITFIELD)
  22. __u8 hwid_upper:2,
  23. ft:5,
  24. p:1;
  25. __u8 o:1,
  26. gra:2,
  27. dir:1,
  28. hwid:4;
  29. #elif defined(__BIG_ENDIAN_BITFIELD)
  30. __u8 p:1,
  31. ft:5,
  32. hwid_upper:2;
  33. __u8 hwid:4,
  34. dir:1,
  35. gra:2,
  36. o:1;
  37. #else
  38. #error "Please fix <asm/byteorder.h>"
  39. #endif
  40. };
  41. struct erspan_metadata {
  42. int version;
  43. union {
  44. __be32 index; /* Version 1 (type II)*/
  45. struct erspan_md2 md2; /* Version 2 (type III) */
  46. } u;
  47. };
  48. #endif /* _UAPI_ERSPAN_H */