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 6C39142BB5; Sat, 27 May 2023 14:06:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BDB742D0B; Sat, 27 May 2023 14:06:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4B8C442BD9 for ; Sat, 27 May 2023 14:06:07 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34RAfPPs021855; Sat, 27 May 2023 05:06:05 -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=mw+f/cUgYKGElBQenhsdcvF8NuCWnCLLX1gsYR5oDaM=; b=ThArY4lF69ZXgAk74Z+esXgbe7T1vzRCCbNOBG/ECg+NeQAyRFW8w8fkI4m+6tAtDdX2 RiGtCornZPJEJKHSRo/pP0inp2w40h0PPUdSd0ecG0+bB6jbaE9bj/UrcQOjaLGpgLm7 fk1ZYv2pT+0CtMy9gA0+xYKDWPv+axPVQo6o5b6u0psczUX33aehCOkQq13RsiUW2qUB qIOWLzdsYE6d4ITgly91uAfM0m1q4wLS2DFUn9sONpVKNGwPfvSS8FrUKh3oGrHi/nTI ecs1F/nM19rXYYTXeyLFnQTm5rSvEFobzeXiDAoJlPyN7or6W2DT+mv4Gsc/wcwvz9YS hQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3quf7p8ahd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 27 May 2023 05:06:05 -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; Sat, 27 May 2023 05:05:58 -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; Sat, 27 May 2023 05:05:58 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.161.183]) by maili.marvell.com (Postfix) with ESMTP id 36E4D5C7F8D; Sat, 27 May 2023 00:17:22 -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 v5 16/21] pdcp: add timer expiry handle Date: Sat, 27 May 2023 12:46:05 +0530 Message-ID: <20230527071610.903-17-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230527071610.903-1-anoobj@marvell.com> References: <20230526210214.617-1-anoobj@marvell.com> <20230527071610.903-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: OFEuscykx2q2U9n1XnCE7DcKJTk04T9f X-Proofpoint-ORIG-GUID: OFEuscykx2q2U9n1XnCE7DcKJTk04T9f 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-27_08,2023-05-25_03,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 | 30 ++++++++++++++++++ lib/pdcp/rte_pdcp.c | 49 ++++++++++++++++++++++++++++++ lib/pdcp/rte_pdcp.h | 31 +++++++++++++++++++ lib/pdcp/version.map | 2 ++ 4 files changed, 112 insertions(+) diff --git a/doc/guides/prog_guide/pdcp_lib.rst b/doc/guides/prog_guide/pdcp_lib.rst index dcb424bb1d..16deaead15 100644 --- a/doc/guides/prog_guide/pdcp_lib.rst +++ b/doc/guides/prog_guide/pdcp_lib.rst @@ -130,6 +130,36 @@ Supported integrity protection algorithms - SNOW3G-AUTH - ZUC-AUTH +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. + + 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 05c922819e..b926b0df29 100644 --- a/lib/pdcp/rte_pdcp.h +++ b/lib/pdcp/rte_pdcp.h @@ -101,6 +101,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; @@ -111,6 +112,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. @@ -339,6 +341,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[]); + /** * The header 'rte_pdcp_group.h' depends on defines in 'rte_pdcp.h'. So include * in the end. 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