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