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