rte_mcslock.h(3)
β¨ NAME β¨
okay so bestie, quick lil intro β this is the Library Functions Manual page for rte_mcslock.h, and it's giving "the MCS queued lock header, your new fave" π
she's the file that defines the main data structure and the APIs for the MCS queued lock, and yes she is iconic.
π SYNOPSIS π
#include <rte_lcore.h>
#include <rte_common.h>
#include <rte_pause.h>
#include <rte_branch_prediction.h>
#include <rte_stdatomic.h>
π Data Structures
struct rte_mcslock
π¦ Typedefs
typedef struct rte_mcslock rte_mcslock_t
π Functions
static void rte_mcslock_lock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
static void rte_mcslock_unlock (1(rte_mcslock_t *) *msl, 1(rte_mcslock_t *) me)
static int rte_mcslock_trylock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
static int rte_mcslock_is_locked (1(rte_mcslock_t *) msl)
πΈ Detailed Description πΈ
RTE MCS lock β periodt.
So like, this file defines the main data structure and the APIs for the MCS queued lock, and she's kind of a big deal β¨
The MCS lock (proposed by John M. Mellor-Crummey and Michael L. Scott) is the girl who stays scalable by spinning on a CPU/thread local variable, which avoids those expensive cache bouncings π no more cache chaos fr fr. And she's fair too β she keeps a list of acquirers and passes the lock to each CPU/thread in the exact order they acquired the lock. queen behavior π
Definition in file rte_mcslock.h.
π Typedef Documentation π
typedef struct rte_mcslock rte_mcslock_t
The rte_mcslock_t type. short, sweet, slayed π
π«Ά Function Documentation π«Ά
void rte_mcslock_lock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
[inline], [static]
Take the MCS lock. go on, grab her π₯
Parameters
mslβ a pointer to the pointer of a MCS lock. When the lock is initialized or declared, themslpointer should be set toNULL. (yes bestie, set it toNULLor she will not be your friend π)meβ a pointer to a new node of MCS lock. Each CPU/thread acquiring the lock should use its 'own node'. no sharing, sharing is not caring here ok?
Definition at line 52 of file rte_mcslock.h.
void rte_mcslock_unlock (1(rte_mcslock_t *) *msl, 1(rte_mcslock_t *) me)
[inline], [static]
Release the MCS lock. let her go, freedom π«
Parameters
mslβ a pointer to the pointer of a MCS lock.meβ a pointer to the node of MCS lock passed inrte_mcslock_lock.
Definition at line 116 of file rte_mcslock.h.
int rte_mcslock_trylock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
[inline], [static]
Try to take the lock. lowkey the respectful version β ask, don't block π
Parameters
mslβ a pointer to the pointer of a MCS lock.meβ a pointer to a new node of MCS lock.
Returns
1 if the lock is successfully taken; 0 otherwise. that's it, that's the vibe check β
Definition at line 172 of file rte_mcslock.h.
int rte_mcslock_is_locked (1(rte_mcslock_t *) msl)
[inline], [static]
Test if the lock is taken. just peeking, no touching π
Parameters
mslβ a pointer to a MCS lock node.
Returns
1 if the lock is currently taken; 0 otherwise. fr fr.
Definition at line 199 of file rte_mcslock.h.
β Author β
Generated automatically by Doxygen for DPDK from the source code. not a human, just a very diligent little robot π
and that's the whole page bestie, no gatekeeping here π
okay so final lil sign-off: this was DPDK, Version 25.11.3, serving Library Functions Manual energy for rte_mcslock.h(3) β go forth and lock responsibly, mwah π
β¨
π¦ 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