Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2005 16:18:49 +0200
From:      "Chris Dionissopoulos" <dionch@freemail.gr>
To:        <freebsd-pf@freebsd.org>
Subject:   Re: Realtel Gigabit [re(4)] , altq enable patch
Message-ID:  <002a01c50ac4$7438e280$3c00000a@R3B>
References:  <001601c50ab3$fec05b10$3c00000a@R3B>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C50AD5.35AE14C0
Content-Type: text/plain;format=flowed;charset="iso-8859-7";
	reply-type=original
Content-Transfer-Encoding: 7bit

This is an untested patch which (IMHO) enables altq 
processing for  netgraph  virtual ethernet interfaces (ng_eiface(4)).

HOWTO use/test ng_eiface with pf+altq 
~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Patch and compile ng_eiface module.
2. Create a ngeth0 virtual ethernet interface, attached to
a ng_bridge with a physical interface. i.e. (re0 = physical):
---init---
#/sbin/kldload ng_eiface.ko
#/sbin/kldload ng_ether.ko
#/sbin/kldload ng_bridge.ko
#/sbin/ifconfig re0 delete
---create bridge---
#/usr/sbin/ngctl mkpeer re0: bridge lower link0
#/usr/sbin/ngctl name re0:lower bridge0 
#/usr/sbin/ngctl name re0: setpromisc 1
#/usr/sbin/ngctl name re0: setautosrc 0
#/usr/sbin/ngctl connect re0: bridge0 upper link1
---create virtual+connect to bridge----
#/usr/sbin/ngctl mkpeer . eiface hook ether
#/usr/sbin/ngctl connect ngeth0: bridge0: lower link2
#/usr/sbin/ngctl connect ngeth0: bridge0: upper link3
#/usr/sbin/ngctl name ngeth0: setautosrc 1
#/usr/sbin/ngctl name ngeth0: setpromisc0
---config virtual-----
#/sbin/ifconfig ngeth0 link xx:xx:xx:xx:xx:xx
#/sbin/ifconfig ngeth0 yy.yy.yy.yy/zz up


3. Create and load a queue definition which involves ngeth0 interface.
For example; pf.conf:
altq on ngeth0 cbq bandwidth 10Mb queue {vlan}
queue vlan bandwidth 80% cbq(default) {vlan_in vlan_out}
queue vlan_in bandwidth 10% cbq(borrow)
queue vlan_out bandwidth 10% cbq(borrow)

loads these rules:  (pfctl -sq)
queue root_ngeth0 bandwidth 10Mb priority 0 cbq( wrr root ) {vlan}
queue  vlan bandwidth 8Mb cbq( default ) {vlan_in, vlan_out}
queue   vlan_in bandwidth 800Kb cbq( borrow )
queue   vlan_out bandwidth 800Kb cbq( borrow )

4. Create some pf-rules to queue your traffic and test.
(i.e. pass out on ngeth0 ip from any to any queue vlan_out)

Please send me your comments/tests.

Chris.



____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.
------=_NextPart_000_0027_01C50AD5.35AE14C0
Content-Type: application/octet-stream;name="ng_eiface_altq.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;filename="ng_eiface_altq.patch"

--- ng_eiface.c.orig	Fri Feb  4 15:32:40 2005=0A=
+++ ng_eiface.c	Fri Feb  4 15:38:00 2005=0A=
@@ -311,7 +311,7 @@=0A=
 	/*=0A=
 	 * Grab a packet to transmit.=0A=
 	 */=0A=
-	IF_DEQUEUE(&ifp->if_snd, m);=0A=
+	IFQ_DRV_DEQUEUE(&ifp->if_snd, m);=0A=
 =0A=
 	/* If there's nothing to send, return. */=0A=
 	if (m =3D=3D NULL) {=0A=
@@ -446,7 +446,9 @@=0A=
 	ifp->if_start =3D ng_eiface_start;=0A=
 	ifp->if_ioctl =3D ng_eiface_ioctl;=0A=
 	ifp->if_watchdog =3D NULL;=0A=
-	ifp->if_snd.ifq_maxlen =3D IFQ_MAXLEN;=0A=
+	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);=0A=
+	ifp->if_snd.ifq_drv_maxlen =3D IFQ_MAXLEN;=0A=
+	IFQ_SET_READY(&ifp->if_snd);=0A=
 	ifp->if_flags =3D (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);=0A=
 =0A=
 #if 0=0A=

------=_NextPart_000_0027_01C50AD5.35AE14C0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002a01c50ac4$7438e280$3c00000a>