From patchwork Mon Mar 25 22:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13603101 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.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 742B880036 for ; Mon, 25 Mar 2024 22:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711405774; cv=none; b=qAD9hyFLi1CIde9oeVyT2OXDSLK9r+PTmsXH4V6vJC6F6VOo1k3bhIaN+3fTyS1yK+oBeeFqzWVQPgUXeL2J9tzpq5joG6EKq5l7r7Zl1dgRuE8JOzcd9WaWnyEKKKKc6/hwkLwgaXXEoeK1nT4tHgyViQOEwz1+uHpo9xiCBJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711405774; c=relaxed/simple; bh=jTUZkhgK8c/naD6bLeuMaOXJ7Y2Iv7XWUywA22h36u0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=cGxpWtITj/qsMfAYE3pt1ruuXgh/CNyw2qs+0YgslfqxylpYH08TLDx4ZOKmgzR2MOMYM5iKdhUF53T/C3f7NzvAxETDdVDZrnstm3UWWvxvoJ+Zh61cX/dKAj9PguCbALsl8VNZTHuy6UZ9Kv+HhZw/kjcsW5INJyds5egYxNE= 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=R0KB5dF2; arc=none smtp.client-ip=209.85.167.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="R0KB5dF2" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c3ca3c3bbaso1051261b6e.0 for ; Mon, 25 Mar 2024 15:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1711405770; x=1712010570; 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=sn1z7jNN6UI1M2xDr0/Shqw6mHal1y6J6TmMM641NKc=; b=R0KB5dF23urGEudZMsPC9ErC+KGGosZ17ptZJx125iX8lQ65wW7QNHl4Xci1zaFOGZ fL+Fl5nIcHC564fjga9DQTCgkta0cJNnjrwrcjEL+Z9B+++Yg1nKhLWZz3gOL6wLGarZ IP/OEmBEQdMW618MxEkTXnwhIgjJ/4ZPe8Hvs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711405770; x=1712010570; 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=sn1z7jNN6UI1M2xDr0/Shqw6mHal1y6J6TmMM641NKc=; b=VJIT3DDvM3u/gK5pICUWGm2PvAeitQbrfkX48jbgfWcjRGr1GsfZxqKZ8o1SVVd/2u QgrOT2JfnQMGoQ+xNT+kS94gDJEr3h8W4RcfaZnU/31rTBQrXlfcFmz5lWwyj6WBSuAA yj73EheV2j8DaTrLCQdvTtw0l2prbkAlm/pc3c/socB3eQMG1yJPea7+fsNkOdbdQDJl jeVq3OHzzvSMJmcwuIem1XwyzFIOW3u64ue6loWD2ATca6l/figHezsm6P65zRvs1dFJ EkXyKYemVxuijXLXOCEiE1xu+41Q9egMK78BjNZJ6tMZYUIuWWCX9S0K9J/CefV3Ggtt 3Czg== X-Gm-Message-State: AOJu0YyDAE0Q6u4dIMeLWfBjEqaGcNgRwn19oSOtiY8SHUJ8Rfyu/F/j dCO5xwMk4AEvDVu9l/Errjh04toDcF1KU/pH8iaWGHUvG53KpL+5S9YD2eSuLA== X-Google-Smtp-Source: AGHT+IFv0c1bQ+V6qVzS/nCaonyipCAJ3Fnr5lVqX4f3PQK3VAT//Dk+K+6ASvsfQQrs5e/oeGxtZg== X-Received: by 2002:a05:6358:560c:b0:17b:ee6f:b6ae with SMTP id b12-20020a056358560c00b0017bee6fb6aemr10619469rwf.9.1711405770090; Mon, 25 Mar 2024 15:29:30 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id t10-20020a63dd0a000000b005e438fe702dsm6301610pgg.65.2024.03.25.15.29.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2024 15:29:29 -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, Vadim Fedorenko , Richard Cochran Subject: [PATCH net-next 01/12] bnxt_en: Add a timeout parameter to bnxt_hwrm_port_ts_query() Date: Mon, 25 Mar 2024 15:28:51 -0700 Message-Id: <20240325222902.220712-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240325222902.220712-1-michael.chan@broadcom.com> References: <20240325222902.220712-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 The caller can pass this new timeout parameter to the function to specify the firmware timeout value when requesting the TX timestamp from the firmware. This will allow the caller to precisely control the timeout and will be used in the next patch. In this patch, the parameter is 0 which means to use the current default value. Cc: Vadim Fedorenko Cc: Richard Cochran Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan Reviewed-by: Vadim Fedorenko --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 16 ++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index cc07660330f5..dbfd1b36774c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -109,7 +109,8 @@ static void bnxt_ptp_get_current_time(struct bnxt *bp) spin_unlock_bh(&ptp->ptp_lock); } -static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts) +static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts, + u32 txts_tmo) { struct hwrm_port_ts_query_output *resp; struct hwrm_port_ts_query_input *req; @@ -122,10 +123,15 @@ static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts) req->flags = cpu_to_le32(flags); if ((flags & PORT_TS_QUERY_REQ_FLAGS_PATH) == PORT_TS_QUERY_REQ_FLAGS_PATH_TX) { + u32 tmo_us = txts_tmo * 1000; + req->enables = cpu_to_le16(BNXT_PTP_QTS_TX_ENABLES); req->ptp_seq_id = cpu_to_le32(bp->ptp_cfg->tx_seqid); req->ptp_hdr_offset = cpu_to_le16(bp->ptp_cfg->tx_hdr_off); - req->ts_req_timeout = cpu_to_le16(BNXT_PTP_QTS_TIMEOUT); + if (!tmo_us) + tmo_us = BNXT_PTP_QTS_TIMEOUT; + tmo_us = min(tmo_us, BNXT_PTP_QTS_MAX_TMO_US); + req->ts_req_timeout = cpu_to_le16(txts_tmo); } resp = hwrm_req_hold(bp, req); @@ -675,7 +681,8 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) u64 ts = 0, ns = 0; int rc; - rc = bnxt_hwrm_port_ts_query(bp, PORT_TS_QUERY_REQ_FLAGS_PATH_TX, &ts); + rc = bnxt_hwrm_port_ts_query(bp, PORT_TS_QUERY_REQ_FLAGS_PATH_TX, &ts, + 0); if (!rc) { memset(×tamp, 0, sizeof(timestamp)); spin_lock_bh(&ptp->ptp_lock); @@ -891,7 +898,8 @@ int bnxt_ptp_init_rtc(struct bnxt *bp, bool phc_cfg) if (rc) return rc; } else { - rc = bnxt_hwrm_port_ts_query(bp, PORT_TS_QUERY_REQ_FLAGS_CURRENT_TIME, &ns); + rc = bnxt_hwrm_port_ts_query(bp, PORT_TS_QUERY_REQ_FLAGS_CURRENT_TIME, + &ns, 0); if (rc) return rc; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h index fce8dc39a7d0..04886d5f22ad 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h @@ -23,6 +23,7 @@ #define BNXT_HI_TIMER_MASK 0xffff00000000UL #define BNXT_PTP_QTS_TIMEOUT 1000 +#define BNXT_PTP_QTS_MAX_TMO_US 65535 #define BNXT_PTP_QTS_TX_ENABLES (PORT_TS_QUERY_REQ_ENABLES_PTP_SEQ_ID | \ PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT | \ PORT_TS_QUERY_REQ_ENABLES_PTP_HDR_OFFSET)