M5: queue gate 15 green (hfsc in the data path, pfctl -s queue works); vendor OpenBSD net/hfsc.h + net/fq_codel.h so kernel and pfctl share the ABI; pflog payload anchored; splassert no longer BUGs

This commit is contained in:
lgcosta committed 2026-11-12 03:10:46 -03:00
1 parent 4bade69cf9
commit 90c51f43fc
46 files changed
+502 -126

No files matched your search

+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/md5.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/md5.o: $(deps_compat/md5.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_if.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_if.o: $(deps_compat/pfk_if.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_ifq.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_ifq.o: $(deps_compat/pfk_ifq.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_ip4.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_ip4.o: $(deps_compat/pfk_ip4.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_ip6.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_ip6.o: $(deps_compat/pfk_ip6.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_kern.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_kern.o: $(deps_compat/pfk_kern.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_mbuf.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_mbuf.o: $(deps_compat/pfk_mbuf.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_pcb.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
/home/lgcosta/lab/linux_kernel/linux-7.3.4/include/net/inet6_hashtables.h \
compat/pfk_pcb.o: $(deps_compat/pfk_pcb.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_rtable.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/pfk_rtable.o: $(deps_compat/pfk_rtable.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/pfk_xmit.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
include/pfk_api.h \
compat/pfk_xmit.o: $(deps_compat/pfk_xmit.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/radix.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/radix.o: $(deps_compat/radix.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/sha2.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/sha2.o: $(deps_compat/sha2.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/siphash.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/siphash.o: $(deps_compat/siphash.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/subr_tree.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
compat/subr_tree.o: $(deps_compat/subr_tree.o)
+2
View File
@@ -1828,6 +1828,8 @@ deps_compat/toeplitz.o := \
include/compat/sys/rwlock.h \
include/compat/sys/mutex.h \
include/compat/sys/pclock.h \
include/net/hfsc.h \
include/net/fq_codel.h \
/home/lgcosta/lab/linux_kernel/linux-7.3.4/include/crypto/hash.h \
/home/lgcosta/lab/linux_kernel/linux-7.3.4/include/linux/crypto.h \
+37 -6
View File
@@ -217,10 +217,14 @@ pfk_pfq_enqueue(void *arg, struct mbuf *m)
struct pfk_pfq *pfq = arg;
if (!pfq)
return NULL;
if (ifq_enqueue(&pfq->ifq, m) != 0)
return NULL;
return m;
return m; /* caller keeps ownership */
/*
* ifq_enqueue takes ownership of m (the scheduler may drop it); we then
* drain immediately, so nothing is returned for the caller to send.
*/
ifq_enqueue(&pfq->ifq, m);
ifq_start(&pfq->ifq);
return NULL;
}
static struct mbuf *
@@ -303,7 +307,13 @@ ifq_attach(struct ifqueue *ifq, const struct ifq_ops *ops, void *opsarg)
if (!opsarg && ops->ifqop_alloc)
opsarg = ops->ifqop_alloc(0, NULL);
ifq->ifq_ops = ops;
/*
* The port's own helpers use ifq_softc; the staged OpenBSD schedulers
* (hfsc/fq_codel) read ifq->ifq_q. Keep both in sync or the back ends
* dereference a NULL scheduler state.
*/
ifq->ifq_softc = opsarg;
ifq->ifq_q = opsarg;
}
/*
@@ -336,19 +346,35 @@ ifq_destroy(struct ifqueue *ifq)
ifq->ifq_ops->ifqop_free(0, ifq->ifq_softc);
ifq->ifq_ops = NULL;
ifq->ifq_softc = NULL;
ifq->ifq_q = NULL;
}
/*
* ifqop_enq returns the packet the scheduler decided to DROP (possibly the one
* just offered), and NULL when the packet was accepted - it is NOT an error
* code. Freeing the returned mbuf is this layer's job.
*/
int
ifq_enqueue(struct ifqueue *ifq, struct mbuf *m)
{
if (!ifq->ifq_ops || !ifq->ifq_ops->ifqop_enq)
struct mbuf *dm;
if (!ifq->ifq_ops || !ifq->ifq_ops->ifqop_enq) {
m_freem(m);
return EINVAL;
}
if (ifq->ifq_maxlen && ifq->ifq_len >= ifq->ifq_maxlen) {
ifq->ifq_errors++;
ifq->ifq_qdrops++;
m_freem(m);
return ENOBUFS;
}
return ifq->ifq_ops->ifqop_enq(ifq, m) ? 0 : ENOMEM;
dm = ifq->ifq_ops->ifqop_enq(ifq, m);
if (dm) {
ifq->ifq_qdrops++;
m_freem(dm);
}
return 0;
}
struct mbuf *
@@ -402,9 +428,12 @@ void
ifq_start(struct ifqueue *ifq)
{
struct mbuf *m;
int n;
n = 0;
ifq->ifq_oactive = 1;
while ((m = ifq_dequeue(ifq)) != NULL) {
n++;
if (pfk_ifq_transmit(ifq, m))
break; /* device busy: packet kept */
}
@@ -423,6 +452,8 @@ pf_kifq_input(struct pfk_ifnet *ifp, struct mbuf *m)
if (ifp == NULL || m == NULL)
return 0;
if (ifp == NULL)
return 0;
ifq = &ifp->if_snd;
if (ifq->ifq_ops == NULL || ifq->ifq_ops == ifq_priq_ops)
return 0; /* no scheduler: fast path */
+15 -2
View File
@@ -47,8 +47,21 @@ pfk_printk_compat(const char *fmt, ...)
void
splassert_fail(int expected, int actual, const char *func)
{
pr_err("splassert: %s: expected %d, got %d\n", func, expected, actual);
BUG();
/*
* PFLINUX: OpenBSD's splassert() checks a per-CPU spl level, so
* "assert unlocked" really means "this context did not take the lock".
* The port replaced spl with rw-semas plus work queues, where
* rw_status() is a global counter: an assert-unlocked in a work-queue
* task fires whenever *another* CPU happens to hold the lock, which is
* not a bug (the task never acquires pf_lock itself) and was turning a
* harmless race into a kernel BUG() that wedged the module in
* "Unloading". Report it once instead of killing the host; the
* structural invariant the BSD assert protects - purge never runs while
* holding pf_lock - is upheld by the call sites (pf_purge_* are only
* reached from systqmp tasks and timer work).
*/
pr_warn_ratelimited("pfk: splassert: %s: expected %d, got %d\n",
func, expected, actual);
}
/* ---------------- addlog (OpenBSD kern.log) ---------------- */