Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4264576imu; Mon, 7 Jan 2019 19:30:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ks/KSSedg+C+/YPf/IdLNOWASeF0VFxBhqxttuoPkGLXAwur4IpGRqeIvnFQ0DSCVRh58 X-Received: by 2002:a17:902:7481:: with SMTP id h1mr85806pll.341.1546918248163; Mon, 07 Jan 2019 19:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546918248; cv=none; d=google.com; s=arc-20160816; b=aARnoEffK0Bgsp+SLVg/Rs9F8oOUtzldhTZ9Wu6yJUh8JiXlj6TLV8Etv/+q9aTMt/ gFx6WdF/gYAsr0CeO+Sn6Kry3AjNhRBOPaw7aMwUgncU6NYnGh8h2LR5z0m+Ub+50ep5 HvXiRUHUzR2p0P2owOBujLez2/JPYWWket49qErx70iqPpcErudzW5qxTgIAbgGTJnPH qwXf0+3P2UBgz+uGhqFxRXW08SWlG5WjWJoXJeLn7a6Rq3ERhDnodmqBWuzirDtR91SN R3s4djXiaU/TdWh7tGwifVTl0mm1RTLTuvVgXmsoCYvnOvhl/L6d55NOipdhdBcVFXrM GNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=9ROXjCNh7/+j87gFjI2xFwFTr444MTdpI+cCI3EnBUs=; b=g22AsQuG3EGLEyeb8DBVAMXAkXaKprr5kGgWv5+SPLWuKCyRw8cBCZkRkwgzVthOdq Hx1m5njt4v7e64rp5O4zW5XgGJAGcIkuAtRYijZp16ZBvadQvSlYAp5HSS1MBFFu5sx4 DGx5SUtUHyIdOAkizOirWgsNZw1tpnydoM67o9jRcsio8o59P5qVJu5UqtqLPVTVSw8e nLec0AdtyPInaEr9oJFNfRjImiBPw38fJ7i7IJhmB4PFpBZ59eEh3lN3vVfvnJwbU+va H5hReqFLH0m7goVvdlhSpeEt2zlH28KF2LK93HLN1b529hSVh5X3JBOZxYJEO3tPwatr H0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YFtlL5CH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si60516441plz.96.2019.01.07.19.30.32; Mon, 07 Jan 2019 19:30:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YFtlL5CH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbfAHD2O (ORCPT + 99 others); Mon, 7 Jan 2019 22:28:14 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33724 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727762AbfAHD1y (ORCPT ); Mon, 7 Jan 2019 22:27:54 -0500 Received: by mail-pl1-f196.google.com with SMTP id z23so1179058plo.0; Mon, 07 Jan 2019 19:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9ROXjCNh7/+j87gFjI2xFwFTr444MTdpI+cCI3EnBUs=; b=YFtlL5CHtoga5pwRvtOLOWeA09oVqE1mW9T6pSTzYtM3FvKkHlcwvJIcP/Ux6mfPTI 4LvWpAkUKl0JKaCDRO4I/WFf0e7pMjDJdk/Hb7rdPztux+v9OhM9OZnOU4ScGur0k5fb gYEPIjX42Xg0TOhthgbgHb3qsStcDCAObGcsCD6RyBjywjkAr1ZJfNndlV1vwAATZPmO loGLIBlkxhSRfeophxEGpwQ97YjQp42AppKwgiIdk+iYui1ZHRl5ffaiM5zp7bPH6ouy HMe7RE7otffaTACaFRdDpIYZVKMKJ8HbEhLhfWZAiY/Bjvt+D8ITcql8vo7O5Hvpjv8E Sidw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9ROXjCNh7/+j87gFjI2xFwFTr444MTdpI+cCI3EnBUs=; b=fl2ndTk+zaXqCdaNAQVJNDQ2157gOin5Fm7AXqvTmABUxeRZWYnGEMS9Hh9AF3X4/7 gH9cOpBlcs8V+XMtdg4pBPuyeXYKhbvbjat+p+j+je8EGWzEuaKv+ns0sSVegOPn11I+ QY82w2+7DvQV6hP/IDSUZGB4u+5vZV27QKyVB1w58mWZqkNTS4+YEkDZFTJ74zv+36N6 UndJ74X20CHcioWzVPazJ6kKd2Plk/gqz47pKLJx6jelpL/HFba5iqVyr2yZ37gMezxh mBd5Z57bCBLjvkbntrJq/houvZaB7W9UclDkoAt04iNIymsh/SqUnvVs0rHESa7sneFs jPtQ== X-Gm-Message-State: AJcUukfLdd9ITYZi5okD3xd2Kvy8JTtdfbatuxepKY/USkbeFB35WhNf HRftwOdhrxPSkxc4LIFmOa4= X-Received: by 2002:a17:902:28e9:: with SMTP id f96mr88934plb.169.1546918073768; Mon, 07 Jan 2019 19:27:53 -0800 (PST) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id v5sm117327735pgn.5.2019.01.07.19.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jan 2019 19:27:53 -0800 (PST) From: Deepa Dinamani 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 Message-Id: <20190108032657.8331-9-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190108032657.8331-1-deepa.kernel@gmail.com> References: <20190108032657.8331-1-deepa.kernel@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the new y2038 safe timestamping options added, update the documentation to reflect the changes. Signed-off-by: Deepa Dinamani Acked-by: Willem de Bruijn --- 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