All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Yahui Cao <yahui.cao@intel.com>
Cc: Qiming Yang <qiming.yang@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
	Beilei Xing <beilei.xing@intel.com>
Subject: Re: [dpdk-dev] [dpdk-dev 02/12] net/ice: tear down flow director
Date: Sat, 7 Sep 2019 19:21:37 +0800	[thread overview]
Message-ID: <20190907112137.GA110251@intel.com> (raw)
In-Reply-To: <20190906120058.108073-3-yahui.cao@intel.com>

On 09/06, Yahui Cao wrote:
>From: Beilei Xing <beilei.xing@intel.com>
>
>Release resources on flow director, include:
> - Release queue.
> - Release VSI.
>
>Signed-off-by: Beilei Xing <beilei.xing@intel.com>
>---
> 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
>

  reply	other threads:[~2019-09-07 11:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 12:00 [dpdk-dev] [dpdk-dev 00/12] net/ice: add ice Flow Director driver Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 01/12] net/ice: initialize and set up flow director Yahui Cao
2019-09-07 11:01   ` Ye Xiaolong
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 02/12] net/ice: tear down " Yahui Cao
2019-09-07 11:21   ` Ye Xiaolong [this message]
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 03/12] net/ice: enable input set configuration Yahui Cao
2019-09-07 12:32   ` Ye Xiaolong
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 04/12] net/ice: add FDIR create and destroy Yahui Cao
2019-09-07 12:50   ` Ye Xiaolong
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 05/12] net/ice: add FDIR mark action support Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 06/12] net/ice: add hash table for FDIR Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 07/12] net/ice: enable FDIR queue group Yahui Cao
2019-09-07 18:22   ` Ye Xiaolong
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 08/12] net/ice: add FDIR dst mac support Yahui Cao
2019-09-07 18:25   ` Ye Xiaolong
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 09/12] net/ice: add FDIR counter resource init/release Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 10/12] net/ice: add FDIR counter support for flow id Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 11/12] net/ice: add FDIR counter support for flow shared Yahui Cao
2019-09-06 12:00 ` [dpdk-dev] [dpdk-dev 12/12] net/ice: add FDIR non-word aligned field support Yahui Cao

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=20190907112137.GA110251@intel.com \
    --to=xiaolong.ye@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=yahui.cao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.