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 45A47A0C4D; Sun, 5 Sep 2021 11:36:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E33F141102; Sun, 5 Sep 2021 11:36:32 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) by mails.dpdk.org (Postfix) with ESMTP id A50F4410DF; Sun, 5 Sep 2021 11:36:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CbacXpkDdCuBfjq9O/Q1GZx6n2b2ol5wq4uOp9j81juEXeEQ25lq/64wLg7kP/l+7RY/cmyQ9R1vUxhjVVq3GNOoRl8z48g7SxQCCssxz61IxHoGq5C95w648pUronXOfYjgEVoRNla7GXqNSE9auUJIKrv7EYsz0/n+ab0WIVoz1zNI7nLbQlqqhYyjAPK9Rb+dC9phOANBqWk/YF5QlJ6GJX/lpHtHHHbVIyf3YMCM3OatcvO0vbeBJPz2sJzv6VWJSumW1zMN2ZyMWcK/QOAzYRzGlrR3mF08+w4+/mAGaEZylkpXzwlZOMcnOz/h2TxlXdKXgrAhjfOXgmoxgg== 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=huC2D5f9J309BfB8zaFj4S/40NexELSRTFjp5Jj4NqE=; b=TZ9W1FVaySpEH/jTNrF9FmaZCVLpBGkmkOK2ExDsmLCB/jiZ8+oKwnOLwW8UFZZ1yGmqzk6sBUAUJWqQNKPpITJcCOAVrfA+AxqI//au8YEU2SoQPagLKk4BQFah3XXtDwXR19derc0IHNNf5Lnhz5J9dK+Jaw959R8haA9YslVBZaeShaPYfKepAHCrzqUxJO4ofEsHn0AckityoffHT4JbgZGRNamdaYYZTopnH9sO24h+EZYjbkB/FiBDog9EHXAY2F2UyOl4HiPJ4jjSrawvuE6d8Bv7v1CjTL1eVWyuWxc50ohXsGX7YwDuqfFOsmgh60c/tdPSfkuOVwgF/Q== 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=huC2D5f9J309BfB8zaFj4S/40NexELSRTFjp5Jj4NqE=; b=dqVtWCEV0MV0f4RfA6ANuxBtqT3q+nPowSRXqjEzRkauwG+loUJKu86jYjyRbe8ZgKrDk8dLdL8xUD9ZldTzJucJRRc6iQroUIcXHFAmG7z/xw+KvIy1MLTZkl1m5EQU5Qc2BYJtkcoH7OFB67YodybDb1YXRqhHr8eJBQEb7tFSld+19YiJNA3rTPYqT3JuBY4VqVRML+2OOWMDbW6auPvJzMzvDU2QdqRmguc/UVXV/agqolObKe5mZP2U49yh651LwOwyW2A095glNdxkZaOJKF/nBh3SsbGt8JbGgBwOgKUT1bMf7yer+QEO2VAEHTTp/BYwZOZIozy3qbzPpQ== Received: from MW4PR03CA0240.namprd03.prod.outlook.com (2603:10b6:303:b9::35) by MW3PR12MB4540.namprd12.prod.outlook.com (2603:10b6:303:52::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Sun, 5 Sep 2021 09:36:29 +0000 Received: from CO1NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::c5) by MW4PR03CA0240.outlook.office365.com (2603:10b6:303:b9::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend Transport; Sun, 5 Sep 2021 09:36:29 +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 CO1NAM11FT026.mail.protection.outlook.com (10.13.175.67) 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:28 +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:27 +0000 From: Lior Margalit To: Matan Azrad CC: Lior Margalit , , Date: Sun, 5 Sep 2021 12:35:58 +0300 Message-ID: <20210905093558.3845263-3-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: 0301ef7a-7367-4a4c-cda2-08d97050a36c X-MS-TrafficTypeDiagnostic: MW3PR12MB4540: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WMSrgwooZOJDixdlQKIA5+sENNe8rx1Pj27TVoW48hrZEoE30p+QEQ2iQQ9NU5amH0NGCR5E8AWF+yi/cHOYOlB2ovZ7KaHvKevw/6pzdDutsrOB6dNDCrmhRyfiRhRGa8tIrpqDFEj0hU8hWzFuzojO0svQhkbCTvRxCteVZ83FwwwpSoJunvxzuEC2YVo+h93uV2YLO8hmUMxZd6zbMbtyqqvVLQzwrOqsGtgo1K0Pcrb4jN4Yy8/pTLCFlvPQYrlyE0uH/F3qpkdFiIMp9bWLNPKLEnmbBL93CMGKm20iPOy4kGcvlwzmyuF0bRNStHr+tBi1jaYYTChQsI+KV8TY2/4mQ9bKI9BmWZw9+KrNWdcXoSyxPWFI+mWbpK0t9c2Ptdo9eEvJbikOfBUYH5oQBZDq4Fkk3HkKwq0upF0GTo3Eq3mMouJtic+ix86M9uKdmLgnFZQiXf527zZmNdutoh3sgg4j77pCQ/Q3ZB+Lz6PO2OI0tbCPtxggTPzh8wBfGDAEsr/ejM00vJomo+qjM5/RjEuA81gOefaE1Bx1PUqsAIljhRSTENiTSyH+hrvHa5NNc270xfBeQzHxvyQfj7ujZy3wJUOLIh+n2XoTKj0Z8DzaX0wzmV5zaZIntO/WwZRO4RKJ0FJFU+D76HfYe45pK1beoI+HBc4cqac8a8Fww0rzZPEYgFUJ0vPlYirK4W8i/ScDXc0DiUXtPA== 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)(376002)(39860400002)(346002)(136003)(396003)(36840700001)(46966006)(6286002)(2906002)(356005)(316002)(36906005)(336012)(6636002)(7636003)(8676002)(36860700001)(86362001)(2616005)(82740400003)(26005)(186003)(16526019)(478600001)(1076003)(36756003)(426003)(70206006)(47076005)(82310400003)(6862004)(54906003)(83380400001)(6666004)(5660300002)(7696005)(37006003)(4326008)(450100002)(55016002)(70586007)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2021 09:36:28.9967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0301ef7a-7367-4a4c-cda2-08d97050a36c 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: CO1NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4540 Subject: [dpdk-dev] [PATCH v1 2/2] net/mlx5: fix RSS expansion traversal over next nodes 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 is based on DFS algorithm to traverse over the possible expansion paths. The current implementation breaks out, if it reaches the terminator of the "next nodes" array, instead of going backwards to try the next path. For example: testpmd> flow create 0 ingress pattern eth / ipv6 / udp / vxlan / end actions rss level 2 types tcp end / end The paths found are: ETH IPV6 UDP VXLAN END ETH IPV6 UDP VXLAN ETH IPV4 TCP END ETH IPV6 UDP VXLAN ETH IPV6 TCP END The traversal stopped after getting to the terminator of the next nodes of the ETH node. It missed the rest of the nodes in the next nodes array of the VXLAN node. The fix is to go backwards when reaching the terminator of the current level and find if there is a "next node" to start traversing a new path. 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 ETH IPV6 UDP VXLAN IPV4 TCP END ETH IPV6 UDP VXLAN IPV6 TCP END The traversal will find additional paths, because it traverses through all the next nodes array of the VXLAN node. Fixes: 4ed05fc ("ethdev: add flow API to expand RSS flows") Cc: stable@dpdk.org Signed-off-by: Lior Margalit Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 6cf1bb810d..c914a7120c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -460,12 +460,22 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size, /* Follow up with the next possibility. */ next_node = mlx5_flow_expand_rss_skip_explicit(graph, ++next_node); + } else if (!stack_pos) { + /* + * Completing the traverse over the different paths. + * The next_node is advanced to the terminator. + */ + ++next_node; } else { /* Move to the next path. */ - if (stack_pos) + while (stack_pos) { next_node = stack[--stack_pos]; + next_node++; + if (*next_node) + break; + } next_node = mlx5_flow_expand_rss_skip_explicit(graph, - ++next_node); + next_node); stack[stack_pos] = next_node; } node = next_node && *next_node ? &graph[*next_node] : NULL; -- 2.25.1