DPDK 22.11.7
rte_ip_frag.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef _RTE_IP_FRAG_H_
6#define _RTE_IP_FRAG_H_
7
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#include <stdint.h>
20#include <stdio.h>
21
22#include <rte_compat.h>
23#include <rte_config.h>
24#include <rte_malloc.h>
25#include <rte_memory.h>
26#include <rte_ip.h>
27#include <rte_byteorder.h>
28
29struct rte_mbuf;
30
32#define RTE_IP_FRAG_DEATH_ROW_LEN 32
33
35#define RTE_IP_FRAG_DEATH_ROW_MBUF_LEN \
36 (RTE_IP_FRAG_DEATH_ROW_LEN * (RTE_LIBRTE_IP_FRAG_MAX_FRAG + 1))
37
40 uint32_t cnt;
43};
44
64struct rte_ip_frag_tbl * rte_ip_frag_table_create(uint32_t bucket_num,
65 uint32_t bucket_entries, uint32_t max_entries,
66 uint64_t max_cycles, int socket_id);
67
74void
75rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl);
76
98int32_t
100 struct rte_mbuf **pkts_out,
101 uint16_t nb_pkts_out,
102 uint16_t mtu_size,
103 struct rte_mempool *pool_direct,
104 struct rte_mempool *pool_indirect);
105
127struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
128 struct rte_ip_frag_death_row *dr,
129 struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr,
130 struct rte_ipv6_fragment_ext *frag_hdr);
131
143static inline struct rte_ipv6_fragment_ext *
145{
146 if (hdr->proto == IPPROTO_FRAGMENT) {
147 return (struct rte_ipv6_fragment_ext *) ++hdr;
148 }
149 else
150 return NULL;
151}
152
176int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
177 struct rte_mbuf **pkts_out,
178 uint16_t nb_pkts_out, uint16_t mtu_size,
179 struct rte_mempool *pool_direct,
180 struct rte_mempool *pool_indirect);
181
208__rte_experimental
209int32_t
211 struct rte_mbuf **pkts_out,
212 uint16_t nb_pkts_out,
213 uint16_t mtu_size,
214 struct rte_mempool *pool_direct);
215
235struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
236 struct rte_ip_frag_death_row *dr,
237 struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr);
238
247static inline int
249{
250 uint16_t flag_offset, ip_flag, ip_ofs;
251
252 flag_offset = rte_be_to_cpu_16(hdr->fragment_offset);
253 ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK);
254 ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG);
255
256 return ip_flag != 0 || ip_ofs != 0;
257}
258
268 uint32_t prefetch);
269
270
279void
280rte_ip_frag_table_statistics_dump(FILE * f, const struct rte_ip_frag_tbl *tbl);
281
292__rte_experimental
293void
294rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
295 struct rte_ip_frag_death_row *dr, uint64_t tms);
296
301#define IP_FRAG_DEATH_ROW_LEN RTE_IP_FRAG_DEATH_ROW_LEN
303#define IP_FRAG_DEATH_ROW_MBUF_LEN RTE_IP_FRAG_DEATH_ROW_MBUF_LEN
305#define ipv6_extension_fragment rte_ipv6_fragment_ext
308#ifdef __cplusplus
309}
310#endif
311
312#endif /* _RTE_IP_FRAG_H_ */
static uint16_t rte_be_to_cpu_16(rte_be16_t x)
int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size, struct rte_mempool *pool_direct, struct rte_mempool *pool_indirect)
static int rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr *hdr)
Definition: rte_ip_frag.h:248
static struct rte_ipv6_fragment_ext * rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr)
Definition: rte_ip_frag.h:144
__rte_experimental void rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, uint64_t tms)
void rte_ip_frag_table_statistics_dump(FILE *f, const struct rte_ip_frag_tbl *tbl)
struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr)
struct rte_ip_frag_tbl * rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, uint32_t max_entries, uint64_t max_cycles, int socket_id)
#define RTE_IP_FRAG_DEATH_ROW_MBUF_LEN
Definition: rte_ip_frag.h:35
struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
void rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl)
__rte_experimental int32_t rte_ipv4_fragment_copy_nonseg_packet(struct rte_mbuf *pkt_in, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size, struct rte_mempool *pool_direct)
int32_t rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size, struct rte_mempool *pool_direct, struct rte_mempool *pool_indirect)
void rte_ip_frag_free_death_row(struct rte_ip_frag_death_row *dr, uint32_t prefetch)
struct rte_mbuf * row[RTE_IP_FRAG_DEATH_ROW_MBUF_LEN]
Definition: rte_ip_frag.h:41
rte_be16_t fragment_offset
Definition: rte_ip.h:59
uint8_t proto
Definition: rte_ip.h:541