[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240604091939.785535-1-vadfed@meta.com>
Date: Tue, 4 Jun 2024 02:19:39 -0700
From: Vadim Fedorenko <vadfed@...a.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Michael Chan
<michael.chan@...adcom.com>,
Jakub Kicinski <kuba@...nel.org>
CC: "David S. Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>, <netdev@...r.kernel.org>,
"Vadim
Fedorenko" <vadfed@...a.com>, Simon Horman <horms@...nel.org>
Subject: [PATCH net-next] 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.
Fixes: 165f87691a89 ("bnxt_en: add timestamping statistics support")
Reviewed-by: Michael Chan <michael.chan@...adcom.com>
Signed-off-by: Vadim Fedorenko <vadfed@...a.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
Powered by blists - more mailing lists