From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B423A04B5; Tue, 3 Dec 2019 08:02:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 516761BFC4; Tue, 3 Dec 2019 08:00:48 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 422041BFA7 for ; Tue, 3 Dec 2019 08:00:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2019 23:00:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,272,1571727600"; d="scan'208";a="410729829" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by fmsmga005.fm.intel.com with ESMTP; 02 Dec 2019 23:00:38 -0800 From: Qi Zhang To: xiaolong.ye@intel.com Cc: haiyue.wang@intel.com, dev@dpdk.org, Qi Zhang Date: Tue, 3 Dec 2019 15:03:17 +0800 Message-Id: <20191203070318.39620-17-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20191203070318.39620-1-qi.z.zhang@intel.com> References: <20191203070318.39620-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 16/17] net/iavf: move device state flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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