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 5A974A2EDB for ; Sat, 7 Sep 2019 13:23:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4C54E1F10C; Sat, 7 Sep 2019 13:23:45 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B3CC81F0E0 for ; Sat, 7 Sep 2019 13:23:43 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2019 04:23:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,477,1559545200"; d="scan'208";a="186035577" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.5]) by orsmga003.jf.intel.com with ESMTP; 07 Sep 2019 04:23:41 -0700 Date: Sat, 7 Sep 2019 19:21:37 +0800 From: Ye Xiaolong To: Yahui Cao Cc: Qiming Yang , Wenzhuo Lu , dev@dpdk.org, Qi Zhang , Beilei Xing Message-ID: <20190907112137.GA110251@intel.com> References: <20190906120058.108073-1-yahui.cao@intel.com> <20190906120058.108073-3-yahui.cao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906120058.108073-3-yahui.cao@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [dpdk-dev 02/12] net/ice: tear down flow director 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" On 09/06, Yahui Cao wrote: >From: Beilei Xing > >Release resources on flow director, include: > - Release queue. > - Release VSI. > >Signed-off-by: Beilei Xing >--- > drivers/net/ice/ice_fdir_filter.c | 40 ++++++++++++++++++++++ > drivers/net/ice/ice_rxtx.c | 57 +++++++++++++++++++++++++++++++ > drivers/net/ice/ice_rxtx.h | 2 ++ Update document and release as well, and what about combine this patch with prior patch, I think together they enable the FDIR engine. > 3 files changed, 99 insertions(+) > >diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c >index 03d143058..451ef92b2 100644 >--- a/drivers/net/ice/ice_fdir_filter.c >+++ b/drivers/net/ice/ice_fdir_filter.c >@@ -117,6 +117,37 @@ ice_fdir_setup(struct ice_pf *pf) > return err; > } > >+/* >+ * ice_fdir_teardown - release the Flow Director resources >+ * @pf: board private structure >+ */ >+static void >+ice_fdir_teardown(struct ice_pf *pf) >+{ >+ struct rte_eth_dev *eth_dev = pf->adapter->eth_dev; >+ struct ice_vsi *vsi; >+ int err; >+ >+ vsi = pf->fdir.fdir_vsi; >+ if (!vsi) >+ return; >+ >+ err = ice_fdir_tx_queue_stop(eth_dev, pf->fdir.txq->queue_id); >+ if (err) >+ PMD_DRV_LOG(ERR, "Failed to stop TX queue."); >+ >+ err = ice_fdir_rx_queue_stop(eth_dev, pf->fdir.rxq->queue_id); >+ if (err) >+ PMD_DRV_LOG(ERR, "Failed to stop RX queue."); >+ >+ ice_tx_queue_release(pf->fdir.txq); >+ pf->fdir.txq = NULL; >+ ice_rx_queue_release(pf->fdir.rxq); >+ pf->fdir.rxq = NULL; >+ ice_release_vsi(vsi); >+ pf->fdir.fdir_vsi = NULL; >+} >+ > static int > ice_init_fdir_filter(struct ice_adapter *ad) > { >@@ -128,8 +159,17 @@ ice_init_fdir_filter(struct ice_adapter *ad) > return ret; > } > >+static void >+ice_uninit_fdir_filter(struct ice_adapter *ad) >+{ >+ struct ice_pf *pf = &ad->pf; >+ >+ ice_fdir_teardown(pf); >+} >+ > static struct ice_flow_engine ice_fdir_engine = { > .init = ice_init_fdir_filter, >+ .uninit = ice_uninit_fdir_filter, > .type = ICE_FLOW_ENGINE_FDIR, > }; > >diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c >index bd802e350..e41fcb194 100644 >--- a/drivers/net/ice/ice_rxtx.c >+++ b/drivers/net/ice/ice_rxtx.c >@@ -748,6 +748,63 @@ ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) > return 0; > } > >+int >+ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) >+{ >+ struct ice_rx_queue *rxq; >+ int err; >+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); >+ >+ rxq = pf->fdir.rxq; >+ >+ err = ice_switch_rx_queue(hw, rxq->reg_idx, FALSE); >+ if (err) { >+ PMD_DRV_LOG(ERR, "Failed to switch FDIR RX queue %u off", >+ rx_queue_id); >+ return -EINVAL; >+ } >+ ice_rx_queue_release_mbufs(rxq); >+ >+ return 0; >+} >+ >+int >+ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) >+{ >+ struct ice_tx_queue *txq; >+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); >+ struct ice_vsi *vsi = pf->main_vsi; >+ enum ice_status status; >+ uint16_t q_ids[1]; >+ uint32_t q_teids[1]; >+ uint16_t q_handle = tx_queue_id; >+ >+ txq = pf->fdir.txq; >+ if (!txq) { >+ PMD_DRV_LOG(ERR, "TX queue %u is not available", >+ tx_queue_id); >+ return -EINVAL; >+ } >+ vsi = txq->vsi; >+ >+ q_ids[0] = txq->reg_idx; >+ q_teids[0] = txq->q_teid; >+ >+ /* Fix me, we assume TC always 0 here */ >+ status = ice_dis_vsi_txq(hw->port_info, vsi->idx, 0, 1, &q_handle, >+ q_ids, q_teids, ICE_NO_RESET, 0, NULL); >+ if (status != ICE_SUCCESS) { >+ PMD_DRV_LOG(DEBUG, "Failed to disable Lan Tx queue"); >+ return -EINVAL; >+ } >+ >+ ice_tx_queue_release_mbufs(txq); >+ >+ return 0; >+} Better to reuse ice_rx/tx_queue_stop. Thanks, Xiaolong >+ > int > ice_rx_queue_setup(struct rte_eth_dev *dev, > uint16_t queue_idx, >diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h >index 450db0244..24376c0d5 100644 >--- a/drivers/net/ice/ice_rxtx.h >+++ b/drivers/net/ice/ice_rxtx.h >@@ -151,6 +151,8 @@ int ice_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); > int ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); > int ice_fdir_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); > int ice_fdir_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); >+int ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); >+int ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); > void ice_rx_queue_release(void *rxq); > void ice_tx_queue_release(void *txq); > void ice_clear_queues(struct rte_eth_dev *dev); >-- >2.17.1 >