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 B15ACA0C4D; Sun, 5 Sep 2021 11:36:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E86F410E5; Sun, 5 Sep 2021 11:36:31 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by mails.dpdk.org (Postfix) with ESMTP id A6FC0410DF; Sun, 5 Sep 2021 11:36:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JcnsodyDp4sDhBg2ZMDTQrrSox4SXSrV34b/z6dUB7vnCK0xUjYVELtq+5D601hVgnX1SO7YSd+GnHPsR2Z517QYmEPc67zi2pyLH/w0nP2d5VRV1MTpSA2npDwsxK3jx4F/inqGasrWQ5HQC3FggBnsmclPiXtxjc3SpG/nIOAo5/tXNOpXfc/PDFHkBF1TglCWFhRplJgE/+HKRC8D63ZeKmUZlx3bo6c4EA/ZtvJr5whKmTjnj0o+12svnGiyU1diQfmfxnkxPgW23IfyAidejHBPRCEiVazrvk6jHewl4JqRmWOaYP0zXdbzygoU3704SDusTV5Mw7M5HqwJjw== 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; bh=kp/YzFjAs8lOVEC3EFxIx9HFsXlHjTz43KHONBqfqpE=; b=EKYZdFeN+UCAxpMR6F+Ropkuhpf1ZLRf5OlWBaRIz/5Pe/5FFCOapCxPtUxR8qugAdjv92WxoO13jt3cm8mftW48mBhYY7vfVhdDIDy3g303h5KeySP7NQ1ZAYtpn9hQhbs2/oMGZhfwVlBxF6U0JRGt1dlIiS82kv0c8+bx8mR9W/4A8nUqYh99yfLMhWoimuEvpTda6rRZgszvzAhZIKYO8MB3sNeEnO2pfhBfx+rG41DY793qxCkD99Xd8lSzNMhXzP4/g9EErQJjf2llhMw1v36xTSCIibwvVCuw0Wx5/GLFwyHe7KbyootUZB8ulzr/OBzxiBxPSIefq250yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=kp/YzFjAs8lOVEC3EFxIx9HFsXlHjTz43KHONBqfqpE=; b=H5L7jYL4yJZU1scF3y0f8Mxl756rQqAruyKZ8wNDIcM8Ai5e21h0Wmm2hr95fbQRGRP6pg6LM7QnZMxB6wXv6Pg9z9FjEFtQBG2kG/tm3lQz88bCxeJ8GtiKH4uhenBRxsdkJcZldPSpYTD82R8E4Pfe2NqUtgTC5cdn9botIMDSQD0/ccTTYTQiDdPj4unM2xOKj+HHTvt8SdXY7fcW+385HoKmZhxsL/ifTZBd9v3eLQ/XSX5rYbyJYqKUqGTWy3fHwVMh+iu31Gta2ob1xSHKTFnavHBk9u5VdnTMhqziQAtvloxyEhMSTVGHyyhQOXGgGwHWSrPrbaKF8X8lJg== Received: from MWHPR12CA0049.namprd12.prod.outlook.com (2603:10b6:300:103::11) by MN2PR12MB3087.namprd12.prod.outlook.com (2603:10b6:208:d2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20; Sun, 5 Sep 2021 09:36:27 +0000 Received: from CO1NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:300:103:cafe::b7) by MWHPR12CA0049.outlook.office365.com (2603:10b6:300:103::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Sun, 5 Sep 2021 09:36:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT048.mail.protection.outlook.com (10.13.175.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Sun, 5 Sep 2021 09:36:26 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 5 Sep 2021 09:36:24 +0000 From: Lior Margalit To: Matan Azrad CC: Lior Margalit , , Date: Sun, 5 Sep 2021 12:35:57 +0300 Message-ID: <20210905093558.3845263-2-lmargalit@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210905093558.3845263-1-lmargalit@nvidia.com> References: <20210905093558.3845263-1-lmargalit@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0efbc6c7-8833-4603-921c-08d97050a1f4 X-MS-TrafficTypeDiagnostic: MN2PR12MB3087: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mZPzmHO9Y49Ja7i4l+vKnmlljW5ToVxVpEtVR9lfMIceiYZiT1xKQR25jUX7GtRYGQ3GJ2+6W9p9NR+GjLBaM0O1ePiorLVL4ijTVKiuxYBt70nRaGzMzgZ8YTNUA0146kpsr+lHLKnRxaatnBnNJF9CzH/uwn9AQqOnMOH9r6DsnTIxewtMwXpP1tYqMXL6mfEAK9Z9kLGfz+YqiAXnuRwxyBBRBlSJw3QJS9khlBS6eCjoBMpi7Lh6lEdxZOl7p2i7gT0FkDUNfxv5c5TQXUnw7H6IqH8B28PYh1p4YifjlQzfwDPyt1rbGCwJT4jDoMjlSGxqCJFn0oTVaLpO4I8d0imvWEKUkv2CwnHpoE8mrGSDBFLrdRF2kyqI4vRTU5GpRkckxWSwigZttoaDPMsvn7uHpFvqCe4QX5l7Tge+Ukz+2IAAou6LxQwJDOA5tb2Yo3HCFideZ0mBd5cv9K3vtZVNH4TEpodlzrsZFKogAaCeTQuENXqf5SiB+Pm6MGeQiX+tywTeZF0VeFx//9cb4rao6f18j5kCf6bWZmy9qYvBqyBaYYBdYDEuYXDdgYfkcEcsjsj1eMhYWEHmLfcl5b0YJdfHISOaLZSHusJqIlrsYmTIFvPqoShBEdACqzdMo8gSSsqaAeZu+ugvAtwFCE8jiN6CDd13SnjIN+jWP+4uwdK+IEqAIAXwT55ql7Oynshn8k9NYZArISxYSA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(346002)(39860400002)(376002)(396003)(46966006)(36840700001)(7636003)(356005)(6862004)(2906002)(6666004)(82310400003)(83380400001)(36756003)(8676002)(8936002)(426003)(47076005)(6636002)(5660300002)(36860700001)(82740400003)(336012)(55016002)(4326008)(70586007)(316002)(6286002)(70206006)(1076003)(54906003)(7696005)(450100002)(478600001)(26005)(2616005)(36906005)(186003)(86362001)(16526019)(37006003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2021 09:36:26.5442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0efbc6c7-8833-4603-921c-08d97050a1f4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3087 Subject: [dpdk-dev] [PATCH v1 1/2] net/mlx5: fix RSS expansion for 'explicit' graph node 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" The RSS expansion algorithm is using a graph to find the possible expansion paths. A graph node with the 'explicit' flag will be skipped, if it is not found in the flow pattern. The current implementation misses the case where the node with the explicit flag is in the middle of the expanded path. For example: testpmd> flow create 0 ingress pattern eth / ipv6 / udp / vxlan / end actions rss level 2 types tcp end / end The VLAN node has the explicit flag, so it is currently included in the expanded flow: ETH IPV6 UDP VXLAN END ETH IPV6 UDP VXLAN ETH VLAN IPV4 TCP END ETH IPV6 UDP VXLAN ETH VLAN IPV6 TCP END The fix is to skip the nodes with the explicit flag while iterating over the possible expansion paths. Using the above example, the flows will be: ETH IPV6 UDP VXLAN END ETH IPV6 UDP VXLAN ETH IPV4 TCP END ETH IPV6 UDP VXLAN ETH IPV6 TCP END Fixes: 3f02c7ff6815 ("net/mlx5: fix RSS expansion for inner tunnel VLAN") Cc: stable@dpdk.org Signed-off-by: Lior Margalit Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 44 ++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 4762fa0f5f..6cf1bb810d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -259,6 +259,26 @@ mlx5_flow_expand_rss_item_complete(const struct rte_flow_item *item) return ret; } +static const int * +mlx5_flow_expand_rss_skip_explicit(const struct mlx5_flow_expand_node graph[], + const int *next_node) +{ + const struct mlx5_flow_expand_node *node = NULL; + const int *next = next_node; + + while (next && *next) { + /* + * Skip the nodes with the MLX5_EXPANSION_NODE_EXPLICIT + * flag set, because they were not found in the flow pattern. + */ + node = &graph[*next]; + if (!(node->node_flags & MLX5_EXPANSION_NODE_EXPLICIT)) + break; + next = node->next; + } + return next; +} + #define MLX5_RSS_EXP_ELT_N 16 /** @@ -391,17 +411,8 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size, } } memset(flow_items, 0, sizeof(flow_items)); - next_node = node->next; - while (next_node) { - /* - * Skip the nodes with the MLX5_EXPANSION_NODE_EXPLICIT - * flag set, because they were not found in the flow pattern. - */ - node = &graph[*next_node]; - if (!(node->node_flags & MLX5_EXPANSION_NODE_EXPLICIT)) - break; - next_node = node->next; - } + next_node = mlx5_flow_expand_rss_skip_explicit(graph, + node->next); stack[stack_pos] = next_node; node = next_node ? &graph[*next_node] : NULL; while (node) { @@ -438,7 +449,8 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size, /* Go deeper. */ if (!(node->node_flags & MLX5_EXPANSION_NODE_OPTIONAL) && node->next) { - next_node = node->next; + next_node = mlx5_flow_expand_rss_skip_explicit(graph, + node->next); if (stack_pos++ == MLX5_RSS_EXP_ELT_N) { rte_errno = E2BIG; return -rte_errno; @@ -446,15 +458,17 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size, stack[stack_pos] = next_node; } else if (*(next_node + 1)) { /* Follow up with the next possibility. */ - ++next_node; + next_node = mlx5_flow_expand_rss_skip_explicit(graph, + ++next_node); } else { /* Move to the next path. */ if (stack_pos) next_node = stack[--stack_pos]; - next_node++; + next_node = mlx5_flow_expand_rss_skip_explicit(graph, + ++next_node); stack[stack_pos] = next_node; } - node = *next_node ? &graph[*next_node] : NULL; + node = next_node && *next_node ? &graph[*next_node] : NULL; }; return lsize; } -- 2.25.1