aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-04-15 08:50:00 -0700
committerDave Barach <openvpp@barachs.net>2021-04-15 17:12:10 +0000
commit7fdf8b2d5d125d17c38fd13f45b48dc5b2281af1 (patch)
treebf3ca79ef071dd75f223637696d77ad4d26a768c
parenta5dd6d78742a6ef396a4dc821dae5965b0e035b8 (diff)
tcp: support for rate sample attr flag
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I94b8063c9d8f9b811589c6815cb5c8ca6220f2b5
-rw-r--r--src/vnet/session/transport_types.h10
-rw-r--r--src/vnet/tcp/tcp.c14
2 files changed, 23 insertions, 1 deletions
diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h
index f0fc285510f..5f14701f110 100644
--- a/src/vnet/session/transport_types.h
+++ b/src/vnet/session/transport_types.h
@@ -220,9 +220,17 @@ typedef struct transport_endpoint_pair_
_ (GSO) \
_ (RATE_SAMPLING)
+typedef enum transport_endpt_attr_flag_bit_
+{
+#define _(name) TRANSPORT_ENDPT_ATTR_F_BIT_##name,
+ foreach_transport_endpt_cfg_flags
+#undef _
+} __clib_packed transport_endpt_attr_flag_bit_t;
+
typedef enum transport_endpt_attr_flag_
{
-#define _(name) TRANSPORT_ENDPT_ATTR_F_##name,
+#define _(name) \
+ TRANSPORT_ENDPT_ATTR_F_##name = 1 << TRANSPORT_ENDPT_ATTR_F_BIT_##name,
foreach_transport_endpt_cfg_flags
#undef _
} __clib_packed transport_endpt_attr_flag_t;
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 7f1e63e7b84..e447fac00b5 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -904,6 +904,18 @@ tcp_set_attribute (tcp_connection_t *tc, transport_endpt_attr_t *attr)
tc->cfg_flags |= TCP_CFG_F_NO_TSO;
tc->cfg_flags &= ~TCP_CFG_F_TSO;
}
+ if (attr->flags & TRANSPORT_ENDPT_ATTR_F_RATE_SAMPLING)
+ {
+ if (!(tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE))
+ tcp_bt_init (tc);
+ tc->cfg_flags |= TCP_CFG_F_RATE_SAMPLE;
+ }
+ else
+ {
+ if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
+ tcp_bt_cleanup (tc);
+ tc->cfg_flags &= ~TCP_CFG_F_RATE_SAMPLE;
+ }
break;
case TRANSPORT_ENDPT_ATTR_CC_ALGO:
if (tc->cc_algo == tcp_cc_algo_get (attr->cc_algo))
@@ -941,6 +953,8 @@ tcp_get_attribute (tcp_connection_t *tc, transport_endpt_attr_t *attr)
attr->flags |= TRANSPORT_ENDPT_ATTR_F_CSUM_OFFLOAD;
if (tc->cfg_flags & TCP_CFG_F_TSO)
attr->flags |= TRANSPORT_ENDPT_ATTR_F_GSO;
+ if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
+ attr->flags |= TRANSPORT_ENDPT_ATTR_F_RATE_SAMPLING;
break;
case TRANSPORT_ENDPT_ATTR_CC_ALGO:
attr->cc_algo = tc->cc_algo - tcp_main.cc_algos;