From: Subbaraya Sundeep <sbhatta@marvell.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
<edumazet@google.com>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <horms@kernel.org>,
<michael.chan@broadcom.com>, <sdf@fomichev.me>,
<almasrymina@google.com>, <dtatulea@nvidia.com>,
<asml.silence@gmail.com>, <dw@davidwei.uk>,
<daniel@iogearbox.net>
Subject: Re: [PATCH net-next 2/6] net: introduce a trivial netdev_queue_config()
Date: Thu, 22 Jan 2026 13:42:40 +0530 [thread overview]
Message-ID: <20260122081240.GB1544331@kernel-ep2> (raw)
In-Reply-To: <20260122005113.2476634-3-kuba@kernel.org>
On 2026-01-22 at 06:21:09, Jakub Kicinski (kuba@kernel.org) wrote:
> We may choose to extend or reimplement the logic which renders
> the per-queue config. The drivers should not poke directly into
> the queue state. Add a helper for drivers to use when they want
> to query the config for a specific queue.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> net/core/Makefile | 1 +
> include/net/netdev_queues.h | 3 +++
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++---
> net/core/netdev_config.c | 32 +++++++++++++++++++++++
> 4 files changed, 39 insertions(+), 3 deletions(-)
> create mode 100644 net/core/netdev_config.c
>
> diff --git a/net/core/Makefile b/net/core/Makefile
> index 9ef2099c5426..d643a5a7fd18 100644
> --- a/net/core/Makefile
> +++ b/net/core/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_NETDEV_ADDR_LIST_TEST) += dev_addr_lists_test.o
>
> obj-y += net-sysfs.o
> obj-y += hotdata.o
> +obj-y += netdev_config.o
> obj-y += netdev_rx_queue.o
> obj-y += netdev_queues.o
> obj-$(CONFIG_PAGE_POOL) += page_pool.o page_pool_user.o
> diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
> index 2ab3eae8e8c3..725bf69ef86c 100644
> --- a/include/net/netdev_queues.h
> +++ b/include/net/netdev_queues.h
> @@ -170,6 +170,9 @@ struct netdev_queue_mgmt_ops {
> unsigned int supported_params;
> };
>
> +void netdev_queue_config(struct net_device *dev, int rxq,
> + struct netdev_queue_config *qcfg);
> +
Minor nit: make function name something like netdev_get_queue_config
(to avoid same as struct name)
Thanks,
Sundeep
> bool netif_rxq_has_unreadable_mp(struct net_device *dev, int idx);
>
> /**
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 0b95100a7c36..d57e833ce690 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -4326,12 +4326,12 @@ static void bnxt_init_ring_struct(struct bnxt *bp)
>
> for (i = 0; i < bp->cp_nr_rings; i++) {
> struct bnxt_napi *bnapi = bp->bnapi[i];
> + struct netdev_queue_config qcfg;
> struct bnxt_ring_mem_info *rmem;
> struct bnxt_cp_ring_info *cpr;
> struct bnxt_rx_ring_info *rxr;
> struct bnxt_tx_ring_info *txr;
> struct bnxt_ring_struct *ring;
> - struct netdev_rx_queue *rxq;
>
> if (!bnapi)
> continue;
> @@ -4349,8 +4349,8 @@ static void bnxt_init_ring_struct(struct bnxt *bp)
> if (!rxr)
> goto skip_rx;
>
> - rxq = __netif_get_rx_queue(bp->dev, i);
> - rxr->rx_page_size = rxq->qcfg.rx_page_size;
> + netdev_queue_config(bp->dev, i, &qcfg);
> + rxr->rx_page_size = qcfg.rx_page_size;
>
> ring = &rxr->rx_ring_struct;
> rmem = &ring->ring_mem;
> diff --git a/net/core/netdev_config.c b/net/core/netdev_config.c
> new file mode 100644
> index 000000000000..562087bd30c8
> --- /dev/null
> +++ b/net/core/netdev_config.c
> @@ -0,0 +1,32 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/netdevice.h>
> +#include <net/netdev_queues.h>
> +#include <net/netdev_rx_queue.h>
> +
> +/**
> + * netdev_queue_config() - get configuration for a given queue
> + * @dev: net_device instance
> + * @rxq_idx: index of the queue of interest
> + * @qcfg: queue configuration struct (output)
> + *
> + * Render the configuration for a given queue. This helper should be used
> + * by drivers which support queue configuration to retrieve config for
> + * a particular queue.
> + *
> + * @qcfg is an output parameter and is always fully initialized by this
> + * function. Some values may not be set by the user, drivers may either
> + * deal with the "unset" values in @qcfg, or provide the callback
> + * to populate defaults in queue_management_ops.
> + */
> +void netdev_queue_config(struct net_device *dev, int rxq_idx,
> + struct netdev_queue_config *qcfg)
> +{
> + struct netdev_queue_config *stored;
> +
> + memset(qcfg, 0, sizeof(*qcfg));
> +
> + stored = &__netif_get_rx_queue(dev, rxq_idx)->qcfg;
> + qcfg->rx_page_size = stored->rx_page_size;
> +}
> +EXPORT_SYMBOL(netdev_queue_config);
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-01-22 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 0:51 [PATCH net-next 0/6] net: restore the structure of driver-facing qcfg API Jakub Kicinski
2026-01-22 0:51 ` [PATCH net-next 1/6] eth: bnxt: always set the queue mgmt ops Jakub Kicinski
2026-01-22 8:04 ` Subbaraya Sundeep
2026-01-22 15:36 ` Jakub Kicinski
2026-01-22 16:31 ` Subbaraya Sundeep
2026-01-22 0:51 ` [PATCH net-next 2/6] net: introduce a trivial netdev_queue_config() Jakub Kicinski
2026-01-22 8:12 ` Subbaraya Sundeep [this message]
2026-01-22 15:36 ` Jakub Kicinski
2026-01-22 0:51 ` [PATCH net-next 3/6] net: move mp->rx_page_size validation to __net_mp_open_rxq() Jakub Kicinski
2026-01-22 0:51 ` [PATCH net-next 4/6] net: use netdev_queue_config() for mp restart Jakub Kicinski
2026-01-22 15:06 ` Dragos Tatulea
2026-01-22 15:46 ` Jakub Kicinski
2026-01-22 16:28 ` Dragos Tatulea
2026-01-23 1:41 ` Jakub Kicinski
2026-01-22 0:51 ` [PATCH net-next 5/6] net: add queue config validation callback Jakub Kicinski
2026-01-22 0:51 ` [PATCH net-next 6/6] eth: bnxt: plug bnxt_validate_qcfg() into qops Jakub Kicinski
2026-01-23 21:20 ` [PATCH net-next 0/6] net: restore the structure of driver-facing qcfg API patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122081240.GB1544331@kernel-ep2 \
--to=sbhatta@marvell.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=asml.silence@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox