* [PATCH net] be2net: fix data race in be_get_new_eqd
@ 2026-01-19 15:34 David Yang
2026-01-19 21:13 ` Vadim Fedorenko
2026-01-21 2:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: David Yang @ 2026-01-19 15:34 UTC (permalink / raw)
To: netdev
Cc: David Yang, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Sathya Perla, Padmanabh Ratnakar, linux-kernel
In be_get_new_eqd(), statistics of pkts, protected by u64_stats_sync, are
read and accumulated in ignorance of possible u64_stats_fetch_retry()
events. Before the commit in question, these statistics were retrieved
one by one directly from queues. Fix this by reading them into temporary
variables first.
Fixes: 209477704187 ("be2net: set interrupt moderation for Skyhawk-R using EQ-DB")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 5bb31c8fab39..995c159003d7 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2141,7 +2141,7 @@ static int be_get_new_eqd(struct be_eq_obj *eqo)
struct be_aic_obj *aic;
struct be_rx_obj *rxo;
struct be_tx_obj *txo;
- u64 rx_pkts = 0, tx_pkts = 0;
+ u64 rx_pkts = 0, tx_pkts = 0, pkts;
ulong now;
u32 pps, delta;
int i;
@@ -2157,15 +2157,17 @@ static int be_get_new_eqd(struct be_eq_obj *eqo)
for_all_rx_queues_on_eq(adapter, eqo, rxo, i) {
do {
start = u64_stats_fetch_begin(&rxo->stats.sync);
- rx_pkts += rxo->stats.rx_pkts;
+ pkts = rxo->stats.rx_pkts;
} while (u64_stats_fetch_retry(&rxo->stats.sync, start));
+ rx_pkts += pkts;
}
for_all_tx_queues_on_eq(adapter, eqo, txo, i) {
do {
start = u64_stats_fetch_begin(&txo->stats.sync);
- tx_pkts += txo->stats.tx_reqs;
+ pkts = txo->stats.tx_reqs;
} while (u64_stats_fetch_retry(&txo->stats.sync, start));
+ tx_pkts += pkts;
}
/* Skip, if wrapped around or first calculation */
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] be2net: fix data race in be_get_new_eqd
2026-01-19 15:34 [PATCH net] be2net: fix data race in be_get_new_eqd David Yang
@ 2026-01-19 21:13 ` Vadim Fedorenko
2026-01-21 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2026-01-19 21:13 UTC (permalink / raw)
To: David Yang, netdev
Cc: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Sathya Perla, Padmanabh Ratnakar, linux-kernel
On 19/01/2026 15:34, David Yang wrote:
> In be_get_new_eqd(), statistics of pkts, protected by u64_stats_sync, are
> read and accumulated in ignorance of possible u64_stats_fetch_retry()
> events. Before the commit in question, these statistics were retrieved
> one by one directly from queues. Fix this by reading them into temporary
> variables first.
>
> Fixes: 209477704187 ("be2net: set interrupt moderation for Skyhawk-R using EQ-DB")
> Signed-off-by: David Yang <mmyangfl@gmail.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] be2net: fix data race in be_get_new_eqd
2026-01-19 15:34 [PATCH net] be2net: fix data race in be_get_new_eqd David Yang
2026-01-19 21:13 ` Vadim Fedorenko
@ 2026-01-21 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-21 2:40 UTC (permalink / raw)
To: Yangfl
Cc: netdev, ajit.khaparde, sriharsha.basavapatna, somnath.kotur,
andrew+netdev, davem, edumazet, kuba, pabeni, sathya.perla,
padmanabh.ratnakar, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 19 Jan 2026 23:34:36 +0800 you wrote:
> In be_get_new_eqd(), statistics of pkts, protected by u64_stats_sync, are
> read and accumulated in ignorance of possible u64_stats_fetch_retry()
> events. Before the commit in question, these statistics were retrieved
> one by one directly from queues. Fix this by reading them into temporary
> variables first.
>
> Fixes: 209477704187 ("be2net: set interrupt moderation for Skyhawk-R using EQ-DB")
> Signed-off-by: David Yang <mmyangfl@gmail.com>
>
> [...]
Here is the summary with links:
- [net] be2net: fix data race in be_get_new_eqd
https://git.kernel.org/netdev/net/c/302e5b481caa
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] 3+ messages in thread
end of thread, other threads:[~2026-01-21 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 15:34 [PATCH net] be2net: fix data race in be_get_new_eqd David Yang
2026-01-19 21:13 ` Vadim Fedorenko
2026-01-21 2:40 ` 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