Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp224200lqh; Mon, 6 May 2024 17:45:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUaLn1BhAcPNotf49UemzV/CvnbXurMvOLz6aVSyAqZ5WaXo8KKFQh1PN/3hfSCfYxcemRL4aifjQ5IHGfQ0jKOqzGUWazGz30v2zuAvw== X-Google-Smtp-Source: AGHT+IHrRg++oPcIAferWGx0yR3Hb7Mt4lpgI2O7SBloC6FM4umkR3BkISm6zKtmSmz0t+/Bjl5/ X-Received: by 2002:a17:902:f64f:b0:1e6:116b:b0d3 with SMTP id m15-20020a170902f64f00b001e6116bb0d3mr16092846plg.28.1715042753946; Mon, 06 May 2024 17:45:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715042753; cv=pass; d=google.com; s=arc-20160816; b=VMuiefHF/te06fySeI7qllj122SuKHQdBLf2di6L4nZfAbzPVJ1JEfvCTxh7yZUVZ4 sS/yAtu6juKiHfdABgKdKl/6GUnwREjv0nVSP6zyxwyMHCf8PQY7BIdn8jNMGUr6TECU 8klw8+SmaJUUmZMjaE7GTdUX4Ofxu/o3XIt/yhtfK7tqY0abwL2n5hhF2ucUX7SKNJ3y 0obIzZhl0SlsEUhXY8RfgbkEPOgvrXRCUTLGVv5fQPklOQ+g0WL4gsGsk//Hv7N5QtMc 5jCD6fB4H8PM1LK4Jtz8StsET61FZ93WpjL5NL9Wv5VwNQuGRW2BX655o4vRtaDcnQE1 N17g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=PmC0CJo8VGzdQ+lw2Wkc3ro98vq94DGKwTKxAwIJ2N8=; fh=eeL6EqYOJpOtxC20FB/jSm0nvsMF9BU95SXOWb/C0a0=; b=pa7a7mTmYSalj5pGhauBMdvD8sqUTdlVlRbl33DL+L8uYyKQF3Psq+VvqDoF2WVkx7 w+1A4yBgsRU+DP9nz/UoSTMOQgv0zr/o/i5ewRvlZMCf4xCZ3Cog0XcpWqMfmP3WtpHa 75/D79aTB8P+PhDpZTQKWG8bbMv25mHdKwBspeE2bXYoYPx1nbFWTOlqL3Twpt2GCjM6 8mHh0NQRZ0Fwefv+f7SM3UKc7P0qDBEtd6YeyfBIkQ5tTcVpLK9GND0M1AyD/w1Yi4y9 xnDzlXmCYQPVcy/z2oD3f+eT3xefUWWChkVTbndkKOMWrQ56XlFOG6AkWwipEeHq6SRm 0r4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hbbLEjJK; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n18-20020a170903111200b001e6172e34b6si9287395plh.273.2024.05.06.17.45.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 17:45:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hbbLEjJK; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E824E283E1A for ; Tue, 7 May 2024 00:45:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C548F1876; Tue, 7 May 2024 00:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hbbLEjJK" Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3A8210E3 for ; Tue, 7 May 2024 00:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715042708; cv=none; b=R6PY2SKkMyPgnUeKZnfb5v0OkPlxrmoCLctEik98WjAIak0y2egmY2faMeXr64U/zTsWTCRWxeZdc9roancytlniLvaZ3Q7irl+oSfQOQ1ava6X1hsunFgr/fBYkf0OjySRWPcEPLB/dJ4BdJzqNsf/i6DJb+mqA11r3/bNEWSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715042708; c=relaxed/simple; bh=3q8dZA3RYVxRLzlIk4TjtCOswwWtpfJrGsc5PYHxJ5Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qMZRXcpEUJKJvc/ua5SxSWMDjD/zCwluCSefAStjriNkqs/K3o5Od7xF4cB3RZ8BwwpKLrNWRP8jYyHwwszWQ+p5mhbwGUGxNAQsNF6IbvcXMRAGLCwPWA3idp0ttFsvWM8fZD+zN5fcer/Q3geztDiX/zdn5UaYs6XTS1IBGTc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hbbLEjJK; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715042704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PmC0CJo8VGzdQ+lw2Wkc3ro98vq94DGKwTKxAwIJ2N8=; b=hbbLEjJKcnmdol7u+0trYocZ/jOzebxlC08hEzYJsAmRpFEcoDH7g08lwsHZ/kI6Zw+DWe rdCXGeJxV2BIODY7ys+Yc9tVi2/EKFdfNbWgXurK/Qm+oMKTp0L1Bogjhftm0qAX8AeNeK MQQNU84f+HtzLLwpUr/DBZVPbSv/Oms= Date: Mon, 6 May 2024 17:44:56 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RFC PATCH bpf-next v6 2/3] net: Add additional bit to support clockid_t timestamp type To: Abhishek Chauhan Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney , Willem de Bruijn , Martin KaFai Lau , Daniel Borkmann , bpf , kernel@quicinc.com References: <20240504031331.2737365-1-quic_abchauha@quicinc.com> <20240504031331.2737365-3-quic_abchauha@quicinc.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20240504031331.2737365-3-quic_abchauha@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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);