rte_soring.h(3)

πŸ“¦
version 25.11.3 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

🌸 rte_soring.h(3) β€” Library Functions Manual 🌸

okay bestie, gather round, because this is the rte_soring.h page and it is a lot πŸ’– it's the DPDK soring (Staged Ordered Ring) header, and she's got macros, functions, the whole wardrobe. no cap, this is part 1 of 3 so buckle up, we are NOT done at the end of this 🫢


✨ NAME ✨

rte_soring.h β€” literally the file. that's the name. iconic of her.


πŸŽ€ SYNOPSIS πŸŽ€

#include <rte_ring.h>

πŸ’… Macros

#define RTE_SORING_ST_BIT   30
#define RTE_SORING_ELEM_MAX   (RTE_BIT32(RTE_SORING_ST_BIT) - 1)

🌈 Functions

__rte_experimental ssize_t rte_soring_get_memsize (const struct
    rte_soring_param *prm)
__rte_experimental int rte_soring_init (struct rte_soring *r, const
    struct rte_soring_param *prm)
__rte_experimental unsigned int rte_soring_count (const struct
    rte_soring *r)
__rte_experimental unsigned int rte_soring_free_count (const struct
    rte_soring *r)
__rte_experimental void rte_soring_dump (FILE *f, const struct
    rte_soring *r)
__rte_experimental uint32_t rte_soring_enqueue_bulk (struct rte_soring
    *r, const void *objs, uint32_t n, uint32_t *free_space)
__rte_experimental uint32_t rte_soring_enqueux_bulk (struct rte_soring
    *r, const void *objs, const void *meta, uint32_t n, uint32_t
    *free_space)
__rte_experimental uint32_t rte_soring_enqueue_burst (struct rte_soring
    *r, const void *objs, uint32_t n, uint32_t *free_space)
__rte_experimental uint32_t rte_soring_enqueux_burst (struct rte_soring
    *r, const void *objs, const void *meta, uint32_t n, uint32_t
    *free_space)
__rte_experimental uint32_t rte_soring_dequeue_bulk (struct rte_soring
    *r, void *objs, uint32_t num, uint32_t *available)
__rte_experimental uint32_t rte_soring_dequeux_bulk (struct rte_soring
    *r, void *objs, void *meta, uint32_t num, uint32_t *available)
__rte_experimental uint32_t rte_soring_dequeue_burst (struct rte_soring
    *r, void *objs, uint32_t num, uint32_t *available)
__rte_experimental uint32_t rte_soring_dequeux_burst (struct rte_soring
    *r, void *objs, void *meta, uint32_t num, uint32_t *available)
__rte_experimental uint32_t rte_soring_acquire_bulk (struct rte_soring
    *r, void *objs, uint32_t stage, uint32_t num, uint32_t *ftoken,
    uint32_t *available)
__rte_experimental uint32_t rte_soring_acquirx_bulk (struct rte_soring
    *r, void *objs, void *meta, uint32_t stage, uint32_t num, uint32_t
    *ftoken, uint32_t *available)
__rte_experimental uint32_t rte_soring_acquire_burst (struct rte_soring
    *r, void *objs, uint32_t stage, uint32_t num, uint32_t *ftoken,
    uint32_t *available)
__rte_experimental uint32_t rte_soring_acquirx_burst (struct rte_soring
    *r, void *objs, void *meta, uint32_t stage, uint32_t num, uint32_t
    *ftoken, uint32_t *available)
__rte_experimental void rte_soring_release (struct rte_soring *r, const
    void *objs, uint32_t stage, uint32_t n, uint32_t ftoken)
__rte_experimental void rte_soring_releasx (struct rte_soring *r, const
    void *objs, const void *meta, uint32_t stage, uint32_t n, uint32_t
    ftoken)

πŸ¦‹ Detailed Description πŸ¦‹

