From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 715D8A0541; Thu, 6 Feb 2020 19:45:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4466F1C203; Thu, 6 Feb 2020 19:44:47 +0100 (CET) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 2E9C91C1C0; Thu, 6 Feb 2020 19:44:38 +0100 (CET) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 5AC8630C0FB; Thu, 6 Feb 2020 10:37:16 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 5AC8630C0FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1581014236; bh=0iILt7RwW9gyq8U/a5h8M+j0s3TqqJ+MjBb+SXfxdGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNA2Um/MhUrpWS4qlz244RtcZfSounSN2YT9Yh0tj2we+jxz4qIcqVUpqFQekBMmo n7Lfa/RoTKI7DXVrfA6DXqkn03jrRXlu5kq06qaYiZHlyPJVBrYUp89zKFjuKdJe3O IVYYz9mUlOx7BAgQQQpgNkd8sRx2OItEk+7CaDuY= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id D449814008D; Thu, 6 Feb 2020 10:44:35 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Rahul Gupta , stable@dpdk.org, Kalesh Anakkur Purayil , Somnath Kotur Date: Thu, 6 Feb 2020 10:44:27 -0800 Message-Id: <20200206184432.34360-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200206184432.34360-1-ajit.khaparde@broadcom.com> References: <20200206163314.12755-1-kalesh-anakkur.purayil@broadcom.com> <20200206184432.34360-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/7] net/bnxt: fix default timeout for command to get FW version X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Rahul Gupta Initially when driver is loading, there is no HWRM timeout configured by FW, the VER_GET command needs use default timeout as 500ms and while recovering from fatal/non-fatal FW error, it should use timeout as 50ms. Fixes: 458f0360e8dc ("net/bnxt: get default HWRM command timeout from FW") Cc: stable@dpdk.org Signed-off-by: Rahul Gupta Reviewed-by: Kalesh Anakkur Purayil Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 6 ++++-- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/bnxt/bnxt_hwrm.c | 11 ++++------- drivers/net/bnxt/bnxt_hwrm.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 68786a89b..e8a30fa31 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -606,8 +606,10 @@ struct bnxt { uint16_t max_resp_len; uint16_t hwrm_max_ext_req_len; - /* default command timeout value of 50ms */ -#define HWRM_CMD_TIMEOUT 50000 + /* default command timeout value of 500ms */ +#define DFLT_HWRM_CMD_TIMEOUT 500000 + /* short command timeout value of 50ms */ +#define SHORT_HWRM_CMD_TIMEOUT 50000 /* default HWRM request timeout value */ uint32_t hwrm_cmd_timeout; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 537820960..7147cc8fe 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3998,7 +3998,7 @@ static void bnxt_dev_recover(void *arg) bp->flags &= ~BNXT_FLAG_FATAL_ERROR; do { - rc = bnxt_hwrm_ver_get(bp); + rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT); if (rc == 0) break; rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL); @@ -4688,7 +4688,7 @@ static int bnxt_init_fw(struct bnxt *bp) bp->fw_cap = 0; - rc = bnxt_hwrm_ver_get(bp); + rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT); if (rc) return rc; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index f325aff82..96b34317b 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -100,11 +100,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, if (bp->flags & BNXT_FLAG_FATAL_ERROR) return 0; - /* For VER_GET command, set timeout as 50ms */ - if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET) - timeout = HWRM_CMD_TIMEOUT; - else - timeout = bp->hwrm_cmd_timeout; + timeout = bp->hwrm_cmd_timeout; if (bp->flags & BNXT_FLAG_SHORT_CMD || msg_len > bp->max_req_len) { @@ -949,7 +945,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp) return rc; } -int bnxt_hwrm_ver_get(struct bnxt *bp) +int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout) { int rc = 0; struct hwrm_ver_get_input req = {.req_type = 0 }; @@ -960,6 +956,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) uint32_t dev_caps_cfg; bp->max_req_len = HWRM_MAX_REQ_LEN; + bp->hwrm_cmd_timeout = timeout; HWRM_PREP(req, VER_GET, BNXT_USE_CHIMP_MB); req.hwrm_intf_maj = HWRM_VERSION_MAJOR; @@ -994,7 +991,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) /* convert timeout to usec */ bp->hwrm_cmd_timeout *= 1000; if (!bp->hwrm_cmd_timeout) - bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT; + bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT; if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) { PMD_DRV_LOG(ERR, "Unsupported firmware API version\n"); diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index d8d1360f9..2753720ae 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -120,7 +120,7 @@ int bnxt_hwrm_stat_ctx_free(struct bnxt *bp, int bnxt_hwrm_ctx_qstats(struct bnxt *bp, uint32_t cid, int idx, struct rte_eth_stats *stats, uint8_t rx); -int bnxt_hwrm_ver_get(struct bnxt *bp); +int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout); int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic); int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic); -- 2.21.1 (Apple Git-122.3)