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 B2E3FA034C; Wed, 21 Dec 2022 11:18:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96BE542D2E; Wed, 21 Dec 2022 11:18:02 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2089.outbound.protection.outlook.com [40.107.244.89]) by mails.dpdk.org (Postfix) with ESMTP id 10AD640F16 for ; Sun, 18 Dec 2022 16:09:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Stcx/hSGOmVceh88ChuuyCuNh4mrlcrvjZ8IrWIJZzSVGMUlEUwS3l4asbcMe6dD1xFyGLTmR46+pyv8rO+k8BPPZNPVQrKoYDLJ5zDKX7nxbDO+qeiuATTSyjU5TdTsrl15AVE5KW/fP6rTVPT32X6VELDA/3v/knAwAEJEp+kByGMxInDs9W1KkBb47ngNu1gbUaiWR+Z47J9S2qeLGRXr6Lk35dFIBkSNhamgPhWsxPVzF7F4AOTr7s2JRiPNuqpMPsEHgLsVHGqML9YTiXlpXEcjJsLu6tZjIPlLY+xSvCWYrjkwHhLbYeC5vcgAITdAbHOk8Nsv6Wb2hEotGw== 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=6GAe8Xo+Ce6pLDQvm/s1wiVNVMrji45iMHEttp2edV0=; b=Fad1W4oQ1Hi2wLOqd8O9ocTnc9c98q7d4CXLpGO5iPpyToALiUHJPoZu/seB/kZVm0Z+QgDucR5ilBvWBsoQogmuGDno8bkewbdGIgVAGa0+M2kMAISbKSRlLy/VZpMWYl8iuVCSFLMb6VD4HIS9aR6myD6QWPFBuKpO971NrkG7KTKP6XX5rWdR6QHmfRzyOgrAXHApTeGp1140pIW6oEkEEdXmov8SxexanosKIlufUzqvAKXXUrF/wM2ra6X0G+S4PHfVZKl2Y7dL1TERS9aUiqDht91IEYob2px1g0yp1Ycjhc2oL7G43N8hA2M49Fa87Mr4pkTGHeyaKfkVFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=6GAe8Xo+Ce6pLDQvm/s1wiVNVMrji45iMHEttp2edV0=; b=DPOzJc6c0D7IySlzhrbkMSZimLHYtf2y4heBmmMpwxWS1QJb4p1CsWXu2Y7SVKFM8Fwa/a+idoFIGVjZqqHITRqHaDZkwQ3JBFSowfw0UIYRLUV78RYt9v/1PgWKiPs5wF+zG/9pK7p3AVlyKBNdHX7LgRy0TFA0DE8P1TVG37Ys/E6KfvzIx00VLnNlK0hT+oJqcQ86OaKADf53tHmOu4tFBxS8UG/+2rQGl9lV/I/0OdiiAsdRrKwycP2SeaHFmLQ3oe/iomg41PHHwW924EN3lGNTPYVnpMyv0s3ZFeJiqEhkHWrZw8DShhSRe8PCP07TV5zEyFNCDjOlFf3izQ== Received: from MW4PR03CA0041.namprd03.prod.outlook.com (2603:10b6:303:8e::16) by SA0PR12MB7089.namprd12.prod.outlook.com (2603:10b6:806:2d5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Sun, 18 Dec 2022 15:09:31 +0000 Received: from CO1NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::c8) by MW4PR03CA0041.outlook.office365.com (2603:10b6:303:8e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.18 via Frontend Transport; Sun, 18 Dec 2022 15:09:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT083.mail.protection.outlook.com (10.13.174.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16 via Frontend Transport; Sun, 18 Dec 2022 15:09:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 18 Dec 2022 07:09:29 -0800 Received: from nvidia.com (10.126.231.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, 18 Dec 2022 07:09:26 -0800 From: Erez Shitrit To: , , , , , Matan Azrad CC: , , Yevgeny Kliteynik Subject: [PATCH V1 07/11] net/mlx5/hws: added command to create alias objects Date: Sun, 18 Dec 2022 17:08:48 +0200 Message-ID: <20221218150853.2167280-8-erezsh@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20221218150853.2167280-1-erezsh@nvidia.com> References: <20221218150853.2167280-1-erezsh@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT083:EE_|SA0PR12MB7089:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e111275-50d1-43fa-428e-08dae109ddc6 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I/t1IUdZC3ZAecGR5g91qz/KrlHEIOMPKZpgT0QZPDuLADTvjMTFsvDOtG1pp8tquWDTQCVReiFjEso+6nr3s3W0J4BKxq8BZb2RGkfG+LgeMcjgotc3iQSytgCdopFkt//XNXrGsIxhHny/T00rB38Jx1xMo4dMT8YLYSTGZOrFjqhcGXp5ZfEW6KI9OsBcxS8ZQeVwtQTsK7GGcmKTcTil2LIZEfShU7tATs+8QxG0cF8Vp7HKm9IWRMVKGp8XBhXE4mUuJX1/yT49NwgtfXVPN5JxZxIOij5gkR9ROc9noXBaf7D6gLYSmhECkoskKrXhWh+cyhuv6xxbmGtNUvD7M/SoIGtyhlrRalnKpAvZg5MPp+8EyDzsEC46Mb1ZGeUJDebnMFrV3V3oeOtR2NNkVc1XQujCOvfLJshxNfFLbow2Zq9oRjEZRebB+6B9/AZsAhfMe5+XSPlTCYhn7/18M+bsiNZsX6VhjDRIwet/X3XCTj/j7rcmOyLKdTejjICi5wx5DlbE2q3Ad2PNq7stfd+OKplahM/Vz2YsWws3bNgiGHah7g3ErEd5RvUnURr7sTMd+fCzHeTpXd1s47+RriLwfL/lRGKMotnvcfrseHfv9wFC91eeaJZnvKVum9ffuQvFJf1qelZ6rwTVMk0CxwWm7rXc9KcMM2dYjBnXZD7g8NgfSibhHoNDw4uFA42E6NQBrVzg2iFzR4qzyQ== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(39860400002)(376002)(136003)(451199015)(40470700004)(36840700001)(46966006)(82310400005)(82740400003)(41300700001)(8936002)(36860700001)(70586007)(5660300002)(7636003)(70206006)(4326008)(356005)(8676002)(478600001)(83380400001)(40460700003)(316002)(110136005)(426003)(47076005)(6636002)(36756003)(54906003)(2906002)(26005)(186003)(6286002)(107886003)(86362001)(40480700001)(6666004)(7696005)(16526019)(1076003)(2616005)(336012)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2022 15:09:31.6497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e111275-50d1-43fa-428e-08dae109ddc6 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7089 X-Mailman-Approved-At: Wed, 21 Dec 2022 11:17:53 +0100 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: Yevgeny Kliteynik Added support for a command that can create alias objects - objects that are accessed across VHCA. Signed-off-by: Yevgeny Kliteynik Reviewed-by: Alex Vesker --- drivers/common/mlx5/mlx5_prm.h | 23 ++++++++++++++-- drivers/net/mlx5/hws/mlx5dr_cmd.c | 44 +++++++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 ++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 9d36645949..fd1ad55f1f 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -3135,9 +3135,10 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits { u8 obj_id[0x20]; union { struct { - u8 reserved_at_60[0x3]; + u8 alias_object[0x1]; + u8 reserved_at_61[0x2]; u8 log_obj_range[0x5]; - u8 reserved_at_58[0x18]; + u8 reserved_at_68[0x18]; }; u8 obj_offset[0x20]; }; @@ -3234,6 +3235,19 @@ struct mlx5_ifc_rtc_bits { u8 reserved_at_180[0x280]; }; +struct mlx5_ifc_alias_context_bits { + u8 vhca_id_to_be_accessed[0x10]; + u8 reserved_at_10[0xd]; + u8 status[0x3]; + u8 object_id_to_be_accessed[0x20]; + u8 reserved_at_40[0x40]; + union { + u8 access_key_raw[0x100]; + u8 access_key[8][0x20]; + }; + u8 metadata[0x80]; +}; + enum mlx5_ifc_stc_action_type { MLX5_IFC_STC_ACTION_TYPE_NOP = 0x00, MLX5_IFC_STC_ACTION_TYPE_COPY = 0x05, @@ -3478,6 +3492,11 @@ struct mlx5_ifc_create_header_modify_pattern_in_bits { struct mlx5_ifc_header_modify_pattern_in_bits pattern; }; +struct mlx5_ifc_create_alias_obj_in_bits { + struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; + struct mlx5_ifc_alias_context_bits alias_ctx; +}; + enum { MLX5_CRYPTO_KEY_SIZE_128b = 0x0, MLX5_CRYPTO_KEY_SIZE_256b = 0x1, diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index b120be2d88..9b9f70c933 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -744,6 +744,50 @@ int mlx5dr_cmd_allow_other_vhca_access(struct ibv_context *ctx, return 0; } +struct mlx5dr_devx_obj * +mlx5dr_cmd_alias_obj_create(struct ibv_context *ctx, + struct mlx5dr_cmd_alias_obj_create_attr *alias_attr) +{ + uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)] = {0}; + uint32_t in[MLX5_ST_SZ_DW(create_alias_obj_in)] = {0}; + struct mlx5dr_devx_obj *devx_obj; + void *attr; + void *key; + + devx_obj = simple_malloc(sizeof(*devx_obj)); + if (!devx_obj) { + DR_LOG(ERR, "Failed to allocate memory for ALIAS general object"); + rte_errno = ENOMEM; + return NULL; + } + + attr = MLX5_ADDR_OF(create_alias_obj_in, in, hdr); + MLX5_SET(general_obj_in_cmd_hdr, + attr, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJECT); + MLX5_SET(general_obj_in_cmd_hdr, + attr, obj_type, alias_attr->obj_type); + MLX5_SET(general_obj_in_cmd_hdr, attr, alias_object, 1); + + attr = MLX5_ADDR_OF(create_alias_obj_in, in, alias_ctx); + MLX5_SET(alias_context, attr, vhca_id_to_be_accessed, alias_attr->vhca_id); + MLX5_SET(alias_context, attr, object_id_to_be_accessed, alias_attr->obj_id); + + key = MLX5_ADDR_OF(alias_context, attr, access_key); + memcpy(key, alias_attr->access_key, sizeof(alias_attr->access_key)); + + devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out)); + if (!devx_obj->obj) { + DR_LOG(ERR, "Failed to create ALIAS OBJ"); + simple_free(devx_obj); + rte_errno = errno; + return NULL; + } + + devx_obj->id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id); + + return devx_obj; +} + int mlx5dr_cmd_query_caps(struct ibv_context *ctx, struct mlx5dr_cmd_query_caps *caps) { diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index ea6ced9d27..824ca5e846 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -46,6 +46,13 @@ struct mlx5dr_cmd_rtc_create_attr { bool is_jumbo; }; +struct mlx5dr_cmd_alias_obj_create_attr { + uint32_t obj_id; + uint16_t vhca_id; + uint16_t obj_type; + uint8_t access_key[32]; +}; + struct mlx5dr_cmd_stc_create_attr { uint8_t log_obj_range; uint8_t table_type; @@ -217,6 +224,10 @@ mlx5dr_cmd_header_modify_pattern_create(struct ibv_context *ctx, uint32_t pattern_length, uint8_t *actions); +struct mlx5dr_devx_obj * +mlx5dr_cmd_alias_obj_create(struct ibv_context *ctx, + struct mlx5dr_cmd_alias_obj_create_attr *alias_attr); + int mlx5dr_cmd_sq_modify_rdy(struct mlx5dr_devx_obj *devx_obj); int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx, -- 2.18.2