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 2B832A0524; Wed, 5 May 2021 14:24:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D084941135; Wed, 5 May 2021 14:24:00 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2078.outbound.protection.outlook.com [40.107.237.78]) by mails.dpdk.org (Postfix) with ESMTP id C27A441120 for ; Wed, 5 May 2021 14:23:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BDh6xThsbyWapRpwCLz9HYnYM3UCv0+mNQ77EJ9S3gzjnvR3qGyrYcB5J0W5Jw7kdGrxbXbsNtcsef1uNiuWw0qK6g8VPfEKnaz7ZjFNcu0/xHc1LYNcdr+HPenV6Y//Vsm7Hkja1eIt+4PR5h19EoHMLWJjKjG/2Q//7PZzcc/RqvrlJs64+y6FKp/VZp/zTqRwzoWTVmdOzDmRTXVZhfAfd7DGDaM1NgQ9bzjr1QW6D+WZUrxiZc3KAivLsSf+5jpgcOxhG9kAuVTdH46GzPRbqjSB3LvXF5QakJRi9ImzSFC9BgjpvhM5Itams7oopU39Q2IaVtqf7PqegucbTw== 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=an5YxhzxRm3Qtxr76My3oa8waHb03K/w4AsPOd5XtUg=; b=LNQvRM/8M9stxRAF5ZtntBWm+k6mz29cmtuIz2E/nQKenFW0MJRHJVk1qSteXWWw8dPdgNXKE+vgpeW2CKuaVOcv8VASlEekPyoN8KklImjmfrNciKMMbOOOkrgbAEK2loIbkvUJsxL9psptx+13/S9ImIrEWQ76XW6i+kNK5T2dPDr8U5QvjyvReZ9DG4K6Sq97V8HIFkbqWgycbou82tZ9xYI18+nm04/0tum6EmmP9lIDjLz76AQeO7sGHpCckmxv3g4IJ+vRP8c2VWlZgYqpRmLhgcsS2rrsqHQjDNyXUQS7rkkUlBaJZThNf8LsYiNLQJUI0VF49wXn+6LPkQ== 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=an5YxhzxRm3Qtxr76My3oa8waHb03K/w4AsPOd5XtUg=; b=f0KJw22D7/J88r30hSGzLaHYJ6YinHy8Fr1SnPYu+WOKWjdn6ZSDf45wYXsPrUEGLPbxjflNK9EBThp8q4enRejs+hCZy0SKpwPn1dP/FsSRuOFn5ASRedENJyp7P3e+bNQi3w85iyBf94QUGvE7x/hxo1VxNFMyYsJbtSMn2d12sJMf59hbhxtYpckRQuMyMYFo4yK/Uqk2udYcWV+TByEsUJPjQ5el81xRX7MAbdqDfCYLw/emaKnI8cKjOzeV0hUozS9Z77PFme1A/zDlATG7B8Gr+lzT6qlaXBigKBZFcJXJO79H4rTKPi5wHSpyLzstTrHsSEbrzVxWPHFSuQ== Received: from DM6PR01CA0012.prod.exchangelabs.com (2603:10b6:5:296::17) by DM4PR12MB5088.namprd12.prod.outlook.com (2603:10b6:5:38b::9) 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 12:23:58 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::a9) by DM6PR01CA0012.outlook.office365.com (2603:10b6:5:296::17) 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 12:23:58 +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 DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) 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 12:23:57 +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 12:23:55 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:16 +0300 Message-ID: <20210505122328.51129-6-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-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: 759446c3-965e-4e5e-981e-08d90fc0a82d X-MS-TrafficTypeDiagnostic: DM4PR12MB5088: 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: OuJZ2Em5KC3RfCY4s4+OSDFCyneqMlh0Tb/sHysgJDxHMrpRG7QOv73xkD8duD4iDZHuBoUETlD5r8B/rTzHG+GNOnq6V10W4Odo4UFvZQNjA2cYBabQMnqbc4FgMADFp5A2cLyglDiyBo3j4iMiljwPQ0W6gpWEcf2oJcaG6vb5VW3TB6z7y6yQfaYbcG5GZuSuRP+3g9C1we3PONA2AhDOAtNSjMOaDGYxcw9rv7LlYI/vsVNH6rucILeeDARLY+4XmQ/7XtjwsL8c7aMnmQ8Wtbr2Yep6RXT3vkzHz/KTM05AYqR634Yg+N04uQEg5YmNLlDCdoQHAQGuqDfCOQaGbV6PfbFzIkDsdPBimDw1xiXUK3N4oFxSa8M3im1aHV7wf42Z/IW2Ku0zeozyr5Sy6k0z8W8Q5T/L4kIyqbsLlQhGUx5v32fzplNYW9L6JI7pGNwRPT7x2NTTkVyEaCOOBNqaVQ3Q7IS2NgY/FH/4Ir4I2mzat8ExxselLLs7UDhFVIF6xeUoug+TFMozlG/c81+8cNhCiYdibzcl2kGwcWm1xl3KjG9B0gPOHRjkxsE7tYoyGykAgTCxFUjmn3eLwT03Uq/1CZpwT3e5BpSpUO9KfHLOBVVk6oSAuqp2+A93LIAoWGpN1zw4Mc188eWOORi1U+bQHZzU43lgqvA= 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)(376002)(396003)(346002)(46966006)(36840700001)(1076003)(316002)(478600001)(2906002)(82740400003)(356005)(5660300002)(7636003)(6286002)(36756003)(426003)(110136005)(8676002)(4326008)(8936002)(82310400003)(186003)(7696005)(26005)(16526019)(47076005)(36860700001)(55016002)(2616005)(54906003)(6666004)(70206006)(86362001)(70586007)(36906005)(107886003)(83380400001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:57.8244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 759446c3-965e-4e5e-981e-08d90fc0a82d 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: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5088 Subject: [dpdk-dev] [PATCH v7 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 Acked-by: Viacheslav Ovsiienko --- 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.26.2