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 82C0443238; Sun, 29 Oct 2023 17:36:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE01F42DE8; Sun, 29 Oct 2023 17:33:56 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by mails.dpdk.org (Postfix) with ESMTP id 0199D42DE8 for ; Sun, 29 Oct 2023 17:33:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMNBQepIqCsweaIyC+XMsaLJqrXwBzoSY1CtOQChfhLANkCeyIKVqxmaRA06FScd9lW6IOitUwWQzXyicM93N4r+SzB/EuAzCLwzjsQ6hV/YV356Bhv7Jy5XfIw0lZs641nJ6EMwuwwJI090tJoZVGT30gDpH7CwhgrfbvkKR/AaY8pIDoLL790/K6VMlwjqKP+DkQgGwM3JzfLAqMfnbzlvcWaTidpA+CI3xy1tCC6ersEwzxTDKQSrcXL8ccyBS2eh/g0o2kqxDBsZo8N9SR41lmyknqc6ZgT7iKXAAj2xluQDfLdyAYqCLDwRQxPnfufhYBu17tqJtT1qAPWIDg== 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=FiTyuxAT5QvWxd4d6Kr/UenoF+WKQs4X8IyrFDmgCRw=; b=hk2QwA34jXuiMUbh3t5ljm5ykD909jLYTPMrEOjaz+EIzYGMjE/HsquMYfSYsGZ8UNrEPW/6sgZmGOGc3ugwR0YAXd2mIrMl5JX0uoWX94YT8Qo8P64WQEwf0rm9fgkxLQ311KMXuvGqDGvhainh1uP77Sx2jFLP+DRMxwCxa278GP/U6FwSCfyJih4LA7O/7GvwHqD1KV/s/NLTwIp7EqDXnpw8PLmL51xJL8st0ACbsvZt42uvsX/WtA3FaSNhbAnE5mGg3Euw+N5orJyCeXwYmp7lj0JvoNlROMKpbUwGMHEH1NkOJvwhFUAM5iNmr4dCnEworgFxBN2QGF0vOQ== 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 (0) 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=FiTyuxAT5QvWxd4d6Kr/UenoF+WKQs4X8IyrFDmgCRw=; b=DRQRXxEKNSFJOU/MGJ2WHNBL+AhjPZ/Yb0U3MjZDbYf25PxBYWBF/5m8Xx3uNn+v8z/9wI6SJs6yz646PplknprJmLldt/qVZKyjDeyAR661P0S9HcnJRq/LNGADnW7wji8sCiV3lRmVDV1hyCW+37v5ER7d+AJCa0/WZ/v5ktTuz7+En+Jua7lku3rFXdDLuAoXZsh+/uX5O6LiAfOzkFHtjd0AqPZxr5ANgFwDPpwQCd6ynAov8/o/j4WWsT1M74Hex+9ExjGaPD99K1Zz1O41wzO91YMLER1Xw0PNNoONsJXDxAAduM64vXeyRGLBs+NYW185JJvIiBmQryYQ2Q== Received: from BL1PR13CA0114.namprd13.prod.outlook.com (2603:10b6:208:2b9::29) by LV2PR12MB5776.namprd12.prod.outlook.com (2603:10b6:408:178::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Sun, 29 Oct 2023 16:33:46 +0000 Received: from BL02EPF0001A0FF.namprd03.prod.outlook.com (2603:10b6:208:2b9:cafe::ea) by BL1PR13CA0114.outlook.office365.com (2603:10b6:208:2b9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.14 via Frontend Transport; Sun, 29 Oct 2023 16:33:45 +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 BL02EPF0001A0FF.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.15 via Frontend Transport; Sun, 29 Oct 2023 16:33:45 +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.41; Sun, 29 Oct 2023 09:33:38 -0700 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.41; Sun, 29 Oct 2023 09:33:35 -0700 From: Gregory Etelson To: CC: , , , Rongwei Liu , Ori Kam , Suanming Mou , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 25/30] net/mlx5: sample the srv6 last segment Date: Sun, 29 Oct 2023 18:31:57 +0200 Message-ID: <20231029163202.216450-25-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231029163202.216450-1-getelson@nvidia.com> References: <20231029163202.216450-1-getelson@nvidia.com> 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-TrafficTypeDiagnostic: BL02EPF0001A0FF:EE_|LV2PR12MB5776:EE_ X-MS-Office365-Filtering-Correlation-Id: ef57af83-3fc0-4be2-4bda-08dbd89cd261 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BS0IUrU3tYzMgwO1/4ew63s6X7E2TA1LRQJ1wbEQC8/xTHvsYSwX1uhJ+0anVWv2TylhkwlzKctQGd+dbkk0RymzJfVXkzVMZOBhWqqFZ1rZkzrGitHVBg0dVrA/NgLRx7g3xye32bqKUH2ebFd+ZzYkKr2rlg+v0/uw3nGeqrEC5plzLBbFSemEUyE2zMbDVmUWMMJaLU4tET4cwRS+2Z5zLeHUQfgBgSLBXuSFzqmJO8GtEZQDgP9GoT0F6dhCKbc8P6Cn8sylhi8NmTvQNT+LZHO0MlKiAQqiXG179XWnZZvCHVz3cZaTf2mfxmuDAwlVcd+yu9x1w1uT8IKeEMfS/0iokIywbwPsDdJ0GLqqY2Hr/I66y7TzSuberEZRBsbWBWLTCnwJLgGnW49fCrsZurIwOfbgf10UKXlHeyXSkS0XGvDzJ0LVeVv++PDKkO5Is7+zJVN1B04aX/Fac3WJAr73FdUvzDrAC+DJVql7x302gJdVLi9nzPT1CgjgY/I2IBvNMRAOXVFciUrtUAOQeiO8ruISosjs8Dz9AnRdX7Vf8WTaZm2laZcIa8+TfO5zVpCDA7fwRjx5rH3UA7L0Hc+g9aco/RGn0GD4aafriajP4GxVnGTXe8J5ojkfAm62z1SguXrpc/T56Uy9ooZyJ12JahiBfg/1APDnQyHLNNY6VoMQeYI1lbchC/hNVL8YfC7N3t7g9fw/lOsHMA== 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:(13230031)(4636009)(396003)(39860400002)(136003)(346002)(376002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(82310400011)(46966006)(36840700001)(1076003)(26005)(6286002)(336012)(426003)(356005)(2616005)(7636003)(36756003)(7696005)(36860700001)(82740400003)(107886003)(6666004)(55016003)(316002)(16526019)(86362001)(70586007)(54906003)(70206006)(478600001)(6916009)(83380400001)(47076005)(4326008)(41300700001)(8676002)(8936002)(2906002)(40480700001)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2023 16:33:45.7115 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef57af83-3fc0-4be2-4bda-08dbd89cd261 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: BL02EPF0001A0FF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5776 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 From: Rongwei Liu When removing the IPv6 routing extension header from the packets, the destination address should be updated to the last one in the segment list. Enlarge the hardware sample scope to cover the last segment. Signed-off-by: Rongwei Liu Acked-by: Ori Kam Acked-by: Suanming Mou --- drivers/net/mlx5/mlx5.c | 41 ++++++++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5.h | 6 ++++++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index cdb4eeb612..afb9c717dc 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1067,6 +1067,7 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) struct mlx5_devx_graph_node_attr node = { .modify_field_select = 0, }; + uint32_t i; uint32_t ids[MLX5_GRAPH_NODE_SAMPLE_NUM]; struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_common_dev_config *config = &priv->sh->cdev->config; @@ -1100,10 +1101,18 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) node.next_header_field_size = 0x8; node.in[0].arc_parse_graph_node = MLX5_GRAPH_ARC_NODE_IP; node.in[0].compare_condition_value = IPPROTO_ROUTING; - node.sample[0].flow_match_sample_en = 1; - /* First come first serve no matter inner or outer. */ - node.sample[0].flow_match_sample_tunnel_mode = MLX5_GRAPH_SAMPLE_TUNNEL_FIRST; - node.sample[0].flow_match_sample_offset_mode = MLX5_GRAPH_SAMPLE_OFFSET_FIXED; + /* Final IPv6 address. */ + for (i = 0; i <= MLX5_SRV6_SAMPLE_NUM - 1 && i < MLX5_GRAPH_NODE_SAMPLE_NUM; i++) { + node.sample[i].flow_match_sample_en = 1; + node.sample[i].flow_match_sample_offset_mode = + MLX5_GRAPH_SAMPLE_OFFSET_FIXED; + /* First come first serve no matter inner or outer. */ + node.sample[i].flow_match_sample_tunnel_mode = + MLX5_GRAPH_SAMPLE_TUNNEL_FIRST; + node.sample[i].flow_match_sample_field_base_offset = + (i + 1) * sizeof(uint32_t); /* in bytes */ + } + node.sample[0].flow_match_sample_field_base_offset = 0; node.out[0].arc_parse_graph_node = MLX5_GRAPH_ARC_NODE_TCP; node.out[0].compare_condition_value = IPPROTO_TCP; node.out[1].arc_parse_graph_node = MLX5_GRAPH_ARC_NODE_UDP; @@ -1116,8 +1125,8 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) goto error; } priv->sh->srh_flex_parser.flex.devx_fp->devx_obj = fp; - priv->sh->srh_flex_parser.flex.mapnum = 1; - priv->sh->srh_flex_parser.flex.devx_fp->num_samples = 1; + priv->sh->srh_flex_parser.flex.mapnum = MLX5_SRV6_SAMPLE_NUM; + priv->sh->srh_flex_parser.flex.devx_fp->num_samples = MLX5_SRV6_SAMPLE_NUM; ret = mlx5_devx_cmd_query_parse_samples(fp, ids, priv->sh->srh_flex_parser.flex.mapnum, &priv->sh->srh_flex_parser.flex.devx_fp->anchor_id); @@ -1125,12 +1134,22 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) DRV_LOG(ERR, "Failed to query sample IDs."); goto error; } - ret = mlx5_devx_cmd_match_sample_info_query(ibv_ctx, ids[0], - &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[0]); - if (ret) { - DRV_LOG(ERR, "Failed to query sample id information."); - goto error; + for (i = 0; i <= MLX5_SRV6_SAMPLE_NUM - 1 && i < MLX5_GRAPH_NODE_SAMPLE_NUM; i++) { + ret = mlx5_devx_cmd_match_sample_info_query(ibv_ctx, ids[i], + &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[i]); + if (ret) { + DRV_LOG(ERR, "Failed to query sample id %u information.", ids[i]); + goto error; + } + } + for (i = 0; i <= MLX5_SRV6_SAMPLE_NUM - 1 && i < MLX5_GRAPH_NODE_SAMPLE_NUM; i++) { + priv->sh->srh_flex_parser.flex.devx_fp->sample_ids[i] = ids[i]; + priv->sh->srh_flex_parser.flex.map[i].width = sizeof(uint32_t) * CHAR_BIT; + priv->sh->srh_flex_parser.flex.map[i].reg_id = i; + priv->sh->srh_flex_parser.flex.map[i].shift = + (i + 1) * sizeof(uint32_t) * CHAR_BIT; } + priv->sh->srh_flex_parser.flex.map[0].shift = 0; return 0; error: if (fp) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0289cbd04b..ad82d8060e 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1335,6 +1335,7 @@ struct mlx5_flex_pattern_field { uint16_t shift:5; uint16_t reg_id:5; }; + #define MLX5_INVALID_SAMPLE_REG_ID 0x1F /* Port flex item context. */ @@ -1346,6 +1347,11 @@ struct mlx5_flex_item { struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM]; }; +/* + * Sample an IPv6 address and the first dword of SRv6 header. + * Then it is 16 + 4 = 20 bytes which is 5 dwords. + */ +#define MLX5_SRV6_SAMPLE_NUM 5 /* Mlx5 internal flex parser profile structure. */ struct mlx5_internal_flex_parser_profile { uint32_t refcnt; -- 2.39.2