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 00A8242BB5; Sat, 27 May 2023 14:09:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8A9D42D4A; Sat, 27 May 2023 14:09:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 8C39642D3F for ; Sat, 27 May 2023 14:09:10 +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 34RBrtuG009297; Sat, 27 May 2023 05:09:09 -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=yipJMZaoBAT6LBJQiHs4vi3C0mzQrYQ5SrVH9PO440A=; b=UjP1wQ3IFTVAlY+DcofbmDYQIQA0b9+JazbLPM34hcHqMb05io68vCvXC8357TS1Pk9x hZqjHeO39pDkH/ITvDzmPgFOsbgbYU6g2lrRmg6aul/RfsNSSC4PLaoBioZjudMdLdUO zlLGOHIQfljuqxk61fmxqeL69uIgg6/3DMncVFLMwuWB9FIQisfVC82EOyVfEb42IV31 UybOTE6qxQfcWag/nm7sYbv9TQ9yW/Fl1XYja8k4Np/lWp7pTCN9X5NhFydFSFUNqKTV 9rgF7AbZazCAdFLhp2rWPIK1bBhERufl5FCXnF4B2YzK6C1r+HwDTAgfGTAGuz+3CByV 5g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3quhcm015s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 27 May 2023 05:09:09 -0700 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.48; Sat, 27 May 2023 05:09:07 -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; Sat, 27 May 2023 05:09:07 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.161.183]) by maili.marvell.com (Postfix) with ESMTP id 44B8F5C7F85; Sat, 27 May 2023 00:17:17 -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 15/21] pdcp: add timer callback handlers Date: Sat, 27 May 2023 12:46:04 +0530 Message-ID: <20230527071610.903-16-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: DsPaQgG-gCwnlaIQ4TbZY0zzQ65FeAtm X-Proofpoint-ORIG-GUID: DsPaQgG-gCwnlaIQ4TbZY0zzQ65FeAtm 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 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 34341cdc11..efc74ba9b9 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 84a0f3a43f..daf2c27363 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -902,6 +902,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); @@ -916,6 +917,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 be37ff392c..a0558b99ae 100644 --- a/lib/pdcp/rte_pdcp.c +++ b/lib/pdcp/rte_pdcp.c @@ -56,6 +56,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 980086a93a..05c922819e 100644 --- a/lib/pdcp/rte_pdcp.h +++ b/lib/pdcp/rte_pdcp.h @@ -67,6 +67,51 @@ struct rte_pdcp_entity { uint32_t max_pkt_cache; } __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 stop callback handle */ + rte_pdcp_t_reordering_stop_cb_t stop; +}; + /** * PDCP entity configuration to be used for establishing an entity. */ @@ -113,6 +158,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. */ -- 2.25.1