From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 7E4AE305679 for ; Sat, 11 Jul 2026 21:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783803853; cv=none; b=HjtP4rkB39U2KNINpvP0j7oYuVfdOp8ZV0vo1whJTHZhcEOR9iMPrJKt+Wq/47SZGR4zBOJbuTBamEqONa2U2HEePkBpCCScNrbAwAahJBtPbfEsKdUBCAmZE8jBeJPO/SM9+WO92DkUd6LYi6iin/q+ddkG2WF6n/TocKYgEnE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783803853; c=relaxed/simple; bh=cERCI6uVF9g47+lyhONovzvk5XFd5tFIJTjvMC/kf8k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cluSwK0pIx0evEYVIhJdXmks8+Y2iovanoBG+/ZkUPt0dV5uDb0d8jfoe8cxDQVPtaziUEz1ioEneeqLuZTOmZ/1gFskDWt9bgJMVaf5fLFLMXiu/sPituvNrHQolrOwj5/dUV9f+2JIhhNKZB3VkokNMISiu9lLuwYMPPH7VGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Txs1xkIS; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Txs1xkIS" Message-ID: <45d2be78-4e58-445e-81b2-75dbcd15402f@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783803847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z5WuK1x1fHq3Mg+KyPpmOrUlIIIjpEDexQ1uLTd5pas=; b=Txs1xkISM7iyukESV9HHLrnQS8R2PsL+z8ijLSJN6sX1f654R0e80F+jSY8LVuf0zH/aHv WgobdxcXa63L+inTzkIKS2xTURgQj/VJvQdHmgFAjKj6/0a9mP1aOltFPr6y5qh+HboN1I nGsSjUwOL2HAH853qQIrzjjynuX2KTo= Date: Sat, 11 Jul 2026 22:03:56 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net] ethtool: Embed FEC hist ranges as buffer in struct To: Eric Joyner , netdev@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Mark Bloch , Simon Horman , Maxime Chevallier , Brett Creeley , Breno Leitao , "Nikhil P. Rao" References: <20260710230026.47721-1-eric.joyner@amd.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20260710230026.47721-1-eric.joyner@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 11/07/2026 00:00, 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 embedding a buffer for the driver-supplied ranges in struct > ethtool_fec_hist instead of using a pointer; this ensures there's an > ethtool core-owned consistent copy that can be used after the netdev ops > lock is dropped and later in fec_fill_reply(). While some drivers like > bnxt use a constant struct for their ranges and won't be affected by > this issue, others like mlx5 (and eventually ionic) will use a > dynamically constructed range struct and could potentially run into an > issue. I didn't like the idea of dynamic range, FEC is not changing while the link is UP, I don't see a reason to dynamically reconstruct histogram bins every single call. And the histogram itself is stable per HW per FEC, can be constant pre-defined struct in a driver, like in bnxt. But if dynamic allocation is the only option, then yes, we have to change this ABI. > Since the kernel API changed here, change the in-tree drivers that > report FEC histogram stats to copy their ranges instead of just > supplying a pointer. > > Fixes: cc2f08129925 ("ethtool: add FEC bins histogram report") > Signed-off-by: Eric Joyner