rte_gso.h(3)
β¨ rte_gso.h β¨
hiii bestie π«Ά welcome to the rte_gso.h(3) page β section 3, so you already know it's giving "library functions manual" energy the whole way down. this is your one-stop vibe for the GSO library interface, no cap. let's get into it π
π NAME π
rte_gso.h β it's the interface to the GSO library, and it's that girl π
π¦ SYNOPSIS π¦
#include <stdint.h>
#include <rte_mbuf.h>
πΈ 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)
π Detailed Description π
literally just: Interface to GSO library. short, sweet, iconic π
fr fr, it's Definition in file rte_gso.h. that's the whole thing, she's mysterious like that π
π Macro Definition Documentation π
#define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0)
okay so this flag means: use fixed IP ids for output GSO segments. and listen β setting it to 0 means you're using incremental IP ids instead. so it's fixed vs. incremental, pick your fighter π₯
Definition at line 29 of file rte_gso.h.
π₯ Function Documentation π₯
int rte_gso_segment (struct rte_mbuf * pkt, const struct rte_gso_ctx * ctx, struct rte_mbuf ** pkts_out, uint16_t nb_pkts_out)
bestie, this is the segmentation function β¨ and she handles both single- and multi-MBUF packets, which is lowkey a lot of range.
so, terminology check real quick: the packets that get segmented out of the input packet are what we call 'GSO segments'. everybody say it with me. π
okay now the stuff you actually need to know, and I'm gonna be so serious for one sec:
rte_gso_segment()doesn't check if the input packet has correct checksums.- and it doesn't update checksums for the output GSO segments.
- and additionally, it doesn't process IP fragment packets.
so don't come for her, she never claimed that π
π¨ before you callrte_gso_segment(), your application must set properol_flagson the packet. periodt.
the GSO library uses the same macros as TSO. example: set RTE_MBUF_F_TX_TCP_SEG and RTE_MBUF_F_TX_IPV4 in ol_flags to segment a TCP/IPv4 packet. (yes, exactly those two, copy them character for character, don't freestyle π)
and if rte_gso_segment() succeeds? the RTE_MBUF_F_TX_TCP_SEG flag gets removed for all GSO segments and the input packet. it's clean like that π§
π¦ how the segments are built (this part is so cool) π¦
each of the newly-created GSO segments is organized as a two-segment MBUF:
- the first segment</> is a standard MBUF β it stores a copy of the packet header π
- the second</> is an indirect MBUF β it points to a section of data in the input packet π
and because each GSO segment has multiple MBUFs (typically 2 MBUFs), the driver of the interface you're sending them to should support transmission of multi-segment packets. tell your NIC to step up, respectfully π
also: if the input packet is GSO'd, all the indirect segments are attached to the input packet.
π the freeing thing (do not skip this) π
rte_gso_segment() will not free the input packet β doesn't matter whether it got GSO'd or not. so the application should free it after calling rte_gso_segment(). no leaking in this house, bestie π«Ά
π what happens when memory said no π
if the memory space in pkts_out or MBUF pools is insufficient, this function fails, and it returns (-1) * errno. otherwise, GSO succeeds, and the function returns the number of output GSO segments filled in pkts_out. slay β¨
π Parameters π
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, whenrte_gso_segment()succeeds.nb_pkts_outβ the max number of items thatpkts_outcan keep.
π Returns π
- the number of GSO segments filled in
pkts_outon success π - return
0if it does not need to be GSO'd. - return
-ENOMEMif run out of memory in MBUF pools π - return
-ENOTSUPfor protocols that can not be segmented π - return
-EINVALfor invalid parameters π
π«Ά Author π«Ά
Generated automatically by Doxygen for DPDK from the source code. β so nobody hand-wrote this, she was born fully formed, main character energy from day one π
and that's the whole page, babe β¨ this was DPDK, Version 25.11.3, and the page itself is rte_gso.h(3) β section 3, library functions manual, exactly where you found her πΈ go forth and segment responsibly, ily, bye ππ¦
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms