xref: /dpdk/lib/port/rte_port_frag.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_IP_FRAG_H__
6 #define __INCLUDE_RTE_PORT_IP_FRAG_H__
7 
8 /**
9  * @file
10  * RTE Port for IPv4 Fragmentation
11  *
12  * This port is built on top of pre-initialized single consumer rte_ring. In
13  * order to minimize the amount of packets stored in the ring at any given
14  * time, the IP fragmentation functionality is executed on ring read operation,
15  * hence this port is implemented as an input port. A regular ring_writer port
16  * can be created to write to the same ring.
17  *
18  * The packets written to the ring are either complete IP datagrams or jumbo
19  * frames (i.e. IP packets with length bigger than provided MTU value). The
20  * packets read from the ring are all non-jumbo frames. The complete IP
21  * datagrams written to the ring are not changed. The jumbo frames are
22  * fragmented into several IP packets with length less or equal to MTU.
23  */
24 
25 #include <stdint.h>
26 
27 
28 #include "rte_port.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /** ring_reader_ipv4_frag port parameters */
35 struct rte_port_ring_reader_frag_params {
36 	/** Underlying single consumer ring that has to be pre-initialized. */
37 	struct rte_ring *ring;
38 
39 	/** Maximum Transfer Unit (MTU). Maximum IP packet size (in bytes). */
40 	uint32_t mtu;
41 
42 	/** Size of application dependent meta-data stored per each input packet
43 	    that has to be copied to each of the fragments originating from the
44 	    same input IP datagram. */
45 	uint32_t metadata_size;
46 
47 	/** Pre-initialized buffer pool used for allocating direct buffers for
48 	    the output fragments. */
49 	struct rte_mempool *pool_direct;
50 
51 	/** Pre-initialized buffer pool used for allocating indirect buffers for
52 	    the output fragments. */
53 	struct rte_mempool *pool_indirect;
54 };
55 
56 #define rte_port_ring_reader_ipv4_frag_params rte_port_ring_reader_frag_params
57 
58 #define rte_port_ring_reader_ipv6_frag_params rte_port_ring_reader_frag_params
59 
60 /** ring_reader_ipv4_frag port operations */
61 extern struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops;
62 
63 /** ring_reader_ipv6_frag port operations */
64 extern struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops;
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif
71