New upstream version 18.02
[deb_dpdk.git] / lib / librte_gso / gso_tunnel_tcp4.h
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 #include <rte_mbuf.h>
10
11 /**
12  * Segment a tunneling packet with inner TCP/IPv4 headers. This function
13  * doesn't check if the input packet has correct checksums, and doesn't
14  * update checksums for output GSO segments. Furthermore, it doesn't
15  * process IP fragment packets.
16  *
17  * @param pkt
18  *  The packet mbuf to segment.
19  * @param gso_size
20  *  The max length of a GSO segment, measured in bytes.
21  * @param ipid_delta
22  *  The increasing unit of IP ids.
23  * @param direct_pool
24  *  MBUF pool used for allocating direct buffers for output segments.
25  * @param indirect_pool
26  *  MBUF pool used for allocating indirect buffers for output segments.
27  * @param pkts_out
28  *  Pointer array used to store the MBUF addresses of output GSO
29  *  segments, when it succeeds. If the memory space in pkts_out is
30  *  insufficient, it fails and returns -EINVAL.
31  * @param nb_pkts_out
32  *  The max number of items that 'pkts_out' can keep.
33  *
34  * @return
35  *   - The number of GSO segments filled in pkts_out on success.
36  *   - Return -ENOMEM if run out of memory in MBUF pools.
37  *   - Return -EINVAL for invalid parameters.
38  */
39 int gso_tunnel_tcp4_segment(struct rte_mbuf *pkt,
40                 uint16_t gso_size,
41                 uint8_t ipid_delta,
42                 struct rte_mempool *direct_pool,
43                 struct rte_mempool *indirect_pool,
44                 struct rte_mbuf **pkts_out,
45                 uint16_t nb_pkts_out);
46 #endif