From patchwork Fri Jun 28 19:30:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13716554 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 DB296762D2 for ; Fri, 28 Jun 2024 19:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719603041; cv=none; b=R30OW1mAeLQIEcP63uBEG/P/Vc8bC2t2/eLKAlcsFKqRdygYS0LenV0DBsNRimfdhw13aCIPR0QgU2canvMFFfXD/Jq86oUscgrv4tMiMwfybb+Y5TvnBkkwhjf7UbbiMzZh9TP+0NrmeruGj6DYDA3N8rf5eMh1/fIEFn2XPJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719603041; c=relaxed/simple; bh=xjv8WqsLurkTApHtAtrISsaD4Iey8mqMNIinFjVRfzk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mXPDuF3TsihSkAy4bMG6u1quWZdpPZkz8Foor2RVGtt+HR/Zylp6OYdGCFRuRx2Z17nlX0UueMqQF3S5sjYaNbdDxNpQfZy+PWdvda9QcLem+WFS8jng8Ro/h7y6hGxONigrP7eNYkZ9O4fmEUreIz5PdU7lpmy9p8o7YooU/qY= 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=EdofCHxf; arc=none smtp.client-ip=209.85.215.169 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="EdofCHxf" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-71871d5e087so625912a12.1 for ; Fri, 28 Jun 2024 12:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1719603039; x=1720207839; 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=zvTVR9v4L6sSS0ncZ93rbwMU4d0T8t+SocvwTKDypO4=; b=EdofCHxf6O10LGhFmcMoSqAQkonI1Oa9lyay/qyMGzQ9iM1ufj7GBDQJfsq5e9wPwK knwLHmIr2w35e3FqCr3YRCp2/hbFqirqVsw57uThBmFy0R7VFpMKL0908I3Mn+HLAUug F6ysuOFsTB+Y724mGovDJQNQ3t/+Vk6MCFtwY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719603039; x=1720207839; 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=zvTVR9v4L6sSS0ncZ93rbwMU4d0T8t+SocvwTKDypO4=; b=FvrQ7SHSboYvrX6OUuob1MwrrDhMEY6VKcnYGJsI5ZMnWIUf1g+0uQtdI6TLfKvP/I WrbC+d60gjgRisuAuvVxju0AnXUdnpq9if7iovPdc90KFcC1DAXuvyyzFMPzoq8CLSqb k/DEQiDx+UMdPxqyZ4zpVy4cQtWB45p1KViQZ7PBBx+DHlCuyzIw/r5SiPLaDRB1YHUo pKX+/aTzC7hN+DGKBmjNvp0pco5NBUHnXosb7ldj1Z+Cp79epFfb/UU/famkQXxkwG8V YSUAtMOX2UQgD/4pZnf3vXea3PzZFKXXgumkkyb4JCbL2djEZTUfYQH2oOHsJIlut5lp /Lpw== X-Gm-Message-State: AOJu0Yw9JFul1Ktj2auz05ppaywhaTc9iTtnABWEs4BwBl4gwXW4Y3q+ lCBwaX9hAKHlFqAoy8XkEIXUVkWio/ABRBJ8sjQuc0pSVPtEGsg031DIliA3Ow== X-Google-Smtp-Source: AGHT+IHYEEdqgoHRNa+LKpEcaapA3+wK/RW8jSuY8wdYGIT0IOrLA3Ii0XAjstWhb6l9HmB2kUFqXw== X-Received: by 2002:a05:6a20:a820:b0:1bd:d5ba:e163 with SMTP id adf61e73a8af0-1bdd5bae1b7mr9536330637.26.1719603038789; Fri, 28 Jun 2024 12:30:38 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c939cc9b04sm46707a91.0.2024.06.28.12.30.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2024 12:30:38 -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, horms@kernel.org, przemyslaw.kitszel@intel.com Subject: [PATCH net-next v2 08/10] bnxt_en: Let bnxt_stamp_tx_skb() return error code Date: Fri, 28 Jun 2024 12:30:03 -0700 Message-ID: <20240628193006.225906-9-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240628193006.225906-1-michael.chan@broadcom.com> References: <20240628193006.225906-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; }