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 A6F3942943; Fri, 14 Apr 2023 19:47:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9499642D0B; Fri, 14 Apr 2023 19:47:42 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id AD361400EF for ; Fri, 14 Apr 2023 19:47:41 +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 33EGNfcI012935; Fri, 14 Apr 2023 10:47:40 -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=C90v+GDELR/E/CkGOFp7FJTddyFqf7wI7ULt5a7PsdE=; b=cNpMc7CPOy5rYCNpjjUH/dKsETcB7bdbLlNDQ+FursfxRc+51EUk/FVv6FQgeq5ixBgk M58QQAmlt4arKu+7E2C3KSareblJKFPQ+KJYmAEjpNBtf+EOBpO1i/YBoMIi6DKsKYrc vFzKgnkBhWe7dPvea5sa7I2MjHwYjc+XVH1F8bxAEaOYhT8RPbYsYBTQgPa++wjVoPlE K/7ehBIb6UewA0k1lMkBqsU0I4Gt7lI4XaG1/0oQjYIfQ+3m05fWvVnG+ZdBJ/kVGDPn 9wYupdKA0XPw/7MQ155GED/4+HVITQIbm4uEC4G3t0x2ssSSkAQTE5wSBkH6b6XKEZOb jQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3py646s6ur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 14 Apr 2023 10:47:40 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 14 Apr 2023 10:47:38 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Fri, 14 Apr 2023 10:47:38 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.161.183]) by maili.marvell.com (Postfix) with ESMTP id E43F93F707F; Fri, 14 Apr 2023 10:47:32 -0700 (PDT) From: Anoob Joseph To: Thomas Monjalon , Akhil Goyal , Jerin Jacob , Konstantin Ananyev , Bernard Iremonger CC: Volodymyr Fialko , Hemant Agrawal , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Kiran Kumar K , , Olivier Matz Subject: [PATCH v2 16/22] pdcp: add timer expiry handle Date: Fri, 14 Apr 2023 23:15:06 +0530 Message-ID: <20230414174512.642-17-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414174512.642-1-anoobj@marvell.com> References: <20221222092522.1628-1-anoobj@marvell.com> <20230414174512.642-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Uxu-ZmLClpaseGpe8BxDc1wZKNgPJSSv X-Proofpoint-ORIG-GUID: Uxu-ZmLClpaseGpe8BxDc1wZKNgPJSSv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-14_10,2023-04-14_01,2023-02-09_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 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 | 29 ++++++++++++++++++ lib/pdcp/pdcp_process.c | 49 ++++++++++++++++++++++++++++++ lib/pdcp/rte_pdcp.h | 31 +++++++++++++++++++ lib/pdcp/version.map | 2 ++ 4 files changed, 111 insertions(+) diff --git a/doc/guides/prog_guide/pdcp_lib.rst b/doc/guides/prog_guide/pdcp_lib.rst index f23360dfc3..32370633e5 100644 --- a/doc/guides/prog_guide/pdcp_lib.rst +++ b/doc/guides/prog_guide/pdcp_lib.rst @@ -229,6 +229,35 @@ parameters for entity creation. } } +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 need to 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. + Supported features ------------------ diff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c index 9ba07d5255..91b87a2a81 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -1285,3 +1285,52 @@ pdcp_process_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_enti return 0; } + +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 55e57c3b9b..c077acce63 100644 --- a/lib/pdcp/rte_pdcp.h +++ b/lib/pdcp/rte_pdcp.h @@ -100,6 +100,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, stored for later use in callback functions */ void *timer; @@ -110,6 +111,7 @@ struct rte_pdcp_t_reordering { /** Timer start 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. @@ -327,6 +329,35 @@ rte_pdcp_pkt_post_process(const struct rte_pdcp_entity *entity, return entity->post_process(entity, in_mb, out_mb, num, nb_err); } +/** + * @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[]); + #include #ifdef __cplusplus diff --git a/lib/pdcp/version.map b/lib/pdcp/version.map index d0cf338e1f..89b0463be6 100644 --- a/lib/pdcp/version.map +++ b/lib/pdcp/version.map @@ -11,5 +11,7 @@ EXPERIMENTAL { rte_pdcp_pkt_post_process; rte_pdcp_pkt_pre_process; + rte_pdcp_t_reordering_expiry_handle; + local: *; }; -- 2.25.1