xref: /dpdk/lib/port/rte_port_frag.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2010-2014 Intel Corporation
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson 
599a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_PORT_IP_FRAG_H__
699a2dd95SBruce Richardson #define __INCLUDE_RTE_PORT_IP_FRAG_H__
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson /**
999a2dd95SBruce Richardson  * @file
1099a2dd95SBruce Richardson  * RTE Port for IPv4 Fragmentation
1199a2dd95SBruce Richardson  *
1299a2dd95SBruce Richardson  * This port is built on top of pre-initialized single consumer rte_ring. In
1399a2dd95SBruce Richardson  * order to minimize the amount of packets stored in the ring at any given
1499a2dd95SBruce Richardson  * time, the IP fragmentation functionality is executed on ring read operation,
1599a2dd95SBruce Richardson  * hence this port is implemented as an input port. A regular ring_writer port
1699a2dd95SBruce Richardson  * can be created to write to the same ring.
1799a2dd95SBruce Richardson  *
1899a2dd95SBruce Richardson  * The packets written to the ring are either complete IP datagrams or jumbo
1999a2dd95SBruce Richardson  * frames (i.e. IP packets with length bigger than provided MTU value). The
2099a2dd95SBruce Richardson  * packets read from the ring are all non-jumbo frames. The complete IP
2199a2dd95SBruce Richardson  * datagrams written to the ring are not changed. The jumbo frames are
2299a2dd95SBruce Richardson  * fragmented into several IP packets with length less or equal to MTU.
233e4c5be9SThomas Monjalon  */
2499a2dd95SBruce Richardson 
2599a2dd95SBruce Richardson #include <stdint.h>
2699a2dd95SBruce Richardson 
2799a2dd95SBruce Richardson 
2899a2dd95SBruce Richardson #include "rte_port.h"
2999a2dd95SBruce Richardson 
30*719834a6SMattias Rönnblom #ifdef __cplusplus
31*719834a6SMattias Rönnblom extern "C" {
32*719834a6SMattias Rönnblom #endif
33*719834a6SMattias Rönnblom 
3499a2dd95SBruce Richardson /** ring_reader_ipv4_frag port parameters */
3599a2dd95SBruce Richardson struct rte_port_ring_reader_frag_params {
3699a2dd95SBruce Richardson 	/** Underlying single consumer ring that has to be pre-initialized. */
3799a2dd95SBruce Richardson 	struct rte_ring *ring;
3899a2dd95SBruce Richardson 
3999a2dd95SBruce Richardson 	/** Maximum Transfer Unit (MTU). Maximum IP packet size (in bytes). */
4099a2dd95SBruce Richardson 	uint32_t mtu;
4199a2dd95SBruce Richardson 
4299a2dd95SBruce Richardson 	/** Size of application dependent meta-data stored per each input packet
4399a2dd95SBruce Richardson 	    that has to be copied to each of the fragments originating from the
4499a2dd95SBruce Richardson 	    same input IP datagram. */
4599a2dd95SBruce Richardson 	uint32_t metadata_size;
4699a2dd95SBruce Richardson 
4799a2dd95SBruce Richardson 	/** Pre-initialized buffer pool used for allocating direct buffers for
4899a2dd95SBruce Richardson 	    the output fragments. */
4999a2dd95SBruce Richardson 	struct rte_mempool *pool_direct;
5099a2dd95SBruce Richardson 
5199a2dd95SBruce Richardson 	/** Pre-initialized buffer pool used for allocating indirect buffers for
5299a2dd95SBruce Richardson 	    the output fragments. */
5399a2dd95SBruce Richardson 	struct rte_mempool *pool_indirect;
5499a2dd95SBruce Richardson };
5599a2dd95SBruce Richardson 
5699a2dd95SBruce Richardson #define rte_port_ring_reader_ipv4_frag_params rte_port_ring_reader_frag_params
5799a2dd95SBruce Richardson 
5899a2dd95SBruce Richardson #define rte_port_ring_reader_ipv6_frag_params rte_port_ring_reader_frag_params
5999a2dd95SBruce Richardson 
6099a2dd95SBruce Richardson /** ring_reader_ipv4_frag port operations */
6199a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops;
6299a2dd95SBruce Richardson 
6399a2dd95SBruce Richardson /** ring_reader_ipv6_frag port operations */
6499a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops;
6599a2dd95SBruce Richardson 
6699a2dd95SBruce Richardson #ifdef __cplusplus
6799a2dd95SBruce Richardson }
6899a2dd95SBruce Richardson #endif
6999a2dd95SBruce Richardson 
7099a2dd95SBruce Richardson #endif
71