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 E8CB8A0524; Wed, 5 May 2021 11:51:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA086410FE; Wed, 5 May 2021 11:50:41 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2051.outbound.protection.outlook.com [40.107.93.51]) by mails.dpdk.org (Postfix) with ESMTP id 6E8A24110A for ; Wed, 5 May 2021 11:50:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Df3Y9MhAy04SzSJYTjBR/iCOHRNnkfDjVe+SGczT8KSBaaUlnFC0feEUS1Ve5zzsbaLNZBc/E016fb8wy6JjG/pWHOluzF/mYtmwOpqxY0z9CUShGrt52UYlk2If65LnnNEqR1J8pGFdnnlc3KeUXVEP6u78YvYmo5uz1CGlHCtkLLTM9aRFibmdJddX7XXWCdMQA2RUKj8MxWMPA7FeJlfMJ6x9ZJ/9OgKy1esNbRrJkDEtK+NGl9cBY9YItLVcDVJlW2+6MJakDlVbBHxGJXX60i1lk0V0C05aubs9fTnUyA/FAuSL1CEG2DvF603FxKQfSfnOWLAUt95FyPkM0Q== 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-SenderADCheck; bh=61xlGpwmUHnRXyzcMsdJUc5h407KE4Di0MK051Rx828=; b=Sc3stvRin10ZFuEICroiSoCWYPpdLo52KFSCwu3tHHgJcEQrNccOAHm2jhCudqiaQPJ+WBbQa3XsV1xKjFugW2Hs0IUuJDhblp94ikRY/Jzfh3V1kn13D9SznbjzMp3KLH/1Gdt9Nn/R5sqqf1DJoSK1RZArRjeie2KgfdmhmhwD+Ok4quxHWz1nzcIW0m4ValAZ++1OYjOKk6scXgmURJUKKnbm5fKdFWJUJwO6wdC5qRM6+U0NuUc1ylPdxus6u9OJm16oaLS06HMKv2ct4/HQymWPr3dp/CfLq/zMQghZZDdD19o2f6BQl+0Swn8UHc4qljjVTxERmjJ+08zKEA== 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=none 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=61xlGpwmUHnRXyzcMsdJUc5h407KE4Di0MK051Rx828=; b=mzZAVeOSVWi/EIjYs9b61v/0noN9Wjfe9X9Y3fauluKAbbkxNRmeERQmgCNJE/e6eNgeEty09nlH/vpIBG7ro1CzNb63XUa5VK5BxyXMCmwWMywy33puNqio8mBldK4IZgGpviHJvHRzCU6rDq2CWrabjWgQfx9TWuK9o1cNfiZulpDoC0dNNzW7oExxC42PdDIMYcFhDGVpGu6rsB+ETtvkb3brRsqdrGzlivHOnEfQCKe46gJz0llsAGSqFwtqjxv9VfmyOhsoXrxhaTXDhDdFp5F5/JDRBMnBQqdFNiVxsG/UQZ8rgrAdqKmWuh8je5PWnCoAyMgqusTztaYA/w== Received: from BN9PR03CA0532.namprd03.prod.outlook.com (2603:10b6:408:131::27) by CY4PR12MB1656.namprd12.prod.outlook.com (2603:10b6:910:d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Wed, 5 May 2021 09:50:39 +0000 Received: from BN8NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::4f) by BN9PR03CA0532.outlook.office365.com (2603:10b6:408:131::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 09:50:38 +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 BN8NAM11FT067.mail.protection.outlook.com (10.13.177.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 09:50:38 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 09:50:34 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 12:49:57 +0300 Message-ID: <20210505095009.40250-6-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505095009.40250-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505095009.40250-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] 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: 86cd2372-1d57-4a7c-c285-08d90fab3d1d X-MS-TrafficTypeDiagnostic: CY4PR12MB1656: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NNiUcLSKV8tugkvJAeQlZSAtGmAc4qntNtRjHYNTasO3uM2A7eSb+injiCqKyB6LbwVWbB3qAdQxDya1r5KPQkN940hCqBWRnrGQT5hq3AzMd427D2XRfuMIr3DXjDL/jHXblWNV+aqD8T5OsRs6AT3j8SgcZc5fWQqE5nYeCsNNtqgXYyzPKgT4Dtiqmv1ymtPjr1zlCCrIGLlZl12Od+2ISIevwTvj/h1MqNsRbQOcN2XjuYjK0qCopAW9qEeiz8MbTnNIceas5eTPL+2zKOnpogE79nyCofZZUCnGvRMQlVqrHMHnXi7Cet4uwdGeMIYlq+1kSLd4BVaApqJoAF2fh61hRM4q1WfiC3kVkMA/JfBa/UMSdJ35A4hFCuRLKD1xIyb+tKG6acMB7L+TZpzUH2uPWqxXcRtlRPpom7z6CCx2/endwdHypGyCvMUYN8TjZNRAmzy7nZGtKIuhC7DUdEg3pjg/wmfQ540iqjtqqGEP6yAP6uF4J+maPgv8VFxgNMgcHuFSi9yMvn1p9BE+6Zv8X3XwCdFTQfCLcbp0buvhDtEwvqWeBzkzcdltJ1wkDModFGfLcvevtG+t+ylUrrkNnE8df0fgp5CtXw6lEYZ0TUZudS1jB72TCVsMkz7Gw++uyRohMc6YrZW7dJHLe4X5F3Jl+Imn0HPdMtM= 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)(39860400002)(396003)(376002)(346002)(136003)(46966006)(36840700001)(47076005)(6666004)(478600001)(86362001)(336012)(1076003)(54906003)(36860700001)(26005)(356005)(36756003)(7636003)(110136005)(2906002)(2616005)(316002)(55016002)(36906005)(82310400003)(70586007)(5660300002)(16526019)(70206006)(8936002)(107886003)(83380400001)(7696005)(6286002)(426003)(8676002)(4326008)(82740400003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 09:50:38.6971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86cd2372-1d57-4a7c-c285-08d90fab3d1d 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: BN8NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1656 Subject: [dpdk-dev] [PATCH v6 05/17] common/mlx5: add Dexv CT objects creation 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" Adding support for connection tracking ASO creation via Devx command. Right now only bulk creation is supported. By default, the objects with zero contents will be created. Before using a single object, the modification via posting a WQE to the ASO CT SQ is needed. Signed-off-by: Bing Zhao --- drivers/common/mlx5/mlx5_devx_cmds.c | 50 ++++++++++++++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 4 +++ drivers/common/mlx5/version.map | 1 + 3 files changed, 55 insertions(+) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 7a0efa59e5..3f89796eb4 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -2255,6 +2255,56 @@ mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd, return flow_meter_aso_obj; } +/* + * Create general object of type CONN_TRACK_OFFLOAD using DevX API. + * + * @param[in] ctx + * Context returned from mlx5 open_device() glue function. + * @param [in] pd + * PD value to associate the CONN_TRACK_OFFLOAD ASO object with. + * @param [in] log_obj_size + * log_obj_size to allocate its power of 2 * objects + * in one CONN_TRACK_OFFLOAD bulk allocation. + * + * @return + * The DevX object created, NULL otherwise and rte_errno is set. + */ +struct mlx5_devx_obj * +mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, uint32_t pd, + uint32_t log_obj_size) +{ + uint32_t in[MLX5_ST_SZ_DW(create_conn_track_aso_in)] = {0}; + uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)]; + struct mlx5_devx_obj *ct_aso_obj; + void *ptr; + + ct_aso_obj = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*ct_aso_obj), + 0, SOCKET_ID_ANY); + if (!ct_aso_obj) { + DRV_LOG(ERR, "Failed to allocate CONN_TRACK_OFFLOAD object."); + rte_errno = ENOMEM; + return NULL; + } + ptr = MLX5_ADDR_OF(create_conn_track_aso_in, in, hdr); + MLX5_SET(general_obj_in_cmd_hdr, ptr, opcode, + MLX5_CMD_OP_CREATE_GENERAL_OBJECT); + MLX5_SET(general_obj_in_cmd_hdr, ptr, obj_type, + MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD); + MLX5_SET(general_obj_in_cmd_hdr, ptr, log_obj_range, log_obj_size); + ptr = MLX5_ADDR_OF(create_conn_track_aso_in, in, conn_track_offload); + MLX5_SET(conn_track_offload, ptr, conn_track_aso_access_pd, pd); + ct_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), + out, sizeof(out)); + if (!ct_aso_obj->obj) { + rte_errno = errno; + DRV_LOG(ERR, "Failed to create CONN_TRACK_OFFLOAD obj by using DevX."); + mlx5_free(ct_aso_obj); + return NULL; + } + ct_aso_obj->id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id); + return ct_aso_obj; +} + /** * Create general object of type GENEVE TLV option using DevX API. * diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index e6f9b90293..58dc123778 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -570,6 +570,10 @@ struct mlx5_devx_obj *mlx5_devx_cmd_queue_counter_alloc(void *ctx); __rte_internal int mlx5_devx_cmd_queue_counter_query(struct mlx5_devx_obj *dcs, int clear, uint32_t *out_of_buffers); +__rte_internal +struct mlx5_devx_obj *mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, + uint32_t pd, uint32_t log_obj_size); + /** * Create general object of type FLOW_METER_ASO using DevX API.. * diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map index 18dc96276d..4bbcba5b8e 100644 --- a/drivers/common/mlx5/version.map +++ b/drivers/common/mlx5/version.map @@ -13,6 +13,7 @@ INTERNAL { mlx5_dev_to_pci_addr; # WINDOWS_NO_EXPORT mlx5_devx_cmd_alloc_pd; + mlx5_devx_cmd_create_conn_track_offload_obj; mlx5_devx_cmd_create_cq; mlx5_devx_cmd_create_flex_parser; mlx5_devx_cmd_create_qp; -- 2.27.0