aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libtle_l4p
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libtle_l4p')
-rw-r--r--lib/libtle_l4p/Makefile1
-rw-r--r--lib/libtle_l4p/misc.h4
-rw-r--r--lib/libtle_l4p/tcp_ctl.h6
-rw-r--r--lib/libtle_l4p/tcp_ofo.h2
-rw-r--r--lib/libtle_l4p/tcp_rxq.h2
-rw-r--r--lib/libtle_l4p/tcp_rxtx.c16
-rw-r--r--lib/libtle_l4p/tcp_stream.c7
-rw-r--r--lib/libtle_l4p/tcp_txq.h18
-rw-r--r--lib/libtle_l4p/udp_rxtx.c10
-rw-r--r--lib/libtle_l4p/udp_stream.c6
10 files changed, 37 insertions, 35 deletions
diff --git a/lib/libtle_l4p/Makefile b/lib/libtle_l4p/Makefile
index c0d3e80..e1357d1 100644
--- a/lib/libtle_l4p/Makefile
+++ b/lib/libtle_l4p/Makefile
@@ -47,6 +47,7 @@ SYMLINK-y-include += tle_tcp.h
SYMLINK-y-include += tle_udp.h
# this lib dependencies
+DEPDIRS-y += lib/libtle_misc
DEPDIRS-y += lib/libtle_dring
DEPDIRS-y += lib/libtle_timer
diff --git a/lib/libtle_l4p/misc.h b/lib/libtle_l4p/misc.h
index 55dca10..6450b67 100644
--- a/lib/libtle_l4p/misc.h
+++ b/lib/libtle_l4p/misc.h
@@ -16,6 +16,8 @@
#ifndef _MISC_H_
#define _MISC_H_
+#include <tle_dpdk_wrapper.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -402,7 +404,7 @@ empty_mbuf_ring(struct rte_ring *r)
struct rte_mbuf *mb[MAX_PKT_BURST];
do {
- n = rte_ring_dequeue_burst(r, (void **)mb, RTE_DIM(mb));
+ n = _rte_ring_dequeue_burst(r, (void **)mb, RTE_DIM(mb));
for (i = 0; i != n; i++)
rte_pktmbuf_free(mb[i]);
} while (n != 0);
diff --git a/lib/libtle_l4p/tcp_ctl.h b/lib/libtle_l4p/tcp_ctl.h
index 8ffb924..f7e70e3 100644
--- a/lib/libtle_l4p/tcp_ctl.h
+++ b/lib/libtle_l4p/tcp_ctl.h
@@ -49,10 +49,10 @@ calc_rx_wnd(const struct tle_tcp_stream *s, uint32_t scale)
/* peer doesn't support WSCALE option, wnd size is limited to 64K */
if (scale == TCP_WSCALE_NONE) {
- wnd = s->rx.q->prod.mask << TCP_WSCALE_DEFAULT;
+ wnd = _rte_ring_get_mask(s->rx.q) << TCP_WSCALE_DEFAULT;
return RTE_MIN(wnd, (uint32_t)UINT16_MAX);
} else
- return s->rx.q->prod.mask << scale;
+ return _rte_ring_get_mask(s->rx.q) << scale;
}
/* empty stream's receive queue */
@@ -74,7 +74,7 @@ empty_lq(struct tle_tcp_stream *s, struct stbl *st)
struct stbl_entry *se[MAX_PKT_BURST];
do {
- n = rte_ring_dequeue_burst(s->rx.q, (void **)se, RTE_DIM(se));
+ n = _rte_ring_dequeue_burst(s->rx.q, (void **)se, RTE_DIM(se));
for (i = 0; i != n; i++) {
mb = stbl_get_pkt(se[i]);
get_pkt_info(mb, &pi, &si);
diff --git a/lib/libtle_l4p/tcp_ofo.h b/lib/libtle_l4p/tcp_ofo.h
index 4f3bdab..4580402 100644
--- a/lib/libtle_l4p/tcp_ofo.h
+++ b/lib/libtle_l4p/tcp_ofo.h
@@ -230,7 +230,7 @@ _ofodb_enqueue(struct rte_ring *r, const struct ofodb *db, union seqlen *sl)
num = db->nb_elem;
sl->raw = db->sl.raw;
- n = rte_ring_enqueue_burst(r, (void * const *)db->obj, num);
+ n = _rte_ring_enqueue_burst(r, (void * const *)db->obj, num);
sl->len -= tcp_mbuf_seq_free(db->obj + n, num - n);
return num - n;
diff --git a/lib/libtle_l4p/tcp_rxq.h b/lib/libtle_l4p/tcp_rxq.h
index 90e657f..bddc28e 100644
--- a/lib/libtle_l4p/tcp_rxq.h
+++ b/lib/libtle_l4p/tcp_rxq.h
@@ -80,7 +80,7 @@ rx_ino_enqueue(struct tle_tcp_stream *s, union seqlen *sl,
{
uint32_t i, n;
- n = rte_ring_enqueue_burst(s->rx.q, (void * const *)mb, num);
+ n = _rte_ring_enqueue_burst(s->rx.q, (void * const *)mb, num);
/* error: can'queue some packets into receive buffer. */
for (i = n; i != num; i++)
diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c
index ceaa2bc..ff39f32 100644
--- a/lib/libtle_l4p/tcp_rxtx.c
+++ b/lib/libtle_l4p/tcp_rxtx.c
@@ -154,14 +154,14 @@ static inline void
stream_drb_free(struct tle_tcp_stream *s, struct tle_drb *drbs[],
uint32_t nb_drb)
{
- rte_ring_enqueue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
+ _rte_ring_enqueue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
}
static inline uint32_t
stream_drb_alloc(struct tle_tcp_stream *s, struct tle_drb *drbs[],
uint32_t nb_drb)
{
- return rte_ring_dequeue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
+ return _rte_ring_dequeue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
}
static inline void
@@ -939,7 +939,7 @@ rx_ack_listen(struct tle_tcp_stream *s, struct stbl *st,
if (accept_prep_stream(s, st, cs, &so, tms, pi, si) == 0) {
/* put new stream in the accept queue */
- if (rte_ring_enqueue_burst(s->rx.q,
+ if (_rte_ring_enqueue_burst(s->rx.q,
(void * const *)&ts, 1) == 1) {
*csp = cs;
return 0;
@@ -1927,7 +1927,7 @@ tle_tcp_stream_accept(struct tle_stream *ts, struct tle_stream *rs[],
struct tle_tcp_stream *s;
s = TCP_STREAM(ts);
- n = rte_ring_mc_dequeue_burst(s->rx.q, (void **)rs, num);
+ n = _rte_ring_mc_dequeue_burst(s->rx.q, (void **)rs, num);
if (n == 0)
return 0;
@@ -2138,7 +2138,7 @@ tle_tcp_stream_recv(struct tle_stream *ts, struct rte_mbuf *pkt[], uint16_t num)
struct tle_tcp_stream *s;
s = TCP_STREAM(ts);
- n = rte_ring_mc_dequeue_burst(s->rx.q, (void **)pkt, num);
+ n = _rte_ring_mc_dequeue_burst(s->rx.q, (void **)pkt, num);
if (n == 0)
return 0;
@@ -2174,7 +2174,7 @@ tx_segments(struct tle_tcp_stream *s, uint64_t ol_flags,
if (i == num) {
/* queue packets for further transmission. */
- rc = rte_ring_mp_enqueue_bulk(s->tx.q, (void **)segs, num);
+ rc = _rte_ring_mp_enqueue_bulk(s->tx.q, (void **)segs, num);
if (rc != 0)
free_segments(segs, num);
}
@@ -2228,8 +2228,8 @@ tle_tcp_stream_send(struct tle_stream *ts, struct rte_mbuf *pkt[], uint16_t num)
if (i != k) {
/* queue packets for further transmission. */
- n = rte_ring_mp_enqueue_burst(s->tx.q, (void **)pkt + k,
- (i - k));
+ n = _rte_ring_mp_enqueue_burst(s->tx.q,
+ (void **)pkt + k, (i - k));
k += n;
/*
diff --git a/lib/libtle_l4p/tcp_stream.c b/lib/libtle_l4p/tcp_stream.c
index f06b2ed..af65967 100644
--- a/lib/libtle_l4p/tcp_stream.c
+++ b/lib/libtle_l4p/tcp_stream.c
@@ -28,7 +28,6 @@
#include "tcp_ofo.h"
#include "tcp_txq.h"
-
static void
unuse_stream(struct tle_tcp_stream *s)
{
@@ -81,7 +80,7 @@ alloc_ring(uint32_t n, uint32_t flags, int32_t socket)
char name[RTE_RING_NAMESIZE];
n = rte_align32pow2(n);
- sz = sizeof(*r) + n * sizeof(r->ring[0]);
+ sz = rte_ring_get_memsize(n);
r = rte_zmalloc_socket(NULL, sz, RTE_CACHE_LINE_SIZE, socket);
if (r == NULL) {
@@ -127,7 +126,7 @@ init_stream(struct tle_ctx *ctx, struct tle_tcp_stream *s)
n = rte_align32pow2(k);
/* size of the drbs ring */
- rsz = sizeof(*s->tx.drb.r) + n * sizeof(s->tx.drb.r->ring[0]);
+ rsz = rte_ring_get_memsize(n);
rsz = RTE_ALIGN_CEIL(rsz, RTE_CACHE_LINE_SIZE);
/* size of the drb. */
@@ -174,7 +173,7 @@ tcp_free_drbs(struct tle_stream *s, struct tle_drb *drb[], uint32_t nb_drb)
struct tle_tcp_stream *us;
us = (struct tle_tcp_stream *)s;
- rte_ring_enqueue_burst(us->tx.drb.r, (void **)drb, nb_drb);
+ _rte_ring_enqueue_burst(us->tx.drb.r, (void **)drb, nb_drb);
}
static struct tle_timer_wheel *
diff --git a/lib/libtle_l4p/tcp_txq.h b/lib/libtle_l4p/tcp_txq.h
index 0b199ba..78f1d56 100644
--- a/lib/libtle_l4p/tcp_txq.h
+++ b/lib/libtle_l4p/tcp_txq.h
@@ -27,15 +27,15 @@ tcp_txq_get_nxt_objs(const struct tle_tcp_stream *s, uint32_t *num)
struct rte_ring *r;
r = s->tx.q;
- sz = r->prod.size;
- mask = r->prod.mask;
+ sz = _rte_ring_get_size(r);
+ mask = _rte_ring_get_mask(r);
head = r->cons.head & mask;
tail = r->prod.tail & mask;
cnt = (tail >= head) ? tail - head : sz - head;
*num = cnt;
- return (struct rte_mbuf **)(r->ring + head);
+ return (struct rte_mbuf **)(_rte_ring_get_data(r) + head);
}
static inline struct rte_mbuf **
@@ -45,15 +45,15 @@ tcp_txq_get_una_objs(const struct tle_tcp_stream *s, uint32_t *num)
struct rte_ring *r;
r = s->tx.q;
- sz = r->prod.size;
- mask = r->prod.mask;
+ sz = _rte_ring_get_size(r);
+ mask = _rte_ring_get_mask(r);
head = r->prod.tail & mask;
tail = r->cons.tail & mask;
cnt = (head >= tail) ? head - tail : sz - tail;
*num = cnt;
- return (struct rte_mbuf **)(r->ring + tail);
+ return (struct rte_mbuf **)(_rte_ring_get_data(r) + tail);
}
static inline void
@@ -90,7 +90,7 @@ tcp_txq_nxt_cnt(struct tle_tcp_stream *s)
struct rte_ring *r;
r = s->tx.q;
- return (r->prod.tail - r->cons.head) & r->prod.mask;
+ return (r->prod.tail - r->cons.head) & _rte_ring_get_mask(r);
}
static inline void
@@ -101,7 +101,7 @@ txs_enqueue(struct tle_ctx *ctx, struct tle_tcp_stream *s)
if (rte_atomic32_add_return(&s->tx.arm, 1) == 1) {
r = CTX_TCP_TSQ(ctx);
- n = rte_ring_enqueue_burst(r, (void * const *)&s, 1);
+ n = _rte_ring_enqueue_burst(r, (void * const *)&s, 1);
RTE_VERIFY(n == 1);
}
}
@@ -112,7 +112,7 @@ txs_dequeue_bulk(struct tle_ctx *ctx, struct tle_tcp_stream *s[], uint32_t num)
struct rte_ring *r;
r = CTX_TCP_TSQ(ctx);
- return rte_ring_dequeue_burst(r, (void **)s, num);
+ return _rte_ring_dequeue_burst(r, (void **)s, num);
}
#ifdef __cplusplus
diff --git a/lib/libtle_l4p/udp_rxtx.c b/lib/libtle_l4p/udp_rxtx.c
index 01d3520..e6b8ded 100644
--- a/lib/libtle_l4p/udp_rxtx.c
+++ b/lib/libtle_l4p/udp_rxtx.c
@@ -97,7 +97,7 @@ rx_stream(struct tle_udp_stream *s, void *mb[], struct rte_mbuf *rp[],
{
uint32_t i, k, r;
- r = rte_ring_enqueue_burst(s->rx.q, mb, num);
+ r = _rte_ring_enqueue_burst(s->rx.q, mb, num);
/* if RX queue was empty invoke user RX notification callback. */
if (s->rx.cb.func != NULL && r != 0 && rte_ring_count(s->rx.q) == r)
@@ -223,7 +223,7 @@ stream_drb_release(struct tle_udp_stream *s, struct tle_drb *drb[],
uint32_t n;
n = rte_ring_count(s->tx.drb.r);
- rte_ring_enqueue_burst(s->tx.drb.r, (void **)drb, nb_drb);
+ _rte_ring_enqueue_burst(s->tx.drb.r, (void **)drb, nb_drb);
/* If stream is still open, then mark it as avaialble for writing. */
if (rwl_try_acquire(&s->tx.use) > 0) {
@@ -310,7 +310,7 @@ tle_udp_stream_recv(struct tle_stream *us, struct rte_mbuf *pkt[], uint16_t num)
struct tle_udp_stream *s;
s = UDP_STREAM(us);
- n = rte_ring_mc_dequeue_burst(s->rx.q, (void **)pkt, num);
+ n = _rte_ring_mc_dequeue_burst(s->rx.q, (void **)pkt, num);
if (n == 0)
return 0;
@@ -451,14 +451,14 @@ static inline void
stream_drb_free(struct tle_udp_stream *s, struct tle_drb *drbs[],
uint32_t nb_drb)
{
- rte_ring_enqueue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
+ _rte_ring_enqueue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
}
static inline uint32_t
stream_drb_alloc(struct tle_udp_stream *s, struct tle_drb *drbs[],
uint32_t nb_drb)
{
- return rte_ring_dequeue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
+ return _rte_ring_dequeue_burst(s->tx.drb.r, (void **)drbs, nb_drb);
}
/* enqueue up to num packets to the destination device queue. */
diff --git a/lib/libtle_l4p/udp_stream.c b/lib/libtle_l4p/udp_stream.c
index 9f379d9..29f5a40 100644
--- a/lib/libtle_l4p/udp_stream.c
+++ b/lib/libtle_l4p/udp_stream.c
@@ -69,7 +69,7 @@ init_stream(struct tle_ctx *ctx, struct tle_udp_stream *s)
n = RTE_MAX(ctx->prm.max_stream_rbufs, 1U);
n = rte_align32pow2(n);
- sz = sizeof(*s->rx.q) + n * sizeof(s->rx.q->ring[0]);
+ sz = rte_ring_get_memsize(n);
s->rx.q = rte_zmalloc_socket(NULL, sz, RTE_CACHE_LINE_SIZE,
ctx->prm.socket_id);
@@ -90,7 +90,7 @@ init_stream(struct tle_ctx *ctx, struct tle_udp_stream *s)
n = rte_align32pow2(k);
/* size of the drbs ring */
- rsz = sizeof(*s->tx.drb.r) + n * sizeof(s->tx.drb.r->ring[0]);
+ rsz = rte_ring_get_memsize(n);
rsz = RTE_ALIGN_CEIL(rsz, RTE_CACHE_LINE_SIZE);
/* size of the drb. */
@@ -137,7 +137,7 @@ udp_free_drbs(struct tle_stream *s, struct tle_drb *drb[], uint32_t nb_drb)
struct tle_udp_stream *us;
us = (struct tle_udp_stream *)s;
- rte_ring_enqueue_burst(us->tx.drb.r, (void **)drb, nb_drb);
+ _rte_ring_enqueue_burst(us->tx.drb.r, (void **)drb, nb_drb);
}
static int