From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2929BA04B1;
	Wed, 30 Sep 2020 08:51:22 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 771951DB03;
	Wed, 30 Sep 2020 08:49:01 +0200 (CEST)
Received: from relay.smtp-ext.broadcom.com (lpdvacalvio01.broadcom.com
 [192.19.229.182]) by dpdk.org (Postfix) with ESMTP id 955FC1DAF8
 for <dev@dpdk.org>; Wed, 30 Sep 2020 08:48:55 +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-ext.broadcom.com (Postfix) with ESMTP id ADB4D3FE20;
 Tue, 29 Sep 2020 23:48:52 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com ADB4D3FE20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;
 s=dkimrelay; t=1601448534;
 bh=ygImelzxlTI8OljNQLYZbWVXfFMm72JtFz0cPuSXz28=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=Fx2QK9zkfgBsMBCI5QToG8iWu4m5tnBHph20661oCFvWrtfJXVcW3IexwDJ0vEvHp
 5ZU72XdoT36xgkMR+5e9OhHGRn9IZSgEoVwo6frpJ/j7vSxab88Ihg6TrSXRHg0OgU
 neo228/8aNLmM2x350xn39hrYvyPg0qXzImRIYlI=
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net,
	ferruh.yigit@intel.com,
	ajit.khaparde@broadcom.com
Date: Wed, 30 Sep 2020 12:33:25 +0530
Message-Id: <20200930070326.20133-3-kalesh-anakkur.purayil@broadcom.com>
X-Mailer: git-send-email 2.10.1
In-Reply-To: <20200930070326.20133-1-kalesh-anakkur.purayil@broadcom.com>
References: <20200122101654.20824-1-kalesh-anakkur.purayil@broadcom.com>
 <20200930070326.20133-1-kalesh-anakkur.purayil@broadcom.com>
Subject: [dpdk-dev] [RFC V2 2/3] net/bnxt: notify applications about device
	reset/recovery
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

When the driver receives RESET_NOTIFY async event from FW or detected
an error condition, it should update the application that FW is going
to reset. Once the driver recoveres from the reset, update the reset
recovery status to application as well.

The recovery process is transparent to the application as the driver
itself tries to recover from FW reset or FW error conditions.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c    | 3 +++
 drivers/net/bnxt/bnxt_ethdev.c | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 8311e26..f2fddf7 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -129,6 +129,9 @@ void bnxt_handle_async_event(struct bnxt *bp,
 			bp->flags |= BNXT_FLAG_FATAL_ERROR;
 			return;
 		}
+		_rte_eth_dev_callback_process(bp->eth_dev,
+					      RTE_ETH_EVENT_RESET,
+					      NULL);
 
 		event_data = rte_le_to_cpu_32(async_cmp->event_data1);
 		/* timestamp_lo/hi values are in units of 100ms */
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b99c712..609bf46 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4566,6 +4566,9 @@ static void bnxt_dev_recover(void *arg)
 		goto err_start;
 
 	PMD_DRV_LOG(INFO, "Recovered from FW reset\n");
+	_rte_eth_dev_callback_process(bp->eth_dev,
+				      RTE_ETH_EVENT_RECOVERED,
+				      NULL);
 	return;
 err_start:
 	bnxt_dev_stop_op(bp->eth_dev);
@@ -4573,6 +4576,9 @@ static void bnxt_dev_recover(void *arg)
 	bp->flags |= BNXT_FLAG_FATAL_ERROR;
 	bnxt_uninit_resources(bp, false);
 	PMD_DRV_LOG(ERR, "Failed to recover from FW reset\n");
+	_rte_eth_dev_callback_process(bp->eth_dev,
+				      RTE_ETH_EVENT_INTR_RMV,
+				      NULL);
 }
 
 void bnxt_dev_reset_and_resume(void *arg)
@@ -4708,6 +4714,9 @@ static void bnxt_check_fw_health(void *arg)
 	bp->flags |= BNXT_FLAG_FW_RESET;
 
 	PMD_DRV_LOG(ERR, "Detected FW dead condition\n");
+	_rte_eth_dev_callback_process(bp->eth_dev,
+				      RTE_ETH_EVENT_RESET,
+				      NULL);
 
 	if (bnxt_is_master_func(bp))
 		wait_msec = info->master_func_wait_period;
-- 
2.10.1