DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: xiaolong.ye@intel.com
Cc: haiyue.wang@intel.com, dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH 16/17] net/iavf: move device state flag
Date: Tue,  3 Dec 2019 15:03:17 +0800
Message-ID: <20191203070318.39620-17-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20191203070318.39620-1-qi.z.zhang@intel.com>

Move device state flag from ice_hw to ice_adatper since it should
not be a part of base code.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/iavf/base/iavf_type.h |  1 -
 drivers/net/iavf/iavf.h           |  1 +
 drivers/net/iavf/iavf_ethdev.c    | 13 +++++--------
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/iavf/base/iavf_type.h b/drivers/net/iavf/base/iavf_type.h
index fb175e8a6..6f85f8c04 100644
--- a/drivers/net/iavf/base/iavf_type.h
+++ b/drivers/net/iavf/base/iavf_type.h
@@ -332,7 +332,6 @@ struct iavf_hw {
 	u16 subsystem_device_id;
 	u16 subsystem_vendor_id;
 	u8 revision_id;
-	bool adapter_stopped;
 
 	/* capabilities for entire device and PCI func */
 	struct iavf_hw_capabilities dev_caps;
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index bbd4d75d0..77b706893 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -127,6 +127,7 @@ struct iavf_adapter {
 	/* For vector PMD */
 	bool rx_vec_allowed;
 	bool tx_vec_allowed;
+	bool stopped;
 };
 
 /* IAVF_DEV_PRIVATE_TO */
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 39faf7fac..73927f1f8 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -421,12 +421,11 @@ iavf_dev_start(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
 
-	hw->adapter_stopped = 0;
+	adapter->stopped = 0;
 
 	vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
@@ -481,12 +480,11 @@ iavf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (hw->adapter_stopped == 1)
+	if (adapter->stopped == 1)
 		return;
 
 	iavf_stop_queues(dev);
@@ -501,7 +499,7 @@ iavf_dev_stop(struct rte_eth_dev *dev)
 
 	/* remove all mac addrs */
 	iavf_add_del_all_mac_addr(adapter, FALSE);
-	hw->adapter_stopped = 1;
+	adapter->stopped = 1;
 }
 
 static int
@@ -1333,6 +1331,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->back = IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
 	adapter->eth_dev = eth_dev;
+	adapter->stopped = 1;
 
 	if (iavf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
@@ -1393,7 +1392,6 @@ static int
 iavf_dev_uninit(struct rte_eth_dev *dev)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
@@ -1401,8 +1399,7 @@ iavf_dev_uninit(struct rte_eth_dev *dev)
 	dev->dev_ops = NULL;
 	dev->rx_pkt_burst = NULL;
 	dev->tx_pkt_burst = NULL;
-	if (hw->adapter_stopped == 0)
-		iavf_dev_close(dev);
+	iavf_dev_close(dev);
 
 	rte_free(vf->vf_res);
 	vf->vsi_res = NULL;
-- 
2.13.6


  parent reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03  7:03 [dpdk-dev] [PATCH 00/17] iavf base code update Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 01/17] net/iavf/base: remove unnecessary header file Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 02/17] net/iavf/base: rename error code enum Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 03/17] net/iavf/base: rename register macro Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 04/17] net/iavf/base: update device id Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 05/17] net/iavf/base: remove unused code Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 06/17] net/iavf/base: remove unnecessary compile option Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 07/17] net/iavf/base: rename functions Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 08/17] net/iavf/base: update virtual channel Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 09/17] net/iavf/base: adjust code indent Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 10/17] net/iavf/base: increase max VSI count for VFs Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 11/17] net/iavf/base: fix command buffer memory free Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 12/17] net/iavf/base: update FW API version for X722 Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 13/17] net/iavf/base: add more link speed support Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 14/17] net/iavf/base: update copyright date Qi Zhang
2019-12-03  7:03 ` [dpdk-dev] [PATCH 15/17] net/iavf/base: fix send adminq return value Qi Zhang
2020-01-02  2:48   ` Yang, Qiming
2019-12-03  7:03 ` Qi Zhang [this message]
2019-12-03  7:03 ` [dpdk-dev] [PATCH 17/17] net/ice/base: update version info Qi Zhang
2020-01-02  2:50 ` [dpdk-dev] [PATCH 00/17] iavf base code update Yang, Qiming
2020-01-02  3:14   ` Ye Xiaolong

Reply instructions:

You may reply publically 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=20191203070318.39620-17-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyue.wang@intel.com \
    --cc=xiaolong.ye@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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git