Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


net_tstamp.h
001: /*
002:  * Userspace API for hardware time stamping of network packets
003:  *
004:  * Copyright (C) 2008,2009 Intel Corporation
005:  * Author: Patrick Ohly <patrick.ohly@intel.com>
006:  *
007:  */
008: 
009: #ifndef _NET_TIMESTAMPING_H
010: #define _NET_TIMESTAMPING_H
011: 
012: #include <linux/socket.h>   /* for SO_TIMESTAMPING */
013: 
014: /* SO_TIMESTAMPING gets an integer bit field comprised of these values */
015: enum {
016:         SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
017:         SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
018:         SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
019:         SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
020:         SOF_TIMESTAMPING_SOFTWARE = (1<<4),
021:         SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
022:         SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
023:         SOF_TIMESTAMPING_MASK =
024:         (SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
025:         SOF_TIMESTAMPING_RAW_HARDWARE
026: };
027: 
028: /**
029:  * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
030:  *
031:  * @flags:      no flags defined right now, must be zero
032:  * @tx_type:    one of HWTSTAMP_TX_*
033:  * @rx_type:    one of one of HWTSTAMP_FILTER_*
034:  *
035:  * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
036:  * this structure. dev_ifsioc() in the kernel takes care of the
037:  * translation between 32 bit userspace and 64 bit kernel. The
038:  * structure is intentionally chosen so that it has the same layout on
039:  * 32 and 64 bit systems, don't break this!
040:  */
041: struct hwtstamp_config {
042:         int flags;
043:         int tx_type;
044:         int rx_filter;
045: };
046: 
047: /* possible values for hwtstamp_config->tx_type */
048: enum hwtstamp_tx_types {
049:         /*
050:          * No outgoing packet will need hardware time stamping;
051:          * should a packet arrive which asks for it, no hardware
052:          * time stamping will be done.
053:          */
054:         HWTSTAMP_TX_OFF,
055: 
056:         /*
057:          * Enables hardware time stamping for outgoing packets;
058:          * the sender of the packet decides which are to be
059:          * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
060:          * before sending the packet.
061:          */
062:         HWTSTAMP_TX_ON,
063: 
064:         /*
065:          * Enables time stamping for outgoing packets just as
066:          * HWTSTAMP_TX_ON does, but also enables time stamp insertion
067:          * directly into Sync packets. In this case, transmitted Sync
068:          * packets will not received a time stamp via the socket error
069:          * queue.
070:          */
071:         HWTSTAMP_TX_ONESTEP_SYNC,
072: };
073: 
074: /* possible values for hwtstamp_config->rx_filter */
075: enum hwtstamp_rx_filters {
076:         /* time stamp no incoming packet at all */
077:         HWTSTAMP_FILTER_NONE,
078: 
079:         /* time stamp any incoming packet */
080:         HWTSTAMP_FILTER_ALL,
081: 
082:         /* return value: time stamp all packets requested plus some others */
083:         HWTSTAMP_FILTER_SOME,
084: 
085:         /* PTP v1, UDP, any kind of event packet */
086:         HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
087:         /* PTP v1, UDP, Sync packet */
088:         HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
089:         /* PTP v1, UDP, Delay_req packet */
090:         HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
091:         /* PTP v2, UDP, any kind of event packet */
092:         HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
093:         /* PTP v2, UDP, Sync packet */
094:         HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
095:         /* PTP v2, UDP, Delay_req packet */
096:         HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
097: 
098:         /* 802.AS1, Ethernet, any kind of event packet */
099:         HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
100:         /* 802.AS1, Ethernet, Sync packet */
101:         HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
102:         /* 802.AS1, Ethernet, Delay_req packet */
103:         HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
104: 
105:         /* PTP v2/802.AS1, any layer, any kind of event packet */
106:         HWTSTAMP_FILTER_PTP_V2_EVENT,
107:         /* PTP v2/802.AS1, any layer, Sync packet */
108:         HWTSTAMP_FILTER_PTP_V2_SYNC,
109:         /* PTP v2/802.AS1, any layer, Delay_req packet */
110:         HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
111: };
112: 
113: #endif /* _NET_TIMESTAMPING_H */
114: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/