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 F2986A059F; Fri, 10 Apr 2020 13:10:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AB36F1D450; Fri, 10 Apr 2020 13:10:08 +0200 (CEST) Received: from mail.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id C0B541C1C1 for ; Fri, 10 Apr 2020 13:10:04 +0200 (CEST) Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Fri, 10 Apr 2020 19:09:43 +0800 From: "Wei Hu (Xavier)" To: Date: Fri, 10 Apr 2020 19:09:26 +0800 Message-ID: <20200410110930.15717-6-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200410110930.15717-1-huwei013@chinasoftinc.com> References: <20200410110930.15717-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] Subject: [dpdk-dev] [PATCH 5/9] net/hns3: fix residual flow directory rules when app restart 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" From: Chengwen Feng 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 Signed-off-by: Wei Hu (Xavier) --- 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