Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp79454lqg; Wed, 10 Apr 2024 16:26:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPDV+DCzCgISGVTqgE+to+xkNfT/gkJTMYYxQbRvdV5AynbR6G3waxNnmvTkMi+6Mi4w/HzDblJkr8XqPxsbcjudbZdtZwUBXs/xQ4hA== X-Google-Smtp-Source: AGHT+IF7QRMxC7xmlODy9K7yGkOX/8NF4y0ssooDeM2ghraALvZwel+4kU7nt4Cr3YQKzLdFipg+ X-Received: by 2002:a25:ac5e:0:b0:dcc:d694:b4a6 with SMTP id r30-20020a25ac5e000000b00dccd694b4a6mr4137474ybd.15.1712791575761; Wed, 10 Apr 2024 16:26:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712791575; cv=pass; d=google.com; s=arc-20160816; b=pD9PZwzqaLL/YkfSoYpq0FeITGi8iDX2CBLG14MOpLdy5WdDp96FhQir0kWqFukWv3 QbH5vrLAsKqJgonw2+KzJmbQaj8BJWrXfWx+TQ4R+5HSZEE116EHXDS/9jdt6cXHgAgw tQxwyoFMYFOCsrblWRbQ6v2foM+nKqSKnH0x4flUy63Gqfyt2UnReXrHnFi4o755NjKV WjsqUzjffEYBjtRvlOCkAE7XnPPrhuD8B8k9WYLgcQvWRoSQMylp6jtAPxxWKvDGeZ/w bm0vSXTIqPAbJxAncFA8EEGwht3Wg4/ywsDV0Zc5NJCTo8CbrYod7lehGqCUUen1l3S2 1ZGg== 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=tRA6/DFmK/DJmNTAFNW2xE1W38sOhbq7XMudIRt8ihs=; fh=KPX7UKuV9wOE6J/tV9pgu+N4YnhiaDKaR4efX4V8Fb4=; b=eLNsBGEn8CrkZkuTyasB+h6kAnhaq3zb+9HN1DTmGeKcTGAMwdIttVsZTsO8H2A2db b4RsCE5rg6wqJ/7J+kdbj46V7FwJqgCeM6SII3FpC+Ix9dstppCJDFsf/ZsZ1UC5MUXq BhXK/fRarl0mSCaGxwFPSpoWcddjW8QdpPzGZH9ftbSFvXNrR7PE0EqK7iHMknkbeJxW /bkZN2p79nnm05Pa3BzIEZsS8/n3FA9pEYVwtcu9teZW67SjKF/gBT30cWnifjDiCCLZ +Kux+JTEqCV5A0Ps08FSQt3nc1JTwtbOhCtQAdMX4jFmEIgf5J5cKRwF1Gqk072qlpGo 25zQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Va+Qlm+5; 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-139530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n15-20020a05622a040f00b00432f4dae712si262426qtx.624.2024.04.10.16.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 16:26:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Va+Qlm+5; 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-139530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139530-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 76C1B1C2198E for ; Wed, 10 Apr 2024 23:26:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28243381B1; Wed, 10 Apr 2024 23:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Va+Qlm+5" Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 B4B5C2C695 for ; Wed, 10 Apr 2024 23:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712791570; cv=none; b=q9X1q+H6fifCH207U+gfam2Xh/OflgjTtlWtp2cotF+2Pvp37RVIc04Jw/0nB+4GJngZvdU9FXtqj/nGpX5wSXlIKrcRUjRoCFrx+nZUPUo1mGipi+mpirJOIr/JDJWfrBZ4QAeMUISMO0gEyNPyEgxySVIphysJvJp3T7tCxP0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712791570; c=relaxed/simple; bh=6bECfZivveGXwjc0wz2UlMqxN5Fu6aMgKDLIjMEVkeI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Vhi3UFezYOIlUSwfWxXBSOooiXAXne+r5opSSEt3ZCMCanQh7TTSXFYxuKoteNkn+OUjIh0+uR4ut2GZHoZgF4TPsa9K8XTQCiGcu8Qs6pUhV2Mq/WFYqEnIynxVhF8AIpWx78n7gfASgF5DcSoKDlHiEkYrKML+pqaUAiGrZ9M= 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=Va+Qlm+5; arc=none smtp.client-ip=95.215.58.176 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=1712791564; 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=tRA6/DFmK/DJmNTAFNW2xE1W38sOhbq7XMudIRt8ihs=; b=Va+Qlm+515KjcFBzYljKyDI9a7OtxhslpQ7SCXUQrXWPNmJ2MeRhfsO4Y1YG9QWHJwkl5T YjvrFFXb5n5JQj/wScwLuRr7vpe9OqGLs2TdrTzYZkxU5LECaqHEzoNuOqXIbjBjKdLFav DnKEyl/TQyRlVIkVNoRbmSsz9FOINjM= Date: Wed, 10 Apr 2024 16:25:57 -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 v1 3/3] net: Add additional bit to support userspace timestamp type To: "Abhishek Chauhan (ABC)" Cc: Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney , Martin KaFai Lau , Daniel Borkmann , bpf , kernel@quicinc.com References: <20240409210547.3815806-1-quic_abchauha@quicinc.com> <20240409210547.3815806-4-quic_abchauha@quicinc.com> <6616b3587520_2a98a5294db@willemb.c.googlers.com.notmuch> 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 4/10/24 1:25 PM, Abhishek Chauhan (ABC) wrote: >>> @@ -830,6 +833,9 @@ enum skb_tstamp_type { >>> * delivery_time in mono clock base (i.e. EDT). Otherwise, the >>> * skb->tstamp has the (rcv) timestamp at ingress and >>> * delivery_time at egress. >>> + * delivery_time in mono clock base (i.e., EDT) or a clock base chosen >>> + * by SO_TXTIME. If zero, skb->tstamp has the (rcv) timestamp at >>> + * ingress. >>> * @napi_id: id of the NAPI struct this skb came from >>> * @sender_cpu: (aka @napi_id) source CPU in XPS >>> * @alloc_cpu: CPU which did the skb allocation. >>> @@ -960,7 +966,7 @@ struct sk_buff { >>> /* private: */ >>> __u8 __mono_tc_offset[0]; >>> /* public: */ >>> - __u8 tstamp_type:1; /* See SKB_MONO_DELIVERY_TIME_MASK */ >>> + __u8 tstamp_type:2; /* See SKB_MONO_DELIVERY_TIME_MASK */ >>> #ifdef CONFIG_NET_XGRESS >>> __u8 tc_at_ingress:1; /* See TC_AT_INGRESS_MASK */ The above "tstamp_type:2" change shifted the tc_at_ingress bit. TC_AT_INGRESS_MASK needs to be adjusted. >>> __u8 tc_skip_classify:1; >> >> With pahole, does this have an effect on sk_buff layout? >> > I think it does and it also impacts BPF testing. Hence in my cover letter i have mentioned that these > changes will impact BPF. My level of expertise is very limited to BPF hence the reason for RFC. > That being said i am actually trying to understand/learn BPF instructions to know things better. > I think we need to also change the offset SKB_MONO_DELIVERY_TIME_MASK and TC_AT_INGRESS_MASK > > > #ifdef __BIG_ENDIAN_BITFIELD > #define SKB_MONO_DELIVERY_TIME_MASK (1 << 7) //Suspecting changes here too > #define TC_AT_INGRESS_MASK (1 << 6) // and here > #else > #define SKB_MONO_DELIVERY_TIME_MASK (1 << 0) > #define TC_AT_INGRESS_MASK (1 << 1) (this might have to change to 1<<2 ) This should be (1 << 2) now. Similar adjustment for the big endian. > #endif > #define SKB_BF_MONO_TC_OFFSET offsetof(struct sk_buff, __mono_tc_offset) > > Also i suspect i change in /selftests/bpf/prog_tests/ctx_rewrite.c ctx_rewrite.c tests the bpf ctx rewrite code. In this particular case, it tests the bpf_convert_tstamp_read() and bpf_convert_tstamp_write() generate the correct bpf instructions. e.g. "w11 &= 3;" is testing the following in bpf_convert_tstamp_read(): *insn++ = BPF_ALU32_IMM(BPF_AND, tmp_reg, TC_AT_INGRESS_MASK | SKB_MONO_DELIVERY_TIME_MASK); The existing "TC_AT_INGRESS_MASK | SKB_MONO_DELIVERY_TIME_MASK" is 0x3 and it should become 0x5 if my hand counts correctly. The patch set cannot be applied to the bpf-next: https://patchwork.kernel.org/project/netdevbpf/patch/20240409210547.3815806-4-quic_abchauha@quicinc.com/ , so bpf CI cannot run to reproduce the issue.