From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesus Sanchez-Palencia Subject: Re: [PATCH v1 net-next 02/14] net: Add a new socket option for a future transmit time. Date: Thu, 28 Jun 2018 11:33:11 -0700 Message-ID: References: <20180627215950.6719-1-jesus.sanchez-palencia@intel.com> <20180627215950.6719-3-jesus.sanchez-palencia@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Network Development , Thomas Gleixner , jan.altenberg@linutronix.de, Vinicius Gomes , kurt.kanzenbach@linutronix.de, Henrik Austad , Richard Cochran , Levi Pearson , ilias.apalodimas@linaro.org, ivan.khoronzhuk@linaro.org, Miroslav Lichvar , Willem de Bruijn , Jamal Hadi Salim , Cong Wang , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , Richard Cochran To: Willem de Bruijn Return-path: Received: from mga04.intel.com ([192.55.52.120]:18899 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030539AbeF1SiD (ORCPT ); Thu, 28 Jun 2018 14:38:03 -0400 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: Hi Willem, On 06/28/2018 07:40 AM, Willem de Bruijn wrote: > On Thu, Jun 28, 2018 at 10:26 AM Willem de Bruijn > wrote: >> >> On Wed, Jun 27, 2018 at 6:08 PM Jesus Sanchez-Palencia >> wrote: >>> >>> From: Richard Cochran >>> >>> This patch introduces SO_TXTIME. User space enables this option in >>> order to pass a desired future transmit time in a CMSG when calling >>> sendmsg(2). The argument to this socket option is a 6-bytes long struct >>> defined as: >>> >>> struct sock_txtime { >>> clockid_t clockid; >>> u16 flags; >>> }; >> >> clockid_t is __kernel_clockid_t is int is a variable length field. >> Please use fixed length fields. > > Sorry, int is fine, of course, and clockid_t is used between userspace and > kernel already. Great. So, in addition to the other feedback in sock.c, what I'm thinking here for the v2 is: - move this struct to and the flags definition (as enums) to include/uapi/linux/net_tstamp.h; - keep clockid as a clockid_t and increase flags to u32 since this already takes 8 bytes in total anyway; - reduce sk_clockid and sk_txtime_flags from struct sock from a u16 to a u8 each. Thanks, Jesus > >> Also, as MAX_CLOCKS is 16, only 4 bits are needed. A single u16 >> is probably sufficient as cmsg argument. To future proof, a u32 will >> allow for more >> than 4 flags. But in struct sock, 16 bits should be sufficient to >> encode both clock id >> and flags.