Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp953176rwb; Thu, 18 Aug 2022 15:39:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ewbJDq4mF0TiKSR01oiwO0/1S2lNukmgyAnsPorkMPgIFWcpHF5mDuRrb7ido5BIl1pVd X-Received: by 2002:a17:907:6818:b0:730:825d:7296 with SMTP id qz24-20020a170907681800b00730825d7296mr3217702ejc.21.1660862397725; Thu, 18 Aug 2022 15:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660862397; cv=none; d=google.com; s=arc-20160816; b=lFVtqvvGVBkGVwGVO57VMm4+BkF29S3ochhLd/yNx1WEsz3j804K3L1UmJdFoowVAR v+rrxP08hKn8JFI0Mc3d9hhmVlIlDTeW/4JeK7034p/YuoDstdgmikhg/hnBanBOfvgG +wO9pkxvyJUaDpkVHxOe4dL+k5oZH6ydFK3M0XnbnU429UMyttIVW8rf7dIn6e97rIS0 HmBZZ0kE5ww4L1aVtVOhNBE+oRP4msF8gHn/CBdYUbqmfST2HZ1dBYWEOLTk/8s1mhDH 5tDZte4nmNHZ+eSCJK2WkP5eT1QkiLKmjNqKbgkwXQAbR7Gy/GAvLg9xHwYjVSqWBwNK 6F7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=bqimtuRDECWOfamqyR5FSsot1AL5746ILjJxrzbyYOY=; b=eKMOBZcJ0Z6f2I0Jhgsz8XYKpUTneH5iyKGw0NTn8YQdOrvJDAnFiO+7Bg9Njm+Uy2 LGVezLT+3I5K2j7WfyoLp6K/5H6iWFHutVnEmmSKKw0qqUWMzbfp3IPWeOdWunTMKg4n JPm6YNFxlzqaWC+k4a3HuXKRNrocfFtAzy9c2c5uN17PyVQmiBUIgKkzZxsW9dXQSOVR hC8lg6JlLCJzTAkm7L1JW4EnQW3tN+KGnM7tFICSEcWk1TUZ+XxhiwbOg3z0HukgzWWS ZQnUtVfN6n1uZh/iePp6wsAuGySjGzgcRHOkl9FVPPv89XbYZKI7BxdkbOLYz0+b0BBu UDGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=QtZNFrME; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=12+QZkWF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js22-20020a17090797d600b0073bf5bc27e9si1676578ejc.346.2022.08.18.15.39.31; Thu, 18 Aug 2022 15:39:57 -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=@dxuuu.xyz header.s=fm3 header.b=QtZNFrME; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=12+QZkWF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346071AbiHRWKp (ORCPT + 99 others); Thu, 18 Aug 2022 18:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346119AbiHRWKl (ORCPT ); Thu, 18 Aug 2022 18:10:41 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C612D25FF; Thu, 18 Aug 2022 15:10:39 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 5C0313200900; Thu, 18 Aug 2022 18:10:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 18 Aug 2022 18:10:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1660860634; x= 1660947034; bh=bqimtuRDECWOfamqyR5FSsot1AL5746ILjJxrzbyYOY=; b=Q tZNFrMEXwo0B/LI90hb4Vym5HO+fB2OVHlsZMXzn0/O8oJtRrNKyNi1ZZbg1WyVm araWUv9Qy7Yuw8OW+YqLca5pwRHzLmItXKyzwwzdFlJumA/bTfrjbaCgijKvWLIK 5ifR+qZa27xAHiQFhKPH5KmEdR/0HUYQcT6nZkTDs3rTI3Y3vBmSBrzFhO+l7lLB QXqe0kE0l3mE8q0JgfqtIeU3ewC1tKcyurtI3Xc/Nvhhtkhqfayg5ge4DjUB48Wi qeEi1HlMXy7fzARInCGAyQwNRaNtcQCH4XS0D1KftDk9hQYMcUxZ+fJT+ntYAieA VULTmDq+MoU4THN2faB8Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1660860634; x= 1660947034; bh=bqimtuRDECWOfamqyR5FSsot1AL5746ILjJxrzbyYOY=; b=1 2+QZkWF9inCmGBBPYFj60fys2jhoL/3SnCrhktpZphBqWhTcqUj59eUGgOKxQgEJ HerW6z/V36bbAnZa5z3tLpafPSDPXPt1u4kzZQxxglUBHMaoiDSGfPHu7pH0b9MV VW/U2u5k3xrKeImFqhIxNMsMIg+6uwCTtMfUDzPv4IP2I3xFNySUCSOkgS/nYEqI ZBXX5OYBD53szxY781XN/i97bXvvy/vuO660DcARFLbpg7k0S89t82Kit+g5JM1m ePP+qx5OAR7zFScALBVoHDJIz48BeFzqBbBTAxdIA1rJeWOe4T/Rxvrm3KceNMfk Zvr8Kl79bfjJqEUH7TH0A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeitddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtugfgjgesthekredt tddtudenucfhrhhomhepffgrnhhivghlucgiuhcuoegugihusegugihuuhhurdighiiiqe enucggtffrrghtthgvrhhnpeegvdejveeuvdeigfejjeeufefhffetfeekuddtuddvuedt ueffvdejleehgeetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegugihusegugihuuhhurdighiii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Aug 2022 18:10:33 -0400 (EDT) Date: Thu, 18 Aug 2022 16:10:32 -0600 From: Daniel Xu To: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, memxor@gmail.com, pablo@netfilter.org, fw@strlen.de, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v2 3/4] bpf: Add support for writing to nf_conn:mark Message-ID: <20220818221032.7b4lcpa7i4gchdvl@kashmir.localdomain> References: <87pmgxuy6v.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87pmgxuy6v.fsf@toke.dk> X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 Hi Toke, On Thu, Aug 18, 2022 at 09:52:08PM +0200, Toke H?iland-J?rgensen wrote: > Daniel Xu writes: > > > Support direct writes to nf_conn:mark from TC and XDP prog types. This > > is useful when applications want to store per-connection metadata. This > > is also particularly useful for applications that run both bpf and > > iptables/nftables because the latter can trivially access this > > metadata. > > Looking closer at the nf_conn definition, the mark field (and possibly > secmark) seems to be the only field that is likely to be feasible to > support direct writes to, as everything else either requires special > handling (like status and timeout), or they are composite field that > will require helpers anyway to use correctly. > > Which means we're in the process of creating an API where users have to > call helpers to fill in all fields *except* this one field that happens > to be directly writable. That seems like a really confusing and > inconsistent API, so IMO it strengthens the case for just making a > helper for this field as well, even though it adds a bit of overhead > (and then solving the overhead issue in a more generic way such as by > supporting clever inlining). > > -Toke I don't particularly have a strong opinion here. But to play devil's advocate: * It may be confusing now, but over time I expect to see more direct write support via BTF, especially b/c there is support for unstable helpers now. So perhaps in the future it will seem more sensible. * The unstable helpers do not have external documentation. Nor should they in my opinion as their unstableness + stale docs may lead to undesirable outcomes. So users of the unstable API already have to splunk through kernel code and/or selftests to figure out how to wield the APIs. All this to say there may not be an argument for discoverability. * Direct writes are slightly more ergnomic than using a helper. Thanks, Daniel