summaryrefslogtreecommitdiff
path: root/lib/librte_gso/gso_udp4.h
diff options
context:
space:
mode:
authorJiayu Hu <jiayu.hu@intel.com>2018-07-06 09:02:22 +0800
committerThomas Monjalon <thomas@monjalon.net>2018-07-11 23:45:20 +0200
commitb166d4f30b667b054bdd8bd1cbf30610061f8cc0 (patch)
treec6b1018f9138e12c61bf2ada31a55de7d75e4766 /lib/librte_gso/gso_udp4.h
parentf28f3594ded2a55cf8ab15995ffc4f0b9e9eda55 (diff)
downloaddpdk-b166d4f30b667b054bdd8bd1cbf30610061f8cc0.zip
dpdk-b166d4f30b667b054bdd8bd1cbf30610061f8cc0.tar.gz
dpdk-b166d4f30b667b054bdd8bd1cbf30610061f8cc0.tar.xz
gso: support UDP/IPv4 fragmentation
This patch adds GSO support for UDP/IPv4 packets. Supported packets may include a single VLAN tag. UDP/IPv4 GSO doesn't check if input packets have correct checksums, and doesn't update checksums for output packets (the responsibility for this lies with the application). Additionally, UDP/IPv4 GSO doesn't process IP fragmented packets. UDP/IPv4 GSO uses two chained MBUFs, one direct MBUF and one indrect MBUF, to organize an output packet. The direct MBUF stores the packet header, while the indirect mbuf simply points to a location within the original packet's payload. Consequently, use of UDP GSO requires multi-segment MBUF support in the TX functions of the NIC driver. If a packet is GSO'd, UDP/IPv4 GSO reduces its MBUF refcnt by 1. As a result, when all of its GSOed segments are freed, the packet is freed automatically. Signed-off-by: Jiayu Hu <jiayu.hu@intel.com> Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Diffstat (limited to 'lib/librte_gso/gso_udp4.h')
-rw-r--r--lib/librte_gso/gso_udp4.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/librte_gso/gso_udp4.h b/lib/librte_gso/gso_udp4.h
new file mode 100644
index 0000000..b2a2908
--- /dev/null
+++ b/lib/librte_gso/gso_udp4.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#ifndef _GSO_UDP4_H_
+#define _GSO_UDP4_H_
+
+#include <stdint.h>
+#include <rte_mbuf.h>
+
+/**
+ * Segment an UDP/IPv4 packet. This function doesn't check if the input
+ * packet has correct checksums, and doesn't update checksums for output
+ * GSO segments. Furthermore, it doesn't process IP fragment packets.
+ *
+ * @param pkt
+ * The packet mbuf to segment.
+ * @param gso_size
+ * The max length of a GSO segment, measured in bytes.
+ * @param direct_pool
+ * MBUF pool used for allocating direct buffers for output segments.
+ * @param indirect_pool
+ * MBUF pool used for allocating indirect buffers for output segments.
+ * @param pkts_out
+ * Pointer array used to store the MBUF addresses of output GSO
+ * segments, when the function succeeds. If the memory space in
+ * pkts_out is insufficient, it fails and returns -EINVAL.
+ * @param nb_pkts_out
+ * The max number of items that 'pkts_out' can keep.
+ *
+ * @return
+ * - The number of GSO segments filled in pkts_out on success.
+ * - Return -ENOMEM if run out of memory in MBUF pools.
+ * - Return -EINVAL for invalid parameters.
+ */
+int gso_udp4_segment(struct rte_mbuf *pkt,
+ uint16_t gso_size,
+ struct rte_mempool *direct_pool,
+ struct rte_mempool *indirect_pool,
+ struct rte_mbuf **pkts_out,
+ uint16_t nb_pkts_out);
+#endif