lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6616b1ceeecad_2a98a529472@willemb.c.googlers.com.notmuch>
Date: Wed, 10 Apr 2024 11:35:42 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Abhishek Chauhan <quic_abchauha@...cinc.com>, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 Andrew Halaney <ahalaney@...hat.com>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
 Martin KaFai Lau <martin.lau@...nel.org>, 
 Martin KaFai Lau <martin.lau@...ux.dev>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 bpf <bpf@...r.kernel.org>
Cc: kernel@...cinc.com
Subject: Re: [RFC PATCH bpf-next v1 2/3] net: assign enum to skb->tstamp_type
 to distinguish between tstamp

Abhishek Chauhan wrote:
> As we are renaming the mono_delivery_time to tstamp_type, it makes
> sense to start assigning tstamp_type based out if enum defined as
> part of this commit
> 
> Earlier we used bool arg flag to check if the tstamp is mono in
> function skb_set_delivery_time, Now the signature of the functions
> accepts enum to distinguish between mono and real time.
> 
> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@linux.dev/
> Signed-off-by: Abhishek Chauhan <quic_abchauha@...cinc.com>
> ---
>  include/linux/skbuff.h                     | 13 +++++++++----
>  net/bridge/netfilter/nf_conntrack_bridge.c |  2 +-
>  net/core/dev.c                             |  2 +-
>  net/core/filter.c                          |  4 ++--
>  net/ipv4/ip_output.c                       |  2 +-
>  net/ipv4/tcp_output.c                      | 14 +++++++-------
>  net/ipv6/ip6_output.c                      |  2 +-
>  net/ipv6/tcp_ipv6.c                        |  2 +-
>  net/sched/act_bpf.c                        |  2 +-
>  net/sched/cls_bpf.c                        |  2 +-
>  10 files changed, 25 insertions(+), 20 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 8210d699d8e9..6160185f0fe0 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -701,6 +701,11 @@ typedef unsigned int sk_buff_data_t;
>  #else
>  typedef unsigned char *sk_buff_data_t;
>  #endif
> +
> 
> 
> +enum skb_tstamp_type {
> +	SKB_TSTAMP_TYPE_RX_REAL = 0,    /* A RX (receive) time in real */
> +	SKB_TSTAMP_TYPE_TX_MONO = 1,    /* A TX (delivery) time in mono */
> +};

I'd drop the RX_/TX_. This is just a version of clockid_t, compressed
to minimize space taken in sk_buff. Simpler to keep to the CLOCK_..
types. Where a clock was set (TX vs RX) is not relevant to the code
that later references skb->tstamp.

>  static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
> -					 bool mono)
> +					enum skb_tstamp_type tstamp_type)
>  {
>  	skb->tstamp = kt;
> -	skb->tstamp_type = kt && mono;
> +	skb->tstamp_type = kt && tstamp_type;

Already introduce a switch here?



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