udp: fix connections move
[vpp.git] / src / vnet / session / transport.c
index 6077ab1..22a356e 100644 (file)
@@ -288,16 +288,22 @@ transport_protocol_get_vft (transport_proto_t transport_proto)
   return &tp_vfts[transport_proto];
 }
 
+u8
+transport_half_open_has_fifos (transport_proto_t tp)
+{
+  return tp_vfts[tp].transport_options.half_open_has_fifos;
+}
+
 transport_service_type_t
 transport_protocol_service_type (transport_proto_t tp)
 {
-  return tp_vfts[tp].service_type;
+  return tp_vfts[tp].transport_options.service_type;
 }
 
 transport_tx_fn_type_t
 transport_protocol_tx_fn_type (transport_proto_t tp)
 {
-  return tp_vfts[tp].tx_type;
+  return tp_vfts[tp].transport_options.tx_type;
 }
 
 void
@@ -334,7 +340,7 @@ transport_stop_listen (transport_proto_t tp, u32 conn_index)
 u8
 transport_protocol_is_cl (transport_proto_t tp)
 {
-  return (tp_vfts[tp].service_type == TRANSPORT_SERVICE_CL);
+  return (tp_vfts[tp].transport_options.service_type == TRANSPORT_SERVICE_CL);
 }
 
 always_inline void
@@ -599,9 +605,8 @@ format_transport_pacer (u8 * s, va_list * args)
 {
   spacer_t *pacer = va_arg (*args, spacer_t *);
 
-  s = format (s, "bucket %u max_burst %u tokens/period %.3f last_update %x",
-             pacer->bucket, pacer->max_burst_size, pacer->tokens_per_period,
-             pacer->last_update);
+  s = format (s, "bucket %u tokens/period %.3f last_update %x",
+             pacer->bucket, pacer->tokens_per_period, pacer->last_update);
   return s;
 }
 
@@ -634,6 +639,12 @@ spacer_set_pace_rate (spacer_t * pacer, u64 rate_bytes_per_sec)
   pacer->tokens_per_period = rate_bytes_per_sec / transport_pacer_period;
 }
 
+static inline u64
+spacer_pace_rate (spacer_t * pacer)
+{
+  return pacer->tokens_per_period * transport_pacer_period;
+}
+
 void
 transport_connection_tx_pacer_reset (transport_connection_t * tc,
                                     u32 rate_bytes_per_sec,
@@ -690,10 +701,15 @@ transport_connection_snd_space (transport_connection_t * tc, u64 time_now,
   return snd_space;
 }
 
+u64
+transport_connection_tx_pacer_rate (transport_connection_t * tc)
+{
+  return spacer_pace_rate (&tc->pacer);
+}
+
 void
-transport_connection_update_tx_stats (transport_connection_t * tc, u32 bytes)
+transport_connection_update_tx_bytes (transport_connection_t * tc, u32 bytes)
 {
-  tc->stats.tx_bytes += bytes;
   if (transport_connection_is_tx_paced (tc))
     spacer_update_bucket (&tc->pacer, bytes);
 }