From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1ADE9C5475B for ; Fri, 8 Mar 2024 03:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6630310ED7E; Fri, 8 Mar 2024 03:36:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Rm4QdZGl"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id E1B6D10ED7E for ; Fri, 8 Mar 2024 03:36:50 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9F6B661CE8; Fri, 8 Mar 2024 03:36:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 406A1C433F1; Fri, 8 Mar 2024 03:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709869009; bh=vAK5UsAi1mlbmfS8eyss1ed3F+nyC6FU4MtAV8GtcKY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rm4QdZGlRLCr8AAepoUDwXNJRdT/41xTmy7pgW1hC/Vkc6H2ViLXJ61BdpMlwF47t wEiZLKsT0zHiG2vaTdBjyw8Yz2Jhir4s0t8rTTdInCx5QEDONETMnmxo2+grPUr68A 1wYgYLcJoM+s4pjo+N3FD/kjR3CM/uidkwekXtRA1OmDZpHzegKXJooc6N/abyAZ/d GgwtlPgImcuZGYVCBU104HdirTzkdsXA7ah6zKSSw8gWaeFm3PGbV+wN0Ue2c0ZfvM o0hGEwYCGMHnOhPGoNDMRCNboOR4rsdMIGrUcszugDtYPt5QWmNqXKb6y1C9r+LSjB ENxvIiLB7g1Fg== Date: Thu, 7 Mar 2024 19:36:46 -0800 From: Jakub Kicinski To: Mina Almasry Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , Christian =?UTF-8?B?S8O2bmln?= , Pavel Begunkov , David Wei , Jason Gunthorpe , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi Subject: Re: [RFC PATCH net-next v6 01/15] queue_api: define queue api Message-ID: <20240307193646.70ef5243@kernel.org> In-Reply-To: References: <20240305020153.2787423-1-almasrymina@google.com> <20240305020153.2787423-2-almasrymina@google.com> <20240307173039.00e6fbb7@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, 7 Mar 2024 18:08:24 -0800 Mina Almasry wrote: > On Thu, Mar 7, 2024 at 5:30=E2=80=AFPM Jakub Kicinski w= rote: > > On Mon, 4 Mar 2024 18:01:36 -0800 Mina Almasry wrote: =20 > > > + * void *(*ndo_queue_mem_alloc)(struct net_device *dev, int idx); > > > + * Allocate memory for an RX queue. The memory returned in the for= m of > > > + * a void * can be passed to ndo_queue_mem_free() for freeing or to > > > + * ndo_queue_start to create an RX queue with this memory. > > > + * > > > + * void (*ndo_queue_mem_free)(struct net_device *dev, void *); > > > + * Free memory from an RX queue. > > > + * > > > + * int (*ndo_queue_start)(struct net_device *dev, int idx, void *); > > > + * Start an RX queue at the specified index. > > > + * > > > + * int (*ndo_queue_stop)(struct net_device *dev, int idx, void **); > > > + * Stop the RX queue at the specified index. > > > */ > > > struct net_device_ops { > > > int (*ndo_init)(struct net_device *dev); > > > @@ -1679,6 +1693,16 @@ struct net_device_ops { > > > int (*ndo_hwtstamp_set)(struct net_device *= dev, > > > struct kernel_hwtst= amp_config *kernel_config, > > > struct netlink_ext_= ack *extack); > > > + void * (*ndo_queue_mem_alloc)(struct net_devic= e *dev, > > > + int idx); > > > + void (*ndo_queue_mem_free)(struct net_device= *dev, > > > + void *queue_mem); > > > + int (*ndo_queue_start)(struct net_device *d= ev, > > > + int idx, > > > + void *queue_mem); > > > + int (*ndo_queue_stop)(struct net_device *de= v, > > > + int idx, > > > + void **out_queue_mem)= ; =20 > > > > The queue configuration object was quite an integral part of the design, > > I'm slightly worried that it's not here :) =20 >=20 > That was a bit of a simplification I'm making since we just want to > restart the queue. I thought it was OK to define some minimal version > here and extend it later with configuration? Because in this context > all we really need is to restart the queue, yes? Right, I think it's perfectly fine for the time being. It works, and is internal to the kernel. > If extending with some configuration is a must please let me know what > configuration struct you're envisioning. Were you envisioning a stub? > Or some real configuration struct that we just don't use at the > moment? Or one that we use for this use case somehow? I had some ideas about storing the configuration as rules, instead of directly in struct netdev_rx_queue. E.g. default queue length =3D 2000, but for select queues you may want a different length. But application binding to a queue would always take precedence,=20 so even if the ideas ever materialize there will be no uAPI change. > > Also we may want to rename > > the about-to-be-merged ops from netdev_stat_ops and netdev_queue_ops, > > and add these there? > > > > https://lore.kernel.org/all/20240306195509.1502746-2-kuba@kernel.org/ >=20 > Yeah, that sounds reasonable! Thanks! We could also keep the > netdev_stat_ops and add new netdev_queue_ops alongside them if you > prefer. Up to you, after some soul searching we renamed the uAPI to call these stats qstats, I just forgot to rename the op struct. But it doesn't matter much. > > Very excited to hear that you made progress on this and ported GVE over= ! =20 >=20 > Actually, we're still discussing but it looks like my GVE queue API > implementation I proposed earlier may be a no-go. Likely someone from > the GVE team will follow up here with this piece, probably in a > separate series. Well, it's going to be ready when it's ready :) Speaking of things which can be merged independently, feel free to post patch 3, maybe it can make v6.9.. > For now I'm carrying my POC for the GVE implementation out of tree > with the rest of the driver changes: >=20 > https://github.com/mina/linux/commit/501b734c80186545281e9edb1bf313f5a2d8= cbee