From 016c3c438e9b066bb45d4934ad039a49bde7014d Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 16 Aug 2026 19:31:09 +0000 Subject: ipcpd: Use capacity queue estimation for mb-ecn The mb-ecn algorithm was using rbuff queue depths in packets to mark, but sockets in the poa component report capacity in bytes. The tx rings are now adaptive to block on queuing delay instead of when full to prevent buffer bloat, controllable via fccntl (FLOWSTXQDLY and FLOWGTXQDLY). Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/fccntl.h | 2 ++ include/ouroboros/ipcp-dev.h | 18 +++++++++++++++--- include/ouroboros/ssm_rbuff.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h index e91e91dd..9a048095 100644 --- a/include/ouroboros/fccntl.h +++ b/include/ouroboros/fccntl.h @@ -67,6 +67,8 @@ #define FLOWGRXQLEN 00000010 /* Get queue length on rx */ #define FLOWGTXQLEN 00000011 /* Get queue length on tx */ #define FLOWGMTU 00000012 /* Get per-packet MTU */ +#define FLOWSTXQDLY 00000013 /* Set tx queueing delay */ +#define FLOWGTXQDLY 00000014 /* Get tx queueing delay */ /* FRCT operations */ #define FRCTSFLAGS 00001000 /* Set flags for FRCT */ diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 8677adf0..ab99d950 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -71,13 +71,25 @@ int ipcp_flow_fini(int fd); int ipcp_flow_get_qoscube(int fd, qoscube_t * cube); +/* Bytes queued in the transmit path of the flow. */ size_t ipcp_flow_queued(int fd); +/* Mean size of a packet written to the flow, bytes. */ +size_t ipcp_flow_mean_len(int fd); + /* - * Identifies the transmit queue behind the flow. Flows attached to - * one point of attachment share a queue and answer the same id. + * Capacity estimator of the transmit queue behind the flow. + * Flows attached to one point of attachment share a queue and + * share the estimator. Armed by the IPCP; unarmed flows read 0. */ -int ipcp_flow_queue_id(int fd); +int ipcp_flow_cap_arm(int fd); + +void ipcp_flow_cap_update(int fd, + size_t qlen, + size_t len); + +/* Estimated capacity of the transmit queue (bytes/s), 0 = unknown. */ +uint64_t ipcp_flow_cap(int fd); int ipcp_spb_reserve(struct ssm_pk_buff ** spb, size_t len); diff --git a/include/ouroboros/ssm_rbuff.h b/include/ouroboros/ssm_rbuff.h index e77eec09..9ff880e9 100644 --- a/include/ouroboros/ssm_rbuff.h +++ b/include/ouroboros/ssm_rbuff.h @@ -55,6 +55,14 @@ void ssm_rbuff_clr_bits(struct ssm_rbuff * rb, uint32_t ssm_rbuff_get_flags(struct ssm_rbuff * rb); +size_t ssm_rbuff_get_limit(struct ssm_rbuff * rb); + +void ssm_rbuff_set_txq_target(struct ssm_rbuff * rb, + const struct timespec * ts); + +void ssm_rbuff_get_txq_target(struct ssm_rbuff * rb, + struct timespec * ts); + void ssm_rbuff_fini(struct ssm_rbuff * rb); int ssm_rbuff_mlock(struct ssm_rbuff * rb); @@ -62,6 +70,9 @@ int ssm_rbuff_mlock(struct ssm_rbuff * rb); int ssm_rbuff_write(struct ssm_rbuff * rb, size_t off); +int ssm_rbuff_write_prio(struct ssm_rbuff * rb, + size_t off); + int ssm_rbuff_write_b(struct ssm_rbuff * rb, size_t off, const struct timespec * abstime); -- cgit v1.2.3