diff options
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/session_node.c | 8 | ||||
-rw-r--r-- | src/vnet/session/transport.c | 13 | ||||
-rw-r--r-- | src/vnet/session/transport.h | 4 |
3 files changed, 19 insertions, 6 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 9e53718b8dd..f51b892736a 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -845,6 +845,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, { if (ctx->transport_vft->flush_data) ctx->transport_vft->flush_data (ctx->tc); + e->event_type = SESSION_IO_EVT_TX; } if (ctx->s->flags & SESSION_F_CUSTOM_TX) @@ -883,7 +884,12 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, session_tx_set_dequeue_params (vm, ctx, max_burst, peek_data); if (PREDICT_FALSE (!ctx->max_len_to_snd)) - return SESSION_TX_NO_DATA; + { + transport_connection_tx_pacer_reset_bucket (ctx->tc, + vm->clib_time. + last_cpu_time); + return SESSION_TX_NO_DATA; + } n_bufs_needed = ctx->n_segs_per_evt * ctx->n_bufs_per_seg; vec_validate_aligned (wrk->tx_buffers, n_bufs_needed - 1, diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index 49a4af71111..8f7e30c8602 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -47,10 +47,6 @@ static clib_spinlock_t local_endpoints_lock; */ static double transport_pacer_period; -#define TRANSPORT_PACER_MIN_MSS 1460 -#define TRANSPORT_PACER_MIN_BURST TRANSPORT_PACER_MIN_MSS -#define TRANSPORT_PACER_MAX_BURST (43 * TRANSPORT_PACER_MIN_MSS) - u8 * format_transport_proto (u8 * s, va_list * args) { @@ -583,6 +579,13 @@ spacer_max_burst (spacer_t * pacer, u64 norm_time_now) u64 n_periods = norm_time_now - pacer->last_update; u64 inc; + if (PREDICT_FALSE (n_periods > 5e5)) + { + pacer->last_update = norm_time_now; + pacer->bucket = TRANSPORT_PACER_MIN_BURST; + return TRANSPORT_PACER_MIN_BURST; + } + if (n_periods > 0 && (inc = (f32) n_periods * pacer->tokens_per_period) > 10) { @@ -674,7 +677,7 @@ transport_connection_snd_space (transport_connection_t * tc, u64 time_now, u32 snd_space, max_paced_burst; snd_space = tp_vfts[tc->proto].send_space (tc); - if (transport_connection_is_tx_paced (tc)) + if (snd_space && transport_connection_is_tx_paced (tc)) { time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT; max_paced_burst = spacer_max_burst (&tc->pacer, time_now); diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 5b45be0a0be..914991d5b31 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -19,6 +19,10 @@ #include <vnet/vnet.h> #include <vnet/session/transport_types.h> +#define TRANSPORT_PACER_MIN_MSS 1460 +#define TRANSPORT_PACER_MIN_BURST TRANSPORT_PACER_MIN_MSS +#define TRANSPORT_PACER_MAX_BURST (43 * TRANSPORT_PACER_MIN_MSS) + typedef struct _transport_options_t { transport_tx_fn_type_t tx_type; |