DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 5/9] net/hns3: fix residual flow directory rules when app restart
Date: Fri, 10 Apr 2020 19:09:26 +0800	[thread overview]
Message-ID: <20200410110930.15717-6-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200410110930.15717-1-huwei013@chinasoftinc.com>

From: Chengwen Feng <fengchengwen@huawei.com>

This patch fixes that the flow directory rules are not cleared during
initialization, which lead to remaining flow directory rules after upper
application(such as testpmd) restarted.

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_fdir.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c
index ca3c78e1c..53c6448cd 100644
--- a/drivers/net/hns3/hns3_fdir.c
+++ b/drivers/net/hns3/hns3_fdir.c
@@ -772,6 +772,20 @@ static int hns3_config_action(struct hns3_hw *hw, struct hns3_fdir_rule *rule)
 	return hns3_fd_ad_config(hw, ad_data.ad_id, &ad_data);
 }
 
+static int hns3_fd_clear_all_rules(struct hns3_hw *hw, uint32_t rule_num)
+{
+	uint32_t i;
+	int ret;
+
+	for (i = 0; i < rule_num; i++) {
+		ret = hns3_fd_tcam_config(hw, true, i, NULL, false);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 int hns3_fdir_filter_init(struct hns3_adapter *hns)
 {
 	struct hns3_pf *pf = &hns->pf;
@@ -785,6 +799,13 @@ int hns3_fdir_filter_init(struct hns3_adapter *hns)
 		.hash_func = rte_hash_crc,
 		.hash_func_init_val = 0,
 	};
+	int ret;
+
+	ret = hns3_fd_clear_all_rules(&hns->hw, rule_num);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Clear all fd rules fail! ret = %d", ret);
+		return ret;
+	}
 
 	fdir_hash_params.socket_id = rte_socket_id();
 	TAILQ_INIT(&fdir_info->fdir_list);
-- 
2.23.0


  parent reply	other threads:[~2020-04-10 11:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 11:09 [dpdk-dev] [PATCH 0/9] misc updates for hns3 PMD driver Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 1/9] net/hns3: simplify process of some return values Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 2/9] net/hns3: replace zero with macro defined in DPDK framework Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 3/9] net/hns3: fix failure when adding a MC MAC address Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 4/9] net/hns3: fix Rx interrupt after reset Wei Hu (Xavier)
2020-04-10 11:09 ` Wei Hu (Xavier) [this message]
2020-04-10 11:09 ` [dpdk-dev] [PATCH 6/9] net/hns3: fix missing RSS in Rx offload capability Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 7/9] net/hns3: fix missing length of hash key when getting RSS Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 8/9] net/hns3: fix default VLAN filter configuration for PF Wei Hu (Xavier)
2020-04-10 11:09 ` [dpdk-dev] [PATCH 9/9] net/hns3: fix VLAN filter when setting promisucous mode Wei Hu (Xavier)
2020-04-14  8:31 ` [dpdk-dev] [PATCH 0/9] misc updates for hns3 PMD driver Ferruh Yigit
2020-04-17 11:09 ` oulijun

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=20200410110930.15717-6-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).