netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Abhishek Chauhan <quic_abchauha@quicinc.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Halaney <ahalaney@redhat.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
	kernel@quicinc.com
Subject: Re: [RFC PATCH bpf-next v6 2/3] net: Add additional bit to support clockid_t timestamp type
Date: Mon, 6 May 2024 17:44:56 -0700	[thread overview]
Message-ID: <cab0c7ba-90bf-49e2-908d-ecd879160667@linux.dev> (raw)
In-Reply-To: <20240504031331.2737365-3-quic_abchauha@quicinc.com>

On 5/3/24 8:13 PM, Abhishek Chauhan wrote:
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index fe86cadfa85b..c3d852eecb01 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -1457,7 +1457,10 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
>   
>   	skb->priority = (cork->tos != -1) ? cork->priority: READ_ONCE(sk->sk_priority);
>   	skb->mark = cork->mark;
> -	skb->tstamp = cork->transmit_time;
> +	if (sk_is_tcp(sk))

This seems not catching all IPPROTO_TCP case. In particular, the percpu 
"ipv4_tcp_sk" is SOCK_RAW. sk_is_tcp() is checking SOCK_STREAM:

void __init tcp_v4_init(void)
{

	/* ... */
	res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW,
				   IPPROTO_TCP, &init_net);

	/* ... */
}

"while :; do ./test_progs -t tc_redirect/tc_redirect_dtime || break; done" 
failed pretty often exactly in this case.

> +		skb_set_delivery_type_by_clockid(skb, cork->transmit_time, CLOCK_MONOTONIC);
> +	else
> +		skb_set_delivery_type_by_clockid(skb, cork->transmit_time, sk->sk_clockid);
>   	/*
>   	 * Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec
>   	 * on dst refcount

[ ... ]

> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 05067bd44775..797a9764e8fe 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -1924,7 +1924,10 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
>   
>   	skb->priority = READ_ONCE(sk->sk_priority);
>   	skb->mark = cork->base.mark;
> -	skb->tstamp = cork->base.transmit_time;
> +	if (sk_is_tcp(sk))
> +		skb_set_delivery_type_by_clockid(skb, cork->base.transmit_time, CLOCK_MONOTONIC);
> +	else
> +		skb_set_delivery_type_by_clockid(skb, cork->base.transmit_time, sk->sk_clockid);
>   
>   	ip6_cork_steal_dst(skb, cork);
>   	IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS);


  parent reply	other threads:[~2024-05-07  0:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04  3:13 [RFC PATCH bpf-next v6 0/3] Replace mono_delivery_time with tstamp_type Abhishek Chauhan
2024-05-04  3:13 ` [RFC PATCH bpf-next v6 1/3] net: Rename mono_delivery_time to tstamp_type for scalabilty Abhishek Chauhan
2024-05-06 18:51   ` Willem de Bruijn
2024-05-06 19:55     ` Abhishek Chauhan (ABC)
2024-05-06 21:29       ` Willem de Bruijn
2024-05-04  3:13 ` [RFC PATCH bpf-next v6 2/3] net: Add additional bit to support clockid_t timestamp type Abhishek Chauhan
2024-05-06 19:00   ` Willem de Bruijn
2024-05-06 19:57     ` Abhishek Chauhan (ABC)
2024-05-07  0:44   ` Martin KaFai Lau [this message]
2024-05-07 11:39     ` Willem de Bruijn
2024-05-07 19:08       ` Abhishek Chauhan (ABC)
2024-05-07 19:18         ` Willem de Bruijn
2024-05-07 19:38           ` Abhishek Chauhan (ABC)
2024-05-04  3:13 ` [RFC PATCH bpf-next v6 3/3] selftests/bpf: Handle forwarding of UDP CLOCK_TAI packets Abhishek Chauhan
2024-05-06 19:04   ` Willem de Bruijn
2024-05-06 20:50     ` Abhishek Chauhan (ABC)
2024-05-06 20:54       ` Abhishek Chauhan (ABC)
2024-05-06 23:40         ` Abhishek Chauhan (ABC)
2024-05-07  0:54       ` Martin KaFai Lau
2024-05-07 19:15         ` Abhishek Chauhan (ABC)

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=cab0c7ba-90bf-49e2-908d-ecd879160667@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=ahalaney@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@quicinc.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_abchauha@quicinc.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).