From 4098ba1fbc9f382d0f9d6b6b071d7ed9a2682cfc Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@hauwei.com>
Date: Fri, 24 Nov 2023 14:19:16 +0800
Subject: [PATCH] add tcp faste timer cnt

---
 src/common/gazelle_dfx_msg.h |  3 +++
 src/ltran/ltran_dfx.c        | 28 ++++++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 93fe3df..8071108 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -117,6 +117,9 @@ struct gazelle_stat_lstack_snmp {
     uint32_t tcp_in_seg;
     uint32_t tcp_in_err;
     uint32_t tcp_out_rst;
+    uint32_t tcp_fin_ack_cnt;
+    uint32_t tcp_delay_ack_cnt;
+    uint32_t tcp_refused_cnt;
 
     /* UDP */
     uint32_t udp_in_datagrams;
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 582a4b7..98e23dc 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -825,6 +825,22 @@ static void gazelle_print_lstack_stat_rate(void *buf, const struct gazelle_stat_
     } while (true);
 }
 
+static void gazelle_print_lstack_tcp_stat(const struct gazelle_stat_lstack_snmp *snmp)
+{
+    printf("tcp_act_open: %u\n",     snmp->tcp_act_open);
+    printf("tcp_passive_open: %u\n", snmp->tcp_passive_open);
+    printf("tcp_attempt_fail: %u\n", snmp->tcp_attempt_fail);
+    printf("tcp_estab_rst: %u\n",    snmp->tcp_estab_rst);
+    printf("tcp_out_seg: %u\n",      snmp->tcp_out_seg);
+    printf("tcp_retran_seg: %u\n",   snmp->tcp_retran_seg);
+    printf("tcp_in_seg: %u\n",       snmp->tcp_in_seg);
+    printf("tcp_in_err: %u\n",       snmp->tcp_in_err);
+    printf("tcp_out_rst: %u\n",      snmp->tcp_out_rst);
+    printf("tcp_fin_ack_cnt: %u\n",  snmp->tcp_fin_ack_cnt);
+    printf("tcp_delay_ack_cnt: %u\n", snmp->tcp_delay_ack_cnt);
+    printf("tcp_refused_cnt: %u\n",  snmp->tcp_refused_cnt);
+}
+
 static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_data *stat,
                                                 const struct gazelle_stat_lstack_snmp *snmp)
 {
@@ -850,16 +866,8 @@ static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_d
     printf("udp_no_ports: %u\n",     snmp->udp_no_ports);
     printf("udp_in_errors: %u\n",    snmp->udp_in_errors);
     printf("udp_out_datagrams: %u\n", snmp->udp_out_datagrams);
-    
-    printf("tcp_act_open: %u\n",     snmp->tcp_act_open);
-    printf("tcp_passive_open: %u\n", snmp->tcp_passive_open);
-    printf("tcp_attempt_fail: %u\n", snmp->tcp_attempt_fail);
-    printf("tcp_estab_rst: %u\n",    snmp->tcp_estab_rst);
-    printf("tcp_out_seg: %u\n",      snmp->tcp_out_seg);
-    printf("tcp_retran_seg: %u\n",   snmp->tcp_retran_seg);
-    printf("tcp_in_seg: %u\n",       snmp->tcp_in_seg);
-    printf("tcp_in_err: %u\n",       snmp->tcp_in_err);
-    printf("tcp_out_rst: %u\n",      snmp->tcp_out_rst);
+
+    gazelle_print_lstack_tcp_stat(snmp);
 
     printf("icmp_in_msgs: %u\n", snmp->icmp_in_msgs);
     printf("icmp_in_errors: %u\n", snmp->icmp_in_errors);
-- 
2.27.0

