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