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
[-- Attachment #1 --]
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.
[-- Attachment #2 --]
--- ng_eiface.c.orig Fri Feb 4 15:32:40 2005
+++ ng_eiface.c Fri Feb 4 15:38:00 2005
@@ -311,7 +311,7 @@
/*
* Grab a packet to transmit.
*/
- IF_DEQUEUE(&ifp->if_snd, m);
+ IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
/* If there's nothing to send, return. */
if (m == NULL) {
@@ -446,7 +446,9 @@
ifp->if_start = ng_eiface_start;
ifp->if_ioctl = ng_eiface_ioctl;
ifp->if_watchdog = NULL;
- ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
+ IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
+ ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
+ IFQ_SET_READY(&ifp->if_snd);
ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);
#if 0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002a01c50ac4$7438e280$3c00000a>
