etcp: per-link acked bytes/packets counters + BBR debug logging
- Add acked_bytes/acked_packets to struct ETCP_LINK (init, reset, increment per ACK) - Add DEBUG_CATEGORY_BBR (23) for BBR-specific debug output - Add BBR input/output DEBUG_DEBUG around bbr_main call in etcp_ack_recv - Add "bbr" category name to debug_config and etcpmon GUI
This commit is contained in:
1 parent
20e81e493d
commit
6b2b0f1360
6 files changed
+26
-4
No files matched your search
@@ -127,6 +127,7 @@ static const struct {
|
||||
{"nat", DEBUG_CATEGORY_NAT},
|
||||
{"keepalive", DEBUG_CATEGORY_KEEPALIVE},
|
||||
{"etcp_route", DEBUG_CATEGORY_ETCPROUTE},
|
||||
{"bbr", DEBUG_CATEGORY_BBR},
|
||||
{"all", DEBUG_CATEGORY_ALL},
|
||||
{NULL, DEBUG_CATEGORY_NONE}
|
||||
};
|
||||
|
||||
+2
-1
@@ -60,7 +60,8 @@ typedef int debug_category_t;
|
||||
#define DEBUG_CATEGORY_NAT 20 // EIM NAT module
|
||||
#define DEBUG_CATEGORY_KEEPALIVE 21 // Link keepalive logic
|
||||
#define DEBUG_CATEGORY_ETCPROUTE 22 // ETCP routing
|
||||
#define DEBUG_CATEGORY_COUNT 23 // Total number of categories
|
||||
#define DEBUG_CATEGORY_BBR 23 // BBR congestion control
|
||||
#define DEBUG_CATEGORY_COUNT 24 // Total number of categories
|
||||
#define DEBUG_CATEGORY_ALL (-1) // special value for all categories
|
||||
|
||||
/* Debug configuration structure */
|
||||
|
||||
+18
-2
@@ -394,6 +394,8 @@ void etcp_conn_reset(struct ETCP_CONN* etcp) {
|
||||
l->inflight_bytes = 0;
|
||||
l->inflight_packets = 0;
|
||||
l->delivered_bytes = 0;
|
||||
l->acked_bytes = 0;
|
||||
l->acked_packets = 0;
|
||||
l->last_ack_time_tb = get_time_tb();
|
||||
l = l->next;
|
||||
}
|
||||
@@ -1243,14 +1245,28 @@ void etcp_ack_recv(struct ETCP_CONN* etcp, uint32_t seq, uint16_t ts, uint16_t d
|
||||
link->delivered_bytes += rs.delivered;
|
||||
link->last_ack_time_tb = now_tb;
|
||||
|
||||
uint32_t new_cwnd = link->inflight_lim_bytes;
|
||||
uint32_t new_pacing = link->bbr_pacing_rate;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_BBR, "[L%u] BBR in: seq=%u del=%u iv=%uus rtt=%uus pri=%u infl=%u lost=%d app=%d cwnd=%u",
|
||||
link->local_link_id, seq, rs.delivered, rs.interval_us, rs.rtt_us,
|
||||
rs.prior_delivered, rs.tx_in_flight, rs.lost, rs.is_app_limited,
|
||||
link->inflight_lim_bytes);
|
||||
|
||||
uint32_t old_cwnd = link->inflight_lim_bytes;
|
||||
uint32_t old_pacing = link->bbr_pacing_rate;
|
||||
uint32_t new_cwnd = old_cwnd;
|
||||
uint32_t new_pacing = old_pacing;
|
||||
bbr_main(link->bbr, &rs, &new_cwnd, &new_pacing, link->mtu, link->inflight_bytes,
|
||||
(link->inflight_bytes >= link->inflight_lim_bytes));
|
||||
etcp_link_update_inflight_lim(link, new_cwnd);
|
||||
link->bbr_pacing_rate = new_pacing;
|
||||
link->bandwidth = (uint32_t)((uint64_t)new_pacing * 8 / 1000);
|
||||
link->bbr_loss_since_ack = 0;
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_BBR, "[L%u] BBR out: cwnd %u→%u pace %u→%u bw=%uK mode=%d cyc=%d infl=%u",
|
||||
link->local_link_id, old_cwnd, new_cwnd, old_pacing, new_pacing,
|
||||
link->bandwidth, link->bbr->mode, link->bbr->cycle_idx, link->inflight_bytes);
|
||||
|
||||
link->acked_bytes += acked_pkt->ll.len;
|
||||
link->acked_packets++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -795,6 +795,8 @@ struct ETCP_LINK* etcp_link_new(struct ETCP_CONN* etcp, struct ETCP_SOCKET* conn
|
||||
link->burst_target_bdp = 0;
|
||||
|
||||
link->delivered_bytes = 0;
|
||||
link->acked_bytes = 0;
|
||||
link->acked_packets = 0;
|
||||
link->last_ack_time_tb = get_time_tb();
|
||||
link->bbr_pacing_rate = 0;
|
||||
link->bbr_loss_since_ack = 0;
|
||||
|
||||
@@ -182,6 +182,8 @@ struct ETCP_LINK {
|
||||
size_t total_encrypted;
|
||||
size_t total_decrypted;
|
||||
uint32_t total_retransmissions;
|
||||
uint64_t acked_bytes; // подтверждённых байт на этом линке
|
||||
uint64_t acked_packets; // подтверждённых пакетов на этом линке
|
||||
|
||||
uint16_t rtt_last; // round trip (время отправки + приёма)
|
||||
uint32_t jitter; // Current jitter [>>16] x0.1 ms
|
||||
|
||||
@@ -750,7 +750,7 @@ static void CreateControls(struct etcpmon_app* app) {
|
||||
"UASYNC","LL_QUEUE","CONNECTION","ETCP","CRYPTO",
|
||||
"MEMORY","TIMING","CONFIG","TUN","ROUTING",
|
||||
"TIMERS","NORMALIZER","BGP","SOCKET","CONTROL",
|
||||
"DUMP","TRAFFIC","DEBUG_CAT","GENERAL","NAT","KEEPALIVE","ETCPROUTE"
|
||||
"DUMP","TRAFFIC","DEBUG_CAT","GENERAL","NAT","KEEPALIVE","ETCPROUTE","BBR"
|
||||
};
|
||||
int ncat = sizeof(cat_names) / sizeof(cat_names[0]);
|
||||
app->debug_cat_count = ncat;
|
||||
|
||||
Reference in new issue
Block a user