From owner-freebsd-pf@FreeBSD.ORG Fri Feb 4 14:19:41 2005 Return-Path: Delivered-To: freebsd-pf@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 095BF16A4CE for ; Fri, 4 Feb 2005 14:19:41 +0000 (GMT) Received: from smtp.freemail.gr (smtp.freemail.gr [213.239.180.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A9DE43D41 for ; Fri, 4 Feb 2005 14:19:40 +0000 (GMT) (envelope-from dionch@freemail.gr) Received: by smtp.freemail.gr (Postfix, from userid 101) id 32A13BC1EB; Fri, 4 Feb 2005 16:19:39 +0200 (EET) Received: from R3B (unknown [62.38.168.185])by smtp.freemail.gr (Postfix) with ESMTP id 29DD6BC193for ; Fri, 4 Feb 2005 16:19:37 +0200 (EET) Message-ID: <002a01c50ac4$7438e280$3c00000a@R3B> From: "Chris Dionissopoulos" To: References: <001601c50ab3$fec05b10$3c00000a@R3B> Date: Fri, 4 Feb 2005 16:18:49 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0027_01C50AD5.35AE14C0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: Realtel Gigabit [re(4)] , altq enable patch X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Chris Dionissopoulos List-Id: Technical discussion and general questions about packet filter (pf) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2005 14:19:41 -0000 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--