l4p/tcp: add flags parameter for tle_tcp_stream_establish() API 91/33491/1
authorKonstantin Ananyev <[email protected]>
Fri, 13 Aug 2021 14:52:48 +0000 (14:52 +0000)
committerKonstantin Ananyev <[email protected]>
Fri, 13 Aug 2021 14:52:48 +0000 (14:52 +0000)
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 <[email protected]>
Change-Id: Id6f09bdcac313f5680438ebc3ce8a6c95e395e78

lib/libtle_l4p/tcp_rxtx.c
lib/libtle_l4p/tle_tcp.h

index 148a0ef..a3e21f5 100644 (file)
@@ -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 */
index 8a42f75..be0c7a9 100644 (file)
@@ -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.