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