summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/broadcom/bnxt
diff options
context:
space:
mode:
authorVadim Fedorenko <vadfed@meta.com>2024-06-04 12:19:39 +0300
committerJakub Kicinski <kuba@kernel.org>2024-06-05 22:52:42 +0300
commitc790275b5edf5d8280ae520bda7c1f37da460c00 (patch)
treeb74f16ffe024929e4803432b666fdc5d997d8ac9 /drivers/net/ethernet/broadcom/bnxt
parent54751f4d5406760f46305725cc61fb72260971b6 (diff)
downloadlinux-c790275b5edf5d8280ae520bda7c1f37da460c00.tar.xz
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@broadcom.com> Signed-off-by: Vadim Fedorenko <vadfed@meta.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20240604091939.785535-1-vadfed@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnxt')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c2
1 files changed, 1 insertions, 1 deletions
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;
}