From patchwork Thu Oct 10 01:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 60844 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A91031E8FF; Thu, 10 Oct 2019 03:42:29 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id DD6E11DFE2; Thu, 10 Oct 2019 03:42:01 +0200 (CEST) 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 A001A30C148; Wed, 9 Oct 2019 18:40:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com A001A30C148 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570671625; bh=p5mLMcCAKXyyS6ms2vbSnNbL+14ZUSpLKAJgsnP7clE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjNiN6hhg24dh4VlqvIhhaK6M5x3ppBMtz2Wni1L2AhIJ3jhligXkBRu4LI3NQnjS xSkridqQlekJHLhiFx3X8A8r+GemgTLGDqMQL2MTqlzmy+1aBDlgR6efMTVC5fuTFc WYpGP5qePTQrewnZ/9bwfK+EEi76AHDoXkZZtV/0= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 3DF8B14008D; Wed, 9 Oct 2019 18:41:58 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org, Santoshkumar Karanappa Rastapur , Lance Richardson Date: Wed, 9 Oct 2019 18:41:47 -0700 Message-Id: <20191010014153.64908-7-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191010014153.64908-1-ajit.khaparde@broadcom.com> References: <167a2652-7ad6-e02a-8a02-01f828bcba8c@intel.com> <20191010014153.64908-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 06/12] net/bnxt: get the default HWRM command timeout from firmware 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" 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. Poll for the valid bit every 1us instead of 600us. Fixes: cbcd375d37d2 ("net/bnxt: fix HWRM macros and locking") Cc: stable@dpdk.org Signed-off-by: Santoshkumar Karanappa Rastapur Signed-off-by: Ajit Khaparde Reviewed-by: Lance Richardson --- drivers/net/bnxt/bnxt.h | 5 +++++ drivers/net/bnxt/bnxt_hwrm.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index ad0b18dddd..5020cd3415 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -525,6 +525,11 @@ 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 HWRM request timeout value */ + uint32_t hwrm_cmd_timeout; + struct bnxt_link_info link_info; struct bnxt_cos_queue_info rx_cos_queue[BNXT_COS_QUEUE_COUNT]; struct bnxt_cos_queue_info tx_cos_queue[BNXT_COS_QUEUE_COUNT]; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index a40197e929..5e3117fee9 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -25,8 +25,6 @@ #include -#define HWRM_CMD_TIMEOUT 6000000 -#define HWRM_SHORT_CMD_TIMEOUT 50000 #define HWRM_SPEC_CODE_1_8_3 0x10803 #define HWRM_VERSION_1_9_1 0x10901 #define HWRM_VERSION_1_9_2 0x10903 @@ -105,9 +103,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, /* For VER_GET command, set timeout as 50ms */ if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET) - timeout = HWRM_SHORT_CMD_TIMEOUT; - else timeout = HWRM_CMD_TIMEOUT; + else + timeout = bp->hwrm_cmd_timeout; if (bp->flags & BNXT_FLAG_SHORT_CMD || msg_len > bp->max_req_len) { @@ -969,6 +967,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;