errqueue.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _LINUX_ERRQUEUE_H
  3. #define _LINUX_ERRQUEUE_H
  4. #include <linux/types.h>
  5. #include <linux/time_types.h>
  6. /* RFC 4884: return offset to extension struct + validation */
  7. struct sock_ee_data_rfc4884 {
  8. __u16 len;
  9. __u8 flags;
  10. __u8 reserved;
  11. };
  12. struct sock_extended_err {
  13. __u32 ee_errno;
  14. __u8 ee_origin;
  15. __u8 ee_type;
  16. __u8 ee_code;
  17. __u8 ee_pad;
  18. __u32 ee_info;
  19. union {
  20. __u32 ee_data;
  21. struct sock_ee_data_rfc4884 ee_rfc4884;
  22. };
  23. };
  24. #define SO_EE_ORIGIN_NONE 0
  25. #define SO_EE_ORIGIN_LOCAL 1
  26. #define SO_EE_ORIGIN_ICMP 2
  27. #define SO_EE_ORIGIN_ICMP6 3
  28. #define SO_EE_ORIGIN_TXSTATUS 4
  29. #define SO_EE_ORIGIN_ZEROCOPY 5
  30. #define SO_EE_ORIGIN_TXTIME 6
  31. #define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
  32. #define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
  33. #define SO_EE_CODE_ZEROCOPY_COPIED 1
  34. #define SO_EE_CODE_TXTIME_INVALID_PARAM 1
  35. #define SO_EE_CODE_TXTIME_MISSED 2
  36. #define SO_EE_RFC4884_FLAG_INVALID 1
  37. /**
  38. * struct scm_timestamping - timestamps exposed through cmsg
  39. *
  40. * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
  41. * communicate network timestamps by passing this struct in a cmsg with
  42. * recvmsg(). See Documentation/networking/timestamping.rst for details.
  43. * User space sees a timespec definition that matches either
  44. * __kernel_timespec or __kernel_old_timespec, in the kernel we
  45. * require two structure definitions to provide both.
  46. */
  47. struct scm_timestamping {
  48. struct timespec ts[3];
  49. };
  50. struct scm_timestamping64 {
  51. struct __kernel_timespec ts[3];
  52. };
  53. /* The type of scm_timestamping, passed in sock_extended_err ee_info.
  54. * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0]
  55. * is zero, then this is a hardware timestamp and recorded in ts[2].
  56. */
  57. enum {
  58. SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */
  59. SCM_TSTAMP_SCHED, /* data entered the packet scheduler */
  60. SCM_TSTAMP_ACK, /* data acknowledged by peer */
  61. };
  62. #endif /* _LINUX_ERRQUEUE_H */