summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_inlines.h
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-02-20 13:46:32 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-02-25 01:28:18 +0000
commit5035bf04130a35b76f6b49f450e27d02bafb9dab (patch)
treef35ce1761221a354c81a6b50e54d030eacb826b4 /src/vnet/tcp/tcp_inlines.h
parenta2d5262afb0a6a7a0d0d4ce3a78fee94ce05be0c (diff)
tcp: fix error counters
Type: fix Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I9f4944f77ecf94f16f809392f28466e33f7f779d
Diffstat (limited to 'src/vnet/tcp/tcp_inlines.h')
-rw-r--r--src/vnet/tcp/tcp_inlines.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp_inlines.h b/src/vnet/tcp/tcp_inlines.h
index 91c57577067..ccd0e3fe3ee 100644
--- a/src/vnet/tcp/tcp_inlines.h
+++ b/src/vnet/tcp/tcp_inlines.h
@@ -18,6 +18,35 @@
#include <vnet/tcp/tcp.h>
+always_inline void
+tcp_node_inc_counter_i (vlib_main_t *vm, u32 tcp4_node, u32 tcp6_node,
+ u8 is_ip4, u32 evt, u32 val)
+{
+ if (is_ip4)
+ vlib_node_increment_counter (vm, tcp4_node, evt, val);
+ else
+ vlib_node_increment_counter (vm, tcp6_node, evt, val);
+}
+
+#define tcp_inc_counter(node_id, err, count) \
+ tcp_node_inc_counter_i (vm, tcp4_##node_id##_node.index, \
+ tcp6_##node_id##_node.index, is_ip4, err, count)
+#define tcp_maybe_inc_err_counter(cnts, err) \
+ { \
+ cnts[err] += (next0 != tcp_next_drop (is_ip4)); \
+ }
+#define tcp_inc_err_counter(cnts, err, val) \
+ { \
+ cnts[err] += val; \
+ }
+#define tcp_store_err_counters(node_id, cnts) \
+ { \
+ int i; \
+ for (i = 0; i < TCP_N_ERROR; i++) \
+ if (cnts[i]) \
+ tcp_inc_counter (node_id, i, cnts[i]); \
+ }
+
always_inline tcp_header_t *
tcp_buffer_hdr (vlib_buffer_t * b)
{