xref: /dpdk/lib/gso/gso_tunnel_tcp4.h (revision e15331dd269da07f7d70a0c7c6b06bd07949c4d1)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4 
5 #ifndef _GSO_TUNNEL_TCP4_H_
6 #define _GSO_TUNNEL_TCP4_H_
7 
8 #include <stdint.h>
9 
10 /**
11  * Segment a tunneling packet with inner TCP/IPv4 headers. This function
12  * doesn't check if the input packet has correct checksums, and doesn't
13  * update checksums for output GSO segments. Furthermore, it doesn't
14  * process IP fragment packets.
15  *
16  * @param pkt
17  *  The packet mbuf to segment.
18  * @param gso_size
19  *  The max length of a GSO segment, measured in bytes.
20  * @param ipid_delta
21  *  The increasing unit of IP ids.
22  * @param direct_pool
23  *  MBUF pool used for allocating direct buffers for output segments.
24  * @param indirect_pool
25  *  MBUF pool used for allocating indirect buffers for output segments.
26  * @param pkts_out
27  *  Pointer array used to store the MBUF addresses of output GSO
28  *  segments, when it succeeds. If the memory space in pkts_out is
29  *  insufficient, it fails and returns -EINVAL.
30  * @param nb_pkts_out
31  *  The max number of items that 'pkts_out' can keep.
32  *
33  * @return
34  *   - The number of GSO segments filled in pkts_out on success.
35  *   - Return -ENOMEM if run out of memory in MBUF pools.
36  *   - Return -EINVAL for invalid parameters.
37  */
38 int gso_tunnel_tcp4_segment(struct rte_mbuf *pkt,
39 		uint16_t gso_size,
40 		uint8_t ipid_delta,
41 		struct rte_mempool *direct_pool,
42 		struct rte_mempool *indirect_pool,
43 		struct rte_mbuf **pkts_out,
44 		uint16_t nb_pkts_out);
45 #endif
46