RTE_DISTRIBUTOR_NAMESIZE(3)

rte_distributor_single.h(3) πŸ’…

okay bestie, welcome to the Library Functions Manual for rte_distributor_single.h β€” yes it's a header that auto-generated itself a whole manpage, we stan a self-documenting king πŸ‘‘


πŸ¦‹ NAME πŸ¦‹

rte_distributor_single.h β€” that's the whole name, no notes, she's iconic and she knows it ✨


✨ SYNOPSIS ✨

Macros

#define RTE_DISTRIBUTOR_NAMESIZE   32

Functions

struct rte_distributor_single * rte_distributor_create_single (const char *name, unsigned int socket_id, unsigned int num_workers)
int rte_distributor_process_single (struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int num_mbufs)
int rte_distributor_returned_pkts_single (struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int max_mbufs)
int rte_distributor_flush_single (struct rte_distributor_single *d)
void rte_distributor_clear_returns_single (struct rte_distributor_single *d)
struct rte_mbuf * rte_distributor_get_pkt_single (struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt)
int rte_distributor_return_pkt_single (struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *mbuf)
void rte_distributor_request_pkt_single (struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt)
struct rte_mbuf * rte_distributor_poll_pkt_single (struct rte_distributor_single *d, unsigned int worker_id)

🌸 Detailed Description 🌸

RTE distributor 🫢

so the distributor is this component that hands packets out one-at-a-time to workers, and it does dynamic load balancing while it's at it. like a bouncer at the club but for mbufs, and way nicer. 🌈

Definition in file rte_distributor_single.h.


πŸŽ€ Macro Definition Documentation πŸŽ€

#define RTE_DISTRIBUTOR_NAMESIZE 32

Length of name for instance πŸ’– (aka how much room you've got for naming your distributor baby)

Definition at line 20 of file rte_distributor_single.h.


πŸ‘‘ Function Documentation πŸ‘‘

struct rte_mbuf * rte_distributor_create_single (const char * name, unsigned int socket_id, unsigned int num_workers)

Function to create a new distributor instance πŸ”₯

She reserves all the memory the distributor needs to operate, and initializes it to work with the number of workers you configured. Main character energy, born ready. ✨

Parameters

  • name β€” The name to be given to the distributor instance.
  • socket_id β€” The NUMA node on which the memory is to be allocated
  • num_workers β€” The maximum number of workers that will request packets from this distributor

Returns

The newly created distributor instance 🫢


int rte_distributor_process_single (struct rte_distributor_single * d, struct rte_mbuf ** mbufs, unsigned int num_mbufs)

Process a set of packets by distributing them among workers that request packets. The distributor will make sure that no two packets that have the same flow id, or tag, in the mbuf will be processed at the same time. no cap, that's the whole guarantee πŸ’…

The user is advocated to set the tag for each mbuf before calling this function. If the user doesn't set the tag, the tag value can be various values depending on driver implementation and configuration. (translation: set your tag yourself or the driver's gonna pick for you and it might be chaotic πŸ™ˆ)

⚠️ This is not multi-thread safe and should only be called on a single lcore. do NOT get bold with it bestie, one lcore only 😭

Parameters

  • d β€” The distributor instance to be used
  • mbufs β€” The mbufs to be distributed
  • num_mbufs β€” The number of mbufs in the mbufs array

Returns

The number of mbufs processed. πŸ’–


int rte_distributor_returned_pkts_single (struct rte_distributor_single * d, struct rte_mbuf ** mbufs, unsigned int max_mbufs)

Get a set of mbufs that have been returned to the distributor by workers πŸ¦‹

should only be called on the same lcore as rte_distributor_process()

Parameters

  • d β€” The distributor instance to be used
  • mbufs β€” The mbufs pointer array to be filled in
  • max_mbufs β€” The size of the mbufs array

Returns

The number of mbufs returned in the mbufs array. ✨


int rte_distributor_flush_single (struct rte_distributor_single * d)

Flush the distributor component, so that there are no in-flight or backlogged packets awaiting processing 🧹

should only be called on the same lcore as rte_distributor_process()

Parameters

  • d β€” The distributor instance to be used

Returns

The number of queued/in-flight packets that were completed by this call. πŸ’œ


void rte_distributor_clear_returns_single (struct rte_distributor_single * d)

Clears the array of returned packets used as the source for the rte_distributor_returned_pkts() API call. clean slate, fresh start, new me 🌸

should only be called on the same lcore as rte_distributor_process()

Parameters

  • d β€” The distributor instance to be used

struct rte_mbuf * rte_distributor_get_pkt_single (struct rte_distributor_single * d, unsigned int worker_id, struct rte_mbuf * oldpkt)

API called by a worker to get a new packet to process. Any previous packet given to the worker is assumed to have completed processing, and may optionally be returned to the distributor via the oldpkt parameter. πŸŽ€

Parameters

  • d β€” The distributor instance to be used
  • worker_id β€” The worker instance number to use β€” must be less that num_workers passed at distributor creation time.
  • oldpkt β€” The previous packet, if any, being processed by the worker

Returns

A new packet to be processed by the worker thread. πŸ”₯


int rte_distributor_return_pkt_single (struct rte_distributor_single * d, unsigned int worker_id, struct rte_mbuf * mbuf)

API called by a worker to return a completed packet without requesting a new packet β€” for example, because a worker thread is shutting down. it's giving "i'm leaving, here's your stuff back" πŸ’€

Parameters

  • d β€” The distributor instance to be used
  • worker_id β€” The worker instance number to use β€” must be less that num_workers passed at distributor creation time.
  • mbuf β€” The previous packet being processed by the worker

void rte_distributor_request_pkt_single (struct rte_distributor_single * d, unsigned int worker_id, struct rte_mbuf * oldpkt)

API called by a worker to request a new packet to process. Any previous packet given to the worker is assumed to have completed processing, and may optionally be returned to the distributor via the oldpkt parameter. Unlike rte_distributor_get_pkt(), this function does not wait for a new packet to be provided by the distributor. go girl, don't wait up ⭐

NOTE: after calling this function, rte_distributor_poll_pkt() should be used to poll for the packet requested. The rte_distributor_get_pkt() API should not be used to try and retrieve the new packet. mixing them up is not the vibe, bestie, fr fr 🚫

Parameters

  • d β€” The distributor instance to be used
  • worker_id β€” The worker instance number to use β€” must be less that num_workers passed at distributor creation time.
  • oldpkt β€” The previous packet, if any, being processed by the worker

struct rte_mbuf * rte_distributor_poll_pkt_single (struct rte_distributor_single * d, unsigned int worker_id)

API called by a worker to check for a new packet that was previously requested by a call to rte_distributor_request_pkt(). It does not wait for the new packet to be available, but returns NULL if the request has not yet been fulfilled by the distributor. lowkey just checking if your order's ready πŸ“

Parameters

  • d β€” The distributor instance to be used
  • worker_id β€” The worker instance number to use β€” must be less that num_workers passed at distributor creation time.

Returns

A new packet to be processed by the worker thread, or NULL if no packet is yet available. πŸ’…


πŸ’– Author πŸ’–

Generated automatically by Doxygen for DPDK from the source code. yes the docs wrote themselves, we love an independent queen πŸ‘‘


and that's the whole page bestie! this lil masterpiece is from DPDK, Version 25.11.3, and it's rte_distributor_single.h(3) out here living her best life. study it, slay with it, and remember: one lcore, always set your tag, periodt. πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from