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 E2A0C42BE2; Tue, 30 May 2023 12:04:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A658342D70; Tue, 30 May 2023 12:03:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 9761A42D39 for ; Tue, 30 May 2023 12:03:14 +0200 (CEST) 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 34U5rbcA030170; Tue, 30 May 2023 03:03:13 -0700 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=/ZpaU3ZukA8tfTuVeAtojC9hYikYvQ7sX5Qu72JPBzI=; b=D2i+BI/xm6n5+kdI/DJ6juDOsLtFlZjJRnpOVkmFCKwzNdv3EMqbWsfoUhmRy0MozwBz CDInVwdTbhvpwnCeYb0HEqlQ+5QEFscvjiqsGkhre0Om33QGdYh6JdtTyL/eZiJW8bvS ETCNaI7evn5hfUBxuhioAzpVX4NRc1jaepWF0R9mYAHEfMBkUmeqWwUNeZtdklmKyZjG eKx/ja4npqjoHm/Ix8WA3CX1caJnNpp0a63KcDnO6/IDaGXYC/a28GDyXs23Ch9+IP5Y U+Z2LouxDjiS9vd77ZKUe1TfPjixOqk40lR0g45jDTELJohrn8zwWuFiuVdh0O2eZ74m 8w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3quhcm7u07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 30 May 2023 03:03:13 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 30 May 2023 03:03:11 -0700 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.48 via Frontend Transport; Tue, 30 May 2023 03:03:11 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.69.246]) by maili.marvell.com (Postfix) with ESMTP id 554313F7050; Tue, 30 May 2023 03:03:07 -0700 (PDT) From: Anoob Joseph To: Thomas Monjalon , Akhil Goyal , Jerin Jacob , Konstantin Ananyev CC: Volodymyr Fialko , Hemant Agrawal , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Kiran Kumar K , , Olivier Matz , Stephen Hemminger Subject: [PATCH v6 16/21] pdcp: add timer expiry handle Date: Tue, 30 May 2023 15:31:53 +0530 Message-ID: <20230530100158.1428-17-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230530100158.1428-1-anoobj@marvell.com> References: <20230527085910.972-1-anoobj@marvell.com> <20230530100158.1428-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: m5Q1akX3NCQeIPy9N1-jB2X2gqZV6HXJ X-Proofpoint-ORIG-GUID: m5Q1akX3NCQeIPy9N1-jB2X2gqZV6HXJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-30_06,2023-05-29_02,2023-05-22_02 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 From: Volodymyr Fialko The PDCP protocol requires usage of timers to keep track of how long an out-of-order packet should be buffered while waiting for missing packets. Applications can register a desired timer implementation with the PDCP library. Once the timer expires, the application will be notified, and further handling of the event will be performed in the PDCP library. When the timer expires, the PDCP library will return the cached packets, and PDCP internal state variables (like RX_REORD, RX_DELIV etc) will be updated accordingly. Signed-off-by: Anoob Joseph Signed-off-by: Volodymyr Fialko --- doc/guides/prog_guide/pdcp_lib.rst | 31 +++++++++++++++++++ lib/pdcp/rte_pdcp.c | 49 ++++++++++++++++++++++++++++++ lib/pdcp/rte_pdcp.h | 34 +++++++++++++++++++-- lib/pdcp/version.map | 2 ++ 4 files changed, 114 insertions(+), 2 deletions(-) diff --git a/doc/guides/prog_guide/pdcp_lib.rst b/doc/guides/prog_guide/pdcp_lib.rst index a925aa7f14..61242edf92 100644 --- a/doc/guides/prog_guide/pdcp_lib.rst +++ b/doc/guides/prog_guide/pdcp_lib.rst @@ -130,6 +130,37 @@ Supported integrity protection algorithms - RTE_CRYPTO_AUTH_SNOW3G_UIA2 - RTE_CRYPTO_AUTH_ZUC_EIA3 +Timers +------ + +PDCP utilizes a reception window mechanism to limit the bits of COUNT value +transmitted in the packet. It utilizes state variables such as RX_REORD, +RX_DELIV to define the window and uses RX_DELIV as the lower pivot point of the +window. + +RX_DELIV would be updated only when packets are received in-order. +Any missing packet would mean RX_DELIV won't be updated. +A timer, t-Reordering, helps PDCP to slide the window +if the missing packet is not received in a specified time duration. + +While starting and stopping the timer will be done by lib PDCP, +application could register its own timer implementation. +This is to make sure application can choose between timers +such as rte_timer and rte_event based timers. +Starting and stopping of timer would happen during pre & post process API. + +When the t-Reordering timer expires, application would receive the expiry event. +To perform the PDCP handling of the expiry event, +``rte_pdcp_t_reordering_expiry_handle`` can be used. +Expiry handling would involve sliding the window by updating state variables and +passing the expired packets to the application. + +.. literalinclude:: ../../../lib/pdcp/rte_pdcp.h + :language: c + :start-after: Structure rte_pdcp_t_reordering 8< + :end-before: >8 End of structure rte_pdcp_t_reordering. + + Sample API usage ---------------- diff --git a/lib/pdcp/rte_pdcp.c b/lib/pdcp/rte_pdcp.c index a0558b99ae..819c66bd08 100644 --- a/lib/pdcp/rte_pdcp.c +++ b/lib/pdcp/rte_pdcp.c @@ -251,3 +251,52 @@ rte_pdcp_control_pdu_create(struct rte_pdcp_entity *pdcp_entity, return m; } + +uint16_t +rte_pdcp_t_reordering_expiry_handle(const struct rte_pdcp_entity *entity, struct rte_mbuf *out_mb[]) +{ + struct entity_priv_dl_part *dl = entity_dl_part_get(entity); + struct entity_priv *en_priv = entity_priv_get(entity); + uint16_t capacity = entity->max_pkt_cache; + uint16_t nb_out, nb_seq; + + /* 5.2.2.2 Actions when a t-Reordering expires */ + + /* + * - deliver to upper layers in ascending order of the associated COUNT value after + * performing header decompression, if not decompressed before: + */ + + /* - all stored PDCP SDU(s) with associated COUNT value(s) < RX_REORD; */ + nb_out = pdcp_reorder_up_to_get(&dl->reorder, out_mb, capacity, en_priv->state.rx_reord); + capacity -= nb_out; + out_mb = &out_mb[nb_out]; + + /* + * - all stored PDCP SDU(s) with consecutively associated COUNT value(s) starting from + * RX_REORD; + */ + nb_seq = pdcp_reorder_get_sequential(&dl->reorder, out_mb, capacity); + nb_out += nb_seq; + + /* + * - update RX_DELIV to the COUNT value of the first PDCP SDU which has not been delivered + * to upper layers, with COUNT value >= RX_REORD; + */ + en_priv->state.rx_deliv = en_priv->state.rx_reord + nb_seq; + + /* + * - if RX_DELIV < RX_NEXT: + * - update RX_REORD to RX_NEXT; + * - start t-Reordering. + */ + if (en_priv->state.rx_deliv < en_priv->state.rx_next) { + en_priv->state.rx_reord = en_priv->state.rx_next; + dl->t_reorder.state = TIMER_RUNNING; + dl->t_reorder.handle.start(dl->t_reorder.handle.timer, dl->t_reorder.handle.args); + } else { + dl->t_reorder.state = TIMER_EXPIRED; + } + + return nb_out; +} diff --git a/lib/pdcp/rte_pdcp.h b/lib/pdcp/rte_pdcp.h index 9cdce7d3a4..c5b99dfa2b 100644 --- a/lib/pdcp/rte_pdcp.h +++ b/lib/pdcp/rte_pdcp.h @@ -102,6 +102,7 @@ typedef void (*rte_pdcp_t_reordering_stop_cb_t)(void *timer, void *args); * * Configuration provided by user, that PDCP library will invoke according to timer behaviour. */ +/* Structure rte_pdcp_t_reordering 8< */ struct rte_pdcp_t_reordering { /** Timer pointer, to be used in callback functions. */ void *timer; @@ -112,6 +113,7 @@ struct rte_pdcp_t_reordering { /** Timer stop callback handle. */ rte_pdcp_t_reordering_stop_cb_t stop; }; +/* >8 End of structure rte_pdcp_t_reordering. */ /** * PDCP entity configuration to be used for establishing an entity. @@ -338,8 +340,36 @@ rte_pdcp_pkt_post_process(const struct rte_pdcp_entity *entity, } /** - * The header 'rte_pdcp_group.h' depends on defines in 'rte_pdcp.h'. So include - * in the end. + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * 5.2.2.2 Actions when a t-Reordering expires + * + * When t-Reordering timer expires, PDCP is required to slide the reception + * window by updating state variables such as RX_REORD & RX_DELIV. + * PDCP would need to deliver some of the buffered packets + * based on the state variables and conditions described. + * + * The expiry handle need to be invoked by the application when t-Reordering + * timer expires. In addition to returning buffered packets, it may also restart + * timer based on the state variables. + * + * @param entity + * Pointer to the *rte_pdcp_entity* for which the timer expired. + * @param[out] out_mb + * The address of an array that can hold up to *rte_pdcp_entity.max_pkt_cache* + * pointers to *rte_mbuf* structures. Used to return buffered packets that are expired. + * @return + * Number of packets returned in *out_mb* buffer. + */ +__rte_experimental +uint16_t +rte_pdcp_t_reordering_expiry_handle(const struct rte_pdcp_entity *entity, + struct rte_mbuf *out_mb[]); + +/** + * The header 'rte_pdcp_group.h' depends on defines in 'rte_pdcp.h'. + * So include in the end. */ #include diff --git a/lib/pdcp/version.map b/lib/pdcp/version.map index 97171f902e..4fd912fac0 100644 --- a/lib/pdcp/version.map +++ b/lib/pdcp/version.map @@ -14,5 +14,7 @@ EXPERIMENTAL { rte_pdcp_pkt_pre_process; rte_pdcp_pkt_crypto_group; + rte_pdcp_t_reordering_expiry_handle; + local: *; }; -- 2.25.1