From 6fddbfcd39d8cfb96ef7a22bbd786c16b9d29e54 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Fri, 13 Aug 2021 14:52:48 +0000 Subject: l4p/tcp: add flags parameter for tle_tcp_stream_establish() API Add extra flags parameter to control tle_tcp_stream_establish() behaviour. Currnetly supported flags: - TLE_TCP_STREAM_F_PRIVATE - to disable putting new stream into internal TLDK stream table. Signed-off-by: Konstantin Ananyev Change-Id: Id6f09bdcac313f5680438ebc3ce8a6c95e395e78 --- lib/libtle_l4p/tcp_rxtx.c | 14 ++++++++------ lib/libtle_l4p/tle_tcp.h | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c index 148a0ef..a3e21f5 100644 --- a/lib/libtle_l4p/tcp_rxtx.c +++ b/lib/libtle_l4p/tcp_rxtx.c @@ -2281,7 +2281,7 @@ tcb_establish(struct tle_tcp_stream *s, const struct tle_tcp_conn_info *ci) struct tle_stream * tle_tcp_stream_establish(struct tle_ctx *ctx, const struct tle_tcp_stream_param *prm, - const struct tle_tcp_conn_info *ci) + const struct tle_tcp_conn_info *ci, uint32_t flags) { int32_t rc; struct tle_tcp_stream *s; @@ -2313,11 +2313,13 @@ tle_tcp_stream_establish(struct tle_ctx *ctx, break; /* add the stream to the stream table */ - st = CTX_TCP_STLB(s->s.ctx); - s->ste = stbl_add_stream_lock(st, s); - if (s->ste == NULL) { - rc = -ENOBUFS; - break; + if ((flags & TLE_TCP_STREAM_F_PRIVATE) == 0) { + st = CTX_TCP_STLB(s->s.ctx); + s->ste = stbl_add_stream_lock(st, s); + if (s->ste == NULL) { + rc = -ENOBUFS; + break; + } } /* fill TCB from user provided data */ diff --git a/lib/libtle_l4p/tle_tcp.h b/lib/libtle_l4p/tle_tcp.h index 8a42f75..be0c7a9 100644 --- a/lib/libtle_l4p/tle_tcp.h +++ b/lib/libtle_l4p/tle_tcp.h @@ -64,6 +64,18 @@ enum { TLE_TCP_REV_RTO = 0x4, /** receive timed-out */ }; +/* + * flags for stream creation/establishment + */ +enum { + /** + * don't put stream into internal stream table + * Note that tle_tcp_rx_bulk() wouldn't able to properly process + * packets for such stream. + */ + TLE_TCP_STREAM_F_PRIVATE = 0x1, +}; + /** * TCP stream creation parameters. */ @@ -257,10 +269,29 @@ int tle_tcp_stream_get_mss(const struct tle_stream *ts); int tle_tcp_stream_get_state(const struct tle_stream *ts, struct tle_tcp_stream_state *st); +/** + * create a new stream within given TCP context. + * Stream is put into ESTABLISHED state stragithway. + * Connection state is recreated based on provided information. + * @param ctx + * TCP context to create new stream within. + * @param prm + * Parameters used to create and initialise the new stream. + * @param ci + * Connection state values to recreate. + * @param flags + * Combination of TLE_TCP_STREAM_F_* values. + * @return + * Pointer to TCP stream structure that can be used in future TCP API calls, + * or NULL on error, with error code set in rte_errno. + * Possible rte_errno errors include: + * - EINVAL - invalid parameter passed to function + * - ENOFILE - max limit of open streams reached for that context + */ struct tle_stream * tle_tcp_stream_establish(struct tle_ctx *ctx, const struct tle_tcp_stream_param *prm, - const struct tle_tcp_conn_info *ci); + const struct tle_tcp_conn_info *ci, uint32_t flags); /** * Client mode connect API. -- cgit 1.2.3-korg