From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C2514A034F; Fri, 7 May 2021 11:08:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF8BC4110B; Fri, 7 May 2021 11:08:27 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 503A640140 for ; Fri, 7 May 2021 11:08:24 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD1sbjzqT5w for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:17 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:15 +0800 Message-ID: <1620378499-5090-3-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/6] net/hns3: fix logging info when clear all FDIR rules X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 If clear FDIR rules fail, the error code was logged, but the error code was useless because it was the sum of all fail code. This patch fixes it by log the success cnt and fail cnt. Fixes: fcba820d9b9e ("net/hns3: support flow director") Fixes: 8eed8acc812e ("net/hns3: add error code to some logs") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_fdir.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 0ef0938..e116d87 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -1026,6 +1026,8 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) struct hns3_fdir_info *fdir_info = &pf->fdir; struct hns3_fdir_rule_ele *fdir_filter; struct hns3_hw *hw = &hns->hw; + int succ_cnt = 0; + int fail_cnt = 0; int ret = 0; /* flush flow director */ @@ -1034,17 +1036,23 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); while (fdir_filter) { TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); - ret += hns3_fd_tcam_config(hw, true, - fdir_filter->fdir_conf.location, - NULL, false); + ret = hns3_fd_tcam_config(hw, true, + fdir_filter->fdir_conf.location, + NULL, false); + if (ret == 0) + succ_cnt++; + else + fail_cnt++; rte_free(fdir_filter); fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); } - if (ret) { - hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret); + if (fail_cnt > 0) { + hns3_err(hw, "fail to delete all FDIR filter, success num = %d " + "fail num = %d", succ_cnt, fail_cnt); ret = -EIO; } + return ret; } -- 2.7.4