svn commit: r401746 - in head/sysutils/pftop: . files

Marcelo Araujo araujo at FreeBSD.org
Mon Nov 16 02:24:59 UTC 2015


Author: araujo
Date: Mon Nov 16 02:24:57 2015
New Revision: 401746
URL: https://svnweb.freebsd.org/changeset/ports/401746

Log:
  - Add support for ALTQ FairQ and Codel protocols.
  - Bump PORTREVISION to 5.
  
  PR:		ports/204405
  Submitted by:	Renato Botelho <garga at FreeBSD.org>
  Obtained from:	pfSense
  Sponsored by:	Rubicon Communications (Netgate)

Added:
  head/sysutils/pftop/files/extra-patch-fairq_codel.diff   (contents, props changed)
Modified:
  head/sysutils/pftop/Makefile

Modified: head/sysutils/pftop/Makefile
==============================================================================
--- head/sysutils/pftop/Makefile	Mon Nov 16 02:22:16 2015	(r401745)
+++ head/sysutils/pftop/Makefile	Mon Nov 16 02:24:57 2015	(r401746)
@@ -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

Added: head/sysutils/pftop/files/extra-patch-fairq_codel.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/pftop/files/extra-patch-fairq_codel.diff	Mon Nov 16 02:24:57 2015	(r401746)
@@ -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) { */


More information about the svn-ports-all mailing list