CNDP  22.08.0
cne_ring_api_internal.h File Reference

Go to the source code of this file.

Functions

unsigned int cne_ring_mp_enqueue_bulk (cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
 
unsigned int cne_ring_sp_enqueue_bulk (cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
 
__cne_always_inline int cne_ring_mp_enqueue (cne_ring_t *r, void *obj)
 
__cne_always_inline int cne_ring_sp_enqueue (cne_ring_t *r, void *obj)
 
unsigned int cne_ring_mc_dequeue_bulk (cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
 
unsigned int cne_ring_sc_dequeue_bulk (cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
 
__cne_always_inline int cne_ring_mc_dequeue (cne_ring_t *r, void **obj_p)
 
__cne_always_inline int cne_ring_sc_dequeue (cne_ring_t *r, void **obj_p)
 
unsigned cne_ring_mp_enqueue_burst (cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
 
unsigned cne_ring_sp_enqueue_burst (cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
 
unsigned cne_ring_mc_dequeue_burst (cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
 
unsigned cne_ring_sc_dequeue_burst (cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
 
unsigned int cne_ring_mp_enqueue_bulk_elem (cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
 
unsigned int cne_ring_sp_enqueue_bulk_elem (cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
 
__cne_always_inline int cne_ring_mp_enqueue_elem (cne_ring_t *r, void *obj, unsigned int esize)
 
__cne_always_inline int cne_ring_sp_enqueue_elem (cne_ring_t *r, void *obj, unsigned int esize)
 
unsigned int cne_ring_mc_dequeue_bulk_elem (cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
 
unsigned int cne_ring_sc_dequeue_bulk_elem (cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
 
__cne_always_inline int cne_ring_mc_dequeue_elem (cne_ring_t *r, void *obj_p, unsigned int esize)
 
__cne_always_inline int cne_ring_sc_dequeue_elem (cne_ring_t *r, void *obj_p, unsigned int esize)
 
unsigned cne_ring_mp_enqueue_burst_elem (cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
 
unsigned cne_ring_sp_enqueue_burst_elem (cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
 
unsigned cne_ring_mc_dequeue_burst_elem (cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
 
unsigned cne_ring_sc_dequeue_burst_elem (cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
 

Detailed Description

CNDP Ring Internal API

Definition in file cne_ring_api_internal.h.

Function Documentation

◆ cne_ring_mp_enqueue_bulk()

unsigned int cne_ring_mp_enqueue_bulk ( cne_ring_t *  r,
void *const *  obj_table,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on the ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n

◆ cne_ring_sp_enqueue_bulk()

unsigned int cne_ring_sp_enqueue_bulk ( cne_ring_t *  r,
void *const *  obj_table,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on a ring (NOT multi-producers safe).

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n

◆ cne_ring_mp_enqueue()

__cne_always_inline int cne_ring_mp_enqueue ( cne_ring_t *  r,
void *  obj 
)

Enqueue one object on a ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
objA pointer to the object to be added.
Returns
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.

Definition at line 80 of file cne_ring_api_internal.h.

◆ cne_ring_sp_enqueue()

__cne_always_inline int cne_ring_sp_enqueue ( cne_ring_t *  r,
void *  obj 
)

Enqueue one object on a ring (NOT multi-producers safe).

Parameters
rA pointer to the ring structure.
objA pointer to the object to be added.
Returns
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.

Definition at line 97 of file cne_ring_api_internal.h.

◆ cne_ring_mc_dequeue_bulk()

unsigned int cne_ring_mc_dequeue_bulk ( cne_ring_t *  r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (multi-consumers safe).

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n

◆ cne_ring_sc_dequeue_bulk()

unsigned int cne_ring_sc_dequeue_bulk ( cne_ring_t *  r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (NOT multi-consumers safe).

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table, must be strictly positive.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n

◆ cne_ring_mc_dequeue()

__cne_always_inline int cne_ring_mc_dequeue ( cne_ring_t *  r,
void **  obj_p 
)

Dequeue one object from a ring (multi-consumers safe).

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_pA pointer to a void * pointer (object) that will be filled.
Returns
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.

Definition at line 158 of file cne_ring_api_internal.h.

◆ cne_ring_sc_dequeue()

__cne_always_inline int cne_ring_sc_dequeue ( cne_ring_t *  r,
void **  obj_p 
)

Dequeue one object from a ring (NOT multi-consumers safe).

Parameters
rA pointer to the ring structure.
obj_pA pointer to a void * pointer (object) that will be filled.
Returns
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.

Definition at line 176 of file cne_ring_api_internal.h.

◆ cne_ring_mp_enqueue_burst()

unsigned cne_ring_mp_enqueue_burst ( cne_ring_t *  r,
void *const *  obj_table,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on the ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
  • n: Actual number of objects enqueued.

◆ cne_ring_sp_enqueue_burst()

unsigned cne_ring_sp_enqueue_burst ( cne_ring_t *  r,
void *const *  obj_table,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on a ring (NOT multi-producers safe).

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
  • n: Actual number of objects enqueued.

◆ cne_ring_mc_dequeue_burst()

unsigned cne_ring_mc_dequeue_burst ( cne_ring_t *  r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (multi-consumers safe). When the request objects are more than the available objects, only dequeue the actual number of objects

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
  • n: Actual number of objects dequeued, 0 if ring is empty

◆ cne_ring_sc_dequeue_burst()

unsigned cne_ring_sc_dequeue_burst ( cne_ring_t *  r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (NOT multi-consumers safe).When the request objects are more than the available objects, only dequeue the actual number of objects

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
  • n: Actual number of objects dequeued, 0 if ring is empty

◆ cne_ring_mp_enqueue_bulk_elem()

unsigned int cne_ring_mp_enqueue_bulk_elem ( cne_ring_t *  r,
const void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on the ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n

◆ cne_ring_sp_enqueue_bulk_elem()

unsigned int cne_ring_sp_enqueue_bulk_elem ( cne_ring_t *  r,
const void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on a ring

Warning
This API is NOT multi-producers safe
Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n

◆ cne_ring_mp_enqueue_elem()

__cne_always_inline int cne_ring_mp_enqueue_elem ( cne_ring_t *  r,
void *  obj,
unsigned int  esize 
)

Enqueue one object on a ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
objA pointer to the object to be added.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
Returns
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.

Definition at line 334 of file cne_ring_api_internal.h.

◆ cne_ring_sp_enqueue_elem()

__cne_always_inline int cne_ring_sp_enqueue_elem ( cne_ring_t *  r,
void *  obj,
unsigned int  esize 
)

Enqueue one object on a ring

Warning
This API is NOT multi-producers safe
Parameters
rA pointer to the ring structure.
objA pointer to the object to be added.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
Returns
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.

Definition at line 357 of file cne_ring_api_internal.h.

◆ cne_ring_mc_dequeue_bulk_elem()

unsigned int cne_ring_mc_dequeue_bulk_elem ( cne_ring_t *  r,
void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (multi-consumers safe).

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n

◆ cne_ring_sc_dequeue_bulk_elem()

unsigned int cne_ring_sc_dequeue_bulk_elem ( cne_ring_t *  r,
void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (NOT multi-consumers safe).

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to dequeue from the ring to the obj_table, must be strictly positive.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n

◆ cne_ring_mc_dequeue_elem()

__cne_always_inline int cne_ring_mc_dequeue_elem ( cne_ring_t *  r,
void *  obj_p,
unsigned int  esize 
)

Dequeue one object from a ring (multi-consumers safe).

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_pA pointer to the object that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
Returns
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.

Definition at line 430 of file cne_ring_api_internal.h.

◆ cne_ring_sc_dequeue_elem()

__cne_always_inline int cne_ring_sc_dequeue_elem ( cne_ring_t *  r,
void *  obj_p,
unsigned int  esize 
)

Dequeue one object from a ring (NOT multi-consumers safe).

Parameters
rA pointer to the ring structure.
obj_pA pointer to the object that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
Returns
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.

Definition at line 452 of file cne_ring_api_internal.h.

◆ cne_ring_mp_enqueue_burst_elem()

unsigned cne_ring_mp_enqueue_burst_elem ( cne_ring_t *  r,
const void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on the ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
  • n: Actual number of objects enqueued.

◆ cne_ring_sp_enqueue_burst_elem()

unsigned cne_ring_sp_enqueue_burst_elem ( cne_ring_t *  r,
const void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  free_space 
)

Enqueue several objects on a ring

Warning
This API is NOT multi-producers safe
Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
  • n: Actual number of objects enqueued.

◆ cne_ring_mc_dequeue_burst_elem()

unsigned cne_ring_mc_dequeue_burst_elem ( cne_ring_t *  r,
void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (multi-consumers safe). When the request objects are more than the available objects, only dequeue the actual number of objects

This function uses a "compare and set" instruction to move the consumer index atomically.

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
  • n: Actual number of objects dequeued, 0 if ring is empty

◆ cne_ring_sc_dequeue_burst_elem()

unsigned cne_ring_sc_dequeue_burst_elem ( cne_ring_t *  r,
void *  obj_table,
unsigned int  esize,
unsigned int  n,
unsigned int *  available 
)

Dequeue several objects from a ring (NOT multi-consumers safe).When the request objects are more than the available objects, only dequeue the actual number of objects

Parameters
rA pointer to the ring structure.
obj_tableA pointer to a table of objects that will be filled.
esizeThe size of ring element, in bytes. It must be a multiple of 4. This must be the same value used while creating the ring. Otherwise the results are undefined.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
  • n: Actual number of objects dequeued, 0 if ring is empty