Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_ERRQUEUE_H
0003 #define _UAPI_LINUX_ERRQUEUE_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/time_types.h>
0007 
0008 /* RFC 4884: return offset to extension struct + validation */
0009 struct sock_ee_data_rfc4884 {
0010     __u16   len;
0011     __u8    flags;
0012     __u8    reserved;
0013 };
0014 
0015 struct sock_extended_err {
0016     __u32   ee_errno;   
0017     __u8    ee_origin;
0018     __u8    ee_type;
0019     __u8    ee_code;
0020     __u8    ee_pad;
0021     __u32   ee_info;
0022     union   {
0023         __u32   ee_data;
0024         struct sock_ee_data_rfc4884 ee_rfc4884;
0025     };
0026 };
0027 
0028 #define SO_EE_ORIGIN_NONE   0
0029 #define SO_EE_ORIGIN_LOCAL  1
0030 #define SO_EE_ORIGIN_ICMP   2
0031 #define SO_EE_ORIGIN_ICMP6  3
0032 #define SO_EE_ORIGIN_TXSTATUS   4
0033 #define SO_EE_ORIGIN_ZEROCOPY   5
0034 #define SO_EE_ORIGIN_TXTIME 6
0035 #define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
0036 
0037 #define SO_EE_OFFENDER(ee)  ((struct sockaddr*)((ee)+1))
0038 
0039 #define SO_EE_CODE_ZEROCOPY_COPIED  1
0040 
0041 #define SO_EE_CODE_TXTIME_INVALID_PARAM 1
0042 #define SO_EE_CODE_TXTIME_MISSED    2
0043 
0044 #define SO_EE_RFC4884_FLAG_INVALID  1
0045 
0046 /**
0047  *  struct scm_timestamping - timestamps exposed through cmsg
0048  *
0049  *  The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
0050  *  communicate network timestamps by passing this struct in a cmsg with
0051  *  recvmsg(). See Documentation/networking/timestamping.rst for details.
0052  *  User space sees a timespec definition that matches either
0053  *  __kernel_timespec or __kernel_old_timespec, in the kernel we
0054  *  require two structure definitions to provide both.
0055  */
0056 struct scm_timestamping {
0057 #ifdef __KERNEL__
0058     struct __kernel_old_timespec ts[3];
0059 #else
0060     struct timespec ts[3];
0061 #endif
0062 };
0063 
0064 struct scm_timestamping64 {
0065     struct __kernel_timespec ts[3];
0066 };
0067 
0068 /* The type of scm_timestamping, passed in sock_extended_err ee_info.
0069  * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0]
0070  * is zero, then this is a hardware timestamp and recorded in ts[2].
0071  */
0072 enum {
0073     SCM_TSTAMP_SND,     /* driver passed skb to NIC, or HW */
0074     SCM_TSTAMP_SCHED,   /* data entered the packet scheduler */
0075     SCM_TSTAMP_ACK,     /* data acknowledged by peer */
0076 };
0077 
0078 #endif /* _UAPI_LINUX_ERRQUEUE_H */