Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp75601lqg; Wed, 10 Apr 2024 16:15:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2WtN89MTKrohCfEbSQXrtPrTGg8cB9RaII9ncfblPMxPcf44mb7o3bI7XyvPBOvpRFKtJoMXOnMElj9dUzJv56FIW9vOgALek9bBQ9A== X-Google-Smtp-Source: AGHT+IGSSmzcDCl/K/OzYw3pc7uRt3AgoefqyuR3FKs4CpGvWT0eCkzXWv+6c0qdKLiAA0OvHOAx X-Received: by 2002:a05:6870:f115:b0:22e:d64e:d5b9 with SMTP id k21-20020a056870f11500b0022ed64ed5b9mr4297840oac.55.1712790934586; Wed, 10 Apr 2024 16:15:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712790934; cv=pass; d=google.com; s=arc-20160816; b=HH+txgDt6TE6w8BQmLCBjvzreuoOWxAzPXUAaJ47B8D3LpKtyPeoAa3W/ZHFctWXxM fvTqEWNbWD6DBVvn5QI6ABDG50b656eSEJG4w3ifswHThGQha5XUqeWBMMMkQI2xawja k/rwvsjeIYuY09BQ7teIy+5YWsnsuzo3G2nabbjBSDbgrNUvLmG3zK/YkTFySMOVH3O1 YKRL816aTNCIUz3SmjPRzxrLRQDkp+O1QwOtbWHeQjO9eOTZnh9gAbD59o8OmCuU+x2Z oXqZh7p0NZOPTem/eCsUA8y/rDn3b82BvDgR5GwWfgtdapP9w5Y4UFXFSafobC5J9qRw P2SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=xfbxzgfJR0MsMDY1vQLFHodv9yObaq7ZXxu6POH4CEo=; fh=k+otbfzlRhTYrhHpVeAt70FjA3rClKSjzTj+Z/bpxU4=; b=V9ekPufIT8iD0HThSxagxbdb39BAeCLX2rfqwHiFUlWdjj6bX4GSC/vc4s8UuEOKZS F4zqKCrU/IBZ4XSibQrc9e/ATwVFjKiaGewh17WV3tqiqDYcc7KYx9hmfNo1uaFqPYBD rODriZ8FZwMjudYQCj+L7h4BZXGxFvOxVFuVKDf5epr2DNF2Y5zyHfGgNdAq7SPyN+Me d2hGeAYdCy75d3kQqeFc2xpxxISUlv/Q+tbZ/GVbh6aA7ZjoUGVjKPyutq21moa6uO4j PmQ7T4fTMumucDcj/Vb29z7EkaL/slk6ixir948k8UbQ8DY/OGJj1jstB+kIg35JQsUo srOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LCRXNlYD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e66-20020a636945000000b005d8c0f44e73si119213pgc.262.2024.04.10.16.15.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 16:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LCRXNlYD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 63E6FB2527E for ; Wed, 10 Apr 2024 23:00:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B792B38F84; Wed, 10 Apr 2024 22:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LCRXNlYD" Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 478FF28370; Wed, 10 Apr 2024 22:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789913; cv=none; b=BCcMG4Qz3nPGGw2BTyaY/oj9Pkko1qPxe1maWA8WV0XW4AeY6iZ0HLT1Lr6OrlgHcFNQz/3ADOeoSLJk3b6jmfHom/Th6/oDFoQ5hI/oaCsdorqZ1U5ULBNNgyCmgs0lW0g/pK8OSKxFyttANDkvKUyDVdQgqFsrBVU9B2PrkQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789913; c=relaxed/simple; bh=GpA3MXV9KDuIyE3HA9j3en+1d7Qfyz4YD1gbt7MOmnM=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=L5sl2oxKFTKC/r+PUoK/Jgt67KRh+ib2hk6Eq5jbs7EwVLG55XZO0TBz2gKG/9Edsr0nmuEbp1Gg1sSKrCq/wQXetl4+zm38Fb6wi4Nq6qr4rSk8IAVANiT8G1Cs/2DMWsCquDuVErtJjqNxl3aahxTejFVKd4fIQ3bhAp0xD1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LCRXNlYD; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-699320fcbc1so44049656d6.3; Wed, 10 Apr 2024 15:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712789911; x=1713394711; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=xfbxzgfJR0MsMDY1vQLFHodv9yObaq7ZXxu6POH4CEo=; b=LCRXNlYDPvRTbe9smefcqjG3SfbMtwM+OqdMPGvfy+fI1GAwz3r13kHAr5MNhInwWL d3hscZtfvd38610k5iqdDOCfkPV0N+djeymfaak/0xi5uCLdPJrsssSmDHYLUFGw5XLr ee4VAFnQVMODLxqq1A6HaucBThcK1DIc9KerCRXE19Nx7ZdH4DtBG9ebJp/J2qHFt2YC L9KvAA0uVcbL80aoj91OWY3bnxgnrLyrABxN6EebgzIUihpY31Yi9BI6HoUqcEnsgPFO nT3+hie5EusFwyzfhsBIzWu6sNeWSb7+iMIbiK2ok7wrFnSu5E4xILFzmKOFoRae0Dcn ARlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712789911; x=1713394711; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=xfbxzgfJR0MsMDY1vQLFHodv9yObaq7ZXxu6POH4CEo=; b=cbV/0lABHVS8Lqu9G2OkrJ+h6oQHitj3aCAj5s0g61Zu1xsydG6XFzKc4ynjnnZ4ol fYeR7JLeJbHjBQgV88KMaLBOaWVPIa0ekRnbdwdnf2zmNt68ek4U4uASb+fvv+/4C54Q LpbyNXryhP2PjBW4IxIcFbtkcSFA2vSGBREBYUkRh6UcdFoucwzr75WuOhhEXDaU3pIU A9VoA2sxmmQtv/6ZMzkeIcnM9ZpMwIZyXInMLIFvdsE+mZCO2nVih0FqHqrP8mIeuN8c u+Hp9fIx3yqwKdkLHZSa1YWOZPTMlET+iWzranFGFaw9pQx0zXumwmkXeFjbQJNZ9mOp fanA== X-Forwarded-Encrypted: i=1; AJvYcCUm/05nX7zFZkGAL1WN2soX7Q0aNLBWtFFNZFwHk5yeUrqQhf6goaQEoHOSwtx6WMMBZdjoBBKgsNLtsQr28sZ3WeRJaIAxPE1X8pUzuDvNNMZ6IDTH+IRSM7MmQvLZO3mNjvBq0pwsw9COnnzD1IWrdd4mpfBUaKcZ X-Gm-Message-State: AOJu0YyjRomWo5SeAJUv6TtSfpBysSdmD/wKdwi5VHZtNu+vrvfIhDun gwTXf2DUlPFf4PK2waJXrRl1bzKi57KnBRDo3mPeyWLhNVdmkfT4 X-Received: by 2002:a05:6214:20eb:b0:699:16a7:7b2e with SMTP id 11-20020a05621420eb00b0069916a77b2emr4072785qvk.19.1712789911111; Wed, 10 Apr 2024 15:58:31 -0700 (PDT) Received: from localhost (73.84.86.34.bc.googleusercontent.com. [34.86.84.73]) by smtp.gmail.com with ESMTPSA id u18-20020a0cea52000000b0069b192e63bfsm121104qvp.91.2024.04.10.15.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:58:30 -0700 (PDT) Date: Wed, 10 Apr 2024 18:58:30 -0400 From: Willem de Bruijn To: "Abhishek Chauhan (ABC)" , 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 , Martin KaFai Lau , Daniel Borkmann , bpf Cc: kernel@quicinc.com Message-ID: <66171996a10d2_2d123b29418@willemb.c.googlers.com.notmuch> In-Reply-To: References: <20240409210547.3815806-1-quic_abchauha@quicinc.com> <20240409210547.3815806-4-quic_abchauha@quicinc.com> <6616b3587520_2a98a5294db@willemb.c.googlers.com.notmuch> Subject: Re: [RFC PATCH bpf-next v1 3/3] net: Add additional bit to support userspace timestamp type Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Abhishek Chauhan (ABC) wrote: > > > On 4/10/2024 8:42 AM, Willem de Bruijn wrote: > > Abhishek Chauhan wrote: > >> tstamp_type can be real, mono or userspace timestamp. > >> > >> This commit adds userspace timestamp and sets it if there is > >> valid transmit_time available in socket coming from userspace. > >> > >> To make the design scalable for future needs this commit bring in > >> the change to extend the tstamp_type:1 to tstamp_type:2 to support > >> userspace timestamp. > >> > >> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@linux.dev/ > >> Signed-off-by: Abhishek Chauhan > > 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 ) > #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 > I am trying to figure out what this part of the code is doing. > https://lore.kernel.org/all/20230321014115.997841-4-kuba@kernel.org/ > > Please correct me if i am wrong here. I broadly agree. We should convert all references to SKB_MONO_DELIVERY_TIME_MASK to an skb_tstamp_type equivalent. > > >> @@ -4274,7 +4280,16 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt, > >> enum skb_tstamp_type tstamp_type) > >> { > >> skb->tstamp = kt; > >> - skb->tstamp_type = kt && tstamp_type; > >> + > >> + if (skb->tstamp_type) > >> + return; > >> + > > > I can put a warn on here incase if both MONO and TAI are set. > OR > Rather make it simple as you have mentioned below. When might skb->tstamp_type already be non-zero when skb_set_deliver_type is called? In most cases, this is called for a fresh skb. In br_ip6_fragment, it is called with a previous value. But this is the value of skb->tstamp_type. It just clears it if kt is 0. If skb->tstamp_type != tstamp_type is not a condition that can be forced by an unprivileged user, then we can warn.