From patchwork Wed May 5 12:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 92921 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C4ECA0524; Wed, 5 May 2021 14:24:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 168CD41120; Wed, 5 May 2021 14:24:04 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by mails.dpdk.org (Postfix) with ESMTP id 9523E41120 for ; Wed, 5 May 2021 14:24:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gSbXde491Y2+152r8wcMBmBqiiMkT1O/+hWWJIgG592NhhN2guYsTsUNAS+w5K4sm4ZQ0qdcGLuIGdMoINp5glCt+gJ2rOHb905CqbJoT8L/gZXogjKoE2GjO8RkNvbMd71z4Y2Q2+cgShbTNN8wL0mpvdORMHV/FkA0Ne0ml84rDbU1d3wAB3rLhfDv47Vk9Ne/jW3FN7oQNDOGYOA+eBtclFY77WhyHHdP3u6MrsPtL1BidoavA6ZD/hSTEB6KtKq9scSGZGUviNn1QUCFrqHrxUJh2h0QoAOZUhCq4rEJd58SzC/Hw+Uh3NCG040IqL4dJy/c8hrTTcLh1Fpe5A== 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=b5+Xy81XOEcZioYHxeeY+3FvXobIWeKfZmPIT4Fd5RI=; b=AXF3UpGXMYk2C5CzJkAj9mBbQ4qIgZdiZxOB5XH+TaRup2xLjjWLxz27trryf8ZY30SmyoEDZDVGub5SczTidXyu3lx493smhviBx4WvU8T9l2s5L19XMCoARnqmx078mtpu7qHAlN6i0f6GheSo4Bq8+32ZofR3Zbc0X5XefpzB8jE6lQZNga/VG/jt2asAEPIbkJ/Mb053bJPnykIqdsmjW4WB3p/8gvEhrN8Jd2UXXQ9gO2kC6KNcFKqfvA+xR5JCklsgrpLm7Uxp8y3W1HP0Hxj4S2VYGVJq8V8W1YIR9FLwq+j2OcRmm0kwwlJ4Eb1zWX4IMLfk4zp6T09ttA== 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=b5+Xy81XOEcZioYHxeeY+3FvXobIWeKfZmPIT4Fd5RI=; b=SK3HlFogDIo7/ibv6wWbJfYckARVWf0wgYH07q+jobg3yuRLRBqP0h1W8bSYi4z+Ka8Kn6320cYbW7FeyqMk569h1fM9aPTB/PrhyIvm983PNP/u7yeg14DnK3Q4UJfhBxofOuiU6Yamv6y+CEIRruZ8BCxEPeF1OBd73v5Z6Aj1a8EEaeF0CN10DX7JJAeovwn6klNBKXygV90WmsSF1YzTkGnt3bY+Y28pI30zubF9NXV1s5WRQO9Fnw9W4OnyqP0TgYmtvxB3Qx+pdNfP3U8QVIZ7mtTpk759UkwbqoveJWMPA1K2Ww34c3AvtHFVlxRokbaUmcI5ASJEb8Q90A== Received: from DS7PR03CA0233.namprd03.prod.outlook.com (2603:10b6:5:3ba::28) by CY4PR1201MB2487.namprd12.prod.outlook.com (2603:10b6:903:d0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 12:24:00 +0000 Received: from DM6NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::dc) by DS7PR03CA0233.outlook.office365.com (2603:10b6:5:3ba::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 12:23:59 +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 DM6NAM11FT054.mail.protection.outlook.com (10.13.173.95) 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:59 +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:57 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:17 +0300 Message-ID: <20210505122328.51129-7-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 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: fa0b6f39-82a0-4e5a-d20b-08d90fc0a960 X-MS-TrafficTypeDiagnostic: CY4PR1201MB2487: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:40; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1mpv77kxgcyT4A2PS1AqKk12nZS1YnbmfuneaOq1dx0ZroxZkSr8doLWw/ABjIv27Wu0QzRLNvVmxvyQ3C3prTtIKhcuc9A71g4S1J+Copge7QGSnaJPgFH5EGEKGqT7MYTWwTnHnTE6aAekfRErB2hxQg6ZBTv+rSXddijFL0VfXaIo5Jzac8VyG8oOfdC8nvRJ9dRTr/MDpFLuDT5gCK9NGvksB0beBQrA2ijcTa6tPqee9Ch09UNQRy7Jx6u978sJMfZYujw4BqBpQVw5E8Ig1NebL6tYfqC8emfIbpFGvX0alRJq5hR4cNQWOnbTVsy5xsddRTReiO1uhbU3J7Sqyb93xpl6k6mQLUfjB1a5DCgd/x5npmTKd3znzABLGKzjOTsfWiPuQCQrk2pWVgmerR9YD/FNarUpbJxPuaKTQpR9I7jTtmQXapvNW2XUG3Gr7WB9fh8/1F96Kl5P2BANcAydSqTEwu3lL/8lzd6p82u6KFMwLQpl18T7lDaBouE8h6zsYmW2BP17kdlIiEM0qrJHvSCuffryR7fZiR/GrWWBP4bWo0/e0Slj5mK2O+6Daevqc4QegNQ8goMS14ybGUqI2XhvR+DEx3WfhROl9XvouJVvDku9U6hXP00WVkbklNhJPOyaFWUxJPM17IJ8JYabcFqgWLCkIZS8V9w= 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)(376002)(39860400002)(346002)(396003)(136003)(46966006)(36840700001)(7636003)(83380400001)(36906005)(110136005)(7696005)(2616005)(82740400003)(47076005)(356005)(8936002)(36860700001)(54906003)(26005)(5660300002)(55016002)(186003)(16526019)(316002)(36756003)(426003)(1076003)(107886003)(70206006)(30864003)(336012)(86362001)(6666004)(478600001)(6286002)(8676002)(82310400003)(2906002)(70586007)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:23:59.8018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa0b6f39-82a0-4e5a-d20b-08d90fc0a960 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: DM6NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2487 Subject: [dpdk-dev] [PATCH v7 06/17] net/mlx5: add modify support for CT 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" After the connection tracking object bulk is allocated, all the objects' contents are filled with zero by default. Every new-allocated object must be modified via WQE operation before it is used. In order to reduce the latency for the flow creation, an asynchronous way is used instead of busy waiting for the CQE to be generated. Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 8 + drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_flow_aso.c | 252 +++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0ff7b8c2bc..96b5cccf19 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -493,6 +493,7 @@ struct mlx5_aso_sq_elem { uint16_t burst_size; }; struct mlx5_aso_mtr *mtr; + struct mlx5_aso_ct_action *ct; }; }; @@ -1012,6 +1013,10 @@ struct mlx5_aso_ct_action { bool is_original; /* The direction of the DR action to be used. */ }; +/* CT action object state update. */ +#define MLX5_ASO_CT_UPDATE_STATE(c, s) \ + __atomic_store_n(&((c)->state), (s), __ATOMIC_RELAXED) + /* ASO connection tracking software pool definition. */ struct mlx5_aso_ct_pool { uint16_t index; /* Pool index in pools array. */ @@ -1695,5 +1700,8 @@ int mlx5_aso_meter_update_by_wqe(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); int mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); +int mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile); #endif /* RTE_PMD_MLX5_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 402c829843..71b0871bcd 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -843,6 +843,8 @@ struct mlx5_flow { #define MLX5_ASO_WQE_CQE_RESPONSE_DELAY 10u #define MLX5_MTR_POLL_WQE_CQE_TIMES 100000u +#define MLX5_CT_POLL_WQE_CQE_TIMES MLX5_MTR_POLL_WQE_CQE_TIMES + #define MLX5_MAN_WIDTH 8 /* Legacy Meter parameter structure. */ struct mlx5_legacy_flow_meter { diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 9f2d21b375..fbf6e5ef38 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -887,3 +887,255 @@ mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, mtr->offset); return -1; } + +/* + * Post a WQE to the ASO CT SQ to modify the context. + * + * @param[in] mng + * Pointer to the CT pools management structure. + * @param[in] ct + * Pointer to the generic CT structure related to the context. + * @param[in] profile + * Pointer to configuration profile. + * + * @return + * 1 on success (WQE number), 0 on failure. + */ +static uint16_t +mlx5_aso_ct_sq_enqueue_single(struct mlx5_aso_ct_pools_mng *mng, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile) +{ + volatile struct mlx5_aso_wqe *wqe = NULL; + struct mlx5_aso_sq *sq = &mng->aso_sq; + uint16_t size = 1 << sq->log_desc_n; + uint16_t mask = size - 1; + uint16_t res; + struct mlx5_aso_ct_pool *pool; + void *desg; + void *orig_dir; + void *reply_dir; + + rte_spinlock_lock(&sq->sqsl); + /* Prevent other threads to update the index. */ + res = size - (uint16_t)(sq->head - sq->tail); + if (unlikely(!res)) { + rte_spinlock_unlock(&sq->sqsl); + DRV_LOG(ERR, "Fail: SQ is full and no free WQE to send"); + return 0; + } + wqe = &sq->sq_obj.aso_wqes[sq->head & mask]; + rte_prefetch0(&sq->sq_obj.aso_wqes[(sq->head + 1) & mask]); + /* Fill next WQE. */ + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_WAIT); + sq->elts[sq->head & mask].ct = ct; + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + /* Each WQE will have a single CT object. */ + wqe->general_cseg.misc = rte_cpu_to_be_32(pool->devx_obj->id + + ct->offset); + wqe->general_cseg.opcode = rte_cpu_to_be_32(MLX5_OPCODE_ACCESS_ASO | + (ASO_OPC_MOD_CONNECTION_TRACKING << + WQE_CSEG_OPC_MOD_OFFSET) | + sq->pi << WQE_CSEG_WQE_INDEX_OFFSET); + wqe->aso_cseg.operand_masks = rte_cpu_to_be_32 + (0u | + (ASO_OPER_LOGICAL_OR << ASO_CSEG_COND_OPER_OFFSET) | + (ASO_OP_ALWAYS_TRUE << ASO_CSEG_COND_1_OPER_OFFSET) | + (ASO_OP_ALWAYS_TRUE << ASO_CSEG_COND_0_OPER_OFFSET) | + (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET)); + wqe->aso_cseg.data_mask = UINT64_MAX; + /* To make compiler happy. */ + desg = (void *)(uintptr_t)wqe->aso_dseg.data; + MLX5_SET(conn_track_aso, desg, valid, 1); + MLX5_SET(conn_track_aso, desg, state, profile->state); + MLX5_SET(conn_track_aso, desg, freeze_track, !profile->enable); + MLX5_SET(conn_track_aso, desg, connection_assured, + profile->live_connection); + MLX5_SET(conn_track_aso, desg, sack_permitted, profile->selective_ack); + MLX5_SET(conn_track_aso, desg, challenged_acked, + profile->challenge_ack_passed); + /* Heartbeat, retransmission_counter, retranmission_limit_exceeded: 0 */ + MLX5_SET(conn_track_aso, desg, heartbeat, 0); + MLX5_SET(conn_track_aso, desg, max_ack_window, + profile->max_ack_window); + MLX5_SET(conn_track_aso, desg, retransmission_counter, 0); + MLX5_SET(conn_track_aso, desg, retranmission_limit_exceeded, 0); + MLX5_SET(conn_track_aso, desg, retranmission_limit, + profile->retransmission_limit); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_scale, + profile->reply_dir.scale); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_close_initiated, + profile->reply_dir.close_initiated); + /* Both directions will use the same liberal mode. */ + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_liberal_enabled, + profile->liberal_mode); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_data_unacked, + profile->reply_dir.data_unacked); + MLX5_SET(conn_track_aso, desg, reply_direction_tcp_max_ack, + profile->reply_dir.last_ack_seen); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_scale, + profile->original_dir.scale); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_close_initiated, + profile->original_dir.close_initiated); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_liberal_enabled, + profile->liberal_mode); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_data_unacked, + profile->original_dir.data_unacked); + MLX5_SET(conn_track_aso, desg, original_direction_tcp_max_ack, + profile->original_dir.last_ack_seen); + MLX5_SET(conn_track_aso, desg, last_win, profile->last_window); + MLX5_SET(conn_track_aso, desg, last_dir, profile->last_direction); + MLX5_SET(conn_track_aso, desg, last_index, profile->last_index); + MLX5_SET(conn_track_aso, desg, last_seq, profile->last_seq); + MLX5_SET(conn_track_aso, desg, last_ack, profile->last_ack); + MLX5_SET(conn_track_aso, desg, last_end, profile->last_end); + orig_dir = MLX5_ADDR_OF(conn_track_aso, desg, original_dir); + MLX5_SET(tcp_window_params, orig_dir, sent_end, + profile->original_dir.sent_end); + MLX5_SET(tcp_window_params, orig_dir, reply_end, + profile->original_dir.reply_end); + MLX5_SET(tcp_window_params, orig_dir, max_win, + profile->original_dir.max_win); + MLX5_SET(tcp_window_params, orig_dir, max_ack, + profile->original_dir.max_ack); + reply_dir = MLX5_ADDR_OF(conn_track_aso, desg, reply_dir); + MLX5_SET(tcp_window_params, reply_dir, sent_end, + profile->reply_dir.sent_end); + MLX5_SET(tcp_window_params, reply_dir, reply_end, + profile->reply_dir.reply_end); + MLX5_SET(tcp_window_params, reply_dir, max_win, + profile->reply_dir.max_win); + MLX5_SET(tcp_window_params, reply_dir, max_ack, + profile->reply_dir.max_ack); + sq->head++; + sq->pi += 2; /* Each WQE contains 2 WQEBB's. */ + rte_io_wmb(); + sq->sq_obj.db_rec[MLX5_SND_DBR] = rte_cpu_to_be_32(sq->pi); + rte_wmb(); + *sq->uar_addr = *(volatile uint64_t *)wqe; /* Assume 64 bit ARCH. */ + rte_wmb(); + rte_spinlock_unlock(&sq->sqsl); + return 1; +} + +/* + * Update the status field of CTs to indicate ready to be used by flows. + * A continuous number of CTs since last update. + * + * @param[in] sq + * Pointer to ASO CT SQ. + * @param[in] num + * Number of CT structures to be updated. + * + * @return + * 0 on success, a negative value. + */ +static void +mlx5_aso_ct_status_update(struct mlx5_aso_sq *sq, uint16_t num) +{ + uint16_t size = 1 << sq->log_desc_n; + uint16_t mask = size - 1; + uint16_t i; + struct mlx5_aso_ct_action *ct = NULL; + uint16_t idx; + + for (i = 0; i < num; i++) { + idx = (uint16_t)((sq->tail + i) & mask); + ct = sq->elts[idx].ct; + MLX5_ASSERT(ct); + MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_READY); + } +} + +/* + * Handle completions from WQEs sent to ASO CT. + * + * @param[in] mng + * Pointer to the CT pools management structure. + */ +static void +mlx5_aso_ct_completion_handle(struct mlx5_aso_ct_pools_mng *mng) +{ + struct mlx5_aso_sq *sq = &mng->aso_sq; + struct mlx5_aso_cq *cq = &sq->cq; + volatile struct mlx5_cqe *restrict cqe; + const uint32_t cq_size = 1 << cq->log_desc_n; + const uint32_t mask = cq_size - 1; + uint32_t idx; + uint32_t next_idx; + uint16_t max; + uint16_t n = 0; + int ret; + + rte_spinlock_lock(&sq->sqsl); + max = (uint16_t)(sq->head - sq->tail); + if (unlikely(!max)) { + rte_spinlock_unlock(&sq->sqsl); + return; + } + next_idx = cq->cq_ci & mask; + do { + idx = next_idx; + next_idx = (cq->cq_ci + 1) & mask; + /* Need to confirm the position of the prefetch. */ + rte_prefetch0(&cq->cq_obj.cqes[next_idx]); + cqe = &cq->cq_obj.cqes[idx]; + ret = check_cqe(cqe, cq_size, cq->cq_ci); + /* + * Be sure owner read is done before any other cookie field or + * opaque field. + */ + rte_io_rmb(); + if (unlikely(ret != MLX5_CQE_STATUS_SW_OWN)) { + if (likely(ret == MLX5_CQE_STATUS_HW_OWN)) + break; + mlx5_aso_cqe_err_handle(sq); + } else { + n++; + } + cq->cq_ci++; + } while (1); + if (likely(n)) { + mlx5_aso_ct_status_update(sq, n); + sq->tail += n; + rte_io_wmb(); + cq->cq_obj.db_rec[0] = rte_cpu_to_be_32(cq->cq_ci); + } + rte_spinlock_unlock(&sq->sqsl); +} + +/* + * Update connection tracking ASO context by sending WQE. + * + * @param[in] sh + * Pointer to mlx5_dev_ctx_shared object. + * @param[in] ct + * Pointer to connection tracking offload object. + * @param[in] profile + * Pointer to connection tracking TCP parameter. + * + * @return + * 0 on success, -1 on failure. + */ +int +mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile) +{ + struct mlx5_aso_ct_pools_mng *mng = sh->ct_mng; + uint32_t poll_wqe_times = MLX5_CT_POLL_WQE_CQE_TIMES; + struct mlx5_aso_ct_pool *pool; + + MLX5_ASSERT(ct); + do { + mlx5_aso_ct_completion_handle(mng); + if (mlx5_aso_ct_sq_enqueue_single(mng, ct, profile)) + return 0; + /* Waiting for wqe resource. */ + rte_delay_us_sleep(10u); + } while (--poll_wqe_times); + pool = container_of(ct, struct mlx5_aso_ct_pool, actions[ct->offset]); + DRV_LOG(ERR, "Fail to send WQE for ASO CT %d in pool %d", + ct->offset, pool->index); + return -1; +}