Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp305857lqc; Thu, 7 Mar 2024 19:37:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXsEOAdoIrJqchZbhxI+oHzj+nf7glnqLucJQbm1glmrOAiHZG1sKPxRNbY3qlb+pc6XRECJYsemDAbMhhEXDAov0xUQt2Y5eGzGBma9w== X-Google-Smtp-Source: AGHT+IGx1zHCH9/96cHKc76BfsYqKHqGGDGi0tYuowFpq/WQhOnzyLTQ90QKqrXWHgQ7ADHH4Sqt X-Received: by 2002:a50:999b:0:b0:564:f6d5:f291 with SMTP id m27-20020a50999b000000b00564f6d5f291mr944659edb.34.1709869030945; Thu, 07 Mar 2024 19:37:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709869030; cv=pass; d=google.com; s=arc-20160816; b=e8oeQw62S0r/hFyjaGe+YtoGRdhIM6u/HaVvPcCl3S3Qe911O2IusDxXzf61eLpmET GJTHOtCSQcnEYpsk6U609gyraG/RZE0IyVGQV6CmMioqfBRTZQxuojWBjRPIM46nVW7R y6x7BvFOb2sy/b3et75MhHt8qlKGaFFbkHS5z8UBflbLvRM+YC935Ab1Yj9NPYjws5gp xa4R09/IJdGe9XvpGWu5XMaXp6ppfA2FRVvW++XAgUP0PnQhwTUv40d1QwI7XsBBbw89 bWzEcJHo+9ogL6P4CZlJuFV3Zs7WqNCu187QUEmx3c8yfXBY8wWuemaBQ+2VWjpQbjSp zhig== 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=syxIWKE3S26W0j6msPnRRAi9l/TB0f5xT9b7ECco0Jw=; fh=0pLE4JJRN74KjaWh+xqC4QqySLF7blf2qnedm85zsZc=; b=qb9LlpiwTtFmLLg38ag+/6iv2UeFyP3e2iaFEG/npKm8Z/wr2QH9gqhMeqBnuqUY6/ XYVqdoatl5zN1Ro/zU5+ZfPSfGZ3AY1OFjVRArUQwwEHjIJUTi74RG3oXrEzltUQ9hRy kDODE89X9ongcBK/58qOZfjVJAJKVrhsVjmulQS3Nd0/3J01mRveEX7r9MUxmN/9Boq0 o2A0e6FtvxmrLNSvuE2JlfP7dQcqbli3LDN/jM+un6ModjBpxwilBCyzol9TSzTlJBk/ 94PGqWANx2oT7vxN2MbLjE1uLJKchU8ac+JnNEZirK6eFkvnqq6sWeuNyhW1RnPJTSb7 NUfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rm4QdZGl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b8-20020a056402084800b0056666f330bcsi7509875edz.408.2024.03.07.19.37.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 19:37:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rm4QdZGl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 841441F21EC6 for ; Fri, 8 Mar 2024 03:37:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22A042C6BB; Fri, 8 Mar 2024 03:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Rm4QdZGl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CABDC23775; Fri, 8 Mar 2024 03:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709869010; cv=none; b=KENJPlgkeWS8Jb60tO0RWZ0tYxJ/z0PNhGq5IdlPmZ+TRUwz+uwTs4Caog6Cq4D82bZSVNOlHHTAYQvQ6IlnByKtJgek8BQjrtr6btcfdlbbC56RIS05byoNcnjoAW0QDLdpZYESliC/uYjXssKGTc4mcZTs30JlMSwcCGYcesI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709869010; c=relaxed/simple; bh=vAK5UsAi1mlbmfS8eyss1ed3F+nyC6FU4MtAV8GtcKY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NXylPHmYZ32wBJvabKcfva9uq45q4jjmcJIspdhil3hJMZ99gSiA59f1g0xGFO92LjeQPJnh3gcLDyCe3K1pGNGUmVFCNBmZpMFwipB52v8ckwRoOCqmY1RvZpp1roXCnTTQ/g5Y07dWubhcMJ28ZsAVVJ0MuJ7f7RA6mCwlI00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rm4QdZGl; arc=none smtp.client-ip=10.30.226.201 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> 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: quoted-printable 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