xref: /linux-6.15/include/uapi/linux/errqueue.h (revision 52267790)
1607ca46eSDavid Howells #ifndef _UAPI_LINUX_ERRQUEUE_H
2607ca46eSDavid Howells #define _UAPI_LINUX_ERRQUEUE_H
3607ca46eSDavid Howells 
4607ca46eSDavid Howells #include <linux/types.h>
5607ca46eSDavid Howells 
6607ca46eSDavid Howells struct sock_extended_err {
7607ca46eSDavid Howells 	__u32	ee_errno;
8607ca46eSDavid Howells 	__u8	ee_origin;
9607ca46eSDavid Howells 	__u8	ee_type;
10607ca46eSDavid Howells 	__u8	ee_code;
11607ca46eSDavid Howells 	__u8	ee_pad;
12607ca46eSDavid Howells 	__u32   ee_info;
13607ca46eSDavid Howells 	__u32   ee_data;
14607ca46eSDavid Howells };
15607ca46eSDavid Howells 
16607ca46eSDavid Howells #define SO_EE_ORIGIN_NONE	0
17607ca46eSDavid Howells #define SO_EE_ORIGIN_LOCAL	1
18607ca46eSDavid Howells #define SO_EE_ORIGIN_ICMP	2
19607ca46eSDavid Howells #define SO_EE_ORIGIN_ICMP6	3
20607ca46eSDavid Howells #define SO_EE_ORIGIN_TXSTATUS	4
21*52267790SWillem de Bruijn #define SO_EE_ORIGIN_ZEROCOPY	5
22607ca46eSDavid Howells #define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
23607ca46eSDavid Howells 
24607ca46eSDavid Howells #define SO_EE_OFFENDER(ee)	((struct sockaddr*)((ee)+1))
25607ca46eSDavid Howells 
26*52267790SWillem de Bruijn #define SO_EE_CODE_ZEROCOPY_COPIED	1
27*52267790SWillem de Bruijn 
28f24b9be5SWillem de Bruijn /**
29f24b9be5SWillem de Bruijn  *	struct scm_timestamping - timestamps exposed through cmsg
30f24b9be5SWillem de Bruijn  *
31f24b9be5SWillem de Bruijn  *	The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
32f24b9be5SWillem de Bruijn  *	communicate network timestamps by passing this struct in a cmsg with
33f24b9be5SWillem de Bruijn  *	recvmsg(). See Documentation/networking/timestamping.txt for details.
34f24b9be5SWillem de Bruijn  */
35f24b9be5SWillem de Bruijn struct scm_timestamping {
36f24b9be5SWillem de Bruijn 	struct timespec ts[3];
37f24b9be5SWillem de Bruijn };
38f24b9be5SWillem de Bruijn 
39f24b9be5SWillem de Bruijn /* The type of scm_timestamping, passed in sock_extended_err ee_info.
40f24b9be5SWillem de Bruijn  * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0]
41f24b9be5SWillem de Bruijn  * is zero, then this is a hardware timestamp and recorded in ts[2].
42f24b9be5SWillem de Bruijn  */
43f24b9be5SWillem de Bruijn enum {
44f24b9be5SWillem de Bruijn 	SCM_TSTAMP_SND,		/* driver passed skb to NIC, or HW */
45e7fd2885SWillem de Bruijn 	SCM_TSTAMP_SCHED,	/* data entered the packet scheduler */
46e1c8a607SWillem de Bruijn 	SCM_TSTAMP_ACK,		/* data acknowledged by peer */
47f24b9be5SWillem de Bruijn };
48607ca46eSDavid Howells 
49607ca46eSDavid Howells #endif /* _UAPI_LINUX_ERRQUEUE_H */
50