aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/ring.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-10-17 16:08:18 +0000
committerDamjan Marion <damarion@cisco.com>2023-11-02 16:08:57 +0000
commit47447f1f599064032d364ad253f0b0a91fe21435 (patch)
tree4e7b4193b2f283ced8047d413bebaab0762e4be4 /src/vppinfra/ring.h
parent38c619115b0399bae8b0dcf66e57e623cc50809c (diff)
iavf: new driver using new dev infra
Type: feature Change-Id: I9ae0dbf28b4571a37c568b587b771f90c06f200d Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/ring.h')
-rw-r--r--src/vppinfra/ring.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/vppinfra/ring.h b/src/vppinfra/ring.h
index 8527fdb5978..ae25e40b5c0 100644
--- a/src/vppinfra/ring.h
+++ b/src/vppinfra/ring.h
@@ -33,19 +33,24 @@ clib_ring_header (void *v)
}
always_inline void
+clib_ring_reset (void *v)
+{
+ clib_ring_header_t *h = clib_ring_header (v);
+ h->next = 0;
+ h->n_enq = 0;
+}
+
+always_inline void
clib_ring_new_inline (void **p, u32 elt_bytes, u32 size, u32 align)
{
void *v;
- clib_ring_header_t *h;
vec_attr_t va = { .elt_sz = elt_bytes,
.hdr_sz = sizeof (clib_ring_header_t),
.align = align };
v = _vec_alloc_internal (size, &va);
- h = clib_ring_header (v);
- h->next = 0;
- h->n_enq = 0;
+ clib_ring_reset (v);
p[0] = v;
}