xref: /dpdk/lib/pdcp/rte_pdcp.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1a702bd09SAnoob Joseph /* SPDX-License-Identifier: BSD-3-Clause
2a702bd09SAnoob Joseph  * Copyright(C) 2023 Marvell.
3a702bd09SAnoob Joseph  */
4a702bd09SAnoob Joseph 
5a702bd09SAnoob Joseph #ifndef RTE_PDCP_H
6a702bd09SAnoob Joseph #define RTE_PDCP_H
7a702bd09SAnoob Joseph 
8a702bd09SAnoob Joseph /**
9a702bd09SAnoob Joseph  * @file rte_pdcp.h
10a702bd09SAnoob Joseph  *
11a702bd09SAnoob Joseph  * RTE PDCP support.
12a702bd09SAnoob Joseph  *
13a702bd09SAnoob Joseph  * A framework for PDCP protocol processing.
14a702bd09SAnoob Joseph  */
15a702bd09SAnoob Joseph 
16a702bd09SAnoob Joseph #include <rte_compat.h>
17a702bd09SAnoob Joseph #include <rte_common.h>
18a702bd09SAnoob Joseph #include <rte_mempool.h>
193a3e8931SAnoob Joseph #include <rte_pdcp_hdr.h>
20a702bd09SAnoob Joseph #include <rte_security.h>
21a702bd09SAnoob Joseph 
22647495bdSAnoob Joseph /* Forward declarations. */
23647495bdSAnoob Joseph struct rte_pdcp_entity;
24647495bdSAnoob Joseph 
25647495bdSAnoob Joseph /* PDCP pre-process function based on entity configuration. */
26647495bdSAnoob Joseph typedef uint16_t (*rte_pdcp_pre_p_t)(const struct rte_pdcp_entity *entity,
27647495bdSAnoob Joseph 				     struct rte_mbuf *mb[],
28647495bdSAnoob Joseph 				     struct rte_crypto_op *cop[],
29647495bdSAnoob Joseph 				     uint16_t num, uint16_t *nb_err);
30647495bdSAnoob Joseph 
31647495bdSAnoob Joseph /* PDCP post-process function based on entity configuration. */
32647495bdSAnoob Joseph typedef uint16_t (*rte_pdcp_post_p_t)(const struct rte_pdcp_entity *entity,
33647495bdSAnoob Joseph 				      struct rte_mbuf *in_mb[],
34647495bdSAnoob Joseph 				      struct rte_mbuf *out_mb[],
35647495bdSAnoob Joseph 				      uint16_t num, uint16_t *nb_err);
36647495bdSAnoob Joseph 
37a702bd09SAnoob Joseph /**
38a702bd09SAnoob Joseph  * PDCP entity.
39a702bd09SAnoob Joseph  *
40a702bd09SAnoob Joseph  * 4.2.2 PDCP entities
41a702bd09SAnoob Joseph  *
42a702bd09SAnoob Joseph  * The PDCP entities are located in the PDCP sublayer.
43a702bd09SAnoob Joseph  * Several PDCP entities may be defined for a UE.
44a702bd09SAnoob Joseph  * Each PDCP entity is carrying the data of one radio bearer.
45a702bd09SAnoob Joseph  * A PDCP entity is associated either to the control plane or the user plane
46a702bd09SAnoob Joseph  * depending on which radio bearer it is carrying data for.
47a702bd09SAnoob Joseph  */
48c6552d9aSTyler Retzlaff struct __rte_cache_aligned rte_pdcp_entity {
49647495bdSAnoob Joseph 	/** Entity specific pre-process handle. */
50647495bdSAnoob Joseph 	rte_pdcp_pre_p_t pre_process;
51647495bdSAnoob Joseph 	/** Entity specific post-process handle. */
52647495bdSAnoob Joseph 	rte_pdcp_post_p_t post_process;
53a702bd09SAnoob Joseph 	/**
54a702bd09SAnoob Joseph 	 * PDCP entities may hold packets for purposes of in-order delivery
55a702bd09SAnoob Joseph 	 * (in case of receiving PDCP entity) and re-transmission
56a702bd09SAnoob Joseph 	 * (in case of transmitting PDCP entity).
57a702bd09SAnoob Joseph 	 *
58a702bd09SAnoob Joseph 	 * The field 'max_pkt_cache' would be used to indicate the maximum
59a702bd09SAnoob Joseph 	 * number of packets that may be cached in an entity at any point of time.
60a702bd09SAnoob Joseph 	 * When application provides buffers to receive packets from PDCP entity,
61a702bd09SAnoob Joseph 	 * the size of the buffer should be such that it can
62a702bd09SAnoob Joseph 	 * hold additionally 'max_pkt_cache' number of packets.
63a702bd09SAnoob Joseph 	 */
64a702bd09SAnoob Joseph 	uint32_t max_pkt_cache;
65c6552d9aSTyler Retzlaff };
66a702bd09SAnoob Joseph 
67a702bd09SAnoob Joseph /**
6879576518SVolodymyr Fialko  * Callback function type for t-Reordering timer start, set during PDCP entity establish.
6979576518SVolodymyr Fialko  * This callback is invoked by PDCP library, during t-Reordering timer start event.
7079576518SVolodymyr Fialko  * Only one t-Reordering per receiving PDCP entity would be running at a given time.
7179576518SVolodymyr Fialko  *
7279576518SVolodymyr Fialko  * @see struct rte_pdcp_timer
7379576518SVolodymyr Fialko  * @see rte_pdcp_entity_establish()
7479576518SVolodymyr Fialko  *
7579576518SVolodymyr Fialko  * @param timer
7679576518SVolodymyr Fialko  *   Pointer to timer.
7779576518SVolodymyr Fialko  * @param args
7879576518SVolodymyr Fialko  *   Pointer to timer arguments.
7979576518SVolodymyr Fialko  */
8079576518SVolodymyr Fialko typedef void (*rte_pdcp_t_reordering_start_cb_t)(void *timer, void *args);
8179576518SVolodymyr Fialko 
8279576518SVolodymyr Fialko /**
8379576518SVolodymyr Fialko  * Callback function type for t-Reordering timer stop, set during PDCP entity establish.
8479576518SVolodymyr Fialko  * This callback will be invoked by PDCP library, during t-Reordering timer stop event.
8579576518SVolodymyr Fialko  *
8679576518SVolodymyr Fialko  * @see struct rte_pdcp_timer
8779576518SVolodymyr Fialko  * @see rte_pdcp_entity_establish()
8879576518SVolodymyr Fialko  *
8979576518SVolodymyr Fialko  * @param timer
9079576518SVolodymyr Fialko  *   Pointer to timer.
9179576518SVolodymyr Fialko  * @param args
9279576518SVolodymyr Fialko  *   Pointer to timer arguments.
9379576518SVolodymyr Fialko  */
9479576518SVolodymyr Fialko typedef void (*rte_pdcp_t_reordering_stop_cb_t)(void *timer, void *args);
9579576518SVolodymyr Fialko 
9679576518SVolodymyr Fialko /**
9779576518SVolodymyr Fialko  * PDCP t-Reordering timer interface
9879576518SVolodymyr Fialko  *
9979576518SVolodymyr Fialko  * Configuration provided by user, that PDCP library will invoke according to timer behaviour.
10079576518SVolodymyr Fialko  */
101f381ac0fSVolodymyr Fialko /* Structure rte_pdcp_t_reordering 8< */
10279576518SVolodymyr Fialko struct rte_pdcp_t_reordering {
10379576518SVolodymyr Fialko 	/** Timer pointer, to be used in callback functions. */
10479576518SVolodymyr Fialko 	void *timer;
10579576518SVolodymyr Fialko 	/** Timer arguments, to be used in callback functions. */
10679576518SVolodymyr Fialko 	void *args;
10779576518SVolodymyr Fialko 	/** Timer start callback handle. */
10879576518SVolodymyr Fialko 	rte_pdcp_t_reordering_start_cb_t start;
10979576518SVolodymyr Fialko 	/** Timer stop callback handle. */
11079576518SVolodymyr Fialko 	rte_pdcp_t_reordering_stop_cb_t stop;
11179576518SVolodymyr Fialko };
112f381ac0fSVolodymyr Fialko /* >8 End of structure rte_pdcp_t_reordering. */
11379576518SVolodymyr Fialko 
11479576518SVolodymyr Fialko /**
115a702bd09SAnoob Joseph  * PDCP entity configuration to be used for establishing an entity.
116a702bd09SAnoob Joseph  */
117a702bd09SAnoob Joseph /* Structure rte_pdcp_entity_conf 8< */
118a702bd09SAnoob Joseph struct rte_pdcp_entity_conf {
119a702bd09SAnoob Joseph 	/** PDCP transform for the entity. */
120a702bd09SAnoob Joseph 	struct rte_security_pdcp_xform pdcp_xfrm;
121a702bd09SAnoob Joseph 	/** Crypto transform applicable for the entity. */
122a702bd09SAnoob Joseph 	struct rte_crypto_sym_xform *crypto_xfrm;
123a702bd09SAnoob Joseph 	/** Mempool for crypto symmetric session. */
124a702bd09SAnoob Joseph 	struct rte_mempool *sess_mpool;
125a702bd09SAnoob Joseph 	/** Crypto op pool. */
126a702bd09SAnoob Joseph 	struct rte_mempool *cop_pool;
1273a3e8931SAnoob Joseph 	/** Mbuf pool to be used for allocating control PDUs.*/
1283a3e8931SAnoob Joseph 	struct rte_mempool *ctrl_pdu_pool;
129a702bd09SAnoob Joseph 	/**
130a702bd09SAnoob Joseph 	 * Sequence number value to be used.
131a702bd09SAnoob Joseph 	 * 32 bit count value to be used for the first packet
132a702bd09SAnoob Joseph 	 * would be derived based on HFN (`rte_security_pdcp_xform.hfn`) and SN.
133a702bd09SAnoob Joseph 	 */
134a702bd09SAnoob Joseph 	uint32_t sn;
135a702bd09SAnoob Joseph 	/** Indicate whether the PDCP entity belongs to Side Link Radio Bearer. */
136a702bd09SAnoob Joseph 	bool is_slrb;
137a702bd09SAnoob Joseph 	/** Enable security offload on the device specified. */
138a702bd09SAnoob Joseph 	bool en_sec_offload;
139a702bd09SAnoob Joseph 	/** Device on which security/crypto session need to be created. */
140a702bd09SAnoob Joseph 	uint8_t dev_id;
141a702bd09SAnoob Joseph 	/**
142a702bd09SAnoob Joseph 	 * Reverse direction during IV generation.
143a702bd09SAnoob Joseph 	 * Can be used to simulate UE crypto processing.
144a702bd09SAnoob Joseph 	 */
145a702bd09SAnoob Joseph 	bool reverse_iv_direction;
1463a3e8931SAnoob Joseph 	/**
1473a3e8931SAnoob Joseph 	 * Status report required (specified in TS 38.331).
1483a3e8931SAnoob Joseph 	 *
1493a3e8931SAnoob Joseph 	 * If PDCP entity is configured to send a PDCP status report,
1503a3e8931SAnoob Joseph 	 * the upper layer application may request a receiving PDCP entity
1513a3e8931SAnoob Joseph 	 * to generate a PDCP status report using ``rte_pdcp_control_pdu_create``.
1523a3e8931SAnoob Joseph 	 * In addition, PDCP status reports may be generated during operations
1533a3e8931SAnoob Joseph 	 * such as entity re-establishment.
1543a3e8931SAnoob Joseph 	 */
1553a3e8931SAnoob Joseph 	bool status_report_required;
156c12cfe62SVolodymyr Fialko 	/** Enable out of order delivery. */
157c12cfe62SVolodymyr Fialko 	bool out_of_order_delivery;
15879576518SVolodymyr Fialko 	/** t-Reordering timer configuration. */
15979576518SVolodymyr Fialko 	struct rte_pdcp_t_reordering t_reordering;
160a702bd09SAnoob Joseph };
161a702bd09SAnoob Joseph /* >8 End of structure rte_pdcp_entity_conf. */
162a702bd09SAnoob Joseph 
163a702bd09SAnoob Joseph /**
164a702bd09SAnoob Joseph  * @warning
165a702bd09SAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
166a702bd09SAnoob Joseph  *
167a702bd09SAnoob Joseph  * 5.1.1 PDCP entity establishment
168a702bd09SAnoob Joseph  *
169a702bd09SAnoob Joseph  * Establish PDCP entity based on provided input configuration.
170a702bd09SAnoob Joseph  *
171a702bd09SAnoob Joseph  * @param conf
172a702bd09SAnoob Joseph  *   Parameters to be used for initializing PDCP entity object.
173a702bd09SAnoob Joseph  * @return
174a702bd09SAnoob Joseph  *   - Valid handle if success
175a702bd09SAnoob Joseph  *   - NULL in case of failure. rte_errno will be set to error code.
176a702bd09SAnoob Joseph  */
177a702bd09SAnoob Joseph __rte_experimental
178a702bd09SAnoob Joseph struct rte_pdcp_entity *
179a702bd09SAnoob Joseph rte_pdcp_entity_establish(const struct rte_pdcp_entity_conf *conf);
180a702bd09SAnoob Joseph 
181a702bd09SAnoob Joseph /**
182a702bd09SAnoob Joseph  * @warning
183a702bd09SAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
184a702bd09SAnoob Joseph  *
185a702bd09SAnoob Joseph  * 5.1.3 PDCP entity release
186a702bd09SAnoob Joseph  *
187a702bd09SAnoob Joseph  * Release PDCP entity.
188a702bd09SAnoob Joseph  *
189a702bd09SAnoob Joseph  * For UL/transmitting PDCP entity, all stored PDCP SDUs would be dropped.
190a702bd09SAnoob Joseph  * For DL/receiving PDCP entity, the stored PDCP SDUs would be returned in
191a702bd09SAnoob Joseph  * *out_mb* buffer. The buffer should be large enough to hold all cached
192a702bd09SAnoob Joseph  * packets in the entity.
193a702bd09SAnoob Joseph  *
194a702bd09SAnoob Joseph  * Entity release would result in freeing all memory associated with the PDCP
195a702bd09SAnoob Joseph  * entity as well as any crypto/security sessions created.
196a702bd09SAnoob Joseph  *
197a702bd09SAnoob Joseph  * @param pdcp_entity
198a702bd09SAnoob Joseph  *   Pointer to the PDCP entity to be released.
199a702bd09SAnoob Joseph  * @param[out] out_mb
200a702bd09SAnoob Joseph  *   The address of an array that can hold up to *rte_pdcp_entity.max_pkt_cache*
201a702bd09SAnoob Joseph  *   pointers to *rte_mbuf* structures.
202a702bd09SAnoob Joseph  * @return
203a702bd09SAnoob Joseph  *   -  0: Success and no cached packets to return
204a702bd09SAnoob Joseph  *   - >0: Success and the number of packets returned in out_mb
205a702bd09SAnoob Joseph  *   - <0: Error code in case of failures
206a702bd09SAnoob Joseph  */
207a702bd09SAnoob Joseph __rte_experimental
208a702bd09SAnoob Joseph int
209a702bd09SAnoob Joseph rte_pdcp_entity_release(struct rte_pdcp_entity *pdcp_entity,
210a702bd09SAnoob Joseph 			struct rte_mbuf *out_mb[]);
211a702bd09SAnoob Joseph 
212a702bd09SAnoob Joseph /**
213a702bd09SAnoob Joseph  * @warning
214a702bd09SAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
215a702bd09SAnoob Joseph  *
216a702bd09SAnoob Joseph  * 5.1.4 PDCP entity suspend
217a702bd09SAnoob Joseph  *
218a702bd09SAnoob Joseph  * Suspend PDCP entity.
219a702bd09SAnoob Joseph  *
220a702bd09SAnoob Joseph  * For DL/receiving PDCP entity, the stored PDCP SDUs would be returned in
221a702bd09SAnoob Joseph  * *out_mb* buffer. The buffer should be large enough to hold all cached
222a702bd09SAnoob Joseph  * packets in the entity.
223a702bd09SAnoob Joseph  *
224a702bd09SAnoob Joseph  * For UL/transmitting PDCP entity, *out_mb* buffer would be unused.
225a702bd09SAnoob Joseph  *
226a702bd09SAnoob Joseph  * @param pdcp_entity
227a702bd09SAnoob Joseph  *   Pointer to the PDCP entity to be suspended.
228a702bd09SAnoob Joseph  * @param[out] out_mb
229a702bd09SAnoob Joseph  *   The address of an array that can hold up to *rte_pdcp_entity.max_pkt_cache*
230a702bd09SAnoob Joseph  *   pointers to *rte_mbuf* structures.
231a702bd09SAnoob Joseph  * @return
232a702bd09SAnoob Joseph  *   -  0: Success and no cached packets to return.
233a702bd09SAnoob Joseph  *   - >0: Success and the number of packets returned in out_mb.
234a702bd09SAnoob Joseph  *   - <0: Error code in case of failures.
235a702bd09SAnoob Joseph  */
236a702bd09SAnoob Joseph __rte_experimental
237a702bd09SAnoob Joseph int
238a702bd09SAnoob Joseph rte_pdcp_entity_suspend(struct rte_pdcp_entity *pdcp_entity,
239a702bd09SAnoob Joseph 			struct rte_mbuf *out_mb[]);
240a702bd09SAnoob Joseph 
241647495bdSAnoob Joseph /**
242647495bdSAnoob Joseph  * @warning
243647495bdSAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
244647495bdSAnoob Joseph  *
2453a3e8931SAnoob Joseph  * Create control PDU packet of the `type` specified. The control PDU packet
2463a3e8931SAnoob Joseph  * would be allocated from *rte_pdcp_entity_conf.ctrl_pdu_pool* by lib PDCP.
2473a3e8931SAnoob Joseph  *
2483a3e8931SAnoob Joseph  * @param pdcp_entity
2493a3e8931SAnoob Joseph  *   Pointer to the PDCP entity for which the control PDU need to be generated.
2503a3e8931SAnoob Joseph  * @param type
2513a3e8931SAnoob Joseph  *   Type of control PDU to be generated.
2523a3e8931SAnoob Joseph  * @return
2533a3e8931SAnoob Joseph  *   - Control PDU generated, in case of success.
2543a3e8931SAnoob Joseph  *   - NULL in case of failure. rte_errno will be set to error code.
2553a3e8931SAnoob Joseph  */
2563a3e8931SAnoob Joseph __rte_experimental
2573a3e8931SAnoob Joseph struct rte_mbuf *
2583a3e8931SAnoob Joseph rte_pdcp_control_pdu_create(struct rte_pdcp_entity *pdcp_entity,
2593a3e8931SAnoob Joseph 			    enum rte_pdcp_ctrl_pdu_type type);
2603a3e8931SAnoob Joseph 
2613a3e8931SAnoob Joseph /**
2623a3e8931SAnoob Joseph  * @warning
2633a3e8931SAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
2643a3e8931SAnoob Joseph  *
265647495bdSAnoob Joseph  * For input mbufs and given PDCP entity pre-process the mbufs and prepare
266647495bdSAnoob Joseph  * crypto ops that can be enqueued to the cryptodev associated with given
267647495bdSAnoob Joseph  * session. Only error packets would be moved returned in the input buffer,
268647495bdSAnoob Joseph  * *mb*, and it is the responsibility of the application to free the same.
269647495bdSAnoob Joseph  *
270647495bdSAnoob Joseph  * @param entity
271647495bdSAnoob Joseph  *   Pointer to the *rte_pdcp_entity* object the packets belong to.
272647495bdSAnoob Joseph  * @param[in, out] mb
273647495bdSAnoob Joseph  *   The address of an array of *num* pointers to *rte_mbuf* structures
274647495bdSAnoob Joseph  *   which contain the input packets.
275647495bdSAnoob Joseph  *   Any error packets would be returned in the same buffer.
276647495bdSAnoob Joseph  * @param[out] cop
277647495bdSAnoob Joseph  *   The address of an array that can hold up to *num* pointers to
278647495bdSAnoob Joseph  *   *rte_crypto_op* structures. Crypto ops would be allocated by
279647495bdSAnoob Joseph  *   ``rte_pdcp_pkt_pre_process`` API.
280647495bdSAnoob Joseph  * @param num
281647495bdSAnoob Joseph  *   The maximum number of packets to process.
282647495bdSAnoob Joseph  * @param[out] nb_err
283647495bdSAnoob Joseph  *   Pointer to return the number of error packets returned in *mb*.
284647495bdSAnoob Joseph  * @return
285647495bdSAnoob Joseph  *   Count of crypto_ops prepared.
286647495bdSAnoob Joseph  */
287647495bdSAnoob Joseph __rte_experimental
288647495bdSAnoob Joseph static inline uint16_t
289647495bdSAnoob Joseph rte_pdcp_pkt_pre_process(const struct rte_pdcp_entity *entity,
290647495bdSAnoob Joseph 			 struct rte_mbuf *mb[], struct rte_crypto_op *cop[],
291647495bdSAnoob Joseph 			 uint16_t num, uint16_t *nb_err)
292647495bdSAnoob Joseph {
293647495bdSAnoob Joseph 	return entity->pre_process(entity, mb, cop, num, nb_err);
294647495bdSAnoob Joseph }
295647495bdSAnoob Joseph 
296647495bdSAnoob Joseph /**
297647495bdSAnoob Joseph  * @warning
298647495bdSAnoob Joseph  * @b EXPERIMENTAL: this API may change without prior notice.
299647495bdSAnoob Joseph  *
300647495bdSAnoob Joseph  * For input mbufs and given PDCP entity, perform PDCP post-processing of the mbufs.
301647495bdSAnoob Joseph  *
302647495bdSAnoob Joseph  * Input mbufs are the ones retrieved from rte_crypto_ops dequeued from cryptodev
303647495bdSAnoob Joseph  * and grouped by *rte_pdcp_pkt_crypto_group()*.
304647495bdSAnoob Joseph  *
305647495bdSAnoob Joseph  * The post-processed packets would be returned in the *out_mb* buffer.
306647495bdSAnoob Joseph  * The resultant mbufs would be grouped into success packets and error packets.
307647495bdSAnoob Joseph  * Error packets would be grouped in the end of the array and
308647495bdSAnoob Joseph  * it is the responsibility of the application to handle the same.
309647495bdSAnoob Joseph  *
310647495bdSAnoob Joseph  * When in-order delivery is enabled, PDCP entity may buffer packets and would
311647495bdSAnoob Joseph  * deliver packets only when all prior packets have been post-processed.
312647495bdSAnoob Joseph  * That would result in returning more/less packets than enqueued.
313647495bdSAnoob Joseph  *
314647495bdSAnoob Joseph  * @param entity
315647495bdSAnoob Joseph  *   Pointer to the *rte_pdcp_entity* object the packets belong to.
316647495bdSAnoob Joseph  * @param in_mb
317647495bdSAnoob Joseph  *   The address of an array of *num* pointers to *rte_mbuf* structures.
318647495bdSAnoob Joseph  * @param[out] out_mb
319c12cfe62SVolodymyr Fialko  *   The address of an array that can hold up to *rte_pdcp_entity.max_pkt_cache*
320c12cfe62SVolodymyr Fialko  *   pointers to *rte_mbuf* structures to output packets after PDCP post-processing.
321647495bdSAnoob Joseph  * @param num
322647495bdSAnoob Joseph  *   The maximum number of packets to process.
323647495bdSAnoob Joseph  * @param[out] nb_err
324647495bdSAnoob Joseph  *   The number of error packets returned in *out_mb* buffer.
325647495bdSAnoob Joseph  * @return
326647495bdSAnoob Joseph  *   Count of packets returned in *out_mb* buffer.
327647495bdSAnoob Joseph  */
328647495bdSAnoob Joseph __rte_experimental
329647495bdSAnoob Joseph static inline uint16_t
330647495bdSAnoob Joseph rte_pdcp_pkt_post_process(const struct rte_pdcp_entity *entity,
331647495bdSAnoob Joseph 			  struct rte_mbuf *in_mb[],
332647495bdSAnoob Joseph 			  struct rte_mbuf *out_mb[],
333647495bdSAnoob Joseph 			  uint16_t num, uint16_t *nb_err)
334647495bdSAnoob Joseph {
335647495bdSAnoob Joseph 	return entity->post_process(entity, in_mb, out_mb, num, nb_err);
336647495bdSAnoob Joseph }
337647495bdSAnoob Joseph 
338482f6b23SAnoob Joseph /**
339f381ac0fSVolodymyr Fialko  * @warning
340f381ac0fSVolodymyr Fialko  * @b EXPERIMENTAL: this API may change without prior notice
341f381ac0fSVolodymyr Fialko  *
342f381ac0fSVolodymyr Fialko  * 5.2.2.2 Actions when a t-Reordering expires
343f381ac0fSVolodymyr Fialko  *
344f381ac0fSVolodymyr Fialko  * When t-Reordering timer expires, PDCP is required to slide the reception
345f381ac0fSVolodymyr Fialko  * window by updating state variables such as RX_REORD & RX_DELIV.
346f381ac0fSVolodymyr Fialko  * PDCP would need to deliver some of the buffered packets
347f381ac0fSVolodymyr Fialko  * based on the state variables and conditions described.
348f381ac0fSVolodymyr Fialko  *
349f381ac0fSVolodymyr Fialko  * The expiry handle need to be invoked by the application when t-Reordering
350f381ac0fSVolodymyr Fialko  * timer expires. In addition to returning buffered packets, it may also restart
351f381ac0fSVolodymyr Fialko  * timer based on the state variables.
352f381ac0fSVolodymyr Fialko  *
353f381ac0fSVolodymyr Fialko  * @param entity
354f381ac0fSVolodymyr Fialko  *   Pointer to the *rte_pdcp_entity* for which the timer expired.
355f381ac0fSVolodymyr Fialko  * @param[out] out_mb
356f381ac0fSVolodymyr Fialko  *   The address of an array that can hold up to *rte_pdcp_entity.max_pkt_cache*
357f381ac0fSVolodymyr Fialko  *   pointers to *rte_mbuf* structures. Used to return buffered packets that are expired.
358f381ac0fSVolodymyr Fialko  * @return
359f381ac0fSVolodymyr Fialko  *   Number of packets returned in *out_mb* buffer.
360f381ac0fSVolodymyr Fialko  */
361f381ac0fSVolodymyr Fialko __rte_experimental
362f381ac0fSVolodymyr Fialko uint16_t
363f381ac0fSVolodymyr Fialko rte_pdcp_t_reordering_expiry_handle(const struct rte_pdcp_entity *entity,
364f381ac0fSVolodymyr Fialko 				    struct rte_mbuf *out_mb[]);
365f381ac0fSVolodymyr Fialko 
366f381ac0fSVolodymyr Fialko /**
367f381ac0fSVolodymyr Fialko  * The header 'rte_pdcp_group.h' depends on defines in 'rte_pdcp.h'.
368f381ac0fSVolodymyr Fialko  * So include in the end.
369482f6b23SAnoob Joseph  */
370482f6b23SAnoob Joseph #include <rte_pdcp_group.h>
371482f6b23SAnoob Joseph 
372a702bd09SAnoob Joseph #ifdef __cplusplus
373*719834a6SMattias Rönnblom extern "C" {
374*719834a6SMattias Rönnblom #endif
375*719834a6SMattias Rönnblom 
376*719834a6SMattias Rönnblom #ifdef __cplusplus
377a702bd09SAnoob Joseph }
378a702bd09SAnoob Joseph #endif
379a702bd09SAnoob Joseph 
380a702bd09SAnoob Joseph #endif /* RTE_PDCP_H */
381