From patchwork Wed Jun 26 16:43:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13713192 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 4619A18FDCF for ; Wed, 26 Jun 2024 16:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719420227; cv=none; b=kSt5/8bSsYQy95Wy3/g0/yZnMoG1t6RJ8zW0w9f9yQ8nACuad4XxuTC22Ca5GsCtOiMeRTnEt30te6Ss2t1meYOXI2naayVi7icMI9bkoSyz/T0NmpCJh9DXxvAOuWMsF5Z/7ysWL1qUU3qe5Y0jsswAKimtnVEO4w4i9V5PVjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719420227; c=relaxed/simple; bh=T+6CFfWRYFa8uJvryOyD05vwqYzv5B++kfE6kXjp58k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G/BxcKBM+JoKtuVBI2URBogHY30Dh6GzT/G3LnrFFwhi9+Tlo2suuKXkbR/mCjqSdoH9qmsOffW6ab70uGJBN379D61vsu+4yVaPeHXnw4ceNaLK+y3pJ487PHU/VT9YFSGfDLNpwci59vBITYu+m1FGD101AfJ2MDDp1ZOvBwU= 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=gtfwDIKz; arc=none smtp.client-ip=209.85.222.177 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="gtfwDIKz" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-79c05313ec8so137393985a.3 for ; Wed, 26 Jun 2024 09:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1719420225; x=1720025025; 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=+Onr20j6DLjsl7PydSZyHaOF9uCE8J6kvDxx3ihAZjM=; b=gtfwDIKzDhetyHWGyAzaY9RPzwOA1+LNOHp9jTU+cyb8i654ol7yANagl9Bsi3M6Oc fwqWq3IOXpbETB6V+3tYpmR6zFDix6pVEdh5wTOLer7KMfmoxFLJD/LnKFnQUk8l8v6A +a86S2TBSiFpW8Z5FrYADch8Vq+nqxYCAaKrI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719420225; x=1720025025; 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=+Onr20j6DLjsl7PydSZyHaOF9uCE8J6kvDxx3ihAZjM=; b=Zefd6Kx72u+KFCF00OKZBiLydWcB0Sk1MU7gk+EHqQWf56omeO3CXcJ0O1l1MxsZ1q RyRSJmB67TT5w64/JIiCIwKk8EHc1Vn4Prk1LTLO7zJeJEftF6euh9mt6Ju7WZO2kurS FdjhASzYSKTPU67G5MZcAvfoGf4NNWpvscw2CiOwxgn31G0Df2c6fQ/yOyYG07KQLNAK oEAsoF2CQe9NUFNlssNKf03ijg44lwrgOReQXGl0vkTo11EG1gaRuJwDx6TzaAv5McQ5 HtYQP0mNiTc+h9UpJJTAGFiZg+Dc6LftXURLrJaSs2b6vXV+0/cogG9MoYuBc5fZvAAD 4XbA== X-Gm-Message-State: AOJu0YyK73yf9+z0CRZoR2HfAn+Ui2Wl7zx56CHITkK/CBh+1njHdPk8 H2gjhyxdjoeRB0hrLiZGXhYAkRWhW7tVdSqZKpHRf0VGWlvrGQVEUvsu5dvI/X/sMFGazrDPK7I = X-Google-Smtp-Source: AGHT+IFTa5APjcViZnk55jjLe/Zt9Ne6itwXSib0m1UbgitndDXB1u/4+RLN7sMdxBnKSWJHJnjVBg== X-Received: by 2002:a05:620a:240f:b0:795:5115:5ae3 with SMTP id af79cd13be357-79be47b7035mr1245339685a.50.1719420224734; Wed, 26 Jun 2024 09:43:44 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79d53c42aafsm53570485a.58.2024.06.26.09.43.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2024 09:43:44 -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, richardcochran@gmail.com Subject: [PATCH net-next 08/10] bnxt_en: Let bnxt_stamp_tx_skb() return error code Date: Wed, 26 Jun 2024 09:43:05 -0700 Message-ID: <20240626164307.219568-9-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240626164307.219568-1-michael.chan@broadcom.com> References: <20240626164307.219568-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 Change the function bnxt_stamp_tx_skb() to return 0 for suceess or -EAGAIN if the timestamp is still pending in firmware. The calling PTP aux worker will reschedule based on the return code. Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index baf191959b13..bd1e270307ec 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -683,7 +683,7 @@ static u64 bnxt_cc_read(const struct cyclecounter *cc) return ns; } -static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) +static int bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) { struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; struct skb_shared_hwtstamps timestamp; @@ -711,7 +711,7 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) } else { if (!time_after_eq(jiffies, txts_req->abs_txts_tmo)) { txts_req->txts_pending = true; - return; + return -EAGAIN; } ptp->stats.ts_lost++; netdev_warn_once(bp->dev, @@ -722,6 +722,8 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) txts_req->tx_skb = NULL; atomic_inc(&ptp->tx_avail); txts_req->txts_pending = false; + + return 0; } static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info) @@ -730,12 +732,16 @@ static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info) ptp_info); unsigned long now = jiffies; struct bnxt *bp = ptp->bp; + int rc = 0; if (ptp->txts_req.tx_skb) - bnxt_stamp_tx_skb(bp, ptp->txts_req.tx_skb); + rc = bnxt_stamp_tx_skb(bp, ptp->txts_req.tx_skb); - if (!time_after_eq(now, ptp->next_period)) + if (!time_after_eq(now, ptp->next_period)) { + if (rc == -EAGAIN) + return 0; return ptp->next_period - now; + } bnxt_ptp_get_current_time(bp); ptp->next_period = now + HZ; @@ -745,7 +751,7 @@ static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info) spin_unlock_bh(&ptp->ptp_lock); ptp->next_overflow_check = now + BNXT_PHC_OVERFLOW_PERIOD; } - if (ptp->txts_req.txts_pending) + if (rc == -EAGAIN) return 0; return HZ; }