From patchwork Fri Sep 30 07:22:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117190 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E64CDA034C; Fri, 30 Sep 2022 09:25:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F5CB42B84; Fri, 30 Sep 2022 09:24:25 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 920F042BC9; Fri, 30 Sep 2022 09:24:22 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1pN2lt6zVhk0; Fri, 30 Sep 2022 15:20:12 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:20 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 16/19] net/hns3: add check for L3 and L4 type Date: Fri, 30 Sep 2022 15:22:17 +0800 Message-ID: <20220930072220.20753-17-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected 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 From: Huisong Li When user set 'L3_SRC/DST_ONLY' or 'L4_SRC/DST_ONLY' to 'rss_hf' and do not specify the packet type, these types will be set to hardware. So this patch adds a check for them. Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_rss.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index ea745c791f..ca5a129234 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -400,8 +400,34 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) return ret; } +static void +hns3_rss_check_l3l4_types(struct hns3_hw *hw, uint64_t rss_hf) +{ + uint64_t ip_mask = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | + RTE_ETH_RSS_NONFRAG_IPV4_OTHER | + RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | + RTE_ETH_RSS_NONFRAG_IPV6_OTHER; + uint64_t l4_mask = RTE_ETH_RSS_NONFRAG_IPV4_TCP | + RTE_ETH_RSS_NONFRAG_IPV4_UDP | + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | + RTE_ETH_RSS_NONFRAG_IPV6_TCP | + RTE_ETH_RSS_NONFRAG_IPV6_UDP | + RTE_ETH_RSS_NONFRAG_IPV6_SCTP; + uint64_t l3_src_dst_mask = RTE_ETH_RSS_L3_SRC_ONLY | + RTE_ETH_RSS_L3_DST_ONLY; + uint64_t l4_src_dst_mask = RTE_ETH_RSS_L4_SRC_ONLY | + RTE_ETH_RSS_L4_DST_ONLY; + + if (rss_hf & l3_src_dst_mask && + !(rss_hf & ip_mask || rss_hf & l4_mask)) + hns3_warn(hw, "packet type isn't specified, L3_SRC/DST_ONLY is ignored."); + + if (rss_hf & l4_src_dst_mask && !(rss_hf & l4_mask)) + hns3_warn(hw, "packet type isn't specified, L4_SRC/DST_ONLY is ignored."); +} + static uint64_t -hns3_rss_calc_tuple_filed(uint64_t rss_hf) +hns3_rss_calc_tuple_filed(struct hns3_hw *hw, uint64_t rss_hf) { uint64_t l3_only_mask = RTE_ETH_RSS_L3_SRC_ONLY | RTE_ETH_RSS_L3_DST_ONLY; @@ -430,6 +456,7 @@ hns3_rss_calc_tuple_filed(uint64_t rss_hf) !has_l3_l4_only) tuple |= hns3_set_tuple_table[i].rss_field; } + hns3_rss_check_l3l4_types(hw, rss_hf); return tuple; } @@ -445,7 +472,7 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); req = (struct hns3_rss_input_tuple_cmd *)desc.data; - tuple_field = hns3_rss_calc_tuple_filed(rss_hf); + tuple_field = hns3_rss_calc_tuple_filed(hw, rss_hf); req->tuple_field = rte_cpu_to_le_64(tuple_field); ret = hns3_cmd_send(hw, &desc, 1); if (ret) {