so this file is literally the definition of the DPDK soring (that's Staged Ordered Ring, say it with your chest) public API. brief rundown because bestie you deserve context:

enqueue/dequeue behaves exactly like a conventional rte_ring β€” any rte_ring sync types work, all of them, etc. ✨ but ALSO, plot twist, there can be multiple stages. for each stage there's an acquire (start) and a release (finish) operation. once some elems are 'acquired', the user can safely assume they have exclusive possession of those elems until 'release' for them is done. πŸ’…

heads up though: as of right now, the user has to release exactly the same number of elems they acquired before. no take-backs, no leftovers, fr.

after 'release', elems can be 'acquired' by the next stage and/or dequeued (in the case of the last stage).

extra debugging can be enabled with the RTE_SORING_DEBUG macro πŸ›

Definition in file rte_soring.h.


🧚 Macro Definition Documentation 🧚

#define RTE_SORING_ST_BIT 30

the upper 2 bits are used for status πŸ‘‘

Definition at line 33 of file rte_soring.h.

#define RTE_SORING_ELEM_MAX (RTE_BIT32(RTE_SORING_ST_BIT) - 1)

the max possible number of elements in the soring. that's the ceiling, bestie, we don't go above it πŸŽ€

Definition at line 36 of file rte_soring.h.


⭐ Function Documentation ⭐

Warning πŸ’€ EXPERIMENTAL: this API may change without prior notice.

okay so every single function down here carries that same warning, so I'm putting it up top once, and then you mentally stamp it on every entry below, k? every. single. one. πŸ“Œ


🫢 rte_soring_get_memsize

__rte_experimental ssize_t rte_soring_get_memsize (const struct
    rte_soring_param * prm)
Warning EXPERIMENTAL: this API may change without prior notice.

calculate the memory size needed for a soring πŸ’–

this function returns the number of bytes needed for a soring, given the expected parameters for it. this value is the sum of the size of the internal metadata plus the size of the memory needed by the actual soring elements and their metadata. and the value is aligned to a cache line size ✨ (she's tidy like that).

Parameters

  • prm β€” pointer to the structure that contains soring creation parameters.

Returns

  • the memory size needed for the soring on success πŸ’…
  • -EINVAL if the provided parameter values are invalid 😭

🌸 rte_soring_init

__rte_experimental int rte_soring_init (struct rte_soring * r, const struct
    rte_soring_param * prm)
Warning EXPERIMENTAL: this API may change without prior notice.

initialize a soring structure πŸŽ€

initialize a soring structure in memory pointed by "r". the size of the memory area must be large enough to store the soring internal structures plus the objects and metadata tables. and it is strongly advised to use rte_soring_get_memsize() to get the appropriate size. do not eyeball it, bestie, use the function πŸ™ˆ

Parameters

  • r β€” pointer to the soring structure.
  • prm β€” pointer to the structure that contains soring creation parameters.

Returns

  • 0 on success, or a negative error code.

🌈 rte_soring_count

__rte_experimental unsigned int rte_soring_count (const struct rte_soring *
    r)
Warning EXPERIMENTAL: this API may change without prior notice.

return the total number of filled entries in a soring πŸ’–

Parameters

  • r β€” a pointer to the soring structure.

Returns

  • the number of entries in the soring.

✨ rte_soring_free_count

__rte_experimental unsigned int rte_soring_free_count (const struct
    rte_soring * r)
Warning EXPERIMENTAL: this API may change without prior notice.

return the total number of unfilled entries in a soring πŸ¦‹ (the empty seats, the available vibes).

Parameters

  • r β€” a pointer to the soring structure.

Returns

  • the number of free entries in the soring.

πŸ’œ rte_soring_dump

__rte_experimental void rte_soring_dump (FILE * f, const struct rte_soring *
    r)
Warning EXPERIMENTAL: this API may change without prior notice.

dump the status of the soring πŸ“‹ spill the tea, soring, what's your status.

Parameters

  • f β€” a pointer to a file for output
  • r β€” pointer to the soring structure.

πŸŽ€ rte_soring_enqueue_bulk

__rte_experimental uint32_t rte_soring_enqueue_bulk (struct rte_soring * r,
    const void * objs, uint32_t n, uint32_t * free_space)
Warning EXPERIMENTAL: this API may change without prior notice.

enqueue several objects on the soring. enqueues exactly the requested number of objects or none β€” it's all or nothing, she does not do half measures πŸ’…

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to enqueue. the size of objects to enqueue must be the same value as the 'elem_size' parameter used while creating the soring. otherwise the results are undefined πŸ’€
  • n β€” the number of objects to add in the soring from the 'objs'.
  • free_space β€” if non-NULL, returns the amount of space in the soring after the enqueue operation has finished.

Returns

  • actual number of objects enqueued, either 0 or n.

🌟 rte_soring_enqueux_bulk

__rte_experimental uint32_t rte_soring_enqueux_bulk (struct rte_soring * r,
    const void * objs, const void * meta, uint32_t n, uint32_t * free_space)
Warning EXPERIMENTAL: this API may change without prior notice.

enqueue several objects plus metadata on the soring. enqueues exactly the requested number of objects or none ✨

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to enqueue. the size of objects to enqueue must be the same value as the 'elem_size' parameter used while creating the soring. otherwise the results are undefined πŸ’€
  • meta β€” a pointer to an array of metadata values for each object to enqueue. note that if the user isn't using object metadata values, then this parameter can be NULL. the size of elements in this array must be the same value as the 'meta_size' parameter used while creating the soring. if the user created the soring with a 'meta_size' value equal to zero, then the 'meta' parameter should be NULL. otherwise the results are undefined πŸ™ˆ
  • n β€” the number of objects to add in the soring from the 'objs'.
  • free_space β€” if non-NULL, returns the amount of space in the soring after the enqueue operation has finished.

Returns

  • actual number of objects enqueued, either 0 or n.

πŸ¦‹ rte_soring_enqueue_burst

__rte_experimental uint32_t rte_soring_enqueue_burst (struct rte_soring * r,
    const void * objs, uint32_t n, uint32_t * free_space)
Warning EXPERIMENTAL: this API may change without prior notice.

enqueue several objects on the soring. enqueues up to the requested number of objects β€” see, burst is flexible, bulk is strict. know the difference bestie 🫢

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to enqueue. the size of objects to enqueue must be the same value as the 'elem_size' parameter used while creating the soring. otherwise the results are undefined πŸ’€
  • n β€” the number of objects to add in the soring from the 'objs'.
  • free_space β€” if non-NULL, returns the amount of space in the soring after the enqueue operation has finished.

Returns

  • actual number of objects enqueued.

πŸ’– rte_soring_enqueux_burst

__rte_experimental uint32_t rte_soring_enqueux_burst (struct rte_soring * r,
    const void * objs, const void * meta, uint32_t n, uint32_t * free_space)
Warning EXPERIMENTAL: this API may change without prior notice.

enqueue several objects plus metadata on the soring. enqueues up to the requested number of objects ✨

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to enqueue. the size of objects to enqueue must be the same value as the 'elem_size' parameter used while creating the soring. otherwise the results are undefined πŸ’€
  • meta β€” a pointer to an array of metadata values for each object to enqueue. note that if the user isn't using object metadata values, then this parameter can be NULL. the size of elements in this array must be the same value as the 'meta_size' parameter used while creating the soring. if the user created the soring with a 'meta_size' value equal to zero, then the 'meta' parameter should be NULL. otherwise the results are undefined πŸ™ˆ
  • n β€” the number of objects to add in the soring from the 'objs'.
  • free_space β€” if non-NULL, returns the amount of space in the soring after the enqueue operation has finished.

Returns

  • actual number of objects enqueued.

πŸ”₯ rte_soring_dequeue_bulk

__rte_experimental uint32_t rte_soring_dequeue_bulk (struct rte_soring * r,
    void * objs, uint32_t num, uint32_t * available)
Warning EXPERIMENTAL: this API may change without prior notice.

dequeue several objects from the soring. dequeues exactly the requested number of objects or none πŸ’…


and that's where part 1 runs out, bestie β€” there's more coming in part 2, don't go anywhere, we are SO not finished 😭

Parameters

  • r β€” a pointer to the soring structure πŸ’–
  • objs β€” a pointer to an array of objects to dequeue. Size of objects to enqueue must be the same value as the elem_size parameter you used while creating the soring. If it's not, the results are undefined β€” like, genuinely don't πŸ™ˆ
  • num β€” the number of objects to dequeue from the soring into the objs.
  • available β€” if it's non-NULL, it gives you back the number of remaining soring entries after the dequeue has finished. cute little receipt ✨

Returns

  • Actual number of objects dequeued, either 0 or num.

__rte_experimental uint32_t rte_soring_dequeux_bulk(struct rte_soring * r, void * objs, void * meta, uint32_t num, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice. she's still in her testing era πŸ’…

Dequeue several objects plus metadata from the soring. Bestie, it's all-or-nothing: it dequeues exactly the requested number of objects, or none. No in-between, that's the vibe πŸŽ€

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to dequeue. Size of objects to enqueue must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined 🫠
  • meta β€” a pointer to an array of metadata values, one for each object to dequeue. Quick note: if you're not using object metadata values, this parameter can be NULL. The size of the elements in this array must be the same value as the meta_size parameter used while creating the soring. And if you created the soring with meta_size equal to zero, then meta should be NULL. Otherwise the results are undefined, fr fr.
  • num β€” the number of objects to dequeue from the soring into the objs.
  • available β€” if non-NULL, returns the number of remaining soring entries after the dequeue has finished.

Returns

  • Actual number of objects dequeued, either 0 or num.

__rte_experimental uint32_t rte_soring_dequeue_burst(struct rte_soring * r, void * objs, uint32_t num, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Dequeue several objects from the soring β€” and this one is the chill version, she dequeues up to the requested number of objects 🌸

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to dequeue. Size of objects to enqueue must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • num β€” the number of objects to dequeue from the soring into the objs.
  • available β€” if non-NULL, returns the number of remaining soring entries after the dequeue has finished.

Returns

  • Actual number of objects dequeued. (Could be fewer than num, that's just her.)

__rte_experimental uint32_t rte_soring_dequeux_burst(struct rte_soring * r, void * objs, void * meta, uint32_t num, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Dequeue several objects plus metadata from the soring, up to the requested number of objects πŸ’« it's giving "burst but make it fancy."

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to dequeue. Size of objects to enqueue must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • meta β€” a pointer to an array of metadata values for each object to dequeue. Note that if the user isn't using object metadata values, this parameter can be NULL. The size of the elements in this array must be the same value as the meta_size parameter used while creating the soring. If the user created the soring with meta_size equal to zero, then meta should be NULL. Otherwise the results are undefined 😭
  • num β€” the number of objects to dequeue from the soring into the objs.
  • available β€” if non-NULL, returns the number of remaining soring entries after the dequeue has finished.

Returns

  • Actual number of objects dequeued.

__rte_experimental uint32_t rte_soring_acquire_bulk(struct rte_soring * r, void * objs, uint32_t stage, uint32_t num, uint32_t * ftoken, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Acquire several objects from the soring for a given stage 🎯 Again: exactly the requested number of objects, or none. Iconic commitment, honestly. πŸ‘‘

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to acquire. Size of objects must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • stage β€” the stage to acquire objects for.
  • num β€” the number of objects to acquire.
  • ftoken β€” a pointer to the opaque token value used by the release() op. You, bestie, have to store this value somewhere, and hand it back later to release(). Don't lose it πŸ’€
  • available β€” if non-NULL, returns the number of remaining soring entries for the given stage after the acquire has finished.

Returns

  • Actual number of objects acquired, either 0 or num.

__rte_experimental uint32_t rte_soring_acquirx_bulk(struct rte_soring * r, void * objs, void * meta, uint32_t stage, uint32_t num, uint32_t * ftoken, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Acquire several objects plus metadata from the soring for a given stage. Acquires exactly the requested number of objects, or none β€” the x in the name is the main character energy ✨

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to acquire. Size of objects must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • meta β€” a pointer to an array of metadata values for each acquired object. Note that if the user isn't using object metadata values, this parameter can be NULL. The size of the elements in this array must be the same value as the meta_size parameter used while creating the soring. If the user created the soring with meta_size equal to zero, then meta should be NULL. Otherwise the results are undefined πŸ™ˆ
  • stage β€” the stage to acquire objects for.
  • num β€” the number of objects to acquire.
  • ftoken β€” a pointer to the opaque token value used by the release() op. You have to store this value somewhere and later provide it to the release(). Guard it with your life 🫢
  • available β€” if non-NULL, returns the number of remaining soring entries for the given stage after the acquire has finished.

Returns

  • Actual number of objects acquired, either 0 or num.

__rte_experimental uint32_t rte_soring_acquire_burst(struct rte_soring * r, void * objs, uint32_t stage, uint32_t num, uint32_t * ftoken, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Acquire several objects from the soring for a given stage β€” up to the requested number of objects this time 🌈 she's flexible like that.

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to acquire. Size of objects must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • stage β€” the stage to acquire objects for.
  • num β€” the number of objects to acquire.
  • ftoken β€” a pointer to the opaque token value used by the release() op. The user has to store this value somewhere, and later provide it to the release(). No storing it in your camera roll and forgetting, okay 😭
  • available β€” if non-NULL, returns the number of remaining soring entries for the given stage after the acquire has finished.

Returns

  • Actual number of objects acquired.

__rte_experimental uint32_t rte_soring_acquirx_burst(struct rte_soring * r, void * objs, void * meta, uint32_t stage, uint32_t num, uint32_t * ftoken, uint32_t * available)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Acquire several objects plus metadata from the soring for a given stage, up to the requested number of objects πŸ’œ the deluxe combo, the full set, the whole package.

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to acquire. Size of objects must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • meta β€” a pointer to an array of metadata values for each acquired object. Note that if the user isn't using object metadata values, this parameter can be NULL. The size of the elements in this array must be the same value as the meta_size parameter used while creating the soring. If the user created the soring with meta_size equal to zero, then meta should be NULL. Otherwise the results are undefined πŸ’€
  • stage β€” the stage to acquire objects for.
  • num β€” the number of objects to acquire.
  • ftoken β€” a pointer to the opaque token value used by the release() op. The user has to store this value somewhere, and later provide it to the release(). Treasure it. Put it in a little box. πŸŽ€
  • available β€” if non-NULL, returns the number of remaining soring entries for the given stage after the acquire has finished.

Returns

  • Actual number of objects acquired.

__rte_experimental void rte_soring_release(struct rte_soring * r, const void * objs, uint32_t stage, uint32_t n, uint32_t ftoken)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Release several objects for a given stage back to the soring πŸ¦‹ Heads up though: this means these objects become available for the next stage or for dequeue. You're handing them back to the group chat, they're circulating again.

Parameters

  • r β€” a pointer to the soring structure.
  • objs β€” a pointer to an array of objects to release. Note that unless the user needs to overwrite soring objects, this parameter can be NULL. Size of objects must be the same value as the elem_size parameter used while creating the soring. Otherwise the results are undefined.
  • stage β€” the current stage.
  • n β€” the number of objects to release. Has to be the same value as what was returned by the acquire() op. Matching values only, bestie, it's a duo costume situation πŸ‘―
  • ftoken β€” the opaque token value obtained from the acquire() op.

__rte_experimental void rte_soring_releasx(struct rte_soring * r, const void * objs, const void * meta, uint32_t stage, uint32_t n, uint32_t ftoken)

⚠️ EXPERIMENTAL: this API may change without prior notice.

Release several objects plus metadata for a given stage back to the soring 🌸 And yeah, same deal as before: this means these objects become available for the next stage or dequeue. She's back in circulation, periodt.

πŸ’– Parameters πŸ’–

okay bestie, here's the tea on every single argument this release op takes β˜•βœ¨ no skipping, we list them ALL:

  • r β€” a pointer to the soring structure. that's it, that's the whole vibe 🫢
  • objs β€” a pointer to an array of objects you wanna release. important note: unless you actually need to overwrite the soring objects, this parameter can be NULL. but the size of your objects has to be the exact same value as the elem_size parameter you used when you created the soring πŸŽ€ if it isn't?? the results are undefined β€” like, no cap, undefined. we don't do that here πŸ’€
  • meta β€” a pointer to an array of metadata values, one for each object you're releasing. another note: if you're not using object metadata values at all, then this parameter can be NULL, easy. but the size of the elements in this array has to match the meta_size parameter you used when creating the soring ✨ and if you created the soring with meta_size equal to zero, then meta should be NULL. otherwise the results are undefined β€” periodt, don't test it πŸ™ˆ
  • stage β€” the current stage. just... the stage πŸ¦‹
  • n β€” the number of objects to release. this one has to be the same value as what the acquire() op returned. no creative liberties allowed, bestie πŸ’…
  • ftoken β€” the opaque 'token' value you got from the acquire() op. opaque means don't peek inside it, just hand it back like a good girlie πŸ”₯

πŸ‘‘ Author πŸ‘‘

generated automatically by Doxygen for DPDK from the source code. i did NOT hand-write that part, the robots handled it and honestly? they ate πŸ€–βœ¨


aaaaand that's a wrap on rte_soring.h(3) β€” sourced from DPDK, Version 25.11.3, and this whole glow-up was brought to you by the rte_soring.h(3) page itself 🌸 go forth and sort, you absolute icon, i'm literally so proud of you πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from