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 45ADCA0524; Wed, 5 May 2021 09:20:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04DEC4110F; Wed, 5 May 2021 09:19:48 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) by mails.dpdk.org (Postfix) with ESMTP id 562EC41113 for ; Wed, 5 May 2021 09:19:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idLMQZqsQ7KF57deRbUXqbCXHIWr1mEV0Js1ifQP0zD7AcyRxvWj1P3IcGfW+kx7sE11ad4Q5DFzjauhtuY5wdu77y0Zwn6vxjZN0THIX7zOETFX3whsMvVjPFH20Sj9s15CDfX43OJx34rpyLEI9yx4ZkDPE2ppyUaEkdP0655TViXZKFu5YIVVsp0B3If/zpr6WGgxCFpKL99D1pfvoAwzxmdfRT/FyFZPAbkxmPdaLVLUNH0n97i6fTEMuX66Mwl0nC0azgN8FJ+8PzrGBsU1oK2mN7+YscOTZ7twqZH+vZGleIx2pWpg3SQCdaSjovgWa1yPQp38g+4m/CWpOQ== 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=+gseLG6jh+Guu+qKG2a0rpPo+K7MpjhdoENL+pmasSs=; b=M96efHq5Z5YosHY9CF6i3PzW7JmKOUicp9hREY8eR+MigtM2ous3Je3oFCXbLvMenqton7/XR09wC1STj+BVa43GiPbpCVrKx3QY2DFnMhMVZvWyaF/I9e6n0CefhKu1l2+KCIq5NxTqlbekdQ1KARFYk5VfwRhDXkqi2n9Co1qdBpT4IET5FA4+4uZlvH4I564Z4gqK2ATfKGlVpqOlsMbaF/igCwIuk4INswxqOiJrKh4QBB7n5bkv0835UEEHZ42Wrgdc1ZQOGOKj2KER4f82zXRxF5nXl6LaxWi6eAhibAc5QgrOFENUk/jIisVWYieHYvWa58zTuUrDF/yYlw== 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=+gseLG6jh+Guu+qKG2a0rpPo+K7MpjhdoENL+pmasSs=; b=l6CrStT1VLV44e2ujXTDsfHAh2gwRz7WSCg8ZPVaaQjRsPDYG5KbOBeJPPHy1CiXbNveP7biicTG7HUQaN4VUGURwKQ7DkP4nUNJWB7ov2dp/Cf/pJ8Jxd6ctiDRyxiNA/1rSnc8EGBE/4mEQWsmPdZCIzmZrVkv0FWjBg9fH2FGYWy62nbS1DGLhTjoaSyCfJUdTQ8C5BN2YyibXvTI2asc580wr0xQslLJkR4nGlyY/w0Nyc5wyP8vydR8N3CIcISmiga7QkWERRxcPtsjsUskM+H/UjvQ+tf5aV72DMRjgYkmtbcnjBq5UUhAQKRcHKgggq7oEIjO7vINhGf5Fg== Received: from DM5PR17CA0072.namprd17.prod.outlook.com (2603:10b6:3:13f::34) by CH0PR12MB5108.namprd12.prod.outlook.com (2603:10b6:610:bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Wed, 5 May 2021 07:19:44 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13f:cafe::84) by DM5PR17CA0072.outlook.office365.com (2603:10b6:3:13f::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Wed, 5 May 2021 07:19:44 +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 DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) 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 07:19:44 +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 07:19:41 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 10:19:05 +0300 Message-ID: <20210505071917.31802-6-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505071917.31802-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505071917.31802-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fee73c12-3051-4555-864a-08d90f96281e X-MS-TrafficTypeDiagnostic: CH0PR12MB5108: 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: wPuDDnarF8ngnyMYFtVbslmehUDz+5mTHXrQC5nDUrndOCUeaQGS9fhTD3SnmyM4sPwoyt5wQjmrXU5KdNQr8HpIaXOSpKUCpZ1aoLNsYX43ojtQVgyqHRhrNamBr+yJdIslmTHoZIM1uWMQa/rrEQrPROO3PrffqKYDWoTxHIVYDJrwzHV1CVG5cVhgVZZQby9Q+5cE/4N8WIy6JWv1I5suuc9fgnhU0SWdEtwFm2ZAVpyIt7ixRO9fS3nTFOlNn6o3aYSUNWf+Po+Svk6ZrjswUK9MreezegAFqX1E78SG5mTVFXo4nGRKgo/hvd01Fl0Fu1W6+tcB5YY3Pfz/A/HjWXbF0dmZxYVcbneZXscoKrHKf3HeNeMrxGTdSXgXtURh0Bc6T54jfTDREBqrdzGiYn0G4WENwUIhZdFKR+hRYnBtQTYeaRCWszi9RFxlzjNOdK88wTtipI4a/WOpG+ERtzfYReD/ZoLAb3qK3sX+nd8+7UWsO0X+ACCYHGpdQ+r5o0Ma00jmWfVlq+AePpQY5tu9V3YfVdW3uK6mfR9WaMSUYm6jyItRk4xc+3qWgEoAxaz59P796o2pDjRcRVBldFZWD1dZtrZ35BfyNBBCZ/2xq9AX2CRgscmdZmHHi5NckmI0O+1QlAkzdsTSNG8hKmQAWVlJ70LGef1YEoE= 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)(346002)(39860400002)(396003)(376002)(136003)(36840700001)(46966006)(55016002)(26005)(7636003)(336012)(54906003)(82740400003)(8676002)(110136005)(16526019)(6286002)(107886003)(186003)(36860700001)(70206006)(426003)(36906005)(356005)(316002)(70586007)(5660300002)(47076005)(1076003)(6666004)(36756003)(7696005)(4326008)(2906002)(478600001)(86362001)(82310400003)(2616005)(8936002)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 07:19:44.1186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fee73c12-3051-4555-864a-08d90f96281e 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: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5108 Subject: [dpdk-dev] [PATCH v4 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 ad67883fde..dc01266642 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -2232,6 +2232,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 746320cf04..e67cea506d 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -569,6 +569,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