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 64AADA0350; Mon, 28 Feb 2022 12:42:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B7F54068C; Mon, 28 Feb 2022 12:42:30 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by mails.dpdk.org (Postfix) with ESMTP id 82EFE40140 for ; Mon, 28 Feb 2022 12:42:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SHGPLszm/TK7ZwicJ28tElRB4K12Cgba6GUUy/xDx186jopbEDfFlAfld0KX/aLLr4jWuBY4GM0viwp/eVs7BrAyahkD2EEN1uW2S49CxrCT3HuR8tqSx3m1HVOuruiUTMyKFoFiDruOFl1oCO+qWnGl8g58i1P9EXGKCJH6xjIBTpvrVa8p8f1B64xT4qZT8aoPraHMAitfoU6y8euDPMWJsZqOfpqepumw9nrDkrOujPJSGrOkdt8UUnPU4OrEGgHGNFRkMqhPHIArAWdPJRW1JOZcdJ3aIoOjpLKACCIQhyOSQ8xvwO9262K9ObNS71MCDHQbJejM676qgUzWcg== 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=cOb8cBUJDEru+EXMNmBeqY13wMkGrwQiADop7HgSepY=; b=nx7Gb3IMjbyiNhmOytNsNXfrBnUDWi2L3CnlHnAMQKZFXz/pj1Et6pz5eD3jeHxTGIC6MmB1Lg5hTuO/+/A5qgyswKSKqkfI7771Yscu7fnJvQJ76k0qUmDG4KXQy/uy5bjTMQmhuRhSmzgADUhxdRLDDcmvCFXxxUjDxloGzkwN3vh+lJeOwSmbExYHzzUq69RWHJdkexmFCoQ1AgFIvB0YTSijVkq2MSz0nfgfsooIGIsWJ4hi22qpEiYWKaCSYh2TrAlJ0b7qhfN74tii5Ibp+UQ7peklYwzZySaJ/R9PaszSVMchHuGcrn2HTaORbyEukr0crRtXXS+MdV2k/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org 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=cOb8cBUJDEru+EXMNmBeqY13wMkGrwQiADop7HgSepY=; b=SqNCmpeXHqE4/dQlPbg5VCuOnChlRfvF26nGzRSlRsvjbOkTtF9Vveq0rlGg0+HytMmhB6BvOQw7CEFUTcUROpzWFm7qAD9PMwsOc/gUOBAVzJ2Ac4/x3fpgv++UHiNf8OG1SGeiCQm/nJBb7s6t4qwI8AcW5CzvQ9mHsvHRX8RViFpLKGuxemxRiPvICagttbVeKbveUhnpFQpteaaYtCfGocrNoDdlGPBUHC2U5XW60mV9EYccsbwpQNFzLS8veoi0K8jsf5LnJwad1Cztk7ZhvTx9yCDVHCJdUO3ldgqJ/LYeWXwa642CaU8+HJ/TBlyL1PRYBz2wMt8k71Eimg== Received: from BN9PR03CA0682.namprd03.prod.outlook.com (2603:10b6:408:10e::27) by MWHPR1201MB0272.namprd12.prod.outlook.com (2603:10b6:301:52::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Mon, 28 Feb 2022 11:42:26 +0000 Received: from BN8NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10e:cafe::fb) by BN9PR03CA0682.outlook.office365.com (2603:10b6:408:10e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 11:42:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT015.mail.protection.outlook.com (10.13.176.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 11:42:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 28 Feb 2022 11:42:08 +0000 Received: from nvidia.com (10.126.231.35) 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.9; Mon, 28 Feb 2022 03:42:05 -0800 From: Bing Zhao To: , CC: , , Subject: [PATCH] net/mlx5: fix matcher priority with ICMP or ICMPv6 Date: Mon, 28 Feb 2022 13:41:49 +0200 Message-ID: <20220228114149.493759-1-bingz@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a80fe3a-2085-4a43-908a-08d9faaf643e X-MS-TrafficTypeDiagnostic: MWHPR1201MB0272:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O7Nj2qThoxBEi3At7mNzzXMiWx6FJxyccj0v74PiPKzAkwAV6z+O59qPyarZL54B4SE1bcXUg9oN0+9mFs8YfafuDaX5SX7OL4sx8e+gETtxW0KvuIEI+PbB40LkZERgYrw9pzZjBn0bh3IvgCU/YAArpu8UDRcBY7i7P6J8JhAIyiaXxCJu3pHSBnUJFAjXzEIMuMlioHCnWUhfbecExnz1GoroXQbn8mgc0OLZW+DetwBrB+yTZ3HsQsPgDca8PEzoeODXqt4gIxJxSoXejNLG6EwR0NPMjoNwCJMgDhYuGxa6YqnjZv5ejOSGz8AsNvW4ExhTjUv2DXR6h/AR23d7/MXeJHwbkJE8JVEUAiudWd6/w98GESJF6FWgCzum1vQQDi5hRuzNCAtnhFKVdcxXCYgdkP+syef9fvwxk1RErR6xTz2iISAXDCRDpibG+1P6fn8HcSWISnsTDMuaPFxFceEnic+wK+BkF1Hoxqs01GEm1MjVK/VUaVWTE/HJ8ln1TaWSQiKrdUsZ64LOg6T80am6yDnm9BnWqNwiQpZjJq0WkbSZ1aehGrICIxV5NY1tlhw3x2OgRXsx+sKREHnyy6sHwc9TEhG3xT1h6ro2kwrGT154tDGrfe4J1A2xN+9o/XDSU1ZgyWpdg0O6h4PHnNMlCnw8AEQQ7QGLAMEKdQ/Ah/rVCe4CUvbwtdqY1A3aAtThR8fBByIlrJXkOw== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(70586007)(70206006)(36860700001)(36756003)(81166007)(54906003)(6636002)(316002)(82310400004)(356005)(2906002)(110136005)(4326008)(5660300002)(508600001)(86362001)(6666004)(7696005)(8936002)(8676002)(55016003)(40460700003)(107886003)(336012)(426003)(1076003)(26005)(2616005)(6286002)(186003)(47076005)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 11:42:25.5959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a80fe3a-2085-4a43-908a-08d9faaf643e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0272 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 On TCP/IP-based layered network, ICMP is considered and implemented as part of layer 3 IP protocol. Actually, it is a user of the IP protocol and must be encapsulated within IP packets. There is no layer 4 protocol over ICMP. The rule with layer 4 should be matched prior to the rule only with layer 3 pattern when: 1. Both rules are created in the same table 2. Both rules could be hit 3. The rules has the same priority The steering result of the packet is indeterministic if there are rules with patterns IP and IP+ICMP in the same table with the same priority. Like TCP / UDP, a packet should hit the rule with a longer matching criterion. By treating the priority of ICMP/ICMPv6 as a layer 4 priority in the PMD internally, the IP+ICMP will be hit in prior to IP only. Fixes: d53aa89aea91 ("net/mlx5: support matching on ICMP/ICMP6") Cc: jackmin@nvidia.com Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2191ce6e58..1da0d886ef 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -13653,11 +13653,13 @@ flow_dv_translate(struct rte_eth_dev *dev, case RTE_FLOW_ITEM_TYPE_ICMP: flow_dv_translate_item_icmp(match_mask, match_value, items, tunnel); + matcher.priority = MLX5_PRIORITY_MAP_L4; last_item = MLX5_FLOW_LAYER_ICMP; break; case RTE_FLOW_ITEM_TYPE_ICMP6: flow_dv_translate_item_icmp6(match_mask, match_value, items, tunnel); + matcher.priority = MLX5_PRIORITY_MAP_L4; last_item = MLX5_FLOW_LAYER_ICMP6; break; case RTE_FLOW_ITEM_TYPE_TAG: -- 2.25.1