aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authoraraujo <araujo@FreeBSD.org>2015-11-16 10:24:57 +0800
committeraraujo <araujo@FreeBSD.org>2015-11-16 10:24:57 +0800
commitd30dbb764ca4d20a62d5e43918374584f826fa6d (patch)
tree5aa4206312ce978a6f952d801b6e5b5709b9d49b /sysutils
parent58ec765714c835258b0cefaa7a121b232512bc8e (diff)
downloadfreebsd-ports-gnome-d30dbb764ca4d20a62d5e43918374584f826fa6d.tar.gz
freebsd-ports-gnome-d30dbb764ca4d20a62d5e43918374584f826fa6d.tar.zst
freebsd-ports-gnome-d30dbb764ca4d20a62d5e43918374584f826fa6d.zip
- Add support for ALTQ FairQ and Codel protocols.
- Bump PORTREVISION to 5. PR: ports/204405 Submitted by: Renato Botelho <garga@FreeBSD.org> Obtained from: pfSense Sponsored by: Rubicon Communications (Netgate)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/pftop/Makefile7
-rw-r--r--sysutils/pftop/files/extra-patch-fairq_codel.diff102
2 files changed, 108 insertions, 1 deletions
diff --git a/sysutils/pftop/Makefile b/sysutils/pftop/Makefile
index 292c2c75e05d..d4e5b7ea18bd 100644
--- a/sysutils/pftop/Makefile
+++ b/sysutils/pftop/Makefile
@@ -3,7 +3,7 @@
PORTNAME= pftop
PORTVERSION= 0.7
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= sysutils net
MASTER_SITES= http://www.eee.metu.edu.tr/~canacar/
@@ -36,6 +36,11 @@ MAKE_ENV+= __MAKE_CONF=/dev/null
PLIST_FILES= sbin/pftop man/man8/pftop.8.gz
post-patch:
+.if ${OSVERSION} >= 1100000
+ @${ECHO_MSG} "===> Applying FairQ/Codel patches to ${PORTNAME}."
+ @${CAT} ${FILESDIR}/extra-patch-fairq_codel.diff | \
+ ${PATCH} ${PATCH_ARGS}
+.endif
@${REINPLACE_CMD} -e 's|<sys/queue.h>|"${FILESDIR}/queue.h"|g' \
${WRKSRC}/engine.c
@${REINPLACE_CMD} -e 's|__dead|__dead2|g' ${WRKSRC}/sf-gencode.h
diff --git a/sysutils/pftop/files/extra-patch-fairq_codel.diff b/sysutils/pftop/files/extra-patch-fairq_codel.diff
new file mode 100644
index 000000000000..3c501b15f501
--- /dev/null
+++ b/sysutils/pftop/files/extra-patch-fairq_codel.diff
@@ -0,0 +1,102 @@
+--- pftop.c.orig 2013-05-11 12:53:55.000000000 +0000
++++ pftop.c 2013-05-11 12:54:00.000000000 +0000
+@@ -48,6 +48,8 @@
+ #include <altq/altq_cbq.h>
+ #include <altq/altq_priq.h>
+ #include <altq/altq_hfsc.h>
++#include <altq/altq_fairq.h>
++#include <altq/altq_codel.h>
+ #endif
+
+ #include <ctype.h>
+@@ -371,6 +373,8 @@
+ class_stats_t cbq_stats;
+ struct priq_classstats priq_stats;
+ struct hfsc_classstats hfsc_stats;
++ struct fairq_classstats fairq_stats;
++ struct codel_ifstats codel_stats;
+ };
+
+ struct queue_stats {
+@@ -1764,6 +1768,8 @@
+ return (-1);
+ }
+ num_queues = nr_queues = pa.nr;
++ if (pa.altq.scheduler == ALTQT_CODEL)
++ num_queues = 1;
+ for (nr = 0; nr < nr_queues; ++nr) {
+ pa.nr = nr;
+ if (ioctl(pf_dev, DIOCGETALTQ, &pa)) {
+@@ -1772,10 +1778,10 @@
+ return (-1);
+ }
+ #ifdef PFALTQ_FLAG_IF_REMOVED
+- if (pa.altq.qid > 0 &&
++ if ((pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) &&
+ !(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) {
+ #else
+- if (pa.altq.qid > 0) {
++ if (pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) {
+ #endif
+ pq.nr = nr;
+ pq.ticket = pa.ticket;
+@@ -1928,11 +1934,14 @@
+ tb_start();
+ for (d = 0; d < node->depth; d++)
+ tbprintf(" ");
+- tbprintf(node->altq.qname);
++ if (node->altq.qname[0] != '\0')
++ tbprintf(node->altq.qname);
++ else
++ tbprintf("root");
+ print_fld_tb(FLD_QUEUE);
+
+ if (node->altq.scheduler == ALTQT_CBQ ||
+- node->altq.scheduler == ALTQT_HFSC
++ node->altq.scheduler == ALTQT_HFSC || node->altq.scheduler == ALTQT_FAIRQ || node->altq.scheduler == ALTQT_CODEL
+ )
+ print_fld_bw(FLD_BANDW, (double)node->altq.bandwidth);
+
+@@ -2003,6 +2012,42 @@
+ node->qstats_last.data.hfsc_stats.xmit_cnt.bytes, interval);
+ }
+ break;
++ case ALTQT_FAIRQ:
++ print_fld_str(FLD_SCHED, "fairq");
++ print_fld_size(FLD_PKTS,
++ node->qstats.data.fairq_stats.xmit_cnt.packets);
++ print_fld_size(FLD_BYTES,
++ node->qstats.data.fairq_stats.xmit_cnt.bytes);
++ print_fld_size(FLD_DROPP,
++ node->qstats.data.fairq_stats.drop_cnt.packets);
++ print_fld_size(FLD_DROPB,
++ node->qstats.data.fairq_stats.drop_cnt.bytes);
++ print_fld_size(FLD_QLEN, node->qstats.data.fairq_stats.qlength);
++ if (interval > 0) {
++ pps = calc_pps(node->qstats.data.fairq_stats.xmit_cnt.packets,
++ node->qstats_last.data.fairq_stats.xmit_cnt.packets, interval);
++ bps = calc_rate(node->qstats.data.fairq_stats.xmit_cnt.bytes,
++ node->qstats_last.data.fairq_stats.xmit_cnt.bytes, interval);
++ }
++ break;
++ case ALTQT_CODEL:
++ print_fld_str(FLD_SCHED, "codel");
++ print_fld_size(FLD_PKTS,
++ node->qstats.data.codel_stats.cl_xmitcnt.packets);
++ print_fld_size(FLD_BYTES,
++ node->qstats.data.codel_stats.cl_xmitcnt.bytes);
++ print_fld_size(FLD_DROPP,
++ node->qstats.data.codel_stats.cl_dropcnt.packets);
++ print_fld_size(FLD_DROPB,
++ node->qstats.data.codel_stats.cl_dropcnt.bytes);
++ print_fld_size(FLD_QLEN, node->qstats.data.codel_stats.qlength);
++ if (interval > 0) {
++ pps = calc_pps(node->qstats.data.codel_stats.cl_xmitcnt.packets,
++ node->qstats_last.data.codel_stats.cl_xmitcnt.packets, interval);
++ bps = calc_rate(node->qstats.data.codel_stats.cl_xmitcnt.bytes,
++ node->qstats_last.data.codel_stats.cl_xmitcnt.bytes, interval);
++ }
++ break;
+ }
+
+ /* if (node->altq.scheduler != ALTQT_HFSC && interval > 0) { */