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 42D53A0588; Tue, 21 Apr 2020 10:57:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 621E51D93D; Tue, 21 Apr 2020 10:56:55 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 3EB411D932 for ; Tue, 21 Apr 2020 10:56:51 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp.broadcom.com (Postfix) with ESMTP id CD05D1BC809; Tue, 21 Apr 2020 01:56:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com CD05D1BC809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587459411; bh=mGPCcrHWP8qn8fkJnwoGcxvg54wZh9OggeU0AaDCoeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iIABoytAESakHoQeucngnGhZevQr7iWIkMjgpAN3gAF1Zc6Fwa0ag1Xv0b5E1mH/8 osZRwDga4x1AIGYBW2iyRDRGkZZyNFZ4glObDXraSqolOHt9hjb++6xDIY5Pbqpp8+ KU9OgLoaxR2Xy/FrAPOugjGvhahI7/AmsbS6nLjg= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Tue, 21 Apr 2020 14:42:51 +0530 Message-Id: <20200421091257.8089-4-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20200421091257.8089-1-kalesh-anakkur.purayil@broadcom.com> References: <20200421091257.8089-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress 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: Kalesh AP FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is unable to process a specific cmd while hot reset is in progress. Host driver is expected to keep retrying the cmd for 2s with a gap of 50ms between each retrial. Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE still returns error after 2 seconds. Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Lance Richardson Reviewed-by: Somnath Kotur Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt.h | 5 +++++ drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++-------- drivers/net/bnxt/bnxt_hwrm.c | 4 ++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index a7a9e41..d55a570 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -480,6 +480,11 @@ struct bnxt_error_recovery_info { uint32_t last_reset_counter; }; +/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */ +#define BNXT_IF_CHANGE_RETRY_INTERVAL 50 +/* Maximum retry count for FUNC_DRV_IF_CHANGE */ +#define BNXT_IF_CHANGE_RETRY_COUNT 40 + struct bnxt_mark_info { uint32_t mark_id; bool valid; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3397c05..b6c7132 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = eth_dev->data->dev_private; uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads; int vlan_mask = 0; - int rc; + int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT; if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) { PMD_DRV_LOG(ERR, "Queues are not configured yet!\n"); @@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS); } - rc = bnxt_hwrm_if_change(bp, 1); - if (!rc) { - if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) { - rc = bnxt_handle_if_change_status(bp); - if (rc) - return rc; - } + do { + rc = bnxt_hwrm_if_change(bp, 1); + if (rc == 0 || rc != -EAGAIN) + break; + + rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL); + } while (retry_cnt--); + + if (rc) + return rc; + + if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) { + rc = bnxt_handle_if_change_status(bp); + if (rc) + return rc; } + bnxt_enable_int(bp); rc = bnxt_init_chip(bp); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 4c0fac6..dc0b405 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, rc = -EINVAL; \ else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \ rc = -ENOTSUP; \ + else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \ + rc = -EAGAIN; \ else if (rc > 0) \ rc = -EIO; \ return rc; \ @@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, rc = -EINVAL; \ else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \ rc = -ENOTSUP; \ + else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \ + rc = -EAGAIN; \ else if (rc > 0) \ rc = -EIO; \ return rc; \ -- 2.10.1