Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27893708rwd; Tue, 4 Jul 2023 09:18:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrUr+q91/NjBIyqMj/5VaZ4IlUtbDQq027MDk2u2tenOUga4zfNWUTfpd/6pVRx0z06DwV X-Received: by 2002:a17:903:11d1:b0:1aa:d971:4623 with SMTP id q17-20020a17090311d100b001aad9714623mr16584959plh.38.1688487484904; Tue, 04 Jul 2023 09:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688487484; cv=none; d=google.com; s=arc-20160816; b=UEADKG4reJcegCLq2x4VRvTdRl4g3txkIoFvaXPPz9+KwhT6EAtRdddg4KGbiQTqWg CPEck07zJdaknyHVKW4RamK7zFfnAjWGSqEJNkojlcl/VJjrK8s/ES4lM0U5faxPz52c u5BJR4G+tEoptcYhUHRL4P5r1Rw2MReh0uHBLUvWXL5j3Y+84rSreEJw8oQea6HpPkBs lW2XL8l8dfsR55veIqfJHXJLNNfyd+LXpDsaUr6Z8ZEVSCyUsy7boHc9R5OZhq1St3Qm F8NwJEZvngBBYloL04XOqx8hVOnASLp5nmHQFQfwvWaTcG2A9wgIuIGfZxnqvHzvG6IH OxdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=9pD4Ch4S5j+ANwqD1CPw58d4xO0OpJUusf60fgZFUbo=; fh=wHBket55eKhh+dZ7LCC2yfdDQ4JT3NkbsPcm5Kn6oZg=; b=tt6ush05FesM2J98PVKuoNgodgQhZATW0Djgz+TaQopY0EocA3fm7L/967Ls2Dgf+M VvQzcNgBmwYO3LI0JPEw2PasOu2UM3UM0XWYypxIf42cbJV9G9tJewbcMmyfSCrGy9Fm eTwYIsU2sV/ND9BGk9gappjI+3u7+3AztSlZV1PWV5UnohXC37m/BrQyWuRF8rL3HZVU HVpN2S4644Q70ubde4Cr+OQ7TGdkiMz0ET47gJuoEmoDvx1PRzYyu0VhI/TUTN+MS7el uYKK6tNeVM6+g/F9WD4hnsnAr4Gq3P+vJt5LBfeurfcTMTQELRhMxKdpeDZR7EpTrdr7 LM5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tu-berlin.de header.s=dkim-tub header.b=hfWY4UV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=tu-berlin.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170903230400b001b8894c8e20si718560plh.279.2023.07.04.09.17.50; Tue, 04 Jul 2023 09:18:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tu-berlin.de header.s=dkim-tub header.b=hfWY4UV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=tu-berlin.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbjGDQL7 (ORCPT + 99 others); Tue, 4 Jul 2023 12:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjGDQL6 (ORCPT ); Tue, 4 Jul 2023 12:11:58 -0400 Received: from mailrelay.tu-berlin.de (mailrelay.tu-berlin.de [130.149.7.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2CD8DA; Tue, 4 Jul 2023 09:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tu-berlin.de; l=3292; s=dkim-tub; t=1688487116; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=9pD4Ch4S5j+ANwqD1CPw58d4xO0OpJUusf60fgZFUbo=; b=hfWY4UV33/eHHwR+FaYBf3Z/czA2f7hz/aaixxy6d1lKPsyUXAvm1jRu OUCQhP8/injsL0R5m8qSZUYYV2hQ2Ex8/h/b9y+b83qi80YkOkyo1Q3bL TvAqMnSmPf6dQpz/LjyrbIs029Wd1FE0PbPhQTkcxj2b93fieH7iJEU6d k=; X-IronPort-AV: E=Sophos;i="6.01,181,1684792800"; d="scan'208";a="1396566" Received: from mail.tu-berlin.de ([141.23.12.141]) by mailrelay.tu-berlin.de with ESMTP; 04 Jul 2023 18:11:53 +0200 Message-ID: Subject: Re: [PATCH 0/2] bpf, net: Allow setting SO_TIMESTAMPING* from BPF From: =?ISO-8859-1?Q?J=F6rn-Thorben?= Hinz To: John Fastabend , , , , CC: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "Martin KaFai Lau" , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , "Paolo Abeni" , Shuah Khan , Willem de Bruijn , Deepa Dinamani Date: Tue, 4 Jul 2023 18:11:51 +0200 In-Reply-To: <64a33ce7b50d2_6520520875@john.notmuch> References: <20230703175048.151683-1-jthinz@mailbox.tu-berlin.de> <64a33ce7b50d2_6520520875@john.notmuch> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thank you for the feedback. Just noticed I missed the =E2=80=9Cbpf-next=E2=80=9D designation in the sub= ject. Will add that in v2. On Mon, 2023-07-03 at 14:25 -0700, John Fastabend wrote: > J=C3=B6rn-Thorben Hinz wrote: > > BPF applications, e.g., a TCP congestion control, might benefit > > from > > precise packet timestamps. These timestamps are already available > > in > > __sk_buff and bpf_sock_ops, but could not be requested: A BPF > > program > > was not allowed to set SO_TIMESTAMPING* on a socket. This change > > enables > > BPF programs to actively request the generation of timestamps from > > a > > stream socket. > >=20 > > To reuse the setget_sockopt BPF prog test for > > bpf_{get,set}sockopt(SO_TIMESTAMPING_NEW), also implement the > > missing > > getsockopt(SO_TIMESTAMPING_NEW) in the network stack. > >=20 > > I reckon the way I added getsockopt(SO_TIMESTAMPING_NEW) causes an > > API > > change: For existing users that set SO_TIMESTAMPING_NEW but queried > > SO_TIMESTAMPING_OLD afterwards, it would now look as if no > > timestamping > > flags have been set. Is this an acceptable change? If not, I=E2=80=99m > > happy to > > change getsockopt() to only be strict about the newly-implemented > > getsockopt(SO_TIMESTAMPING_NEW), or not distinguish between > > SO_TIMESTAMPING_NEW and SO_TIMESTAMPING_OLD at all. >=20 > Yeah, I think it would be best if we keep the old behavior and let > SO_TIMESTAMPING_OLD return timestamps for both new/old. It looks > like it should be relatively easy to implement? Alright, I guessed that would be preferred. Yes, if there is no objection to making the added getsockopt(SO_TIMESTAMPING_NEW) this tiny bit more =E2=80=9Cstrict=E2=80=9D= , it=E2=80=99s just a matter of modifying the if inserted in sk_getsockopt(). (And, well, in the other case I would even remove this if.) >=20 > Otherwise the series lgtm. Great, thanks. >=20 > >=20 > > J=C3=B6rn-Thorben Hinz (2): > > =C2=A0 net: Implement missing getsockopt(SO_TIMESTAMPING_NEW) > > =C2=A0 bpf: Allow setting SO_TIMESTAMPING* with bpf_setsockopt() > >=20 > > =C2=A0include/uapi/linux/bpf.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 3 ++- > > =C2=A0net/core/filter.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 2 ++ > > =C2=A0net/core/sock.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | 9 +++++++-- > > =C2=A0tools/include/uapi/linux/bpf.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | 3 ++- > > =C2=A0tools/testing/selftests/bpf/progs/bpf_tracing_net.h | 2 ++ > > =C2=A0tools/testing/selftests/bpf/progs/setget_sockopt.c=C2=A0 | 4 ++++ > > =C2=A06 files changed, 19 insertions(+), 4 deletions(-) > >=20 > > --=20 > > 2.39.2 > >=20