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 88F3841BDB; Sun, 5 Feb 2023 14:43:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CED042B8C; Sun, 5 Feb 2023 14:42:59 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by mails.dpdk.org (Postfix) with ESMTP id 2542542D0B for ; Sun, 5 Feb 2023 14:42:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EKNv+k3yVPnEjJX6UwkzzE3arPCRZLonZsPi8CPtzxFw6kaCuBiXpzUzHamG36jcm+O6qaDb3WHgJaZjFMSaAzF9QffBZNsxtJMMew6eAaNlaJogPCgL87/w8F/QI8BH/B4XfDnckcma31wr4C38/J0IeYJGt1+Yx/+2D8KwGazDV1VRxEd0my+A5ysxv3idbwUMEPGsV169faNiDGkCp/xY368MasnA9ikVSdLET5vxK/Q7FfynR6lbVtwv9k0F8iI6qXyZSPhlcePf1/8qxlchujSdRlHBMYznquhg84twAJzX8gOAMm7+5xTztaI9I3Dr8zvVyDcm9WDiljggOA== 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=dvluOnw1KG10KVmpk2gzRyl1dKa4DuJ0xWKZ7ro1eWQ=; b=d2uxaYYDvEu0L05WCVYJhkUb8Lbs4/jPzPgu6ETDdFzaQvmf87NfCGBelDvY6P1jktAahOk++qNXxXjr9Pbcy28WyGDWhPEZWp9PGPWa7+0nsDhtHtQyA6PTUrV1mv/wq5SxsyMM9if2gubNRoR9Mco58Bs9LyxkESx/Y9xIoCeCdLBvT7DwKrWcovxne98qS6kv3SmRf71bHpAfJk4H667j/m+7hVLjYf9skHF4oo7Pi2YEplUZ4sTdhZpl6pcIcgRZ+OllCf3ytjGl3gk0LnW0OX0tl+seWWXdd6WRiSxGERvdtbd8PmpfPLoCtS8qCEwM23q78R8bUvcpI6a+iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=dvluOnw1KG10KVmpk2gzRyl1dKa4DuJ0xWKZ7ro1eWQ=; b=ET3Pmte/kvcrjxTNWMclztZNTN/oooJO/Wi8AKGutFdxwUgWVI/gSWDPGdewDq+6z0KCqGO96+NrfNEPdqEkPXah7PYM3+6eSYFeZvmm7AEm+fhZ4vPosWcL+LLcICetfmKc6J2cFX/fI7moLtoPsreZCPJFZEgMlGZ83wMGJkkL42zHWVn57RH3NNUDA6SAu7GH3hVQs3nbDlCVVqs9n0d6tgltgvaAayP0Yr3aHWNUYqXBW9OLexV3AFfkYLGDlhK9PJzPyZxHYL2fPoLIKMxL4xRW+hN2LhjhHoneaH8Mn+m9NPJnRd3+OjEKLzS2XYb+SjFRuPAsFdVAjSHhiw== Received: from MW4PR04CA0050.namprd04.prod.outlook.com (2603:10b6:303:6a::25) by SN7PR12MB7953.namprd12.prod.outlook.com (2603:10b6:806:345::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32; Sun, 5 Feb 2023 13:42:56 +0000 Received: from CO1PEPF00001A60.namprd05.prod.outlook.com (2603:10b6:303:6a:cafe::f6) by MW4PR04CA0050.outlook.office365.com (2603:10b6:303:6a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32 via Frontend Transport; Sun, 5 Feb 2023 13:42:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF00001A60.mail.protection.outlook.com (10.167.241.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.21 via Frontend Transport; Sun, 5 Feb 2023 13:42:56 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 5 Feb 2023 05:42:39 -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.36; Sun, 5 Feb 2023 05:42:37 -0800 From: Leo Xu To: CC: Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support Date: Sun, 5 Feb 2023 15:41:54 +0200 Message-ID: <20230205134154.408984-4-yongquanx@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230205134154.408984-1-yongquanx@nvidia.com> References: <20221220074403.1015411-1-yongquanx@nvidia.com> <20230205134154.408984-1-yongquanx@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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-TrafficTypeDiagnostic: CO1PEPF00001A60:EE_|SN7PR12MB7953:EE_ X-MS-Office365-Filtering-Correlation-Id: 32e4ab7c-4002-490b-4820-08db077ee369 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T6ixwEcuFL8D95ihy12PinSHaPGjgzxuwjTrBKcrwCAwuB1osrEjEgFBAF7lsCcf2wZcRyfIMUf9GJhcLScPL3ON4ZyAdqzQHEsR7tJC4ZSYPUwM4iEeZWj/L5maX6i9MGh9ZamWuhJSCeqO64nYWFtparrI1qPTqFIlVRVrriccjQJS8EwBAKYJoBx1cuDrhcwSVEzRFY2rQ9UsMnWO915cELeaGgTSQzxb0slJRm3BXz24SJsqWjGCJcx1LSwdhe1EdLdoYKcSeoqDD8BNSWmOfv9v9OP7mLzCAyKuz5QqJTim+UoaFvSBtjgONLbcbwd1qS//2rCFIG6SPXuzCwB1rapi1CwEy9PW4cy7dtlVymrBKZcC0yHv5FDEQkVwKuaUvRvj8DMeLmhHWvjHLd4tTDwCBMmGYonxrF+rILRTxozPAIc3fmI5GfEkkWzHFwBzNpRhFlC29Zzwi5Rp6VgDD/tfS3p74LVQKQi5CmBToAZMXp8kBZorPyc9Kz1vSRs1SrJ1C1Nna1GYrydcrL2/GaSUlaWl643+Cnhvs4EyOd3Wkltrrbeb5IYZRFrdkK6je8PsnBwo7BDiJ8w1gi3BWg0d2YAU0gUD7MebNjD5SNmM29JAszKd6pA8cl95FmmX1vsB3/XccJLQaWiXGARqKeM6Ct3ynuJ7ycNA/g3auE0p0jVHcn8KtlFw3mHOpxwh1Cl1iIjSxT2zJtFFtw== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(82310400005)(40460700003)(1076003)(55016003)(40480700001)(6666004)(107886003)(478600001)(2616005)(26005)(186003)(16526019)(6286002)(4326008)(8676002)(70586007)(70206006)(6916009)(7696005)(316002)(7636003)(54906003)(82740400003)(36756003)(86362001)(356005)(47076005)(426003)(83380400001)(336012)(36860700001)(5660300002)(41300700001)(8936002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2023 13:42:56.4096 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32e4ab7c-4002-490b-4820-08db077ee369 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF00001A60.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7953 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 This patch adds ICMPv6 ID and sequence match support for HWS. Since type and code of ICMPv6 echo is already specified by ITEM type: RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY mlx5 pmd will set appropriate type and code automatically: Echo request: type(128), code(0) Echo reply: type(129), code(0) type and code provided by application will be ignored Signed-off-by: Leo Xu --- drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 6b98eb8c96..d56e85631d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -368,6 +368,47 @@ mlx5dr_definer_icmp6_dw1_set(struct mlx5dr_definer_fc *fc, DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask); } +static void +mlx5dr_definer_icmp6_echo_dw1_mask_set(struct mlx5dr_definer_fc *fc, + __rte_unused const void *item_spec, + uint8_t *tag) +{ + const struct rte_flow_item_icmp6 spec = {0xFF, 0xFF, 0x0}; + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); +} + +static void +mlx5dr_definer_icmp6_echo_request_dw1_set(struct mlx5dr_definer_fc *fc, + __rte_unused const void *item_spec, + uint8_t *tag) +{ + const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REQUEST, 0, 0}; + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); +} + +static void +mlx5dr_definer_icmp6_echo_reply_dw1_set(struct mlx5dr_definer_fc *fc, + __rte_unused const void *item_spec, + uint8_t *tag) +{ + const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REPLY, 0, 0}; + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); +} + +static void +mlx5dr_definer_icmp6_echo_dw2_set(struct mlx5dr_definer_fc *fc, + const void *item_spec, + uint8_t *tag) +{ + const struct rte_flow_item_icmp6_echo *v = item_spec; + rte_be32_t dw2; + + dw2 = (rte_be_to_cpu_16(v->hdr.identifier) << __mlx5_dw_bit_off(header_icmp, ident)) | + (rte_be_to_cpu_16(v->hdr.sequence) << __mlx5_dw_bit_off(header_icmp, seq_nb)); + + DR_SET(tag, dw2, fc->byte_off, fc->bit_off, fc->bit_mask); +} + static void mlx5dr_definer_ipv6_flow_label_set(struct mlx5dr_definer_fc *fc, const void *item_spec, @@ -1441,6 +1482,48 @@ mlx5dr_definer_conv_item_icmp6(struct mlx5dr_definer_conv_data *cd, return 0; } +static int +mlx5dr_definer_conv_item_icmp6_echo(struct mlx5dr_definer_conv_data *cd, + struct rte_flow_item *item, + int item_idx) +{ + const struct rte_flow_item_icmp6_echo *m = item->mask; + struct mlx5dr_definer_fc *fc; + bool inner = cd->tunnel; + + if (!cd->relaxed) { + /* Overwrite match on L4 type ICMP6 */ + fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)]; + fc->item_idx = item_idx; + fc->tag_set = &mlx5dr_definer_icmp_protocol_set; + fc->tag_mask_set = &mlx5dr_definer_ones_set; + DR_CALC_SET(fc, eth_l2, l4_type, inner); + + /* Set fixed type and code for icmp6 echo request/reply */ + fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW1]; + fc->item_idx = item_idx; + fc->tag_mask_set = &mlx5dr_definer_icmp6_echo_dw1_mask_set; + if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST) + fc->tag_set = &mlx5dr_definer_icmp6_echo_request_dw1_set; + else /* RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY */ + fc->tag_set = &mlx5dr_definer_icmp6_echo_reply_dw1_set; + DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw1); + } + + if (!m) + return 0; + + /* Set identifier & sequence into icmp_dw2 */ + if (m->hdr.identifier || m->hdr.sequence) { + fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW2]; + fc->item_idx = item_idx; + fc->tag_set = &mlx5dr_definer_icmp6_echo_dw2_set; + DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw2); + } + + return 0; +} + static int mlx5dr_definer_conv_item_meter_color(struct mlx5dr_definer_conv_data *cd, struct rte_flow_item *item, @@ -1577,6 +1660,11 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx, ret = mlx5dr_definer_conv_item_icmp6(&cd, items, i); item_flags |= MLX5_FLOW_LAYER_ICMP6; break; + case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST: + case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY: + ret = mlx5dr_definer_conv_item_icmp6_echo(&cd, items, i); + item_flags |= MLX5_FLOW_LAYER_ICMP6; + break; case RTE_FLOW_ITEM_TYPE_METER_COLOR: ret = mlx5dr_definer_conv_item_meter_color(&cd, items, i); item_flags |= MLX5_FLOW_ITEM_METER_COLOR; -- 2.27.0