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 call rte_gso_segment(), your application must set proper ol_flags on 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, when rte_gso_segment() succeeds.
  • nb_pkts_out β€” the max number of items that pkts_out can keep.

πŸ‘‘ Returns πŸ‘‘

  1. the number of GSO segments filled in pkts_out on success πŸ’–
  2. return 0 if it does not need to be GSO'd.
  3. return -ENOMEM if run out of memory in MBUF pools 😭
  4. return -ENOTSUP for protocols that can not be segmented πŸ™…
  5. return -EINVAL for 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