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 94DCE41D44 for ; Mon, 27 Feb 2023 08:12:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F3F441143; Mon, 27 Feb 2023 08:12:38 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) by mails.dpdk.org (Postfix) with ESMTP id 1E57141140 for ; Mon, 27 Feb 2023 08:12:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VoPE/BPOGvtGP8I2I5L07Sg3rGzNffEWP90C//VYiMifJ8iQeLtV9vMnP+p994/0T1txmg0ggqY6C3xvPUsIP4fdFxVwe1nn9HZTsz0e9mukfQH/CUqq/FoidqP0BidBfVkRs1OeV96wYvyK7V20yC4STdCcxE1f2ufxeBnqfzAJZMCV6MXUZnYfr5lSzadnYbI09OWcyGNQHehgaVS+rtCcAhpziC5UHAGxiZALuZTc9OXQMmElJmlzUX0NYkHfy4CZgZNqnKmT6mqJkkzxqXFV0hmDyRda7ABw81AD/HrH6Pt5hJrSRXPcPntKfjEYdnJP8tgoX4VJ6niS2a1k/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qUi9Z7QpkCRnMRLG9AGdkyIef1rHx44VzNybkWSXF+Y=; b=WfIxzj/xTMiBk5lHS6PzrUG8sh65vsEuq6aJkwfAV4clIGFKkbylQ/VY8Z0Y9R1d2wfyme65+Z2vmAjUCdpGyz6/juo7ZpST4sScyMxS1rgDgls+b2x8CouTmS+mfI/PqA3gxYLkRsaMYOYwypFYPnRDGGS8FnP0wX6APXaYi5LgoJR1m1b1gXXdJIXD2EYQRVfjzHyFWiTubdGepp305/47+HXBifJZe6JA7iTSWZb1cC8PjC+Xi4QI+HHhtRen6Fh2kOVBkM6Udi/0xy8eC7+zjyTv3MgUacV9IMlkp0bRyMjbzbKEZfBsBNSljQjc3akCG4yx299TNyuyeZZsXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qUi9Z7QpkCRnMRLG9AGdkyIef1rHx44VzNybkWSXF+Y=; b=SCsfPr6zti+3C6oGwUpgpvnrHj/IAGZVPwIesPL0W5IqNAyC0pDULZnTPeyPrQHvXSCwx4mqhDhxD7sFueIqbCkPB0hi9KgYuzwqW01mDa/s1C/z9LABwDoBhgwW8n3pwfkHld6XdwJ+1BG/xsP2ubBo2j8XIFvDF4acgXjmCFO6plaCC5e0CzXoCTeIXyMZV1EIR/Lw1NrP+s2X0JfGzkRe7TgsbP5yhMqJ19W2grTe08mr4+wLAYjoIOtW4A9ibn+PMaHWEwZcfNCp/U4rAHIs/1iU0sK8ZRgNqdUdg2E/GvtsWrEfU6OCOEDUKqXxuql2Bo4HCx2u3TEqFM9HLg== Received: from MN2PR16CA0047.namprd16.prod.outlook.com (2603:10b6:208:234::16) by PH7PR12MB7967.namprd12.prod.outlook.com (2603:10b6:510:273::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Mon, 27 Feb 2023 07:12:35 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::8f) by MN2PR16CA0047.outlook.office365.com (2603:10b6:208:234::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29 via Frontend Transport; Mon, 27 Feb 2023 07:12:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.12 via Frontend Transport; Mon, 27 Feb 2023 07:12:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 26 Feb 2023 23:12:18 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 26 Feb 2023 23:12:15 -0800 From: Xueming Li To: Huisong Li CC: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix duplicate RSS rule check' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 15:00:13 +0800 Message-ID: <20230227070107.15664-105-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|PH7PR12MB7967:EE_ X-MS-Office365-Filtering-Correlation-Id: f77032b4-4db9-475d-712d-08db18920023 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nc5TYHNLQwUXbEvOlk6Q3w5hL9lZjEtF9fq/0mGukO5Ej2AQTWrid42ATKIZHQdbKlJ67Jxnxc6Eoio2RT6ekLLWR/ZP/cGra64QFVebmZJNSdpxuJsuVBLFMxB99q81MP8l+GuzoL5WsJ6jV9g1kGgtIWSeCgHN3yZ2naBXpbIvCvKUC0/UHoV2IX8v57ExhCd1AGrfUtdAHk/vrwKZwGWXRD/dQI+M+oQVV13YD6LfvpMkghte0xTNu1OUxQEU1+SNgQDFkOePIdZg168pzxHQeyFd9Dirfd6JX5YYALFULg6fT8Zo36JqSJwOC+41iwBXapUMcj929b22P4Z50C8HZF5x7T2Fab7QHQEWcWOduaxVCFTOjkVO+ZWImf6vy/MwcP1KKBBSo92KiwB7NXxOY5yL4aHonipQhMUBG484kiCP87in2mcN/aFZXKuTxfY1nM9J9qR+RuOoU1hTrUvXaC4Q0v6rpUGeIJsxdHa8wy/SLJIyKuqipzPEPycm8WT41v1YA8soRfFHqMJ0dhG1O9kSD1k6oQBEBufCPzD0qsiAJlomv+SMSFbJ5i7G2O6nzEXyS7YaJZ7jlyAudSvaDUYXH5YVutrb41+YDcyaIZYlVDM93JXKK+j9fdM9gwaIFnJABtCVmWVnTWWqJVVYBCE9QWRMlGq1Y/w3pFlHKOv3dpCbM3oYX3l+UJ11osP9qnrBQNOEmyxa6L1/juMQx9NGlukwhKUWmF/yUhNTqQgAbPY5m495q1p/fUy37ilk6u2+/fY3tpEYN32KCDmIjy41p9t22rp3feCkmpA= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(346002)(376002)(136003)(396003)(451199018)(40470700004)(36840700001)(46966006)(2616005)(966005)(36756003)(82310400005)(86362001)(54906003)(186003)(40460700003)(16526019)(6286002)(2906002)(36860700001)(5660300002)(8936002)(6916009)(8676002)(70586007)(70206006)(41300700001)(1076003)(26005)(47076005)(426003)(478600001)(53546011)(336012)(55016003)(40480700001)(7696005)(4326008)(7636003)(82740400003)(356005)(316002)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:12:34.7640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f77032b4-4db9-475d-712d-08db18920023 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7967 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/01/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=6ae7e4345ee40b5a3abcce0eb28f717b4c3b202a Thanks. Xueming Li --- >From 6ae7e4345ee40b5a3abcce0eb28f717b4c3b202a Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Tue, 31 Jan 2023 21:03:00 +0800 Subject: [PATCH] net/hns3: fix duplicate RSS rule check Cc: Xueming Li [ upstream commit 150fd8f839e332d68aa7b60646c2033084544cb7 ] Currently, the interface for verifying duplicate RSS rules has some problems: 1) If the value of 'func' in configuring RSS rule is default value, this rule is mistakenly considered as a duplicate rule. 2) If key length is zero or 'key' is NULL in configuring RSS rule this rule is also mistakenly considered as a duplicate rule. 3) If 'key' or 'queue' in struct rte_flow_action_rss being NULL is used to memcpy, which may cause segment fault. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 63 +++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index a30b19cfdb..e80ec0f053 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1272,28 +1272,59 @@ hns3_filterlist_flush(struct rte_eth_dev *dev) } } +static bool +hns3_flow_rule_key_same(const struct rte_flow_action_rss *comp, + const struct rte_flow_action_rss *with) +{ + if (comp->key_len != with->key_len) + return false; + + if (with->key_len == 0) + return true; + + if (comp->key == NULL && with->key == NULL) + return true; + + if (!(comp->key != NULL && with->key != NULL)) + return false; + + return !memcmp(comp->key, with->key, with->key_len); +} + +static bool +hns3_flow_rule_queues_same(const struct rte_flow_action_rss *comp, + const struct rte_flow_action_rss *with) +{ + if (comp->queue_num != with->queue_num) + return false; + + if (with->queue_num == 0) + return true; + + if (comp->queue == NULL && with->queue == NULL) + return true; + + if (!(comp->queue != NULL && with->queue != NULL)) + return false; + + return !memcmp(comp->queue, with->queue, with->queue_num); +} + static bool hns3_action_rss_same(const struct rte_flow_action_rss *comp, const struct rte_flow_action_rss *with) { - bool rss_key_is_same; - bool func_is_same; + bool same_level; + bool same_types; + bool same_func; - func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? - (comp->func == with->func) : true; + same_level = (comp->level == with->level); + same_types = (comp->types == with->types); + same_func = (comp->func == with->func); - if (with->key_len == 0 || with->key == NULL) - rss_key_is_same = 1; - else - rss_key_is_same = comp->key_len == with->key_len && - !memcmp(comp->key, with->key, with->key_len); - - return (func_is_same && rss_key_is_same && - comp->types == with->types && - comp->level == with->level && - comp->queue_num == with->queue_num && - !memcmp(comp->queue, with->queue, - sizeof(*with->queue) * with->queue_num)); + return same_level && same_types && same_func && + hns3_flow_rule_key_same(comp, with) && + hns3_flow_rule_queues_same(comp, with); } static bool -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:44.277581600 +0800 +++ 0106-net-hns3-fix-duplicate-RSS-rule-check.patch 2023-02-27 14:08:40.849237000 +0800 @@ -1 +1 @@ -From 150fd8f839e332d68aa7b60646c2033084544cb7 Mon Sep 17 00:00:00 2001 +From 6ae7e4345ee40b5a3abcce0eb28f717b4c3b202a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 150fd8f839e332d68aa7b60646c2033084544cb7 ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org @@ -25 +27 @@ -index dd762c02cb..881d70613c 100644 +index a30b19cfdb..e80ec0f053 100644