All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Dai <wei.dai@intel.com>
To: jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, Wei Dai <wei.dai@intel.com>, stable@dpdk.org
Subject: [PATCH v3] net/i40e: fix mirror rule reset when port is stopped
Date: Wed, 20 Sep 2017 09:59:30 +0800	[thread overview]
Message-ID: <1505872770-63412-1-git-send-email-wei.dai@intel.com> (raw)
In-Reply-To: <1505097022-11224-1-git-send-email-wei.dai@intel.com>

When an i40e PF port is stopped, all mirror rules should be removed.
All rule related software and hardware resources should also be
removed.

Fixes: a4def5edf0fc ("i40e: enable port mirroring")
Cc: stable@dpdk.org

Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f12aefa..23b9b38 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -361,6 +361,12 @@ static int i40e_dev_sync_phy_type(struct i40e_hw *hw);
 static void i40e_configure_registers(struct i40e_hw *hw);
 static void i40e_hw_init(struct rte_eth_dev *dev);
 static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
+static enum i40e_status_code i40e_aq_del_mirror_rule(struct i40e_hw *hw,
+						     uint16_t seid,
+						     uint16_t rule_type,
+						     uint16_t *entries,
+						     uint16_t count,
+						     uint16_t rule_id);
 static int i40e_mirror_rule_set(struct rte_eth_dev *dev,
 			struct rte_eth_mirror_conf *mirror_conf,
 			uint8_t sw_id, uint8_t on);
@@ -2096,10 +2102,23 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 
 	/* Remove all mirror rules */
 	while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) {
-		TAILQ_REMOVE(&pf->mirror_list, p_mirror, rules);
-		rte_free(p_mirror);
+		int ret;
+		ret = i40e_aq_del_mirror_rule(hw,
+					      pf->main_vsi->veb->seid,
+					      p_mirror->rule_type,
+					      p_mirror->entries,
+					      p_mirror->num_entries,
+					      p_mirror->id);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "failed to remove mirror rule: "
+				    "status = %d, aq_err = %d.", ret,
+				    hw->aq.asq_last_status);
+		} else {
+			TAILQ_REMOVE(&pf->mirror_list, p_mirror, rules);
+			rte_free(p_mirror);
+			pf->nb_mirror_rule--;
+		}
 	}
-	pf->nb_mirror_rule = 0;
 
 	if (!rte_intr_allow_others(intr_handle))
 		/* resume to the default handler */
-- 
2.7.5

  reply	other threads:[~2017-09-20  1:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 14:52 [PATCH] net/i40e: fix mirror rule reset when port is stopped Wei Dai
2017-09-07  7:34 ` Dai, Wei
2017-09-07  7:35 ` Dai, Wei
2017-09-07  7:37   ` Tu, LijuanX A
2017-09-07  7:50 ` Wu, Jingjing
2017-09-07  9:22   ` Dai, Wei
2017-09-11  2:11 ` [PATCH v2] " Wei Dai
2017-09-11  2:45   ` Xing, Beilei
2017-09-13  7:32     ` Wu, Jingjing
2017-09-19  2:21     ` Wu, Jingjing
2017-09-20  1:44       ` Dai, Wei
2017-09-11  2:30 ` Wei Dai
2017-09-20  1:59   ` Wei Dai [this message]
2017-09-20  2:12     ` [PATCH v4] " Wei Dai
2017-09-20  4:16       ` [PATCH v5] " Wei Dai
2017-09-20  9:23         ` Ananyev, Konstantin
2017-09-20 14:26           ` Dai, Wei
2017-09-20 22:46             ` Ananyev, Konstantin
2017-09-23  2:26               ` Wu, Jingjing
2017-09-23 10:37                 ` Ananyev, Konstantin
2017-09-23 16:34                   ` Dai, Wei
2017-09-25  6:36         ` [PATCH v6] net/i40e: fix mirror rule reset when port is closed Wei Dai
2017-09-26 13:49           ` Wu, Jingjing
2017-09-28 15:49             ` [dpdk-stable] " Ferruh Yigit

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=1505872770-63412-1-git-send-email-wei.dai@intel.com \
    --to=wei.dai@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /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.