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 8408AA0524; Wed, 5 May 2021 08:51:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 929524110A; Wed, 5 May 2021 08:51:20 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) by mails.dpdk.org (Postfix) with ESMTP id B0946410F2 for ; Wed, 5 May 2021 08:51:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fBUZdDNxm3q08YHjHZRc5zGF53A63BLrmBpTuROCRwHgOb90HiRdmqHgVYrFR0bv/1sIFHmIwUBrGY+azPT4xGapeSYdKNWOpomdjkEhx9nmHkMML3J990zcqqQNdvwrDEFCZLrbNr/fr0jguWcAo7UXpc/YuTzYVbGnToe3G29TBu0XaaQJd5Px92m7H1vncX14S3FZiqPFDLl4QNX0Zo1SDEz3y5TYdYQyXLAM3meu78WlM1c3yDZyPtNGQgsZaFP34xuGXGpXVjL14gT8BgT68lVJOabNi66vtfxUx3R0SNI0UtmWZ/Qn7x3yWfgeAUyxH10o8hZQ6ZL4+4avjA== 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=bBIuYdhq7um4hz66bQbzbuqABFNeJrrSYWfRvlcPeaWi0jnYYf2jCChoXMOFNvHLkB/ddUwJ8U3XA2k+aPazVd+dpWH1YcYrIGoF/DUiP97wWyXaMhVpwfw/HuD6Jbu3meFlN1jR0JBZYigY+uAGa5NdBFpIeaA3QysVXaD3UCQT9+8+Ydgr1vjX4S56eYGADcXHvR+idDzXq3NV/DgcaBSpNwbFngueT8X444H9Gmf1K+X6E3EyhPBkGub2vNv7fKcKbSihLG43ePQUt8DF8MHTu97he+QHBq7E2LnmBtBSRwm6gO2UOh3osBb2RT8GfTeks0H952BxKzVcohY62Q== 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=LK0OP94OokVnA6/NhZwKbdRQFDzp0Ev2xwgWiH4+wWY6KW8NJa/9sgP+ObEnOuHHUcMmI0xPtUCDonZaHdUyl2bmEUR2RjMzFUldIJ9+0rdwUBgFVFu5TjdXhY45zeqNpgcJaIaqD7A0OeW/ACnOe+BoWUZJvUE2OsEtPxFuYKkd6j+qBWlMl83EekJx/r1YfmGCcfWfhTjgSckrZEgeo3ghUlNGzyDVTL8HJNJ3kmoNPsajq94FsEpCeOXKraaABXY2a4FWCQ/azeh2qWiVbR3kGW/lYXbIHr3zCl+JpR/SkjdoZPsSYxQHp0JrGcICYQkdCNRvLlEQ6MykPt1OYA== Received: from BN9PR03CA0443.namprd03.prod.outlook.com (2603:10b6:408:113::28) by MWHPR12MB1501.namprd12.prod.outlook.com (2603:10b6:301:f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Wed, 5 May 2021 06:51:15 +0000 Received: from BN8NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::cb) by BN9PR03CA0443.outlook.office365.com (2603:10b6:408:113::28) 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 06:51:15 +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 BN8NAM11FT041.mail.protection.outlook.com (10.13.177.18) 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 06:51:14 +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 06:50:49 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 09:49:56 +0300 Message-ID: <20210505065008.30680-6-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505065008.30680-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505065008.30680-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: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7910c721-7a7f-489d-9ccb-08d90f922d5a X-MS-TrafficTypeDiagnostic: MWHPR12MB1501: 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: 4yi8LLj8nB1+Lq6MdMBaij4RghzW2Sohqiu+wjTlR4TRMKhYrsKj/Qe2MKh7p6DPs35IiusvBvioWMO03ht9fHRApI+/fCgINjXDyQDpJ5ETUCtcUIfKRD4q49eyYyS2AeZqhPBfNJ4VCACo41QgPklu7hHS7IBaqqABOtxh/B1qQ5z+oDeANd9RJJkqWBugn+QlpI4H9chSUzES6NCVb4igTgbKFGvwTAhljEXGSpcclgmNBDrTkf+l0HbbQ54dlogu+R3m3gkEK5v3oF36cAky4Q8CIf4DBIK7KhTzhWl1CF8XHYdX4hEt1oTnz7cbYd8PIvuiy21tYg90P3X80JjJcyuo7E2R2Dk8vt8QHI+Sevk9l9GkxefrU/bROgVd9MAy15JQeKEBRKfSclCJgPaBYkE7tEAH0FsWzs1SG3iAFV/ybK8hu9nubn0ho4gX50fHFO2/aw9ZdESIYW6m8CRAnueOZGg5S+xj6m2N7H6tqcMYriIQfWt71YfAeEiJYST7ZIW4P4gQH5oSnrk/nYKaNINlscJ2N15MiGHSrGH3kfqgFCSdIlk5FVAv+9iNGk9DkQaoZtSKXSbKLCsQbXEpP285Zh4oofxIHKN4+1dGaYiKDyWdO/AywXVMadOoWZFtO8djSawOjgfi7Y0rUkxEjVQZCQvpvwI9/XCaOpM= 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)(136003)(39860400002)(396003)(346002)(376002)(46966006)(36840700001)(2906002)(54906003)(316002)(70206006)(36756003)(7696005)(1076003)(107886003)(36906005)(7636003)(70586007)(47076005)(55016002)(478600001)(26005)(5660300002)(86362001)(336012)(82740400003)(2616005)(16526019)(8676002)(6286002)(82310400003)(426003)(4326008)(36860700001)(186003)(6666004)(356005)(8936002)(110136005)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 06:51:14.8211 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7910c721-7a7f-489d-9ccb-08d90f922d5a 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: BN8NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1501 Subject: [dpdk-dev] [PATCH v3 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