xref: /dpdk/lib/port/rte_port_frag.h (revision 30a1de105a5f40d77b344a891c4a68f79e815c43)
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 
33 #include "rte_port.h"
34 
35 /** ring_reader_ipv4_frag port parameters */
36 struct rte_port_ring_reader_frag_params {
37 	/** Underlying single consumer ring that has to be pre-initialized. */
38 	struct rte_ring *ring;
39 
40 	/** Maximum Transfer Unit (MTU). Maximum IP packet size (in bytes). */
41 	uint32_t mtu;
42 
43 	/** Size of application dependent meta-data stored per each input packet
44 	    that has to be copied to each of the fragments originating from the
45 	    same input IP datagram. */
46 	uint32_t metadata_size;
47 
48 	/** Pre-initialized buffer pool used for allocating direct buffers for
49 	    the output fragments. */
50 	struct rte_mempool *pool_direct;
51 
52 	/** Pre-initialized buffer pool used for allocating indirect buffers for
53 	    the output fragments. */
54 	struct rte_mempool *pool_indirect;
55 };
56 
57 #define rte_port_ring_reader_ipv4_frag_params rte_port_ring_reader_frag_params
58 
59 #define rte_port_ring_reader_ipv6_frag_params rte_port_ring_reader_frag_params
60 
61 /** ring_reader_ipv4_frag port operations */
62 extern struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops;
63 
64 /** ring_reader_ipv6_frag port operations */
65 extern struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops;
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif
72