DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 3/4] net/bnxt: minor refactoring of async handling code
Date: Mon, 12 Jul 2021 13:34:34 +0530	[thread overview]
Message-ID: <20210712080435.9149-4-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210712080435.9149-1-kalesh-anakkur.purayil@broadcom.com>

From: Somnath Kotur <somnath.kotur@broadcom.com>

Store the async event completion data1 and data2 in separate variables
at the start of the function before the switch case for the different
events so they can be used by any of the event handlers.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 2c7fd78..500146b 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -103,7 +103,10 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	uint16_t port_id = bp->eth_dev->data->port_id;
 	struct bnxt_error_recovery_info *info;
 	uint32_t event_data;
-	uint32_t echo_req_data1, echo_req_data2;
+	uint32_t data1, data2;
+
+	data1 = rte_le_to_cpu_32(async_cmp->event_data1);
+	data2 = rte_le_to_cpu_32(async_cmp->event_data2);
 
 	switch (event_id) {
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
@@ -136,7 +139,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		}
 
 		pthread_mutex_lock(&bp->err_recovery_lock);
-		event_data = rte_le_to_cpu_32(async_cmp->event_data1);
+		event_data = data1;
 		/* timestamp_lo/hi values are in units of 100ms */
 		bp->fw_reset_max_msecs = async_cmp->timestamp_hi ?
 			rte_le_to_cpu_16(async_cmp->timestamp_hi) * 100 :
@@ -170,8 +173,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		PMD_DRV_LOG(INFO, "Port %u: Error recovery async event received\n",
 			    port_id);
 
-		event_data = rte_le_to_cpu_32(async_cmp->event_data1) &
-				EVENT_DATA1_FLAGS_MASK;
+		event_data = data1 & EVENT_DATA1_FLAGS_MASK;
 
 		if (event_data & EVENT_DATA1_FLAGS_MASTER_FUNC)
 			info->flags |= BNXT_FLAG_MASTER_FUNC;
@@ -198,22 +200,18 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		bnxt_schedule_fw_health_check(bp);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEBUG_NOTIFICATION:
-		PMD_DRV_LOG(INFO, "DNC event: evt_data1 %#x evt_data2 %#x\n",
-			    rte_le_to_cpu_32(async_cmp->event_data1),
-			    rte_le_to_cpu_32(async_cmp->event_data2));
+		PMD_DRV_LOG(INFO, "Port: %u DNC event: data1 %#x data2 %#x\n",
+			    port_id, data1, data2);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE:
 		bnxt_process_default_vnic_change(bp, async_cmp);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST:
-		echo_req_data1 = rte_le_to_cpu_32(async_cmp->event_data1);
-		echo_req_data2 = rte_le_to_cpu_32(async_cmp->event_data2);
 		PMD_DRV_LOG(INFO,
 			    "Port %u: Received fw echo request: data1 %#x data2 %#x\n",
-			    port_id, echo_req_data1, echo_req_data2);
+			    port_id, data1, data2);
 		if (bp->recovery_info)
-			bnxt_hwrm_fw_echo_reply(bp, echo_req_data1,
-						echo_req_data2);
+			bnxt_hwrm_fw_echo_reply(bp, data1, data2);
 		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
-- 
2.10.1


  parent reply	other threads:[~2021-07-12  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12  8:04 [dpdk-dev] [PATCH 0/4] bnxt PMD patches Kalesh A P
2021-07-12  8:04 ` [dpdk-dev] [PATCH 1/4] net/bnxt: update HSI structure Kalesh A P
2021-07-12  8:04 ` [dpdk-dev] [PATCH 2/4] net/bnxt: inform firmware about host MTU Kalesh A P
2021-07-12  8:04 ` Kalesh A P [this message]
2021-07-12  8:04 ` [dpdk-dev] [PATCH 4/4] net/bnxt: add handler for pause storm event Kalesh A P
2021-07-15  0:29 ` [dpdk-dev] [PATCH 0/4] bnxt PMD patches Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210712080435.9149-4-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).