* [PATCH net 0/2] eth: fbnic: Fix drop stats support
@ 2025-08-02 2:46 Mohsin Bashir
2025-08-02 2:46 ` [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting Mohsin Bashir
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Mohsin Bashir @ 2025-08-02 2:46 UTC (permalink / raw)
To: netdev
Cc: alexanderduyck, andrew+netdev, davem, edumazet, horms,
kernel-team, kuba, linux-kernel, mohsin.bashr, pabeni, sdf,
vadim.fedorenko
Fix hardware drop stats support on the TX path of fbnic by addressing two
issues: ensure that tx_dropped stats are correctly copied to the
rtnl_link_stats64 struct, and protect the copying of drop stats from
fdb->hw_stats to the local variable with the hw_stats_lock to
ensure consistency.
Mohsin Bashir (2):
eth: fbnic: Fix tx_dropped reporting
eth: fbnic: Lock the tx_dropped update
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting
2025-08-02 2:46 [PATCH net 0/2] eth: fbnic: Fix drop stats support Mohsin Bashir
@ 2025-08-02 2:46 ` Mohsin Bashir
2025-08-04 11:14 ` Simon Horman
2025-08-02 2:46 ` [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update Mohsin Bashir
2025-08-05 23:20 ` [PATCH net 0/2] eth: fbnic: Fix drop stats support patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Mohsin Bashir @ 2025-08-02 2:46 UTC (permalink / raw)
To: netdev
Cc: alexanderduyck, andrew+netdev, davem, edumazet, horms,
kernel-team, kuba, linux-kernel, mohsin.bashr, pabeni, sdf,
vadim.fedorenko
Correctly copy the tx_dropped stats from the fbd->hw_stats to the
rtnl_link_stats64 struct.
Fixes: 5f8bd2ce8269 ("eth: fbnic: add support for TMI stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
---
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 7bd7812d9c06..dc295e1b8516 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -420,16 +420,16 @@ static void fbnic_get_stats64(struct net_device *dev,
tx_packets = stats->packets;
tx_dropped = stats->dropped;
- stats64->tx_bytes = tx_bytes;
- stats64->tx_packets = tx_packets;
- stats64->tx_dropped = tx_dropped;
-
/* Record drops from Tx HW Datapath */
tx_dropped += fbd->hw_stats.tmi.drop.frames.value +
fbd->hw_stats.tti.cm_drop.frames.value +
fbd->hw_stats.tti.frame_drop.frames.value +
fbd->hw_stats.tti.tbi_drop.frames.value;
+ stats64->tx_bytes = tx_bytes;
+ stats64->tx_packets = tx_packets;
+ stats64->tx_dropped = tx_dropped;
+
for (i = 0; i < fbn->num_tx_queues; i++) {
struct fbnic_ring *txr = fbn->tx[i];
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update
2025-08-02 2:46 [PATCH net 0/2] eth: fbnic: Fix drop stats support Mohsin Bashir
2025-08-02 2:46 ` [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting Mohsin Bashir
@ 2025-08-02 2:46 ` Mohsin Bashir
2025-08-04 11:12 ` Simon Horman
2025-08-05 23:20 ` [PATCH net 0/2] eth: fbnic: Fix drop stats support patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Mohsin Bashir @ 2025-08-02 2:46 UTC (permalink / raw)
To: netdev
Cc: alexanderduyck, andrew+netdev, davem, edumazet, horms,
kernel-team, kuba, linux-kernel, mohsin.bashr, pabeni, sdf,
vadim.fedorenko
Wrap copying of drop stats on TX path from fbd->hw_stats by the
hw_stats_lock. Currently, it is being performed outside the lock and
another thread accessing fbd->hw_stats can lead to inconsistencies.
Fixes: 5f8bd2ce8269 ("eth: fbnic: add support for TMI stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
---
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index dc295e1b8516..d0e381ad7bee 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -421,10 +421,12 @@ static void fbnic_get_stats64(struct net_device *dev,
tx_dropped = stats->dropped;
/* Record drops from Tx HW Datapath */
+ spin_lock(&fbd->hw_stats_lock);
tx_dropped += fbd->hw_stats.tmi.drop.frames.value +
fbd->hw_stats.tti.cm_drop.frames.value +
fbd->hw_stats.tti.frame_drop.frames.value +
fbd->hw_stats.tti.tbi_drop.frames.value;
+ spin_unlock(&fbd->hw_stats_lock);
stats64->tx_bytes = tx_bytes;
stats64->tx_packets = tx_packets;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update
2025-08-02 2:46 ` [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update Mohsin Bashir
@ 2025-08-04 11:12 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-08-04 11:12 UTC (permalink / raw)
To: Mohsin Bashir
Cc: netdev, alexanderduyck, andrew+netdev, davem, edumazet,
kernel-team, kuba, linux-kernel, pabeni, sdf, vadim.fedorenko
On Fri, Aug 01, 2025 at 07:46:36PM -0700, Mohsin Bashir wrote:
> Wrap copying of drop stats on TX path from fbd->hw_stats by the
> hw_stats_lock. Currently, it is being performed outside the lock and
> another thread accessing fbd->hw_stats can lead to inconsistencies.
>
> Fixes: 5f8bd2ce8269 ("eth: fbnic: add support for TMI stats")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
Thanks,
I note that hw_stats_lock is documented as protecting hw_stats.
And that it is already used for that purpose elsewhere in
fbnic_get_stats64().
I do wonder if some refactoring could allow only locking
hw_stats_lock once in fbnic_get_stats64(). But that line of thought
doesn't effect the correctness of this patch.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting
2025-08-02 2:46 ` [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting Mohsin Bashir
@ 2025-08-04 11:14 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-08-04 11:14 UTC (permalink / raw)
To: Mohsin Bashir
Cc: netdev, alexanderduyck, andrew+netdev, davem, edumazet,
kernel-team, kuba, linux-kernel, pabeni, sdf, vadim.fedorenko
On Fri, Aug 01, 2025 at 07:46:35PM -0700, Mohsin Bashir wrote:
> Correctly copy the tx_dropped stats from the fbd->hw_stats to the
> rtnl_link_stats64 struct.
>
> Fixes: 5f8bd2ce8269 ("eth: fbnic: add support for TMI stats")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
Thanks,
I note that the local variable tx_dropped was being saved to stats64
before it's values were accumulated from hw_stats.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/2] eth: fbnic: Fix drop stats support
2025-08-02 2:46 [PATCH net 0/2] eth: fbnic: Fix drop stats support Mohsin Bashir
2025-08-02 2:46 ` [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting Mohsin Bashir
2025-08-02 2:46 ` [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update Mohsin Bashir
@ 2025-08-05 23:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-05 23:20 UTC (permalink / raw)
To: Mohsin Bashir
Cc: netdev, alexanderduyck, andrew+netdev, davem, edumazet, horms,
kernel-team, kuba, linux-kernel, pabeni, sdf, vadim.fedorenko
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 1 Aug 2025 19:46:34 -0700 you wrote:
> Fix hardware drop stats support on the TX path of fbnic by addressing two
> issues: ensure that tx_dropped stats are correctly copied to the
> rtnl_link_stats64 struct, and protect the copying of drop stats from
> fdb->hw_stats to the local variable with the hw_stats_lock to
> ensure consistency.
>
> Mohsin Bashir (2):
> eth: fbnic: Fix tx_dropped reporting
> eth: fbnic: Lock the tx_dropped update
>
> [...]
Here is the summary with links:
- [net,1/2] eth: fbnic: Fix tx_dropped reporting
https://git.kernel.org/netdev/net/c/2972395d8fad
- [net,2/2] eth: fbnic: Lock the tx_dropped update
https://git.kernel.org/netdev/net/c/53abd9c86fd0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-05 23:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-02 2:46 [PATCH net 0/2] eth: fbnic: Fix drop stats support Mohsin Bashir
2025-08-02 2:46 ` [PATCH net 1/2] eth: fbnic: Fix tx_dropped reporting Mohsin Bashir
2025-08-04 11:14 ` Simon Horman
2025-08-02 2:46 ` [PATCH net 2/2] eth: fbnic: Lock the tx_dropped update Mohsin Bashir
2025-08-04 11:12 ` Simon Horman
2025-08-05 23:20 ` [PATCH net 0/2] eth: fbnic: Fix drop stats support patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).