All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: davem@davemloft.net, linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org
Subject: [PATCH v3 8/8] socket: Update timestamping Documentation
Date: Mon,  7 Jan 2019 19:26:57 -0800	[thread overview]
Message-ID: <20190108032657.8331-9-deepa.kernel@gmail.com> (raw)
In-Reply-To: <20190108032657.8331-1-deepa.kernel@gmail.com>

With the new y2038 safe timestamping options added, update the
documentation to reflect the changes.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Willem de Bruijn <willemb@google.com>
---
 Documentation/networking/timestamping.txt | 43 ++++++++++++++++++++---
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt
index 1be0b6f9e0cb..67e4ab3cdb86 100644
--- a/Documentation/networking/timestamping.txt
+++ b/Documentation/networking/timestamping.txt
@@ -6,11 +6,21 @@ The interfaces for receiving network packages timestamps are:
 * SO_TIMESTAMP
   Generates a timestamp for each incoming packet in (not necessarily
   monotonic) system time. Reports the timestamp via recvmsg() in a
-  control message as struct timeval (usec resolution).
+  control message in usec resolution.
+  SO_TIMESTAMP is defined as SO_TIMESTAMP_NEW or SO_TIMESTAMP_OLD
+  based on the architecture type and time_t representation of libc.
+  Control message format is in struct __kernel_old_timeval for
+  SO_TIMESTAMP_OLD and in struct __kernel_sock_timeval for
+  SO_TIMESTAMP_NEW options respectively.
 
 * SO_TIMESTAMPNS
   Same timestamping mechanism as SO_TIMESTAMP, but reports the
-  timestamp as struct timespec (nsec resolution).
+  timestamp as struct timespec in nsec resolution.
+  SO_TIMESTAMPNS is defined as SO_TIMESTAMPNS_NEW or SO_TIMESTAMPNS_OLD
+  based on the architecture type and time_t representation of libc.
+  Control message format is in struct timespec for SO_TIMESTAMPNS_OLD
+  and in struct __kernel_timespec for SO_TIMESTAMPNS_NEW options
+  respectively.
 
 * IP_MULTICAST_LOOP + SO_TIMESTAMP[NS]
   Only for multicast:approximate transmit timestamp obtained by
@@ -22,7 +32,7 @@ The interfaces for receiving network packages timestamps are:
   timestamps for stream sockets.
 
 
-1.1 SO_TIMESTAMP:
+1.1 SO_TIMESTAMP (also SO_TIMESTAMP_OLD and SO_TIMESTAMP_NEW):
 
 This socket option enables timestamping of datagrams on the reception
 path. Because the destination socket, if any, is not known early in
@@ -31,15 +41,25 @@ same is true for all early receive timestamp options.
 
 For interface details, see `man 7 socket`.
 
+Always use SO_TIMESTAMP_NEW timestamp to always get timestamp in
+struct __kernel_sock_timeval format.
 
-1.2 SO_TIMESTAMPNS:
+SO_TIMESTAMP_OLD returns incorrect timestamps after the year 2038
+on 32 bit machines.
+
+1.2 SO_TIMESTAMPNS (also SO_TIMESTAMPNS_OLD and SO_TIMESTAMPNS_NEW):
 
 This option is identical to SO_TIMESTAMP except for the returned data type.
 Its struct timespec allows for higher resolution (ns) timestamps than the
 timeval of SO_TIMESTAMP (ms).
 
+Always use SO_TIMESTAMPNS_NEW timestamp to always get timestamp in
+struct __kernel_timespec format.
+
+SO_TIMESTAMPNS_OLD returns incorrect timestamps after the year 2038
+on 32 bit machines.
 
-1.3 SO_TIMESTAMPING:
+1.3 SO_TIMESTAMPING (also SO_TIMESTAMPING_OLD and SO_TIMESTAMPING_NEW):
 
 Supports multiple types of timestamp requests. As a result, this
 socket option takes a bitmap of flags, not a boolean. In
@@ -323,10 +343,23 @@ SO_TIMESTAMP and SO_TIMESTAMPNS records can be retrieved.
 These timestamps are returned in a control message with cmsg_level
 SOL_SOCKET, cmsg_type SCM_TIMESTAMPING, and payload of type
 
+For SO_TIMESTAMPING_OLD:
+
 struct scm_timestamping {
 	struct timespec ts[3];
 };
 
+For SO_TIMESTAMPING_NEW:
+
+struct scm_timestamping64 {
+	struct __kernel_timespec ts[3];
+
+Always use SO_TIMESTAMPING_NEW timestamp to always get timestamp in
+struct scm_timestamping64 format.
+
+SO_TIMESTAMPING_OLD returns incorrect timestamps after the year 2038
+on 32 bit machines.
+
 The structure can return up to three timestamps. This is a legacy
 feature. At least one field is non-zero at any time. Most timestamps
 are passed in ts[0]. Hardware timestamps are passed in ts[2].
-- 
2.17.1


  parent reply	other threads:[~2019-01-08  3:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08  3:26 [PATCH v3 0/8] net: y2038-safe socket timestamps Deepa Dinamani
2019-01-08  3:26 ` Deepa Dinamani
2019-01-08  3:26 ` [PATCH v3 1/8] arch: Use asm-generic/socket.h when possible Deepa Dinamani
2019-01-08  3:26   ` Deepa Dinamani
2019-01-08  4:47   ` Max Filippov
2019-01-08  4:47     ` Max Filippov
2019-01-08  8:22   ` Heiko Carstens
2019-01-08  8:22     ` Heiko Carstens
2019-01-08  3:26 ` [PATCH v3 2/8] sockopt: Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLD Deepa Dinamani
2019-01-08  3:26   ` Deepa Dinamani
2019-01-08  3:26 ` [PATCH v3 3/8] arch: sparc: Override struct __kernel_old_timeval Deepa Dinamani
2019-01-08  3:26   ` Deepa Dinamani
2019-01-08  3:26 ` [PATCH v3 4/8] socket: Use old_timeval types for socket timestamps Deepa Dinamani
2019-01-08  3:26 ` [PATCH v3 5/8] socket: Add struct __kernel_sock_timeval Deepa Dinamani
2019-01-08  3:26 ` [PATCH v3 6/8] socket: Add SO_TIMESTAMP[NS]_NEW Deepa Dinamani
2019-01-08  3:26   ` Deepa Dinamani
2019-01-08 13:46   ` Willem de Bruijn
2019-01-08 13:46     ` Willem de Bruijn
2019-01-08 14:03   ` Willem de Bruijn
2019-01-08 14:03     ` Willem de Bruijn
2019-01-08  3:26 ` [PATCH v3 7/8] socket: Add SO_TIMESTAMPING_NEW Deepa Dinamani
2019-01-08  3:26   ` Deepa Dinamani
2019-01-08 13:40   ` Willem de Bruijn
2019-01-08 13:40     ` Willem de Bruijn
2019-01-08  3:26 ` Deepa Dinamani [this message]
2019-01-08 13:37 ` [PATCH v3 0/8] net: y2038-safe socket timestamps Willem de Bruijn
2019-01-08 13:37   ` Willem de Bruijn
2019-01-08 13:37   ` Willem de Bruijn
2019-01-08 13:53   ` Willem de Bruijn
2019-01-08 13:53     ` Willem de Bruijn
2019-01-08 13:53     ` Willem de Bruijn
2019-01-08 13:53     ` Willem de Bruijn
2019-01-08 21:49 ` David Miller
2019-01-08 21:49   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190108032657.8331-9-deepa.kernel@gmail.com \
    --to=deepa.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.