* [PATCH net-next] bnxt_en: fix atomic counter for ptp packets
@ 2024-06-04 9:19 Vadim Fedorenko
2024-06-05 17:35 ` Simon Horman
2024-06-05 21:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2024-06-04 9:19 UTC (permalink / raw)
To: Vadim Fedorenko, Michael Chan, Jakub Kicinski
Cc: David S. Miller, Paolo Abeni, Richard Cochran, netdev,
Vadim Fedorenko, Simon Horman
atomic_dec_if_positive returns new value regardless if it is updated or
not. The commit in fixes changed the behavior of the condition to one
that differs from original code. Restore original condition to properly
maintain atomic counter.
Fixes: 165f87691a89 ("bnxt_en: add timestamping statistics support")
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6d9faa78e391..7dc00c0d8992 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -513,7 +513,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
if (ptp && ptp->tx_tstamp_en && !skb_is_gso(skb)) {
- if (!atomic_dec_if_positive(&ptp->tx_avail)) {
+ if (atomic_dec_if_positive(&ptp->tx_avail) < 0) {
atomic64_inc(&ptp->stats.ts_err);
goto tx_no_ts;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] bnxt_en: fix atomic counter for ptp packets
2024-06-04 9:19 [PATCH net-next] bnxt_en: fix atomic counter for ptp packets Vadim Fedorenko
@ 2024-06-05 17:35 ` Simon Horman
2024-06-05 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-06-05 17:35 UTC (permalink / raw)
To: Vadim Fedorenko
Cc: Vadim Fedorenko, Michael Chan, Jakub Kicinski, David S. Miller,
Paolo Abeni, Richard Cochran, netdev
On Tue, Jun 04, 2024 at 02:19:39AM -0700, Vadim Fedorenko wrote:
> atomic_dec_if_positive returns new value regardless if it is updated or
> not. The commit in fixes changed the behavior of the condition to one
> that differs from original code. Restore original condition to properly
> maintain atomic counter.
>
> Fixes: 165f87691a89 ("bnxt_en: add timestamping statistics support")
> Reviewed-by: Michael Chan <michael.chan@broadcom.com>
> Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] bnxt_en: fix atomic counter for ptp packets
2024-06-04 9:19 [PATCH net-next] bnxt_en: fix atomic counter for ptp packets Vadim Fedorenko
2024-06-05 17:35 ` Simon Horman
@ 2024-06-05 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-05 21:30 UTC (permalink / raw)
To: Vadim Fedorenko
Cc: vadim.fedorenko, michael.chan, kuba, davem, pabeni,
richardcochran, netdev, horms
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 4 Jun 2024 02:19:39 -0700 you wrote:
> atomic_dec_if_positive returns new value regardless if it is updated or
> not. The commit in fixes changed the behavior of the condition to one
> that differs from original code. Restore original condition to properly
> maintain atomic counter.
>
> Fixes: 165f87691a89 ("bnxt_en: add timestamping statistics support")
> Reviewed-by: Michael Chan <michael.chan@broadcom.com>
> Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
>
> [...]
Here is the summary with links:
- [net-next] bnxt_en: fix atomic counter for ptp packets
https://git.kernel.org/netdev/net-next/c/c790275b5edf
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:[~2024-06-05 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 9:19 [PATCH net-next] bnxt_en: fix atomic counter for ptp packets Vadim Fedorenko
2024-06-05 17:35 ` Simon Horman
2024-06-05 21:30 ` 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).