summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-05-15 11:23:26 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-05-15 11:23:26 +0000
commitdba2baa894a931585fbea74a7e61648b13794a0d (patch)
tree81f56886b604b67cd49c0268a72491a4e6263116 /sys/net
parent2c1d16f261d10af4f37335ceab78f3f5f3def8af (diff)
Hook up FQ-CoDel to the tree and enable configuration in the pfctl(8)
OK sthen, visa
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf_ioctl.c19
-rw-r--r--sys/net/pfvar.h13
2 files changed, 27 insertions, 5 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index a880590dffb..fac156bae3f 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.310 2017/05/02 12:27:37 mikeb Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.311 2017/05/15 11:23:25 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -61,6 +61,7 @@
#include <net/if_var.h>
#include <net/route.h>
#include <net/hfsc.h>
+#include <net/fq_codel.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@@ -598,8 +599,13 @@ pf_create_queues(void)
qif = malloc(sizeof(*qif), M_TEMP, M_WAITOK);
qif->ifp = ifp;
- qif->ifqops = ifq_hfsc_ops;
- qif->pfqops = pfq_hfsc_ops;
+ if (q->flags & PFQS_FLOWQUEUE) {
+ qif->ifqops = ifq_fqcodel_ops;
+ qif->pfqops = pfq_fqcodel_ops;
+ } else {
+ qif->ifqops = ifq_hfsc_ops;
+ qif->pfqops = pfq_hfsc_ops;
+ }
qif->disc = qif->pfqops->pfq_alloc(ifp);
@@ -1088,7 +1094,12 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
break;
}
bcopy(qs, &pq->queue, sizeof(pq->queue));
- error = pfq_hfsc_ops->pfq_qstats(qs, pq->buf, &nbytes);
+ if (qs->flags & PFQS_FLOWQUEUE)
+ error = pfq_fqcodel_ops->pfq_qstats(qs, pq->buf,
+ &nbytes);
+ else
+ error = pfq_hfsc_ops->pfq_qstats(qs, pq->buf,
+ &nbytes);
if (error == 0)
pq->nbytes = nbytes;
break;
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 981d778e37a..48d74247965 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.451 2017/05/02 12:27:37 mikeb Exp $ */
+/* $OpenBSD: pfvar.h,v 1.452 2017/05/15 11:23:25 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1310,6 +1310,13 @@ struct pf_queue_scspec {
u_int d;
};
+struct pf_queue_fqspec {
+ u_int flows;
+ u_int quantum;
+ u_int target;
+ u_int interval;
+};
+
struct pf_queuespec {
TAILQ_ENTRY(pf_queuespec) entries;
char qname[PF_QNAME_SIZE];
@@ -1318,6 +1325,7 @@ struct pf_queuespec {
struct pf_queue_scspec realtime;
struct pf_queue_scspec linkshare;
struct pf_queue_scspec upperlimit;
+ struct pf_queue_fqspec flowqueue;
struct pfi_kif *kif;
u_int flags;
u_int qlimit;
@@ -1325,6 +1333,9 @@ struct pf_queuespec {
u_int32_t parent_qid;
};
+#define PFQS_FLOWQUEUE 0x0001
+#define PFQS_DEFAULT 0x1000 /* maps to HFSC_DEFAULTCLASS */
+
struct priq_opts {
int flags;
};