etcp_router: add congestion counters, fix tx_seq rollback on etcp_send failure, add router metrics to etcpmon GUI
- etcp_router.h: add 9 per-conn counters (pkts_sent/err/rcvd, ack_sent/recv/stale, dup/oob/sign_fail) - etcp_router.c: increment counters at 13 event points; fix tx_seq rollback on etcp_send failure (was causing phantom inflight=256 deadlock); add DEBUG_ERROR on all 5 ignored etcp_send returns; fix router_ack_do_send to update timestamps only on success - etcpmon_protocol.h: add etcpmon_router_metrics (14 aggregated fields) - control_server.c: iterate router_conns to fill aggregated router metrics - etcpmon_gui: new 'Router Congestion' block with queue depths and all counters, Debug Levels shifted down, window 1300->1440 - test_etcp_router_unit: fix test_ack_timer for correct no-BGP-route behavior
This commit is contained in:
1 parent
de8cce521a
commit
7329fa65f1
7 files changed
+229
-23
No files matched your search
@@ -20,7 +20,7 @@
|
||||
//#pragma comment(lib, "user32.lib")
|
||||
//#pragma comment(lib, "gdi32.lib")
|
||||
#define WINDOW_WIDTH 1000
|
||||
#define WINDOW_HEIGHT 1300
|
||||
#define WINDOW_HEIGHT 1440
|
||||
#define WINDOW_CLIENT_W 1250
|
||||
#define UPDATE_INTERVAL 10 /* 50ms → 20 samples per second */
|
||||
/* Global app pointer for callbacks */
|
||||
@@ -750,11 +750,57 @@ static void CreateControls(struct etcpmon_app* app) {
|
||||
q_col1 + 85 + i * 65, qy - 2, 60, 18, hWnd, (HMENU)((UINT_PTR)(IDC_EDIT_DEBUG_0 + i)), hInst, NULL);
|
||||
}
|
||||
|
||||
/* ========================================================================
|
||||
* Router Congestion group — below Queues & Errors
|
||||
* ======================================================================== */
|
||||
{
|
||||
int ry = 1260;
|
||||
int r_col1 = 20, r_col2 = 260, r_col3 = 500, r_col4 = 740;
|
||||
int lw = 85, ew = 70; /* label width, edit width */
|
||||
CreateWindowExA(0, "BUTTON", "Router Congestion",
|
||||
WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
|
||||
10, ry, WINDOW_WIDTH - 20, 140, hWnd, (HMENU)IDC_GB_ROUTER, hInst, NULL);
|
||||
/* Row 1 */
|
||||
int ry1 = ry + 22;
|
||||
CreateWindowExA(0, "STATIC", "Conns:", WS_CHILD | WS_VISIBLE, r_col1, ry1, 50, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrConns = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col1 + 55, ry1 - 2, 50, 18, hWnd, (HMENU)IDC_EDIT_RTR_CONNS, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "Inflight:", WS_CHILD | WS_VISIBLE, r_col2, ry1, 55, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrInflight = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col2 + 60, ry1 - 2, 70, 18, hWnd, (HMENU)IDC_EDIT_RTR_INFLIGHT, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "SendQ:", WS_CHILD | WS_VISIBLE, r_col3, ry1, 55, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrSendQ = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col3 + 55, ry1 - 2, 70, 18, hWnd, (HMENU)IDC_EDIT_RTR_SENDQ, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "RecvQ:", WS_CHILD | WS_VISIBLE, r_col4, ry1, 55, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrRecvQ = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col4 + 55, ry1 - 2, 70, 18, hWnd, (HMENU)IDC_EDIT_RTR_RECVQ, hInst, NULL);
|
||||
/* Row 2 */
|
||||
int ry2 = ry + 47;
|
||||
CreateWindowExA(0, "STATIC", "Pkts Sent:", WS_CHILD | WS_VISIBLE, r_col1, ry2, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrPktsSent = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col1 + lw, ry2 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_PKTS_SENT, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "Send Err:", WS_CHILD | WS_VISIBLE, r_col2, ry2, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrSendErr = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col2 + lw, ry2 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_SEND_ERR, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "Pkts Rcvd:", WS_CHILD | WS_VISIBLE, r_col3, ry2, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrPktsRcvd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col3 + lw, ry2 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_PKTS_RCVD, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "SignFail:", WS_CHILD | WS_VISIBLE, r_col4, ry2, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrSignFail = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col4 + lw, ry2 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_SIGN_FAIL, hInst, NULL);
|
||||
/* Row 3 */
|
||||
int ry3 = ry + 72;
|
||||
CreateWindowExA(0, "STATIC", "ACK Sent:", WS_CHILD | WS_VISIBLE, r_col1, ry3, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrAckSent = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col1 + lw, ry3 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_ACK_SENT, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "ACK Rcvd:", WS_CHILD | WS_VISIBLE, r_col2, ry3, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrAckRecv = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col2 + lw, ry3 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_ACK_RECV, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "Stale ACK:", WS_CHILD | WS_VISIBLE, r_col3, ry3, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrStaleAck = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col3 + lw, ry3 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_STALE_ACK, hInst, NULL);
|
||||
/* Row 4 */
|
||||
int ry4 = ry + 97;
|
||||
CreateWindowExA(0, "STATIC", "Dup Drop:", WS_CHILD | WS_VISIBLE, r_col1, ry4, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrDupDrop = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col1 + lw, ry4 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_DUP_DROP, hInst, NULL);
|
||||
CreateWindowExA(0, "STATIC", "OOB Drop:", WS_CHILD | WS_VISIBLE, r_col2, ry4, lw, 16, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
app->hEditRtrOobDrop = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER, r_col2 + lw, ry4 - 2, ew, 18, hWnd, (HMENU)IDC_EDIT_RTR_OOB_DROP, hInst, NULL);
|
||||
}
|
||||
|
||||
/* ========================================================================
|
||||
* Debug Levels section — right column
|
||||
* ======================================================================== */
|
||||
{
|
||||
int dy = 485;
|
||||
int dy = 645;
|
||||
app->hDebugGroupBox = CreateWindowExA(0, "BUTTON", "Debug Levels",
|
||||
WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
|
||||
1005, dy, 240, 545, hWnd, (HMENU)IDC_STATIC, hInst, NULL);
|
||||
@@ -1586,6 +1632,21 @@ void etcpmon_gui_update_metrics(struct etcpmon_app* app,
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RT_BGP_SENDERS, "%u", metrics->tun.rt_bgp_senders);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RT_BGP_NODES, "%u", metrics->tun.rt_bgp_nodes);
|
||||
|
||||
/* Router Congestion Metrics */
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_CONNS, "%u", metrics->router.total_conns);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_INFLIGHT, "%u", metrics->router.total_inflight);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_SENDQ, "%u", metrics->router.total_send_q);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_RECVQ, "%u", metrics->router.total_recv_q);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_PKTS_SENT, "%u", metrics->router.pkts_sent);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_SEND_ERR, "%u", metrics->router.pkts_send_err);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_PKTS_RCVD, "%u", metrics->router.pkts_rcvd);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_ACK_SENT, "%u", metrics->router.ack_sent);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_ACK_RECV, "%u", metrics->router.ack_recv);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_DUP_DROP, "%u", metrics->router.dup_dropped);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_OOB_DROP, "%u", metrics->router.oob_dropped);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_STALE_ACK, "%u", metrics->router.stale_ack);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_RTR_SIGN_FAIL, "%u", metrics->router.sign_fail);
|
||||
|
||||
/* Queue Metrics */
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_Q_IN_Q_BYTES, "%u", metrics->etcp.input_queue_bytes);
|
||||
UpdateEditIfChanged(hMain, IDC_EDIT_Q_IN_Q_PKTS, "%u", metrics->etcp.input_queue_packets);
|
||||
@@ -1757,6 +1818,20 @@ void etcpmon_gui_clear_metrics(struct etcpmon_app* app) {
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RT_BGP_SENDERS, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RT_BGP_NODES, "");
|
||||
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_CONNS, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_INFLIGHT, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_SENDQ, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_RECVQ, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_PKTS_SENT, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_SEND_ERR, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_PKTS_RCVD, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_ACK_SENT, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_ACK_RECV, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_DUP_DROP, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_OOB_DROP, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_STALE_ACK, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_RTR_SIGN_FAIL, "");
|
||||
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_Q_IN_Q_BYTES, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_Q_IN_Q_PKTS, "");
|
||||
SetDlgItemTextA(app->hWndMain, IDC_EDIT_Q_IN_SEND_BYTES, "");
|
||||
|
||||
@@ -81,6 +81,22 @@ extern "C" {
|
||||
#define IDC_EDIT_RT_BGP_SENDERS 315
|
||||
#define IDC_EDIT_RT_BGP_NODES 316
|
||||
|
||||
/* Router Congestion control IDs */
|
||||
#define IDC_GB_ROUTER 350
|
||||
#define IDC_EDIT_RTR_CONNS 351
|
||||
#define IDC_EDIT_RTR_INFLIGHT 352
|
||||
#define IDC_EDIT_RTR_SENDQ 353
|
||||
#define IDC_EDIT_RTR_RECVQ 354
|
||||
#define IDC_EDIT_RTR_PKTS_SENT 355
|
||||
#define IDC_EDIT_RTR_SEND_ERR 356
|
||||
#define IDC_EDIT_RTR_PKTS_RCVD 357
|
||||
#define IDC_EDIT_RTR_ACK_SENT 358
|
||||
#define IDC_EDIT_RTR_ACK_RECV 359
|
||||
#define IDC_EDIT_RTR_DUP_DROP 360
|
||||
#define IDC_EDIT_RTR_OOB_DROP 361
|
||||
#define IDC_EDIT_RTR_STALE_ACK 362
|
||||
#define IDC_EDIT_RTR_SIGN_FAIL 363
|
||||
|
||||
/* Link list control ID */
|
||||
#define IDC_LIST_LINKS 400
|
||||
|
||||
@@ -252,6 +268,21 @@ struct etcpmon_app {
|
||||
HWND hEditRtBgpSenders;
|
||||
HWND hEditRtBgpNodes;
|
||||
|
||||
/* Router Congestion controls */
|
||||
HWND hEditRtrConns;
|
||||
HWND hEditRtrInflight;
|
||||
HWND hEditRtrSendQ;
|
||||
HWND hEditRtrRecvQ;
|
||||
HWND hEditRtrPktsSent;
|
||||
HWND hEditRtrSendErr;
|
||||
HWND hEditRtrPktsRcvd;
|
||||
HWND hEditRtrAckSent;
|
||||
HWND hEditRtrAckRecv;
|
||||
HWND hEditRtrDupDrop;
|
||||
HWND hEditRtrOobDrop;
|
||||
HWND hEditRtrStaleAck;
|
||||
HWND hEditRtrSignFail;
|
||||
|
||||
/* Links list */
|
||||
HWND hListLinks;
|
||||
|
||||
|
||||
@@ -289,9 +289,27 @@ struct etcpmon_tun_metrics {
|
||||
uint32_t rt_bgp_nodes; /* BGP nodes count (ROUTE_BGP) */
|
||||
};
|
||||
|
||||
/* Router congestion metrics — aggregated over all router_conns */
|
||||
struct etcpmon_router_metrics {
|
||||
uint32_t total_conns;
|
||||
uint32_t total_inflight;
|
||||
uint32_t total_send_q;
|
||||
uint32_t total_recv_q;
|
||||
uint32_t pkts_sent;
|
||||
uint32_t pkts_send_err;
|
||||
uint32_t pkts_rcvd;
|
||||
uint32_t ack_sent;
|
||||
uint32_t ack_recv;
|
||||
uint32_t dup_dropped;
|
||||
uint32_t oob_dropped;
|
||||
uint32_t stale_ack;
|
||||
uint32_t sign_fail;
|
||||
};
|
||||
|
||||
struct etcpmon_rsp_metrics {
|
||||
struct etcpmon_etcp_metrics etcp; /* ETCP connection metrics */
|
||||
struct etcpmon_tun_metrics tun; /* TUN interface metrics */
|
||||
struct etcpmon_etcp_metrics etcp; /* ETCP connection metrics */
|
||||
struct etcpmon_tun_metrics tun; /* TUN interface metrics */
|
||||
struct etcpmon_router_metrics router; /* Router congestion metrics (aggregated) */
|
||||
/* Followed by etcp.links_count * struct etcpmon_link_metrics */
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user