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 91EF9A0A02; Tue, 27 Apr 2021 17:39:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1444E41279; Tue, 27 Apr 2021 17:38:54 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2087.outbound.protection.outlook.com [40.107.95.87]) by mails.dpdk.org (Postfix) with ESMTP id 9ED0E41271 for ; Tue, 27 Apr 2021 17:38:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H5zI1RIy3Kl2GAhSPwn+neFRYq6kuGuUwdIz/aHtExAjn93TDM9q+2SgLbLigrHezfLWuU2MFVdxAV8Cd7s2z81jwhVPpbnu1N2m8IV3l11N/M6E59vMWaaUWE2BTy1OH/3IddcIcdveke2jiMVwAv6z2qaE/lGjEZP98EcWFx/9NGRgMGC/U/i92UOhlVr4a+NuGi09ku4guL7N3MQC+lDOuW3RzA4dF5mcG7lgd2AbW/w29yHqlw6vFU/FyDX9IaweyiO6hsCcye+myZh1zpdUe4rqs4XYqo5t0n69b9Clw6HeJJGYdw7o2TGEdQ6TvPS9i2wc2lVs1Q/lD1j/6w== 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=3baaaDZhkINE9gNZXL5a/RnrPPPrTwZLs1Nmg7y7iqg=; b=SqvOKbniT7KP2DV9pg+RfM7hnE7SpfR2fVTdmlCitswXNVL+hANZM/wEgEjcxgFR4/mC7lMXFKYaETDmQXzoN3ajnp5clorPSGkRSZ4utrOx9gKcqAdyKZWa1Y4+LdMOjHLSzUI4LrO3TSrup5xqX1asKOOzChjp2jjZpVGPgzgY/lzougiGrwEHIXuJCmIE13dhbIaKDXDqmx9By+fz0KAZfUI9BWpNIhq9VLdsFKAA9WMp+4JZhn4jZGHrTkHiy2/EE0RrMV5Yu/Jc4SJzIBKtqFKbJx37U3iHaQ2iwL9Kwq0Q6kep7wLeG+taB3bvw9A3lFSEnAVC5JPqRCHbJg== 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=3baaaDZhkINE9gNZXL5a/RnrPPPrTwZLs1Nmg7y7iqg=; b=rbHadVCUhyWWyr8x9U+wnkPWuHgtaDctst1EmKUO/M0aq5zq45WgdVqaldZCwnVajkfmJKWoHvo4A5EYnCwKoLNZLukWNdAQBG1qL80zN/gkohhTi8nstqh9So5bnlsZp65L3xJ9xfczF5VY+5YRaQjuYkpFKt0nkn6O4I6giAydNUd+obW0UFD9D28hyfN3GpitYfgvVNOn05+uPJJI5ozpHrd/LwU1cWbuVj1EpWCk9X069dneoXEn0IldwbE97LC+N5WK9UOnheDEcWzqwd/NeD+0rh+P27d94d5S3jTgsvd3wxB+R+qj55uaqDN+mQBG/lWynpTtrERanagcZg== Received: from MW4PR04CA0221.namprd04.prod.outlook.com (2603:10b6:303:87::16) by DM6PR12MB3724.namprd12.prod.outlook.com (2603:10b6:5:1c9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Tue, 27 Apr 2021 15:38:50 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::de) by MW4PR04CA0221.outlook.office365.com (2603:10b6:303:87::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Tue, 27 Apr 2021 15:38:50 +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 CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 15:38:49 +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; Tue, 27 Apr 2021 15:38:48 +0000 From: Bing Zhao To: , CC: , , Date: Tue, 27 Apr 2021 18:37:59 +0300 Message-ID: <20210427153811.11554-6-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210427153811.11554-1-bingz@nvidia.com> References: <20210427153811.11554-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0520e494-789b-4e1d-d8aa-08d909928df3 X-MS-TrafficTypeDiagnostic: DM6PR12MB3724: 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: an4Jms7CtXBdH0hD14jMQgck4vwaRuj2YAuhIjqEKnKxLsCmM/5RNRzr82vXpAX1+FoQ/FFJBGmizqaIX/7z+YcoWSDiIky0lP3s0kTZbbYPjbgvG551dsL9gIqI2cE8DTDQDJEujrJxy9Ko2hQq9urdG/0oqotxCUslorPOObNon92KMATwm5dZ6PdNcdl/KT7SdjjOWHB3XSPn4GMPiwuFzOIVTHcuR278q4fvuBmkwu/Cb+rGbzn3rgfUy6fznhHAsk9VxwtgypR5rQ5bLgB2gfKP0LdqTICNO0fSuGXL3EGVmB/fcUPG/zb9S9uMnZNVkWnjXA9TN610QEfnjtFp80UXA29MHyUXS7x0Bf5CKjqw6ihcRInqfENIFyWBdvO8mCDfDHnibxrrlEIeojKU/UdGGFir5ZvJWaXCn1NsVbl9DUcU0PVfrCUwxGUtShDPdYlKZKLBYsrjmPmYOv9tkqWq/46ZHWPwUkuuNSB7AECqkZsqqrYpkKBUnwt0z7p3Aef4NjffQKNlKNeON5rWl0tWd9UsOsIxO0/LCBh5P5iTxesAwBL5h6TXEAt9VxjFMYxlcFKyyJ2EuduuenCnF7tA4WvkkpKZhbVhroKvqkB2yTwQnaJnnltayWs76KjBU01QZsnrQR+TlGKrBRXzvkB7DBHIwvBlQIdg7tY= 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)(346002)(376002)(136003)(46966006)(36840700001)(70586007)(70206006)(426003)(316002)(186003)(6666004)(36906005)(36860700001)(110136005)(16526019)(26005)(5660300002)(7636003)(36756003)(6636002)(86362001)(356005)(4326008)(82310400003)(107886003)(47076005)(8676002)(2906002)(1076003)(83380400001)(8936002)(478600001)(6286002)(55016002)(2616005)(7696005)(336012)(82740400003)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 15:38:49.9879 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0520e494-789b-4e1d-d8aa-08d909928df3 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3724 Subject: [dpdk-dev] [PATCH 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 4300536..f2e7ed4 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -2230,6 +2230,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 956b0b1..435f6c4 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -568,6 +568,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 18dc962..4bbcba5 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.5.5