DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 7/9] net/bnxt: remove a redundant variable
Date: Tue, 28 Jan 2020 12:59:21 +0530	[thread overview]
Message-ID: <20200128072923.9912-8-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200128072923.9912-1-somnath.kotur@broadcom.com>

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

Use "dev->data->dev_started" state, instead of local "dev_stopped"
to check whether port has been started or not.

Fixes: 316e412299fd ("net/bnxt: fix crash when closing")

Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  1 -
 drivers/net/bnxt/bnxt_ethdev.c | 21 +++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 434ce28..1a5d542 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -648,7 +648,6 @@ struct bnxt {
 #define BNXT_OUTER_TPID_BD_SHFT	16
 	uint32_t		outer_tpid_bd;
 	struct bnxt_pf_info	pf;
-	uint8_t			dev_stopped;
 	uint8_t			vxlan_port_cnt;
 	uint8_t			geneve_port_cnt;
 	uint16_t		vxlan_port;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b04685c..72e5441 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -872,9 +872,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 		goto error;
 
 	eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev);
+	eth_dev->data->dev_started = 1;
 
 	bnxt_link_update(eth_dev, 1, ETH_LINK_UP);
-	bp->dev_stopped = 0;
 
 	if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
 		vlan_mask |= ETH_VLAN_FILTER_MASK;
@@ -887,7 +887,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
 	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
 
-	eth_dev->data->dev_started = 1;
 	pthread_mutex_lock(&bp->def_cp_lock);
 	bnxt_schedule_fw_health_check(bp);
 	pthread_mutex_unlock(&bp->def_cp_lock);
@@ -898,7 +897,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
-	bp->dev_stopped = 1;
+	eth_dev->data->dev_started = 0;
 	return rc;
 }
 
@@ -973,7 +972,6 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	bp->mark_table = NULL;
 
 	bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
-	bp->dev_stopped = 1;
 	bp->rx_cosq_cnt = 0;
 }
 
@@ -981,7 +979,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 
-	if (bp->dev_stopped == 0)
+	if (eth_dev->data->dev_started)
 		bnxt_dev_stop_op(eth_dev);
 
 	bnxt_uninit_resources(bp, false);
@@ -1174,7 +1172,7 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 		return rc;
 
 	/* Filter settings will get applied when port is started */
-	if (bp->dev_stopped == 1)
+	if (!eth_dev->data->dev_started)
 		return 0;
 
 	if (bp->vnic_info == NULL)
@@ -1203,7 +1201,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 		return rc;
 
 	/* Filter settings will get applied when port is started */
-	if (bp->dev_stopped == 1)
+	if (!eth_dev->data->dev_started)
 		return 0;
 
 	if (bp->vnic_info == NULL)
@@ -1232,7 +1230,7 @@ static int bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 		return rc;
 
 	/* Filter settings will get applied when port is started */
-	if (bp->dev_stopped == 1)
+	if (!eth_dev->data->dev_started)
 		return 0;
 
 	if (bp->vnic_info == NULL)
@@ -1261,7 +1259,7 @@ static int bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 		return rc;
 
 	/* Filter settings will get applied when port is started */
-	if (bp->dev_stopped == 1)
+	if (!eth_dev->data->dev_started)
 		return 0;
 
 	if (bp->vnic_info == NULL)
@@ -1985,7 +1983,7 @@ static int bnxt_free_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 		return rc;
 
 	/* Filter settings will get applied when port is started */
-	if (bp->dev_stopped == 1)
+	if (!dev->data->dev_started)
 		return 0;
 
 	if (mask & ETH_VLAN_FILTER_MASK) {
@@ -3887,7 +3885,7 @@ static void bnxt_dev_cleanup(struct bnxt *bp)
 {
 	bnxt_set_hwrm_link_config(bp, false);
 	bp->link_info.link_up = 0;
-	if (bp->dev_stopped == 0)
+	if (bp->eth_dev->data->dev_started)
 		bnxt_dev_stop_op(bp->eth_dev);
 
 	bnxt_uninit_resources(bp, true);
@@ -4824,7 +4822,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)
 
 	bp = eth_dev->data->dev_private;
 
-	bp->dev_stopped = 1;
 	bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
 
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
-- 
1.8.3.1


  parent reply	other threads:[~2020-01-28  7:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28  7:29 [dpdk-dev] [PATCH v2 0/9] bnxt patchset Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 1/9] net/bnxt: fix bnxt_alloc_filter() to use a common routine Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 2/9] net/bnxt: fix bumping of L2 filter reference count Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 3/9] net/bnxt: fix to allow group ID 0 for RSS action Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 4/9] net/bnxt: remove redundant if statement Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 5/9] net/bnxt: remove redundant macro Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 6/9] net/bnxt: remove unnecessary structure variable Somnath Kotur
2020-01-28  7:29 ` Somnath Kotur [this message]
2020-01-28  7:29 ` [dpdk-dev] [PATCH 8/9] net/bnxt: fix to support zero mark id along with RSS action Somnath Kotur
2020-01-28  7:29 ` [dpdk-dev] [PATCH 9/9] net/bnxt: fix coverity warnings Somnath Kotur
2020-01-28 21:01 ` [dpdk-dev] [PATCH v3 0/9] bnxt patch set Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix alloc filter to use a common routine Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 2/9] net/bnxt: fix bumping of L2 filter reference count Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 3/9] net/bnxt: fix to allow group ID 0 for RSS action Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 4/9] net/bnxt: remove redundant if statement Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 5/9] net/bnxt: remove redundant macro Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 6/9] net/bnxt: remove unnecessary structure variable Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 7/9] net/bnxt: remove a redundant variable Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 8/9] net/bnxt: fix to support zero mark id along with RSS action Ajit Khaparde
2020-01-28 21:01   ` [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix coverity warnings Ajit Khaparde
2020-01-29 12:30     ` Ferruh Yigit
2020-01-28 21:07   ` [dpdk-dev] [PATCH v3 0/9] bnxt patch set 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=20200128072923.9912-8-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).