Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Eric Joyner <eric.joyner@amd.com>,
	netdev@vger.kernel.org, Gal Pressman <gal@nvidia.com>
Cc: Michael Chan <michael.chan@broadcom.com>,
	Pavan Chebbi <pavan.chebbi@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
	Simon Horman <horms@kernel.org>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Brett Creeley <brett.creeley@amd.com>,
	Breno Leitao <leitao@debian.org>,
	"Nikhil P. Rao" <nikhil.rao@amd.com>
Subject: Re: [PATCH net v2] ethtool: Embed FEC hist ranges as buffer in struct
Date: Thu, 23 Jul 2026 10:52:52 +0100	[thread overview]
Message-ID: <0cd77f88-eb09-4993-a5a1-a70f5d4cf35e@linux.dev> (raw)
In-Reply-To: <20260723041342.39238-1-eric.joyner@amd.com>

On 23/07/2026 05:13, Eric Joyner wrote:
> When a driver's .get_fec_stats() handler is called and the driver
> supports FEC histogram stats, the driver supplies the histogram bin
> ranges via a pointer.  This pointer is assigned while under the netdev
> ops lock in fec_prepare_data(), but the actual data is only read after
> the lock is released; so this allows the driver to change the ranges
> (e.g. from another .get_fec_stats() call) while the current call chain
> is reading them in fec_fill_reply().
> 
> Fix this by adding an ethtool core-owned buffer, ranges_buf, to struct
> ethtool_fec_hist. Drivers whose ranges are built dynamically (currently
> just mlx5) fill ranges_buf and then point the existing ranges pointer at
> it, giving ethtool a consistent copy that stays valid after the netdev
> ops lock is dropped and later in fec_fill_reply(). Drivers whose ranges
> are compile-time constants (bnxt, netdevsim) are unaffected by the
> potential race and keep setting the existing ranges pointer to their
> constant array, without making copies.
> 
> Fixes: cc2f08129925 ("ethtool: add FEC bins histogram report")
> Assisted-by: Claude:claude-sonnet-5
> Signed-off-by: Eric Joyner <eric.joyner@amd.com>
> ---
> v2: Take Vadim Fedorenko's suggestion
> (https://lore.kernel.org/netdev/f136bfb9-1756-4668-acc3-68962cdc6069@linux.dev/)
> and keep the ranges pointer for drivers that use constant ranges arrays;
> only use the new memory for dynamically constructed ranges.
> This makes this patch mostly an mlx5 change.

LGTM, but we definitely need a stamp from mlx folks.

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2026-07-23  9:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  4:13 [PATCH net v2] ethtool: Embed FEC hist ranges as buffer in struct Eric Joyner
2026-07-23  9:52 ` Vadim Fedorenko [this message]
2026-07-28  1:40 ` 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=0cd77f88-eb09-4993-a5a1-a70f5d4cf35e@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.joyner@amd.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=leon@kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mbloch@nvidia.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.rao@amd.com \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /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