aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-05-22 21:51:30 +0000
committerDave Barach <openvpp@barachs.net>2020-05-24 17:34:32 +0000
commitd4712a8933c2f498bc0a482b2e9b904ea7973cc7 (patch)
tree78e7f29130b034b246b27a82805c982845fa1b26
parentfdca4dd1a1a817e65bf44e435261d893fc0c51d6 (diff)
tcp: track buffer alloc failures
Reported as part of "show tcp stats" Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I499ab4e41d13aaf1a0d060e37f09087e63d09567
-rw-r--r--src/vnet/tcp/tcp.h1
-rw-r--r--src/vnet/tcp/tcp_output.c23
2 files changed, 21 insertions, 3 deletions
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index f4cc2c88e62..5c66412dfea 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -58,6 +58,7 @@ typedef struct _tcp_lookup_dispatch
_(to_closing, u32, "timeout closing") \
_(tr_abort, u32, "timer retransmit abort") \
_(rst_unread, u32, "reset on close due to unread data") \
+ _(no_buffer, u32, "out of buffers") \
typedef struct tcp_wrk_stats_
{
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 6bcca31ca77..afc652029c8 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -669,7 +669,10 @@ tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt,
fib_protocol_t fib_proto;
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
- return;
+ {
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
+ return;
+ }
b = vlib_get_buffer (vm, bi);
sw_if_index = vnet_buffer (pkt)->sw_if_index[VLIB_RX];
@@ -750,7 +753,10 @@ tcp_send_reset (tcp_connection_t * tc)
u8 flags;
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
- return;
+ {
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
+ return;
+ }
b = vlib_get_buffer (vm, bi);
tcp_init_buffer (vm, b);
@@ -812,6 +818,7 @@ tcp_send_syn (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
@@ -842,6 +849,7 @@ tcp_send_synack (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
@@ -878,6 +886,7 @@ tcp_send_fin (tcp_connection_t * tc)
else
/* Make sure retransmit retries a fin not data */
tc->flags |= TCP_CONN_FINSNT;
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
@@ -1018,6 +1027,7 @@ tcp_send_ack (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_update_rcv_wnd (tc);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
b = vlib_get_buffer (vm, bi);
@@ -1127,7 +1137,10 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
if (PREDICT_TRUE (seg_size <= bytes_per_buffer))
{
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
- return 0;
+ {
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
+ return 0;
+ }
*b = vlib_get_buffer (vm, bi);
data = tcp_init_buffer (vm, *b);
n_bytes = session_tx_fifo_peek_bytes (&tc->connection, data, offset,
@@ -1154,6 +1167,7 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
{
if (n_bufs)
vlib_buffer_free (vm, wrk->tx_buffers, n_bufs);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return 0;
}
@@ -1415,6 +1429,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
@@ -1478,6 +1493,7 @@ tcp_timer_retransmit_syn_handler (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
@@ -1545,6 +1561,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc)
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
tcp_persist_timer_set (&wrk->timer_wheel, tc);
+ tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}