From patchwork Tue Jun 18 21:53:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13703085 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEF5C1849E6 for ; Tue, 18 Jun 2024 21:54:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718747654; cv=none; b=H/cbfeoXbTJAG3ph0/t/6+08yxyNuDP5PwVkNQHhjPE6uzE/qwDAOzO1leyT6/f/cP67rdhqmmgouajGNjdx1UEQFy7BB+Uv2UxPcGCa5YF14QA+BPiYJicv5IirQB0HHnQmUDU5VotU+msJxHworU3+1uH7iqFAeJu/k0MG7hU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718747654; c=relaxed/simple; bh=g3ecGdo3wye5NJKZqV2FXcUatKIxR0Z2fk7O7bG+efM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MxUJyg93GBya3bQ/b7g/2aubdctSeCVma8/h3m6+7myLteWDSrWPESCnc6/gqBzNFCfnGKJWXKxy/41n3I1qBt7zSZa/VaXP7WdB/PxUz9J0rrAdQaKlnF+jmKXwuON/w96LPxQAkOTfsesCgUCFAm9lfBVHhJIg3DMT++RKqSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=IiNNvnqr; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="IiNNvnqr" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2c7aafe5d2aso194289a91.1 for ; Tue, 18 Jun 2024 14:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1718747652; x=1719352452; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=EVToF3pfbQ7KGkKNFaRWkzwIXSYPnSX3uNAQfMwaQAk=; b=IiNNvnqrvQRNWn5IjGw1oeHEahQ2AJe9gI/m0ExITLc7P/SwnVTA21PH8DXUH22RV8 nL5ptwPxkbVxrT/L/nNK0gBAPnKfbqjHTIY3GgdWcwIKb5sqNKh6pexVe97VyoMFLpyC 5+6rpQtgNB7uk92zE59bBqCF0TkG+Uu4ngFRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718747652; x=1719352452; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EVToF3pfbQ7KGkKNFaRWkzwIXSYPnSX3uNAQfMwaQAk=; b=croJgRV4xA9msUQI7SU0MlGur2izc0tXje0p7RURlIO8VYSuO52ACM8kWSp/Y8IiEF p+wi/qf/DabsTEofcSErUG99W0rgxzvnJaLAKHZ2NbGvewDZX58JSc7oP22U4hS9hIba IUSRZxAXsQxAxvCOWFM6cI/o0+Xq1wwyzSA1SShFF8JF5UAoRI240wPoFSTsfpXEeVth zkDMxE6/ucc+h+bR95hhLLAvWmfd0Ydg4iJDyVbJCiNuOucszADfzcSxwc6WY1kyPBxg pSjG14cO5oTCzgVC4Bk8IDBqIEJj5hKOjnhf9El1Znid+w+vVrhi7VBEbD5rhGkWVAWY UMRQ== X-Gm-Message-State: AOJu0Yxg/cwY1AZUCsZj1Rxdvh3pMcO8khZntT0F1uCkJGSeIJX5IBKz rUX1+tG5da8cWUHrXzddr62WIxuu8dPWo4TEl/qXThY2Fk+vGIsW3+1bBRfGKw== X-Google-Smtp-Source: AGHT+IGGBvHRIDNT31emnAM3/7cx6KGVLsmoC2AAGC4YNWX1ppnwsCmaGIRhaR4fVfmFw0y+dQK2hg== X-Received: by 2002:a17:90a:7e93:b0:2c2:4109:9466 with SMTP id 98e67ed59e1d1-2c6c91154a2mr5189130a91.8.1718747650895; Tue, 18 Jun 2024 14:54:10 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4c45cbd05sm11501990a91.19.2024.06.18.14.54.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2024 14:54:09 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com Subject: [PATCH net 3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error Date: Tue, 18 Jun 2024 14:53:13 -0700 Message-ID: <20240618215313.29631-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240618215313.29631-1-michael.chan@broadcom.com> References: <20240618215313.29631-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Pavan Chebbi The current code only restores PTP tx_avail count when we get DMA mapping errors. Fix it so that the PTP tx_avail count will be restored for both DMA mapping errors and skb_pad() errors. Otherwise PTP TX timestamp will not be available after a PTP packet hits the skb_pad() error. Fixes: 83bb623c968e ("bnxt_en: Transmit and retrieve packet timestamps" Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 89d29d6d7517..a6d69a45fa01 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -732,9 +732,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; tx_dma_error: - if (BNXT_TX_PTP_IS_SET(lflags)) - atomic_inc(&bp->ptp_cfg->tx_avail); - last_frag = i; /* start back at beginning and unmap skb */ @@ -756,6 +753,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) tx_free: dev_kfree_skb_any(skb); tx_kick_pending: + if (BNXT_TX_PTP_IS_SET(lflags)) + atomic_inc(&bp->ptp_cfg->tx_avail); if (txr->kick_pending) bnxt_txr_db_kick(bp, txr, txr->tx_prod); txr->tx_buf_ring[txr->tx_prod].skb = NULL;