API Reference Manual  1.46.0
odp_ipfragreass_reassemble.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2017-2018 Linaro Limited
3  */
4 
7 #ifndef ODP_FRAGREASS_PP_REASSEMBLE_H_
8 #define ODP_FRAGREASS_PP_REASSEMBLE_H_
9 
10 #include <odp_api.h>
11 #include <odp/helper/ip.h>
12 
13 #include "odp_ipfragreass_ip.h"
14 #include "odp_ipfragreass_helpers.h"
15 
16 ODP_STATIC_ASSERT(__SIZEOF_POINTER__ <= 8, "ODP_REASS_PTR__SIZE_ERROR");
17 
22 #define FLOW_TIMEOUT_NS 15000000000ULL
23 
25 #define TS_RES_NS ((uint64_t)1000000)
30 #define EARLIEST_MAX UINT32_MAX
31 
36 #define TS_NOW_TOLERANCE 5000
37 
42 struct flts {
43  uint32_t t;
44 };
45 
49 struct packet {
50  odp_packet_t handle;
51  struct packet *prev;
52  struct flts arrival;
53 };
54 
62 union fraglist {
63  struct {
68  uint32_t earliest;
69 
76  uint32_t part_len:14;
77 
86  uint32_t whole_len:14;
87 
96  struct packet *tail;
97  };
98 
99  odp_u128_t raw;
100 };
101 
107 static inline void init_fraglist(union fraglist *fl)
108 {
109  fl->earliest = EARLIEST_MAX;
110  fl->part_len = 0;
111  fl->whole_len = IP_OCTET_MAX;
112  fl->tail = NULL;
113 }
114 
122 static inline struct packet *prev_packet(struct packet packet)
123 {
124  return packet.prev;
125 }
126 
135 static inline struct packet **prev_packet_ptr(struct packet *packet)
136 {
137  return &packet->prev;
138 }
139 
146 static inline void set_prev_packet(struct packet *packet, struct packet *prev)
147 {
148  packet->prev = prev;
149 }
150 
166 int reassemble_ipv4_packets(odp_atomic_u128_t *fraglists, int num_fraglists,
167  struct packet *fragments, int num_fragments,
168  odp_queue_t out);
169 
178 void garbage_collect_fraglists(odp_atomic_u128_t *fraglists, int num_fraglists,
179  odp_queue_t out, odp_bool_t destroy_all);
180 
181 #endif
#define ODP_STATIC_ASSERT(cond, msg)
Compile time assertion macro.
bool odp_bool_t
Boolean type.
The OpenDataPlane API.
128-bit unsigned integer structure