[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIhWLcnu884VkNDO@opensource>
Date: Tue, 29 Jul 2025 05:03:41 +0000
From: Subbaraya Sundeep <sbhatta@...vell.com>
To: Pavel Begunkov <asml.silence@...il.com>
CC: Jakub Kicinski <kuba@...nel.org>, <netdev@...r.kernel.org>,
<io-uring@...r.kernel.org>, Eric Dumazet <edumazet@...gle.com>,
Willem de
Bruijn <willemb@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, <andrew+netdev@...n.ch>,
<horms@...nel.org>, <davem@...emloft.net>, <sdf@...ichev.me>,
<almasrymina@...gle.com>, <dw@...idwei.uk>,
<michael.chan@...adcom.com>, <dtatulea@...dia.com>,
<ap420073@...il.com>
Subject: Re: [RFC v1 03/22] net: use zero value to restore rx_buf_len to
default
LGTM.
Thanks,
Sundeep
On 2025-07-28 at 11:04:07, Pavel Begunkov (asml.silence@...il.com) wrote:
> From: Jakub Kicinski <kuba@...nel.org>
>
> Distinguish between rx_buf_len being driver default vs user config.
> Use 0 as a special value meaning "unset" or "restore driver default".
> This will be necessary later on to configure it per-queue, but
> the ability to restore defaults may be useful in itself.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
> ---
> Documentation/networking/ethtool-netlink.rst | 2 +-
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 3 +++
> include/linux/ethtool.h | 1 +
> net/ethtool/rings.c | 2 +-
> 4 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
> index b7a99dfdffa9..723f8e1a33a7 100644
> --- a/Documentation/networking/ethtool-netlink.rst
> +++ b/Documentation/networking/ethtool-netlink.rst
> @@ -974,7 +974,7 @@ threshold value, header and data will be split.
> ``ETHTOOL_A_RINGS_RX_BUF_LEN`` controls the size of the buffer chunks driver
> uses to receive packets. If the device uses different memory polls for headers
> and payload this setting may control the size of the header buffers but must
> -control the size of the payload buffers.
> +control the size of the payload buffers. Setting to 0 restores driver default.
>
> CHANNELS_GET
> ============
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index 7bdef64926c8..1a74a7b81ac1 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -396,6 +396,9 @@ static int otx2_set_ringparam(struct net_device *netdev,
> if (ring->rx_mini_pending || ring->rx_jumbo_pending)
> return -EINVAL;
>
> + if (!rx_buf_len)
> + rx_buf_len = OTX2_DEFAULT_RBUF_LEN;
> +
> /* Hardware supports max size of 32k for a receive buffer
> * and 1536 is typical ethernet frame size.
> */
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index dd9f253a56ae..bbc5c485bfbf 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -77,6 +77,7 @@ enum {
> /**
> * struct kernel_ethtool_ringparam - RX/TX ring configuration
> * @rx_buf_len: Current length of buffers on the rx ring.
> + * Setting to 0 means reset to driver default.
> * @rx_buf_len_max: Max length of buffers on the rx ring.
> * @tcp_data_split: Scatter packet headers and data to separate buffers
> * @tx_push: The flag of tx push mode
> diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c
> index 5e872ceab5dd..628546a1827b 100644
> --- a/net/ethtool/rings.c
> +++ b/net/ethtool/rings.c
> @@ -139,7 +139,7 @@ const struct nla_policy ethnl_rings_set_policy[] = {
> [ETHTOOL_A_RINGS_RX_MINI] = { .type = NLA_U32 },
> [ETHTOOL_A_RINGS_RX_JUMBO] = { .type = NLA_U32 },
> [ETHTOOL_A_RINGS_TX] = { .type = NLA_U32 },
> - [ETHTOOL_A_RINGS_RX_BUF_LEN] = NLA_POLICY_MIN(NLA_U32, 1),
> + [ETHTOOL_A_RINGS_RX_BUF_LEN] = { .type = NLA_U32 },
> [ETHTOOL_A_RINGS_TCP_DATA_SPLIT] =
> NLA_POLICY_MAX(NLA_U8, ETHTOOL_TCP_DATA_SPLIT_ENABLED),
> [ETHTOOL_A_RINGS_CQE_SIZE] = NLA_POLICY_MIN(NLA_U32, 1),
> --
> 2.49.0
>
Powered by blists - more mailing lists