-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdcp_reorder.h
68 lines (53 loc) · 1.58 KB
/
pdcp_reorder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(C) 2023 Marvell.
*/
#ifndef PDCP_REORDER_H
#define PDCP_REORDER_H
#include <rte_reorder.h>
struct pdcp_reorder {
struct rte_reorder_buffer *buf;
bool is_active;
};
int pdcp_reorder_create(struct pdcp_reorder *reorder, size_t nb_elem, void *mem, size_t mem_size);
/* NOTE: replace with `rte_reorder_memory_footprint_get` after DPDK 23.07 */
#define SIZE_OF_REORDER_BUFFER (4 * RTE_CACHE_LINE_SIZE)
static inline size_t
pdcp_reorder_memory_footprint_get(size_t nb_elem)
{
return SIZE_OF_REORDER_BUFFER + (2 * nb_elem * sizeof(struct rte_mbuf *));
}
static inline uint32_t
pdcp_reorder_get_sequential(struct pdcp_reorder *reorder, struct rte_mbuf **mbufs,
uint32_t max_mbufs)
{
return rte_reorder_drain(reorder->buf, mbufs, max_mbufs);
}
static inline uint32_t
pdcp_reorder_up_to_get(struct pdcp_reorder *reorder, struct rte_mbuf **mbufs,
uint32_t max_mbufs, uint32_t seqn)
{
return rte_reorder_drain_up_to_seqn(reorder->buf, mbufs, max_mbufs, seqn);
}
static inline void
pdcp_reorder_start(struct pdcp_reorder *reorder, uint32_t min_seqn)
{
int ret;
reorder->is_active = true;
ret = rte_reorder_min_seqn_set(reorder->buf, min_seqn);
RTE_VERIFY(ret == 0);
}
static inline void
pdcp_reorder_stop(struct pdcp_reorder *reorder)
{
reorder->is_active = false;
}
static inline void
pdcp_reorder_insert(struct pdcp_reorder *reorder, struct rte_mbuf *mbuf,
rte_reorder_seqn_t pkt_count)
{
int ret;
*rte_reorder_seqn(mbuf) = pkt_count;
ret = rte_reorder_insert(reorder->buf, mbuf);
RTE_VERIFY(ret == 0);
}
#endif /* PDCP_REORDER_H */