tcp: support for rate sample attr flag

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I94b8063c9d8f9b811589c6815cb5c8ca6220f2b5
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 7f1e63e..e447fac 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -904,6 +904,18 @@
 	  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 @@
 	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;