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 A3B67A04F0 for ; Wed, 18 Dec 2019 07:24:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E9C21BF7F; Wed, 18 Dec 2019 07:24:49 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id A3A6B37AF for ; Wed, 18 Dec 2019 07:24:46 +0100 (CET) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 398FD28FA74; Tue, 17 Dec 2019 22:24:46 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 398FD28FA74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1576650286; bh=fujdIRJyqUwngf5MfoMMb0szQ5U5H/fQwbv+2WCCiZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jYaDf9B4VSFCgBtot/WT4Rp/yyiLTUYCqlZ7jbPsQyoVsLoOcg9R2nSykD/d1750o iLLYzwuBj7m0zik07SSfW+1nTXWYN/7L8OZfDForWb3bkKEdU9YtseJarPeH7qH0SM p4/9Fp2O+Yb5E/RL5j88KX1zeL0hxo+QHu1AXUsY= From: Somnath Kotur To: stable@dpdk.org Cc: ktraynor@redhat.com Date: Wed, 18 Dec 2019 11:54:05 +0530 Message-Id: <20191218062411.13079-14-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20191218062411.13079-1-somnath.kotur@broadcom.com> References: <20191218062411.13079-1-somnath.kotur@broadcom.com> Subject: [dpdk-stable] [PATCH 18.11 13/19] net/bnxt: get default HWRM command timeout from FW X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Ajit Khaparde The HWRM command timeout is set to a very high value. VER_GET command response returns the default request timeout value. Use this value for waiting for HWRM commands to complete. Fixes: cbcd375d37d2 ("net/bnxt: fix HWRM macros and locking") Signed-off-by: Santoshkumar Karanappa Rastapur Signed-off-by: Ajit Khaparde Reviewed-by: Lance Richardson Reviewed-by: Kalesh AP --- drivers/net/bnxt/bnxt.h | 5 +++++ drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 77d5614..20eacc7 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -369,6 +369,11 @@ struct bnxt { uint16_t max_req_len; uint16_t max_resp_len; + /* default command timeout value of 50ms */ +#define HWRM_CMD_TIMEOUT 50000 + /* default HWRM request timeout value */ + uint32_t hwrm_cmd_timeout; + struct bnxt_link_info link_info; struct bnxt_cos_queue_info cos_queue[BNXT_COS_QUEUE_COUNT]; uint8_t tx_cosq_id; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 6ddd226..68c70b7 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -25,7 +25,6 @@ #include "bnxt_vnic.h" #include "hsi_struct_def_dpdk.h" -#define HWRM_CMD_TIMEOUT 6000000 #define HWRM_SPEC_CODE_1_8_3 0x10803 #define HWRM_VERSION_1_9_1 0x10901 @@ -83,6 +82,13 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, GRCPF_REG_KONG_CHANNEL_OFFSET : GRCPF_REG_CHIMP_CHANNEL_OFFSET; uint16_t mb_trigger_offset = use_kong_mb ? GRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER; + uint32_t timeout; + + /* 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; if (bp->flags & BNXT_FLAG_SHORT_CMD) { void *short_cmd_req = bp->hwrm_short_cmd_req_addr; @@ -127,7 +133,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, rte_io_mb(); /* Poll for the valid bit */ - for (i = 0; i < HWRM_CMD_TIMEOUT; i++) { + for (i = 0; i < timeout; i++) { /* Sanity check on the resp->resp_len */ rte_cio_rmb(); if (resp->resp_len && resp->resp_len <= @@ -140,7 +146,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, rte_delay_us(1); } - if (i >= HWRM_CMD_TIMEOUT) { + if (i >= timeout) { PMD_DRV_LOG(ERR, "Error(timeout) sending msg 0x%04x\n", req->req_type); return -ETIMEDOUT; @@ -832,6 +838,13 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) fw_version |= resp->hwrm_intf_upd_8b; bp->hwrm_spec_code = fw_version; + /* def_req_timeout value is in milliseconds */ + bp->hwrm_cmd_timeout = rte_le_to_cpu_16(resp->def_req_timeout); + /* convert timeout to usec */ + bp->hwrm_cmd_timeout *= 1000; + if (!bp->hwrm_cmd_timeout) + bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT; + if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) { PMD_DRV_LOG(ERR, "Unsupported firmware API version\n"); rc = -EINVAL; -- 2.10.1