bnxt_en: fix atomic counter for ptp packets
PATCH 1/1 bnxt_en: fix atomic counter for ptp packets
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.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -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; }
Signature · 1 line
2.43.0
Quoted 8 lines · Vadim Fedorenko
atomic_dec_if_positivereturns 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 <[email protected]>Signed-off-by Vadim Fedorenko <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Tue, 4 Jun 2024 02:19:39 -0700 you wrote:
atomic_dec_if_positivereturns 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 <[email protected]>Signed-off-by Vadim Fedorenko <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html