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 8355E4242B; Fri, 20 Jan 2023 11:22:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3872142DA1; Fri, 20 Jan 2023 11:22:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 72F4C40150 for ; Fri, 20 Jan 2023 11:22:10 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30K7NYEm016078; Fri, 20 Jan 2023 02:22:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ZCaoGYbFANsqL+QqLiH3F/jHPM124Hrh9Ka2oXHVbO4=; b=I/eP7qDxIGejB7DeGXc+qaWetGVHn++EdWX9NLJGSa9+B0nLmTsG5g6BuapZh9DSYEnQ A/IFM013HjEgTH5TFO+yHlZ7QiW2wdVpFlvr933BVd52iJbJofnTr7v7i8s7vR/ycvi7 vAsbzgExXlgqPTlxfupYX4y+jVDHmNcWgeZJHTrgrk4sZG2YsdRu23OuOQoEZNH7VyXr itasSYH1lyIoC66qfR3Vn6rNJT/PD69etJbcqYLYX1GxVN2cZFArOiMEU8ziatMWZcT5 vxcjGNmb7mOh2w3aNEyosIKoqC6xpI+ib4anEmTeyW6AKaE5G7Ax90rjZY4fkvp/u5lF ug== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n71cexxm9-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 20 Jan 2023 02:22:09 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 20 Jan 2023 02:22:02 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Fri, 20 Jan 2023 02:22:02 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 6DB843F704F; Fri, 20 Jan 2023 02:22:00 -0800 (PST) From: Volodymyr Fialko To: , Reshma Pattan CC: , , Volodymyr Fialko Subject: [PATCH 2/3] reorder: add ability to set min sequence number Date: Fri, 20 Jan 2023 11:21:45 +0100 Message-ID: <20230120102146.4035460-3-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120102146.4035460-1-vfialko@marvell.com> References: <20230120102146.4035460-1-vfialko@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 2pbjtqczzKmConR5jIw-NfmCg_xf81PF X-Proofpoint-ORIG-GUID: 2pbjtqczzKmConR5jIw-NfmCg_xf81PF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-20_06,2023-01-20_01,2022-06-22_01 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 Add API `rte_reorder_min_seqn_set` to allow user to specify minimum sequence number. Currently sequence number of first inserted packet is used as minimum sequence number. But for case when we want to wait for packets before the received one this will not work. Signed-off-by: Volodymyr Fialko --- lib/reorder/rte_reorder.c | 31 +++++++++++++++++++++++++++++++ lib/reorder/rte_reorder.h | 18 ++++++++++++++++++ lib/reorder/version.map | 1 + 3 files changed, 50 insertions(+) diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c index 57cc1b286b..0d4c7209f9 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -483,3 +483,34 @@ rte_reorder_drain_up_to_seqn(struct rte_reorder_buffer *b, struct rte_mbuf **mbu return drain_cnt; } + +static bool +rte_reorder_is_empty(const struct rte_reorder_buffer *b) +{ + const struct cir_buffer *order_buf = &b->order_buf, *ready_buf = &b->ready_buf; + unsigned int i; + + /* Ready buffer does not have gaps */ + if (ready_buf->tail != ready_buf->head) + return false; + + /* Order buffer could have gaps, iterate */ + for (i = 0; i < order_buf->size; i++) { + if (order_buf->entries[i] != NULL) + return false; + } + + return true; +} + +unsigned int +rte_reorder_min_seqn_set(struct rte_reorder_buffer *b, uint32_t min_seqn) +{ + if (!rte_reorder_is_empty(b)) + return -ENOTEMPTY; + + b->min_seqn = min_seqn; + b->is_initialized = true; + + return 0; +} diff --git a/lib/reorder/rte_reorder.h b/lib/reorder/rte_reorder.h index c5b354b53d..9f6710bad2 100644 --- a/lib/reorder/rte_reorder.h +++ b/lib/reorder/rte_reorder.h @@ -192,6 +192,24 @@ __rte_experimental unsigned int rte_reorder_drain_up_to_seqn(struct rte_reorder_buffer *b, struct rte_mbuf **mbufs, unsigned int max_mbufs, rte_reorder_seqn_t seqn); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Set minimum sequence number of packet allowed to be buffered. + * To successfully set new value reorder buffer has to be empty(after create, reset or drain_all). + * + * @param b + * Empty reorder buffer instance to modify. + * @param min_seqn + * New sequence number to set. + * @return + * 0 on success, a negative value otherwise. + */ +__rte_experimental +unsigned int +rte_reorder_min_seqn_set(struct rte_reorder_buffer *b, uint32_t min_seqn); #ifdef __cplusplus } #endif diff --git a/lib/reorder/version.map b/lib/reorder/version.map index e3f41ea7ef..aafdf0b5ae 100644 --- a/lib/reorder/version.map +++ b/lib/reorder/version.map @@ -17,4 +17,5 @@ EXPERIMENTAL { rte_reorder_seqn_dynfield_offset; rte_reorder_drain_up_to_seqn; + rte_reorder_min_seqn_set; }; -- 2.34.1