DPDK
19.08.2
|
Go to the source code of this file.
Data Structures | |
struct | rte_gso_ctx |
Macros | |
#define | RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) |
Functions | |
int | rte_gso_segment (struct rte_mbuf *pkt, const struct rte_gso_ctx *ctx, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) |
Interface to GSO library
Definition in file rte_gso.h.
#define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) |
int rte_gso_segment | ( | struct rte_mbuf * | pkt, |
const struct rte_gso_ctx * | ctx, | ||
struct rte_mbuf ** | pkts_out, | ||
uint16_t | nb_pkts_out | ||
) |
Segmentation function, which supports processing of both single- and multi- MBUF packets.
Note that we refer to the packets that are segmented from the input packet as 'GSO segments'. rte_gso_segment() doesn't check if the input packet has correct checksums, and doesn't update checksums for output GSO segments. Additionally, it doesn't process IP fragment packets.
Before calling rte_gso_segment(), applications must set proper ol_flags for the packet. The GSO library uses the same macros as that of TSO. For example, set PKT_TX_TCP_SEG and PKT_TX_IPV4 in ol_flags to segment a TCP/IPv4 packet. If rte_gso_segment() succeeds, the PKT_TX_TCP_SEG flag is removed for all GSO segments and the input packet.
Each of the newly-created GSO segments is organized as a two-segment MBUF, where the first segment is a standard MBUF, which stores a copy of packet header, and the second is an indirect MBUF which points to a section of data in the input packet. Since each GSO segment has multiple MBUFs (i.e. typically 2 MBUFs), the driver of the interface which the GSO segments are sent to should support transmission of multi-segment packets.
If the input packet is GSO'd, its mbuf refcnt reduces by 1. Therefore, when all GSO segments are freed, the input packet is freed automatically.
If the memory space in pkts_out or MBUF pools is insufficient, this function fails, and it returns (-1) * errno. Otherwise, GSO succeeds, and this function returns the number of output GSO segments filled in pkts_out.
pkt | The packet mbuf to segment. |
ctx | GSO context object pointer. |
pkts_out | Pointer array used to store the MBUF addresses of output GSO segments, when rte_gso_segment() succeeds. |
nb_pkts_out | The max number of items that pkts_out can keep. |