summaryrefslogtreecommitdiff
path: root/src/lib/poa
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-08-16 19:31:09 +0000
committerSander Vrijders <sander@ouroboros.rocks>2026-08-31 08:31:45 +0200
commit016c3c438e9b066bb45d4934ad039a49bde7014d (patch)
tree968c83282c3a7143f4fe5b1954309db38cfc732f /src/lib/poa
parent5c239c128c04883dbed6d66f574edf8b48d11e11 (diff)
downloadouroboros-016c3c438e9b066bb45d4934ad039a49bde7014d.tar.gz
ouroboros-016c3c438e9b066bb45d4934ad039a49bde7014d.zip
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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/poa')
-rw-r--r--src/lib/poa/poa.c33
-rw-r--r--src/lib/poa/poa.h10
2 files changed, 14 insertions, 29 deletions
diff --git a/src/lib/poa/poa.c b/src/lib/poa/poa.c
index 3ad17c4f..b40d9fea 100644
--- a/src/lib/poa/poa.c
+++ b/src/lib/poa/poa.c
@@ -1678,9 +1678,9 @@ size_t poa_flow_mean_len(const struct poa_flow * pf)
return LOAD_RELAXED(&pf->poa->avg_len);
}
-int poa_flow_qid(const struct poa_flow * pf)
+struct cap_est * poa_flow_cap_est(struct poa_flow * pf)
{
- return pf->poa->qid;
+ return &pf->poa->cap;
}
void poa_flow_ready(struct poa_flow * pf)
@@ -1830,7 +1830,6 @@ static struct poa * poa_create(enum poa_type type,
poa->ops = ops;
poa->mpl = ops->mpl;
poa->n_eids = n_eids;
- poa->qid = -1;
return poa;
@@ -2213,30 +2212,15 @@ void poa_fini(void)
pthread_mutex_destroy(&poas.mtx);
}
-/*
- * Lowest queue id no attached PoA holds; detaching frees it by
- * leaving the list. Caller holds poas.lock.
- */
-static int poa_qid_alloc(void)
+static size_t poa_count(void)
{
struct list_head * p;
- bool used[POA_MAX_POAS];
- int i;
-
- memset(used, 0, sizeof(used));
-
- list_for_each(p, &poas.list) {
- struct poa * poa = list_entry(p, struct poa, next);
-
- if (poa->qid >= 0 && poa->qid < POA_MAX_POAS)
- used[poa->qid] = true;
- }
+ size_t n = 0;
- for (i = 0; i < POA_MAX_POAS; i++)
- if (!used[i])
- return i;
+ list_for_each(p, &poas.list)
+ n++;
- return -1;
+ return n;
}
static int poa_add(const struct poa_spec * spec,
@@ -2275,8 +2259,7 @@ static int poa_add(const struct poa_spec * spec,
pthread_rwlock_wrlock(&poas.lock);
- poa->qid = poa_qid_alloc();
- if (poa->qid < 0) {
+ if (poa_count() >= POA_MAX_POAS) {
pthread_rwlock_unlock(&poas.lock);
goto fail_start;
}
diff --git a/src/lib/poa/poa.h b/src/lib/poa/poa.h
index 014986a3..9edb0335 100644
--- a/src/lib/poa/poa.h
+++ b/src/lib/poa/poa.h
@@ -34,6 +34,8 @@
#include <ouroboros/time.h>
#include <ouroboros/utils.h>
+#include "../cap.h"
+
#include <errno.h>
#include <limits.h>
#include <poll.h>
@@ -191,9 +193,6 @@ struct poa {
time_t mpl;
- /* Identifies the transmit queue the flows on this PoA share. */
- int qid;
-
/* Mean sent packet size (bytes), EWMA over the send path. */
size_t avg_len;
/* Cost of one packet in the queue, in the transport's terms. */
@@ -204,6 +203,9 @@ struct poa {
size_t q_cache;
uint64_t q_time;
+ /* Capacity estimator of the queue the flows on this PoA share. */
+ struct cap_est cap;
+
/* Queued management frames, capped; poas.mgmt_mtx guards. */
size_t n_mgmt;
@@ -245,7 +247,7 @@ size_t poa_flow_qlen(const struct poa_flow * pf);
size_t poa_flow_qpkts(const struct poa_flow * pf);
-int poa_flow_qid(const struct poa_flow * pf);
+struct cap_est * poa_flow_cap_est(struct poa_flow * pf);
size_t poa_flow_mean_len(const struct poa_flow * pf);