{"id":814799,"url":"http://patchwork.ozlabs.org/api/patches/814799/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/ad6e265b97b66bcdb19b815e6d9092ffbcb461ba.1505719061.git.rcochran@linutronix.de/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<ad6e265b97b66bcdb19b815e6d9092ffbcb461ba.1505719061.git.rcochran@linutronix.de>","list_archive_url":null,"date":"2017-09-18T07:41:16","name":"[RFC,V1,net-next,1/6] net: Add a new socket option for a future transmit time.","commit_ref":null,"pull_url":null,"state":"rfc","archived":true,"hash":"43f804af991ca00966af6ae931bf67eaf42db2dd","submitter":{"id":69550,"url":"http://patchwork.ozlabs.org/api/people/69550/?format=json","name":"Richard Cochran","email":"rcochran@linutronix.de"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/ad6e265b97b66bcdb19b815e6d9092ffbcb461ba.1505719061.git.rcochran@linutronix.de/mbox/","series":[{"id":3574,"url":"http://patchwork.ozlabs.org/api/series/3574/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=3574","date":"2017-09-18T07:41:16","name":"Time based packet transmission","version":1,"mbox":"http://patchwork.ozlabs.org/series/3574/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814799/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814799/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xwdKb67J5z9s72\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 18 Sep 2017 17:43:31 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752553AbdIRHn0 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 03:43:26 -0400","from Galois.linutronix.de ([146.0.238.70]:49781 \"EHLO\n\tGalois.linutronix.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752480AbdIRHnW (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 03:43:22 -0400","from rcochran by Galois.linutronix.de with local (Exim 4.80)\n\t(envelope-from <rcochran@linutronix.de>)\n\tid 1dtqgD-0006bL-Au; Mon, 18 Sep 2017 09:41:21 +0200"],"From":"Richard Cochran <rcochran@linutronix.de>","To":"<netdev@vger.kernel.org>","Cc":"<linux-kernel@vger.kernel.org>, intel-wired-lan@lists.osuosl.org,\n\tAndre Guedes <andre.guedes@intel.com>,\n\tAnna-Maria Gleixner <anna-maria@linutronix.de>,\n\tDavid Miller <davem@davemloft.net>, Henrik Austad <henrik@austad.us>,\n\tJesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>,\n\tJohn Stultz <john.stultz@linaro.org>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tVinicius Costa Gomes <vinicius.gomes@intel.com>","Subject":"[PATCH RFC V1 net-next 1/6] net: Add a new socket option for a\n\tfuture transmit time.","Date":"Mon, 18 Sep 2017 09:41:16 +0200","Message-Id":"<ad6e265b97b66bcdb19b815e6d9092ffbcb461ba.1505719061.git.rcochran@linutronix.de>","X-Mailer":"git-send-email 1.7.10.4","In-Reply-To":"<cover.1505719061.git.rcochran@linutronix.de>","References":"<cover.1505719061.git.rcochran@linutronix.de>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"This patch introduces SO_TXTIME.  User space enables this option in\norder to pass a desired future transmit time in a CMSG when calling\nsendmsg(2).\n\nSigned-off-by: Richard Cochran <rcochran@linutronix.de>\n---\n arch/alpha/include/uapi/asm/socket.h   |  3 +++\n arch/frv/include/uapi/asm/socket.h     |  3 +++\n arch/ia64/include/uapi/asm/socket.h    |  3 +++\n arch/m32r/include/uapi/asm/socket.h    |  3 +++\n arch/mips/include/uapi/asm/socket.h    |  3 +++\n arch/mn10300/include/uapi/asm/socket.h |  3 +++\n arch/parisc/include/uapi/asm/socket.h  |  3 +++\n arch/powerpc/include/uapi/asm/socket.h |  3 +++\n arch/s390/include/uapi/asm/socket.h    |  3 +++\n arch/sparc/include/uapi/asm/socket.h   |  3 +++\n arch/xtensa/include/uapi/asm/socket.h  |  3 +++\n include/net/sock.h                     |  2 ++\n include/uapi/asm-generic/socket.h      |  3 +++\n net/core/sock.c                        | 12 ++++++++++++\n 14 files changed, 50 insertions(+)","diff":"diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h\nindex c6133a045352..4dfacba7820e 100644\n--- a/arch/alpha/include/uapi/asm/socket.h\n+++ b/arch/alpha/include/uapi/asm/socket.h\n@@ -111,4 +111,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _UAPI_ASM_SOCKET_H */\ndiff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h\nindex 9abf02d6855a..ccf79fe9f35a 100644\n--- a/arch/frv/include/uapi/asm/socket.h\n+++ b/arch/frv/include/uapi/asm/socket.h\n@@ -104,5 +104,8 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _ASM_SOCKET_H */\n \ndiff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h\nindex 002eb85a6941..2da305fa85ee 100644\n--- a/arch/ia64/include/uapi/asm/socket.h\n+++ b/arch/ia64/include/uapi/asm/socket.h\n@@ -113,4 +113,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _ASM_IA64_SOCKET_H */\ndiff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h\nindex e268e51a38d1..4d4cde60c520 100644\n--- a/arch/m32r/include/uapi/asm/socket.h\n+++ b/arch/m32r/include/uapi/asm/socket.h\n@@ -104,4 +104,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _ASM_M32R_SOCKET_H */\ndiff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h\nindex 6c755bc07975..b6e13bbf970c 100644\n--- a/arch/mips/include/uapi/asm/socket.h\n+++ b/arch/mips/include/uapi/asm/socket.h\n@@ -122,4 +122,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _UAPI_ASM_SOCKET_H */\ndiff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h\nindex ac82a3f26dbf..0234496dc969 100644\n--- a/arch/mn10300/include/uapi/asm/socket.h\n+++ b/arch/mn10300/include/uapi/asm/socket.h\n@@ -104,4 +104,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _ASM_SOCKET_H */\ndiff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h\nindex 3b2bf7ae703b..e2a282fefcd6 100644\n--- a/arch/parisc/include/uapi/asm/socket.h\n+++ b/arch/parisc/include/uapi/asm/socket.h\n@@ -103,4 +103,7 @@\n \n #define SO_ZEROCOPY\t\t0x4035\n \n+#define SO_TXTIME\t\t0x4036\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _UAPI_ASM_SOCKET_H */\ndiff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h\nindex 3c590c7c42c0..55718129ab06 100644\n--- a/arch/powerpc/include/uapi/asm/socket.h\n+++ b/arch/powerpc/include/uapi/asm/socket.h\n@@ -17,4 +17,7 @@\n \n #include <asm-generic/socket.h>\n \n+#define SO_TXTIME\t\t54\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif\t/* _ASM_POWERPC_SOCKET_H */\ndiff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h\nindex a56916c83565..bfcb29ccf33a 100644\n--- a/arch/s390/include/uapi/asm/socket.h\n+++ b/arch/s390/include/uapi/asm/socket.h\n@@ -110,4 +110,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* _ASM_SOCKET_H */\ndiff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h\nindex b2f5c50d0947..2217187f80f2 100644\n--- a/arch/sparc/include/uapi/asm/socket.h\n+++ b/arch/sparc/include/uapi/asm/socket.h\n@@ -100,6 +100,9 @@\n \n #define SO_ZEROCOPY\t\t0x003e\n \n+#define SO_TXTIME\t\t0x003f\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n /* Security levels - as per NRL IPv6 - don't actually do anything */\n #define SO_SECURITY_AUTHENTICATION\t\t0x5001\n #define SO_SECURITY_ENCRYPTION_TRANSPORT\t0x5002\ndiff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h\nindex 220059999e74..36bdbd8bd6ca 100644\n--- a/arch/xtensa/include/uapi/asm/socket.h\n+++ b/arch/xtensa/include/uapi/asm/socket.h\n@@ -115,4 +115,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif\t/* _XTENSA_SOCKET_H */\ndiff --git a/include/net/sock.h b/include/net/sock.h\nindex 03a362568357..1c378db1060f 100644\n--- a/include/net/sock.h\n+++ b/include/net/sock.h\n@@ -778,6 +778,7 @@ enum sock_flags {\n \tSOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */\n \tSOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */\n \tSOCK_RCU_FREE, /* wait rcu grace period in sk_destruct() */\n+\tSOCK_TXTIME,\n };\n \n #define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))\n@@ -1558,6 +1559,7 @@ void sock_kzfree_s(struct sock *sk, void *mem, int size);\n void sk_send_sigurg(struct sock *sk);\n \n struct sockcm_cookie {\n+\tu64 transmit_time;\n \tu32 mark;\n \tu16 tsflags;\n };\ndiff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h\nindex e47c9e436221..d32e3e1bf4b6 100644\n--- a/include/uapi/asm-generic/socket.h\n+++ b/include/uapi/asm-generic/socket.h\n@@ -106,4 +106,7 @@\n \n #define SO_ZEROCOPY\t\t60\n \n+#define SO_TXTIME\t\t61\n+#define SCM_TXTIME\t\tSO_TXTIME\n+\n #endif /* __ASM_GENERIC_SOCKET_H */\ndiff --git a/net/core/sock.c b/net/core/sock.c\nindex 9b7b6bbb2a23..d916a4c238dd 100644\n--- a/net/core/sock.c\n+++ b/net/core/sock.c\n@@ -1059,6 +1059,13 @@ int sock_setsockopt(struct socket *sock, int level, int optname,\n \t\t\tsock_valbool_flag(sk, SOCK_ZEROCOPY, valbool);\n \t\tbreak;\n \n+\tcase SO_TXTIME:\n+\t\tif (ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))\n+\t\t\tsock_valbool_flag(sk, SOCK_TXTIME, valbool);\n+\t\telse\n+\t\t\tret = -EPERM;\n+\t\tbreak;\n+\n \tdefault:\n \t\tret = -ENOPROTOOPT;\n \t\tbreak;\n@@ -2115,6 +2122,11 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,\n \t\tsockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK;\n \t\tsockc->tsflags |= tsflags;\n \t\tbreak;\n+\tcase SO_TXTIME:\n+\t\tif (!sock_flag(sk, SOCK_TXTIME))\n+\t\t\treturn -EINVAL;\n+\t\tsockc->transmit_time = *(u64 *)CMSG_DATA(cmsg);\n+\t\tbreak;\n \t/* SCM_RIGHTS and SCM_CREDENTIALS are semantically in SOL_UNIX. */\n \tcase SCM_RIGHTS:\n \tcase SCM_CREDENTIALS:\n","prefixes":["RFC","V1","net-next","1/6"]}