From patchwork Fri Apr 14 17:45:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 126115 X-Patchwork-Delegate: gakhil@marvell.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 4220342943; Fri, 14 Apr 2023 19:47:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5047642B8E; Fri, 14 Apr 2023 19:47:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4B43C42D0E for ; Fri, 14 Apr 2023 19:47:35 +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 33E906vC011272; Fri, 14 Apr 2023 10:47:33 -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=b0/x7cWkgsUghz0TosrEX8yQElBhGJ6iNgPQSFf7pzg=; b=gvAeQ55nYdJrdHuwPK1CvUqEoGL+TTPrucGgqeRMrJnB+MjmXcnC/4kZV/VPlrG3TxOC AI2OCxjRR/sw7AS8VZC9tQcXx/fIf/QQzQTdwukVLTh9mB9QcHP1JAY/KCphjTJseEzc 8uFoRinc4Y3HtDlCXzvOomF7ZyqpXDywtCHA5g79zUP9Qm5fZ2AesyPy10Q/9Zy8fu6m uTOchD7ShjGcdpHpT2LDFWfg11O+8Luo3DQBHWIySXeZo2M8h7QcPrJGvB6ISE/B/M8H 2xw2GCxG4HmQOtXpMeJQwlKlOT+R+Y31xE3oJjHaJIOSCBCCjDGwUEA3t8s4zl36tYTE ew== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3py3tk2ejv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 14 Apr 2023 10:47:33 -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; Fri, 14 Apr 2023 10:47:31 -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; Fri, 14 Apr 2023 10:47:31 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.161.183]) by maili.marvell.com (Postfix) with ESMTP id CE99D3F707F; Fri, 14 Apr 2023 10:47:25 -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_R=C3=B6nnblom?= , Kiran Kumar K , , Olivier Matz Subject: [PATCH v2 15/22] pdcp: add timer callback handlers Date: Fri, 14 Apr 2023 23:15:05 +0530 Message-ID: <20230414174512.642-16-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 X-Proofpoint-GUID: Luyf5lG2l6O3NEhD6RIPmdBg2ypGUnqN X-Proofpoint-ORIG-GUID: Luyf5lG2l6O3NEhD6RIPmdBg2ypGUnqN 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 PDCP has a windowing mechanism which allows only packets that fall in a reception window. The pivot point for this window is RX_REORD which happens to be the first missing or next expected packet. If the missing packet is not received after a specified time, then the RX_REORD state variable needs to be moved up to slide the reception window. PDCP relies on timers for such operations. The timer needs to be armed when PDCP library doesn't receive all packets in-order and starts buffering packets that arrived after a missing packet. The timer needs to be cancelled when a missing packet is received. To avoid dependency on particular timer implementation, PDCP library allows application to register two callbacks, timer_start() and timer_stop() that will be called later by library. Signed-off-by: Anoob Joseph Signed-off-by: Volodymyr Fialko --- lib/pdcp/pdcp_entity.h | 2 ++ lib/pdcp/pdcp_process.c | 2 ++ lib/pdcp/rte_pdcp.c | 1 + lib/pdcp/rte_pdcp.h | 47 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h index 71962d7279..ca98a1d0f7 100644 --- a/lib/pdcp/pdcp_entity.h +++ b/lib/pdcp/pdcp_entity.h @@ -120,6 +120,8 @@ enum timer_state { struct pdcp_t_reordering { /** Represent timer state */ enum timer_state state; + /** User defined callback handles */ + struct rte_pdcp_t_reordering handle; }; struct pdcp_cnt_bitmap { diff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c index 16d22cbe14..9ba07d5255 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -874,6 +874,7 @@ pdcp_post_process_update_entity_state(const struct rte_pdcp_entity *entity, if (t_reorder->state == TIMER_RUNNING && en_priv->state.rx_deliv >= en_priv->state.rx_reord) { t_reorder->state = TIMER_STOP; + t_reorder->handle.stop(t_reorder->handle.timer, t_reorder->handle.args); /* Stop reorder buffer, only if it's empty */ if (en_priv->state.rx_deliv == en_priv->state.rx_next) pdcp_reorder_stop(reorder); @@ -888,6 +889,7 @@ pdcp_post_process_update_entity_state(const struct rte_pdcp_entity *entity, en_priv->state.rx_reord = en_priv->state.rx_next; /* Start t-Reordering */ t_reorder->state = TIMER_RUNNING; + t_reorder->handle.start(t_reorder->handle.timer, t_reorder->handle.args); } return processed; diff --git a/lib/pdcp/rte_pdcp.c b/lib/pdcp/rte_pdcp.c index c9d44ca539..755d592578 100644 --- a/lib/pdcp/rte_pdcp.c +++ b/lib/pdcp/rte_pdcp.c @@ -36,6 +36,7 @@ pdcp_dl_establish(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_c struct entity_priv_dl_part *dl = entity_dl_part_get(entity); entity->max_pkt_cache = RTE_MAX(entity->max_pkt_cache, window_size); + dl->t_reorder.handle = conf->t_reordering; return pdcp_reorder_create(&dl->reorder, window_size); } diff --git a/lib/pdcp/rte_pdcp.h b/lib/pdcp/rte_pdcp.h index 0d2f4fe7c1..55e57c3b9b 100644 --- a/lib/pdcp/rte_pdcp.h +++ b/lib/pdcp/rte_pdcp.h @@ -66,6 +66,51 @@ struct rte_pdcp_entity { uint64_t user_area[2]; } __rte_cache_aligned; +/** + * Callback function type for t-Reordering timer start, set during PDCP entity establish. + * This callback is invoked by PDCP library, during t-Reordering timer start event. + * Only one t-Reordering per receiving PDCP entity would be running at a given time. + * + * @see struct rte_pdcp_timer + * @see rte_pdcp_entity_establish() + * + * @param timer + * Pointer to timer. + * @param args + * Pointer to timer arguments. + */ +typedef void (*rte_pdcp_t_reordering_start_cb_t)(void *timer, void *args); + +/** + * Callback function type for t-Reordering timer stop, set during PDCP entity establish. + * This callback will be invoked by PDCP library, during t-Reordering timer stop event. + * + * @see struct rte_pdcp_timer + * @see rte_pdcp_entity_establish() + * + * @param timer + * Pointer to timer. + * @param args + * Pointer to timer arguments. + */ +typedef void (*rte_pdcp_t_reordering_stop_cb_t)(void *timer, void *args); + +/** + * PDCP t-Reordering timer interface + * + * Configuration provided by user, that PDCP library will invoke according to timer behaviour. + */ +struct rte_pdcp_t_reordering { + /** Timer pointer, stored for later use in callback functions */ + void *timer; + /** Timer arguments, stored for later use in callback functions */ + void *args; + /** Timer start callback handle */ + rte_pdcp_t_reordering_start_cb_t start; + /** Timer start callback handle */ + rte_pdcp_t_reordering_stop_cb_t stop; +}; + /** * PDCP entity configuration to be used for establishing an entity. */ @@ -105,6 +150,8 @@ struct rte_pdcp_entity_conf { bool status_report_required; /** Enable out of order delivery. */ bool out_of_order_delivery; + /** t-Reordering timer configuration */ + struct rte_pdcp_t_reordering t_reordering; }; /* >8 End of structure rte_pdcp_entity_conf. */