[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251202105820.14d6de99@kernel.org>
Date: Tue, 2 Dec 2025 10:58:20 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Pavel Begunkov <asml.silence@...il.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Jonathan
Corbet <corbet@....net>, Michael Chan <michael.chan@...adcom.com>, Pavan
Chebbi <pavan.chebbi@...adcom.com>, Andrew Lunn <andrew+netdev@...n.ch>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>, John
Fastabend <john.fastabend@...il.com>, Ilias Apalodimas
<ilias.apalodimas@...aro.org>, Shuah Khan <shuah@...nel.org>, Mina Almasry
<almasrymina@...gle.com>, Stanislav Fomichev <sdf@...ichev.me>, Yue Haibing
<yuehaibing@...wei.com>, David Wei <dw@...idwei.uk>, Haiyue Wang
<haiyuewa@....com>, Jens Axboe <axboe@...nel.dk>, Joe Damato
<jdamato@...tly.com>, Simon Horman <horms@...nel.org>, Vishwanath Seshagiri
<vishs@...com>, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
io-uring@...r.kernel.org, dtatulea@...dia.com
Subject: Re: [PATCH net-next v7 7/9] eth: bnxt: allow providers to set rx
buf size
On Sun, 30 Nov 2025 23:35:22 +0000 Pavel Begunkov wrote:
> +static ssize_t bnxt_get_rx_buf_size(struct bnxt *bp, int rxq_idx)
> +{
> + struct netdev_rx_queue *rxq = __netif_get_rx_queue(bp->dev, rxq_idx);
> + size_t rx_buf_size;
> +
> + rx_buf_size = rxq->mp_params.rx_buf_len;
> + if (!rx_buf_size)
> + return BNXT_RX_PAGE_SIZE;
I'd like to retain my cfg objects in the queue API, if you don't mind.
I guess we just need the way for drivers to fill in the defaults and
then plumb them into the ops.
When drivers implement the logic to consolidate the configuration from
different APIs into the effective one they inevitably diverge in their
interpretations :/ We should keep it in the core from the start and
present to the driver the final queue config.
> + /* Older chips need MSS calc so rx_buf_len is not supported,
> + * but we don't set queue ops for them so we should never get here.
> + */
> + if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS))
> + return -EINVAL;
> +
> + if (!is_power_of_2(rx_buf_size))
> + return -ERANGE;
> +
> + if (rx_buf_size < BNXT_RX_PAGE_SIZE ||
> + rx_buf_size > BNXT_MAX_RX_PAGE_SIZE)
> + return -ERANGE;
> +
> + return rx_buf_size;
> +}
> +
> static int bnxt_queue_mem_alloc(struct net_device *dev, void *qmem, int idx)
> {
> struct bnxt_rx_ring_info *rxr, *clone;
> struct bnxt *bp = netdev_priv(dev);
> struct bnxt_ring_struct *ring;
> + ssize_t rx_buf_size;
> int rc;
>
> if (!bp->rx_ring)
> return -ENETDOWN;
>
> + rx_buf_size = bnxt_get_rx_buf_size(bp, idx);
> + if (rx_buf_size < 0)
> + return rx_buf_size;
Does this survive full ring reconfig? IIRC the large changes to the NIC
config (like changing ring sizes) free and reallocate all rings in bnxt,
but due to "historic reasons?" they don't go thru the queue ops.
Powered by blists - more mailing lists