From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 457EDA00C5; Tue, 4 Jan 2022 09:20:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DF6E411B8; Tue, 4 Jan 2022 09:19:32 +0100 (CET) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp11.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id EE6A5411A7 for ; Tue, 4 Jan 2022 09:19:29 +0100 (CET) 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 4882DC0000F1; Tue, 4 Jan 2022 00:19:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 4882DC0000F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1641284369; bh=RadfgO/Sx0Au1fYl48ayaAN2oJ1HSRibQdPY8ziEI1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qa2I5k6r2ZlDHKWrsA3SrNUFyU4iNouqin8Bi8Kf/0qOyESk7HK+PV1IvDiy6yDTc Q2GLfEBLHoW/arnX2yTSpbrIonwGqXHsWivJVvt22xEZJMjnjZ5RtlOXVw6JkCJuiy o/ytOlzKV1eapIORtoUHefO+923mPzZpKrCc8tSE= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Subject: [dpdk-dev] [PATCH 12/18] net/bnxt: refactor bnxt_stop_rxtx() for reuse Date: Tue, 4 Jan 2022 14:08:18 +0530 Message-Id: <20220104083824.23001-13-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220104083824.23001-1-kalesh-anakkur.purayil@broadcom.com> References: <20220104083824.23001-1-kalesh-anakkur.purayil@broadcom.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Somnath Kotur By accepting rte_eth_dev as input, bnxt_stop_rxtx() can be used in multiple scenarios such as representor devices. Signed-off-by: Somnath Kotur Reviewed-by: Ajit Khaparde Reviewed-by: Kalesh AP --- drivers/net/bnxt/bnxt_cpr.c | 16 ++++++++-------- drivers/net/bnxt/bnxt_cpr.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 5 ++--- drivers/net/bnxt/bnxt_reps.c | 3 +-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index a43b22a..593eebf 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -149,7 +149,7 @@ void bnxt_handle_async_event(struct bnxt *bp, * Avoid any rx/tx packet processing during firmware reset * operation. */ - bnxt_stop_rxtx(bp); + bnxt_stop_rxtx(bp->eth_dev); /* Ignore reset notify async events when stopping the port */ if (!bp->eth_dev->data->dev_started) { @@ -383,15 +383,15 @@ bool bnxt_is_recovery_enabled(struct bnxt *bp) return false; } -void bnxt_stop_rxtx(struct bnxt *bp) +void bnxt_stop_rxtx(struct rte_eth_dev *eth_dev) { - bp->eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts; - bp->eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts; + eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts; + eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts; - rte_eth_fp_ops[bp->eth_dev->data->port_id].rx_pkt_burst = - bp->eth_dev->rx_pkt_burst; - rte_eth_fp_ops[bp->eth_dev->data->port_id].tx_pkt_burst = - bp->eth_dev->tx_pkt_burst; + rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = + eth_dev->rx_pkt_burst; + rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = + eth_dev->tx_pkt_burst; rte_mb(); /* Allow time for threads to exit the real burst functions. */ diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h index 73468ed..52db382 100644 --- a/drivers/net/bnxt/bnxt_cpr.h +++ b/drivers/net/bnxt/bnxt_cpr.h @@ -117,7 +117,7 @@ void bnxt_wait_for_device_shutdown(struct bnxt *bp); bool bnxt_is_recovery_enabled(struct bnxt *bp); bool bnxt_is_primary_func(struct bnxt *bp); -void bnxt_stop_rxtx(struct bnxt *bp); +void bnxt_stop_rxtx(struct rte_eth_dev *eth_dev); /** * Check validity of a completion ring entry. If the entry is valid, include a diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 00acdb7..cf3bd77 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1471,8 +1471,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) eth_dev->data->dev_started = 0; /* Prevent crashes when queues are still in use */ - eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts; - eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts; + bnxt_stop_rxtx(eth_dev); bnxt_disable_int(bp); @@ -4557,7 +4556,7 @@ static void bnxt_check_fw_health(void *arg) bp->flags |= BNXT_FLAG_FATAL_ERROR; bp->flags |= BNXT_FLAG_FW_RESET; - bnxt_stop_rxtx(bp); + bnxt_stop_rxtx(bp->eth_dev); PMD_DRV_LOG(ERR, "Detected FW dead condition\n"); diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 22b76b7..f24f5ef 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -505,8 +505,7 @@ int bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev) struct bnxt_representor *vfr_bp = eth_dev->data->dev_private; /* Avoid crashes as we are about to free queues */ - eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts; - eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts; + bnxt_stop_rxtx(eth_dev); BNXT_TF_DBG(DEBUG, "BNXT Port:%d VFR stop\n", eth_dev->data->port_id); -- 2.10.1