From anand@eis.iisc.ernet.in Thu Jan 1 01:36:19 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 01:36:44 -0800 (PST) Received: from iisc.ernet.in ([144.16.64.3]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i019aFTa015403 for ; Thu, 1 Jan 2004 01:36:17 -0800 Received: from eis.iisc.ernet.in (eis.iisc.ernet.in [144.16.64.5]) by iisc.ernet.in (8.12.8/8.12.8) with SMTP id i019f9bk016607 for ; Thu, 1 Jan 2004 15:11:09 +0530 Received: by eis.iisc.ernet.in (SMI-8.6/SMI-4.1) id PAA19361; Thu, 1 Jan 2004 15:05:48 +0530 From: anand@eis.iisc.ernet.in (SVR Anand) Message-Id: <200401010935.PAA19361@eis.iisc.ernet.in> Subject: netfilter hook in packet capture To: netdev@oss.sgi.com Date: Thu, 1 Jan 2004 15:05:47 +0530 (GMT+05:30) X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2193 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: anand@eis.iisc.ernet.in Precedence: bulk X-list: netdev Hi, I am hoping that this mail will be relevant to those who have an user level application that does firewalling by promiscuously capturing packets, apply extensive decision making rules. I have written one such application and found what I am going to say below has helped me a lot. In the above mentioned scenario, there are many instances I preferred to do the following in the kernel itself as much as possible before further processing done in the user firewall code. What I wanted was i) selective packet capture ii) DoS protection iii) Externally controlling the kernel level filter rules without disrupting the firewall application iv) Ease of filter management vi) Logging v) Performance ... I found that iptables/netfilter satisfies all my requirements as compared to the existing bpf filter. Hence all I had to do was include NF_HOOK at couple of places in af_packet.c and I have the netfilter features accessible to me. With the above trivial inclusion I am currently running my application with all the initial work done by netfilter. Thanks netfilter group! While the sanctity or appropriateness or compliance of the above patch within packet capture scheme of things can be frowned upon, since its utility has been beneficial to me, I thought I would share it with you. If you find it useful I can send you rather simple patch which perhaps you could have easily guessed it! Anand From davem@pizda.ninka.net Thu Jan 1 12:29:32 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 12:29:46 -0800 (PST) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i01KTWTa002355 for ; Thu, 1 Jan 2004 12:29:32 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA10678; Thu, 1 Jan 2004 12:24:31 -0800 Date: Thu, 1 Jan 2004 12:24:30 -0800 From: "David S. Miller" To: "YOSHIFUJI Hideaki / _$B5HF#1QL@" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] IPV6: kill obsolete functions Message-Id: <20040101122430.4fcf6bfd.davem@redhat.com> In-Reply-To: <20040101.154305.69668715.yoshfuji@linux-ipv6.org> References: <20040101.154305.69668715.yoshfuji@linux-ipv6.org> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.6; sparc-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2194 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davem@redhat.com Precedence: bulk X-list: netdev On Thu, 01 Jan 2004 15:43:05 +0900 (JST) YOSHIFUJI Hideaki / _$B5HF#1QL@ wrote: > We've migrated to ip6_append_data(). Old functions such as > ip6_frag_xmit() and ip6_build_xmit() are no longer used. > > D: kill obsolete functions. Applied, arigato Yoshfuji-san. From davem@pizda.ninka.net Thu Jan 1 12:43:13 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 12:43:26 -0800 (PST) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i01KhBTa002835 for ; Thu, 1 Jan 2004 12:43:13 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA10719; Thu, 1 Jan 2004 12:38:14 -0800 Date: Thu, 1 Jan 2004 12:38:14 -0800 From: "David S. Miller" To: Bart De Schuymer Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] Fix loopback over bridge port Message-Id: <20040101123814.15fdc875.davem@redhat.com> In-Reply-To: <200312271536.46940.bdschuym@pandora.be> References: <200312271536.46940.bdschuym@pandora.be> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.6; sparc-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2195 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davem@redhat.com Precedence: bulk X-list: netdev On Sat, 27 Dec 2003 15:36:46 +0100 Bart De Schuymer wrote: > I think the code (in net/ipv4/ip_output.c::ip_dev_loopback_xmit()) > __skb_pull(newskb, newskb->nh.raw - newskb->data); > is useless, as data always points to the network header at that moment. But > that's not really my territory... I think you're right about this, but the code there doesn't cause any problems either, effectively it's a NOP. One could test out whether you and I are right or not by replacing the __skb_pull() call with BUG_TRAP(skb->nh.raw == skb->data) From davem@pizda.ninka.net Thu Jan 1 12:47:14 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 12:47:26 -0800 (PST) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i01KlDTa003236 for ; Thu, 1 Jan 2004 12:47:13 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA10731; Thu, 1 Jan 2004 12:42:18 -0800 Date: Thu, 1 Jan 2004 12:42:18 -0800 From: "David S. Miller" To: Jeff Garzik Cc: benh@kernel.crashing.org, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: Problem with dev_kfree_skb_any() in 2.6.0 Message-Id: <20040101124218.258e8b73.davem@redhat.com> In-Reply-To: <3FF1B939.1090108@pobox.com> References: <1072567054.4112.14.camel@gaston> <20031227170755.4990419b.davem@redhat.com> <3FF0FA6A.8000904@pobox.com> <20031229205157.4c631f28.davem@redhat.com> <20031230051519.GA6916@gtf.org> <20031229220122.30078657.davem@redhat.com> <3FF11745.4060705@pobox.com> <20031229221345.31c8c763.davem@redhat.com> <3FF1B939.1090108@pobox.com> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.6; sparc-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2196 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davem@redhat.com Precedence: bulk X-list: netdev On Tue, 30 Dec 2003 12:43:21 -0500 Jeff Garzik wrote: > Luckily, I feel there is an easy solution, as shown in the attached > patch. We _already_ queue skbs in dev_kfree_skb_irq(). Therefore, > dev_kfree_skb_any() can simply use precisely that same solution. The > raise-softirq code will immediately proceed to action if we are not in > hard IRQ context, otherwise it will follow the expected path. Ok, this is reasonable and works. Though, is there any particular reason you don't like adding a "|| irqs_disabled()" check to the if statement instead? I prefer that solution better actually. From garzik@gtf.org Thu Jan 1 18:58:15 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 18:58:28 -0800 (PST) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i022wETa017655 for ; Thu, 1 Jan 2004 18:58:15 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id 26E0E6611; Thu, 1 Jan 2004 21:58:07 -0500 (EST) Date: Thu, 1 Jan 2004 21:58:07 -0500 From: Jeff Garzik To: "David S. Miller" Cc: benh@kernel.crashing.org, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: Problem with dev_kfree_skb_any() in 2.6.0 Message-ID: <20040102025807.GB3851@gtf.org> References: <1072567054.4112.14.camel@gaston> <20031227170755.4990419b.davem@redhat.com> <3FF0FA6A.8000904@pobox.com> <20031229205157.4c631f28.davem@redhat.com> <20031230051519.GA6916@gtf.org> <20031229220122.30078657.davem@redhat.com> <3FF11745.4060705@pobox.com> <20031229221345.31c8c763.davem@redhat.com> <3FF1B939.1090108@pobox.com> <20040101124218.258e8b73.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040101124218.258e8b73.davem@redhat.com> User-Agent: Mutt/1.3.28i X-archive-position: 2197 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@pobox.com Precedence: bulk X-list: netdev On Thu, Jan 01, 2004 at 12:42:18PM -0800, David S. Miller wrote: > On Tue, 30 Dec 2003 12:43:21 -0500 > Jeff Garzik wrote: > > > Luckily, I feel there is an easy solution, as shown in the attached > > patch. We _already_ queue skbs in dev_kfree_skb_irq(). Therefore, > > dev_kfree_skb_any() can simply use precisely that same solution. The > > raise-softirq code will immediately proceed to action if we are not in > > hard IRQ context, otherwise it will follow the expected path. > > Ok, this is reasonable and works. > > Though, is there any particular reason you don't like adding a > "|| irqs_disabled()" check to the if statement instead? > I prefer that solution better actually. Yep, in fact when I wrote the above message, I came across a couple when I was pondering... * the destructor runs in a more predictable context. * given the problem that started this thread, the 'if' test is a potentially problematic area. Why not eliminate all possibility that this problem will occur again? The only counter argument to this -- to which I have no data to answer -- is that there may be advantage to calling __kfree_skb immediately instead of deferring it slightly. I didn't think that disadvantage outweighted the above, but who knows... I can possibly be convinced otherwise. (and "otherwise" would be using || irqs_disabled()) For the users who don't know/don't care about their context, it just seemed to me that they were not a hot path like users of dev_kfree_skb() and dev_kfree_skb_irq() [unconditional] are... Jeff From scott.feldman@intel.com Thu Jan 1 23:25:05 2004 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 Jan 2004 23:25:18 -0800 (PST) Received: from caduceus.fm.intel.com (fmr02.intel.com [192.55.52.25]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i027P5Ta027452 for ; Thu, 1 Jan 2004 23:25:05 -0800 Received: from petasus.fm.intel.com (petasus.fm.intel.com [10.1.192.37]) by caduceus.fm.intel.com (8.12.9-20030918-01/8.12.9/d: major-outer.mc,v 1.12 2003/12/18 18:58:11 root Exp $) with ESMTP id i027PMgd032695; Fri, 2 Jan 2004 07:25:22 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.fm.intel.com (8.12.9-20030918-01/8.12.9/d: major-inner.mc,v 1.7 2003/12/18 18:58:10 root Exp $) with SMTP id i027PGMQ030344; Fri, 2 Jan 2004 07:25:18 GMT Received: from [134.134.3.50] ([134.134.3.50]) by fmsmsxvs042.fm.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010123240127965 ; Thu, 01 Jan 2004 23:24:01 -0800 Date: Fri, 2 Jan 2004 00:00:41 -0800 (PST) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Mirko Lindner cc: Jeff Garzik , , , , Subject: Re: [PATCH]sk98lin ethtool support In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by oss.sgi.com id i027P5Ta027452 X-archive-position: 2198 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: scott.feldman@intel.com Precedence: bulk X-list: netdev On Tue, 30 Dec 2003, Mirko Lindner wrote: > > Make sure you don't duplicate any ethtool functions.  We don't need a > > NIC-specific diag tool either ;-)  ethtool is the preferred method > > moving forward, as it's already shipping in most Linux distros. > > Yes, we need it ;) No kidding! This is not a tool for SW checks like > media, link or driver version checks, but a tool for HW checks like > register, PROM, MAC, PHY and some other chip and card checks. The > ethtool is a great tool, but the intention of this tool is not the same. If the tool reports the results of running the h/w checks, then you can use ETHTOOL_TEST. The summary results of all the tests is reported as PASS/FAIL. Not sure if your tool needs to do more... -scott From uucp@coruscant.gnumonks.org Fri Jan 2 04:12:30 2004 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 Jan 2004 04:12:50 -0800 (PST) Received: from coruscant.gnumonks.org (mail@coruscant.franken.de [193.174.159.226]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i02CCTTa003090 for ; Fri, 2 Jan 2004 04:12:30 -0800 Received: from uucp by coruscant.gnumonks.org with local-bsmtp (Exim 4.20) id 1AcOAF-0003i6-KJ for netdev@oss.sgi.com; Fri, 02 Jan 2004 13:12:27 +0100 Received: from laforge by obroa-skai.gnumonks.org with local (Exim 3.36 #1) id 1AcOA7-0001Xr-00; Fri, 02 Jan 2004 13:12:19 +0100 Date: Fri, 2 Jan 2004 13:12:18 +0100 From: Harald Welte To: SVR Anand Cc: netdev@oss.sgi.com Subject: Re: netfilter hook in packet capture Message-ID: <20040102121218.GK3530@obroa-skai.de.gnumonks.org> References: <200401010935.PAA19361@eis.iisc.ernet.in> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KrHCbChajFcK0yQE" Content-Disposition: inline In-Reply-To: <200401010935.PAA19361@eis.iisc.ernet.in> X-Operating-System: Linux obroa-skai.de.gnumonks.org 2.6.0-test11 X-Date: Today is Prickle-Prickle, the 72nd day of The Aftermath in the YOLD 3169 User-Agent: Mutt/1.5.4i X-archive-position: 2199 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: laforge@netfilter.org Precedence: bulk X-list: netdev --KrHCbChajFcK0yQE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 01, 2004 at 03:05:47PM +0530, SVR Anand wrote: > While the sanctity or appropriateness or compliance of the above patch wi= thin > packet capture scheme of things can be frowned upon, since its utility ha= s=20 > been beneficial to me, I thought I would share it with you. If you find it > useful I can send you rather simple patch which perhaps you could have ea= sily > guessed it! We would definitely be interested in such a patch. Please first submit it to the netfilter development team, and we will then push it for kernel inclusion (after any changes/suggestions that we might have). Please send the patch to netfilter-devel@lists.netfilter.org Thanks a lot! > Anand --=20 - Harald Welte http://www.netfilter.org/ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie --KrHCbChajFcK0yQE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/9WAiXaXGVTD0i/8RAjuRAJ4ro+9ux1s7gHn0RPyGD/xgoNCFfACeOys6 A3nHSwc7BsqgWdF5Y1ttJb4= =Cv1I -----END PGP SIGNATURE----- --KrHCbChajFcK0yQE-- From demon@pro-linux.de Fri Jan 2 05:26:51 2004 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 Jan 2004 05:27:05 -0800 (PST) Received: from pro-linux.de (4demon.com [217.160.186.4]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i02DQoTa006995 for ; Fri, 2 Jan 2004 05:26:51 -0800 Received: from pro-linux.de (p508B2522.dip.t-dialin.net [80.139.37.34]) by pro-linux.de (Postfix) with ESMTP id B05FE14009E; Fri, 2 Jan 2004 14:26:48 +0100 (CET) Message-ID: <3FF57ECE.5020107@pro-linux.de> Date: Fri, 02 Jan 2004 14:23:10 +0000 From: Mirko Lindner User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031210 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Feldman, Scott" Cc: Jeff Garzik , krishnakumar@naturesoft.net, mlindner@syskonnect.de, netdev@oss.sgi.com, felix@allot.com Subject: Re: [PATCH]sk98lin ethtool support References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2200 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: demon@pro-linux.de Precedence: bulk X-list: netdev Feldman, Scott wrote: > On Tue, 30 Dec 2003, Mirko Lindner wrote: > > >>>Make sure you don't duplicate any ethtool functions. We don't need a >>>NIC-specific diag tool either ;-) ethtool is the preferred method >>>moving forward, as it's already shipping in most Linux distros. >> >>Yes, we need it ;) No kidding! This is not a tool for SW checks like >>media, link or driver version checks, but a tool for HW checks like >>register, PROM, MAC, PHY and some other chip and card checks. The >>ethtool is a great tool, but the intention of this tool is not the same. > > > If the tool reports the results of running the h/w checks, then you can > use ETHTOOL_TEST. The summary results of all the tests is reported as > PASS/FAIL. Not sure if your tool needs to do more... > > -scott > > > > > > Scott, thanks for this info, but the tool reports not only the status, but also the results of a test (Example: "Register 0xxxx=xxx", PROM info...). "Problem" 2: All tests are included in the DIAG tool and not in the driver. We have approx. 100 separate tests (over 1000 individual tests) and the driver is huge enough (Support for Genesis, Yukon, Yukon-Lite, Yukon-Plus and Yukon2 chipsets). Mirko From skraw@ithnet.com Fri Jan 2 07:00:22 2004 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 Jan 2004 07:00:34 -0800 (PST) Received: from heather-ng.ithnet.com (mail3.ithnet.com [217.64.64.7]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i02F0KTa014253 for ; Fri, 2 Jan 2004 07:00:21 -0800 Received: (qmail 6723 invoked by uid 0); 2 Jan 2004 12:39:14 -0000 Received: from skraw@ithnet.com by heather-ng (Processed in 0.556945 secs); 02 Jan 2004 12:39:14 -0000 X-Virus-Status: No Received: from unknown (HELO ithnet.com) (217.64.64.14) by heather-ng.ithnet.com with SMTP; 2 Jan 2004 12:39:13 -0000 X-Sender-Authentication: net64 Date: Fri, 2 Jan 2004 13:39:13 +0100 From: Stephan von Krawczynski To: netdev@oss.sgi.com Subject: Re: 2.4 and ip fragmentation question (background info) Message-Id: <20040102133913.488cd537.skraw@ithnet.com> In-Reply-To: <20031231122325.77f19143.skraw@ithnet.com> References: <20031231122325.77f19143.skraw@ithnet.com> Organization: ith Kommunikationstechnik GmbH X-Mailer: Sylpheed version 0.9.8 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2201 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: skraw@ithnet.com Precedence: bulk X-list: netdev On Wed, 31 Dec 2003 12:23:25 +0100 Stephan von Krawczynski wrote: > Hello, > > is ip fragmentation thought to work with multiple fragmented packets all with > same ID field, same source and destination address? Or can one consider this > situation as generally unsolvable and broken by application? > > Regards, > Stephan As this question obviously sounded significantly stupid enough not to be answered I may point you to this code in 2.4 include/net/ip.h: static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, struct sock *sk) { if (iph->frag_off&__constant_htons(IP_DF)) { /* This is only to work around buggy Windows95/2000 * VJ compression implementations. If the ID field * does not change, they drop every other packet in * a TCP stream using header compression. */ iph->id = ((sk && sk->daddr) ? htons(sk->protinfo.af_inet.id++) : 0); } else __ip_select_ident(iph, dst); } As you all know this sets the ID field inside the ip-header. Interestingly it depends on frag_off and sk->daddr field. I ran into an application (formerly for 2.2 kernel) where the author (!=me) obviously was unaware of this dependency and initialised these fields after calling ip_select_ident. The outcome was that everything runs normal during low traffic, but when more packets were transferred it looked like a increasing amount of packets got "0" as ID, because iph->frag_off was not initialised correctly and the skbs were of course not zeroed. Still this would have been no problem if these packets weren't fragmented. What I saw was that packets got corrupted during high load (because fragmentation obviously vomitted on the high rate of "ID=0" packets), but all was perfectly well during low load. Should the author have read some doc where it is clearly stated that ip_select_ident needs a more or less completely initialised ip header to work as expected? (other way round see my original question...) Regards, Stephan From Sidharth.Deshpande@fh-heidelberg.de Sat Jan 3 06:40:42 2004 Received: with ECARTIS (v1.0.0; list netdev); Sat, 03 Jan 2004 06:40:55 -0800 (PST) Received: from proxy.fh-heidelberg.de (dnsfh.fh-heidelberg.de [193.197.74.49]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i03EefTa010720 for ; Sat, 3 Jan 2004 06:40:42 -0800 Received: from EXFBI01.dcs.fh-heidelberg.de (localhost [127.0.0.1]) by proxy.fh-heidelberg.de (Postfix) with ESMTP id 8C9B31EE5B for ; Sat, 3 Jan 2004 15:40:34 +0100 (CET) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: netstat -s X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Sat, 3 Jan 2004 15:40:34 +0100 Message-ID: <842F6B6B3410144AB9937CFECFE446DE804AF5@EXFBI01.dcs.fh-heidelberg.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: netstat -s Thread-Index: AcPSB6Kw03MxMWcRQMKrf9who8sE8g== From: "Deshpande, Sidharth (FH)" To: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id i03EefTa010720 X-archive-position: 2202 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Sidharth.Deshpande@fh-heidelberg.de Precedence: bulk X-list: netdev Hello Team, I am looking for explanation of output generated by 'netstat -s' on a Linux box. Would any of you spare some time and please let me know what it means or atleast direct me to a definitive source. Thank you Sidharth Deshpande From krishnakumar@naturesoft.net Sun Jan 4 01:58:20 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 01:58:33 -0800 (PST) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i049wITa029412 for ; Sun, 4 Jan 2004 01:58:19 -0800 Received: from gw3.laser5.co.jp ([211.5.140.198] helo=l5ac210.l5.laser5.co.jp) by naturesoft.net with asmtp (Exim 3.35 #1) id 1Ad4yy-0007Uj-00; Sun, 04 Jan 2004 15:25:41 +0530 Subject: [PATCH] r8169 ethtool support. From: "Krishnakumar. R" Reply-To: krishnakumar@naturesoft.net To: jgarzik@pobox.com Cc: Francois Romieu , netdev@oss.sgi.com Content-Type: text/plain Organization: Naturesoft Ltd Message-Id: <1073210391.3555.7.camel@l5ac210.l5.laser5.co.jp> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 04 Jan 2004 18:59:51 +0900 Content-Transfer-Encoding: 7bit X-archive-position: 2203 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: krishnakumar@naturesoft.net Precedence: bulk X-list: netdev Hi, The following patch introduces ethtool support for the r8169 driver. Only the driver info operation will be supported. I dont have the hardware with me, hence has done only a compilation test. The patch is against the latest 2.6.x experimental net driver queue, which is based on 2.6.0-bk2. If found okay, please do apply. Regards, KK. Diffstat output: ---------------- r8169.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+) The patch --------- --- linux-2.6.0-bk2.netdrv.exp/drivers/net/r8169.orig.c 2004-01-04 18:47:10.000000000 +0900 +++ linux-2.6.0-bk2.netdrv.exp/drivers/net/r8169.c 2004-01-04 18:43:06.000000000 +0900 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -382,6 +383,19 @@ return value; } +static void rtl8169_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) +{ + struct rtl8169_private *tp = dev->priv; + + strcpy (info->driver, RTL8169_DRIVER_NAME); + strcpy (info->version, RTL8169_VERSION ); + strcpy (info->bus_info, pci_name(tp->pci_dev)); +} + +static struct ethtool_ops rtl8169_ethtool_ops = { + .get_drvinfo = rtl8169_get_drvinfo, +}; + static void rtl8169_write_gmii_reg_bit(void *ioaddr, int reg, int bitnum, int bitval) { @@ -793,6 +807,7 @@ dev->open = rtl8169_open; dev->hard_start_xmit = rtl8169_start_xmit; dev->get_stats = rtl8169_get_stats; + dev->ethtool_ops = &rtl8169_ethtool_ops; dev->stop = rtl8169_close; dev->tx_timeout = rtl8169_tx_timeout; dev->set_multicast_list = rtl8169_set_rx_mode; -- Home Page: http://puggy.symonds.net/~krishnakumar/ From sekiya@wide.ad.jp Sun Jan 4 08:06:23 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 08:06:36 -0800 (PST) Received: from yui.nc.u-tokyo.ac.jp (yui.nc.u-tokyo.ac.jp [130.69.251.116]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i04G6LTa021664 for ; Sun, 4 Jan 2004 08:06:22 -0800 Received: from anzu.nc.u-tokyo.ac.jp (anzu.nc.u-tokyo.ac.jp [130.69.251.114]) (authenticated bits=0) by yui.nc.u-tokyo.ac.jp (8.12.10/8.12.3/Debian-6.4) with ESMTP id i04G6EYl011355 for ; Mon, 5 Jan 2004 01:06:15 +0900 Date: Mon, 05 Jan 2004 01:06:09 +0900 Message-ID: From: Yuji Sekiya To: netdev@oss.sgi.com Subject: USAGI STABLE Release 5 User-Agent: Wanderlust/2.8.1 (Something) SEMI/1.14.3 (=?ISO-2022-JP?B?GyRCNW0lTkMrGyhC?=) FLIM/1.14.4 (=?ISO-2022-JP?B?GyRCM2A4Nj9ANVxBMBsoQg==?=) APEL/10.3 Emacs/20.7 (i386-vine-linux-gnu) MULE/4.1 (=?ISO-2022-JP?B?GyRCMCobKEI=?=) Organization: USAGI Project MIME-Version: 1.0 (generated by SEMI 1.14.3 - =?ISO-2022-JP?B?IhskQjVtGyhC?= =?ISO-2022-JP?B?GyRCJU5DKxsoQiI=?=) Content-Type: text/plain; charset=US-ASCII X-archive-position: 2204 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sekiya@sfc.wide.ad.jp Precedence: bulk X-list: netdev A Happy New Year ! We are glad to announce the USAGI STABLE RELEASE 5, dated on January 4th, 2004. This is the last major STABLE release based on linux-2.4 kernel from USAGI Project. Our primary target of development is moved to linux-2.6 kernel. Changes from the STABLE RELEASE 4.1 are: * based on linux-2.4.21, * IPsec transport/tunnel mode support, * Mobile IPv6 support, * fixed interaction between IPsec and Mobile IPv6, * Default Router Preference Support, and * Route Information Option Support. However, the IPsec and Mobile IPv6 implementations included in this STABLE release may not developed further. Because the IPsec stack was written for linux-2.4 kernel by USAGI Project and currently we have rewritten NEW IPsec stack for linux-2.6 kernel and the stack is included linux-2.6 mainline kernel. The IPsec stack included linux-2.6 kernel is implemented based on "xfrm" architecture and we will continue developing based on the NEW IPsec stack. The Mobile IPv6 stack is the same situation as the IPsec. The Mobile IPv6 stack included in this release is developed by HUT GO Project and the stack is mainly written for linux-2.4 kernel. Currently USAGI Project and GO Project have started joint project for developing new Mobile IPv6 stack based on linux-2.6 kernel. You can get our complete kit which includes kernel tree, library and applications from . We also provide separate patches against the main-line kernel and the tools . Many of our efforts are already in mainline kernel tree. We will continue making reasonable size patches and trying to merge it into mainline kernel tree. We announce the latest information on our web pages. Please check our web site . We also manage the mailing lists for USAGI users. If you have questions, please join the mailing list. Comments and advises are also welcome on that mailing list. Please visit for further information. Thanks. About USAGI Project The USAGI Project is managed by volunteers and aims to provide better IPv6 environment on Linux freely. We are tightly collaborating with WIDE Project, KAME Project and TAHI Project, and trying to improve Linux kernel, IPv6 related libraries and IPv6 applications. Our snapshots are released every two weeks and stable release is released several times a year. Please check our web site http://www.linux-ipv6.org for the latest information. -- USAGI Project members From brad@mainstreetsoftworks.com Sun Jan 4 09:38:19 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 09:38:34 -0800 (PST) Received: from nameserver1.mcve.com (nameserver1.brainwerkz.net [209.251.159.130]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i04Hc8Ta026827 for ; Sun, 4 Jan 2004 09:38:09 -0800 Received: from mainstreetsoftworks.com (ip68-105-173-45.ga.at.cox.net [68.105.173.45]) by nameserver1.mcve.com (Postfix) with ESMTP id 00D3C85B43; Sun, 4 Jan 2004 12:03:02 -0500 (EST) Message-ID: <3FF846C3.5070207@mainstreetsoftworks.com> Date: Sun, 04 Jan 2004 12:00:51 -0500 From: Brad House User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031121 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Francois Romieu Cc: netdev@oss.sgi.com, Jeff Garzik , brad_mssw@gentoo.org Subject: r8169 in netdev experimental References: <20031122183001.GA16993@gtf.org> <20031124000939.A456@electric-eye.fr.zoreil.com> <20031126004550.A25408@electric-eye.fr.zoreil.com> <20031127235143.A16767@electric-eye.fr.zoreil.com> <20031130014738.A2589@electric-eye.fr.zoreil.com> In-Reply-To: <20031130014738.A2589@electric-eye.fr.zoreil.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2205 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: brad@mainstreetsoftworks.com Precedence: bulk X-list: netdev Ok, sorry I dropped out of existance for a while. I just tried the 2.6.0-bk2 netdev experimental patches, and the r8169 module locks the system on loading. Funny thing is I had to unplug the power cable from the computer for a few seconds and plug it back in, because an immediate reset wouldn't let to old driver work :/ Let me know where to start debugging this, as I should have some time here. (Been busy getting AMD64 port into 'official' mode for Gentoo, so I haven't had time to look into this too much...) Thanks -Brad Francois Romieu wrote: > Hopefully last round of Brad/Realtek's merging. > > Patches apply in this order: > 1 - r8169-hw_start.patch > 2 - r8169-missing-tx-stats.patch > 3 - r8169-intr_mask.patch > > on top of: > > 2.6.0-test11 > + 2.6.0-test9-bk25-netdrvr-exp1 > + r8169-mac-phy-version > + r8169-init_one > + r8169-timer > > The unconditional calls to rtl8169_{rx/tx}_interrupt in rtl8169_interrupt() > are not integrated. That should not make a huge difference. > > -- > Ueimor > > > ------------------------------------------------------------------------ > > > Merge of changes from Realtek: > - register voodoo in rtl8169_hw_start(). > > > drivers/net/r8169.c | 6 ++++++ > 1 files changed, 6 insertions(+) > > diff -puN drivers/net/r8169.c~r8169-hw_start drivers/net/r8169.c > --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-hw_start 2003-11-29 20:36:12.000000000 +0100 > +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-11-29 20:44:17.000000000 +0100 > @@ -1028,6 +1028,12 @@ rtl8169_hw_start(struct net_device *dev) > RTL_W32(TxConfig, > (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << > TxInterFrameGapShift)); > + RTL_W16(CPlusCmd, RTL_R16(CPlusCmd)); > + > + if (tp->mac_version == RTL_GIGA_MAC_VER_D) { > + dprintk(KERN_INFO PFX "Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14 MUST be 1\n"); > + RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | (1 << 14) | (1 << 3)); > + } > > tp->cur_rx = 0; > > > _ > > > ------------------------------------------------------------------------ > > > Driver forgot to update the transmitted bytes counter. > Originally done in rtl8169_start_xmit() by Realtek. > > > drivers/net/r8169.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletion(-) > > diff -puN drivers/net/r8169.c~r8169-missing-tx-stats drivers/net/r8169.c > --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-missing-tx-stats 2003-11-29 22:34:10.000000000 +0100 > +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-11-30 00:26:09.000000000 +0100 > @@ -1303,10 +1303,13 @@ rtl8169_tx_interrupt(struct net_device * > int cur = dirty_tx % NUM_TX_DESC; > struct sk_buff *skb = tp->Tx_skbuff[cur]; > > + /* FIXME: is it really accurate for TxErr ? */ > + tp->stats.tx_bytes += skb->len >= ETH_ZLEN ? > + skb->len : ETH_ZLEN; > + tp->stats.tx_packets++; > rtl8169_unmap_tx_skb(tp->pci_dev, tp->Tx_skbuff + cur, > tp->TxDescArray + cur); > dev_kfree_skb_irq(skb); > - tp->stats.tx_packets++; > dirty_tx++; > tx_left--; > entry++; > > _ > > > ------------------------------------------------------------------------ > > drivers/net/r8169.c | 7 ++----- > 1 files changed, 2 insertions(+), 5 deletions(-) > > diff -puN drivers/net/r8169.c~r8169-intr_mask drivers/net/r8169.c > --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-intr_mask 2003-11-30 01:16:48.000000000 +0100 > +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-11-30 01:18:22.000000000 +0100 > @@ -334,8 +334,7 @@ static void rtl8169_tx_timeout(struct ne > static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev); > > static const u16 rtl8169_intr_mask = > - SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | > - RxErr | RxOK; > + RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; > static const unsigned int rtl8169_rx_config = > (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift); > > @@ -1445,9 +1444,7 @@ rtl8169_interrupt(int irq, void *dev_ins > RTL_W16(IntrStatus, > (status & RxFIFOOver) ? (status | RxOverflow) : status); > > - if ((status & > - (SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver > - | TxErr | TxOK | RxErr | RxOK)) == 0) > + if (!(status & rtl8169_intr_mask)) > break; > > // Rx interrupt > > _ From romieu@fr.zoreil.com Sun Jan 4 14:40:33 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 14:40:46 -0800 (PST) Received: from fr.zoreil.com (electric-eye.fr.zoreil.com [213.41.134.224]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i04MeWTa007487 for ; Sun, 4 Jan 2004 14:40:33 -0800 Received: from electric-eye.fr.zoreil.com (localhost.localdomain [127.0.0.1]) by fr.zoreil.com (8.12.8/8.12.1) with ESMTP id i04McosW003611; Sun, 4 Jan 2004 23:38:50 +0100 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id i04McnH2003610; Sun, 4 Jan 2004 23:38:49 +0100 Date: Sun, 4 Jan 2004 23:38:49 +0100 From: Francois Romieu To: Brad House Cc: netdev@oss.sgi.com, Jeff Garzik , brad_mssw@gentoo.org Subject: Re: r8169 in netdev experimental Message-ID: <20040104233849.A3214@electric-eye.fr.zoreil.com> References: <20031122183001.GA16993@gtf.org> <20031124000939.A456@electric-eye.fr.zoreil.com> <20031126004550.A25408@electric-eye.fr.zoreil.com> <20031127235143.A16767@electric-eye.fr.zoreil.com> <20031130014738.A2589@electric-eye.fr.zoreil.com> <3FF846C3.5070207@mainstreetsoftworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <3FF846C3.5070207@mainstreetsoftworks.com>; from brad@mainstreetsoftworks.com on Sun, Jan 04, 2004 at 12:00:51PM -0500 X-Organisation: Land of Sunshine Inc. X-archive-position: 2206 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: romieu@fr.zoreil.com Precedence: bulk X-list: netdev Brad House : [...] > Let me know where to start debugging this, as I should > have some time here. static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, u32 start, u32 end) { u32 cur; for (cur = start; end - start > 0; cur++) { ^^^^^ This should read: for (cur = start; end - cur > 0; cur++) { Care to test 2.6.1-rc1-mm1 and simply change the offending line ? -- Ueimor From scott.feldman@intel.com Sun Jan 4 16:07:25 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 16:07:38 -0800 (PST) Received: from hermes-pilot.fm.intel.com (fmr99.intel.com [192.55.52.32]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i0507OTa008998 for ; Sun, 4 Jan 2004 16:07:25 -0800 Received: from petasus.fm.intel.com (petasus.fm.intel.com [10.1.192.37]) by hermes-pilot.fm.intel.com (8.12.9-20030918-01/8.12.9/d: major-outer.mc,v 1.12 2003/12/18 18:58:11 root Exp $) with ESMTP id i0504Pmu031989; Mon, 5 Jan 2004 00:04:25 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.fm.intel.com (8.12.9-20030918-01/8.12.9/d: major-inner.mc,v 1.7 2003/12/18 18:58:10 root Exp $) with SMTP id i0508ScU010246; Mon, 5 Jan 2004 00:08:32 GMT Received: from [134.134.3.50] ([134.134.3.50]) by fmsmsxvs041.fm.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010416071211741 ; Sun, 04 Jan 2004 16:07:12 -0800 Date: Sun, 4 Jan 2004 16:43:48 -0800 (PST) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com, "Feldman, Scott" , Subject: [e1000 2.6-exp] back out CSA interrupt fix Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2207 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: scott.feldman@intel.com Precedence: bulk X-list: netdev * 8086:1019 82547 CSA-based LOMs lock up the system with this code, so let's revert back to what's in 2.6.0 until we can figure out why this is causing problems. --------- --- net-drivers-2.5-exp/drivers/net/e1000/e1000_main.c.orig 2004-01-04 15:58:59.000000000 -0800 +++ net-drivers-2.5-exp/drivers/net/e1000/e1000_main.c 2004-01-04 15:59:32.000000000 -0800 @@ -2097,26 +2097,10 @@ __netif_rx_schedule(netdev); } #else - /* Writing IMC and IMS is needed for 82547. - Due to Hub Link bus being occupied, an interrupt - de-assertion message is not able to be sent. - When an interrupt assertion message is generated later, - two messages are re-ordered and sent out. - That causes APIC to think 82547 is in de-assertion - state, while 82547 is in assertion state, resulting - in dead lock. Writing IMC forces 82547 into - de-assertion state. - */ - if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) - e1000_irq_disable(adapter); - for(i = 0; i < E1000_MAX_INTR; i++) if(!e1000_clean_rx_irq(adapter) & !e1000_clean_tx_irq(adapter)) break; - - if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) - e1000_irq_enable(adapter); #endif return IRQ_HANDLED; From torvalds@osdl.org Sun Jan 4 18:30:29 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 18:30:43 -0800 (PST) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i052UTTa013877 for ; Sun, 4 Jan 2004 18:30:29 -0800 Received: from localhost (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i052ULM15312; Sun, 4 Jan 2004 18:30:21 -0800 Date: Sun, 4 Jan 2004 18:30:21 -0800 (PST) From: Linus Torvalds To: Erik Hensema cc: netdev@oss.sgi.com, "David S. Miller" Subject: Re: 2.6.0: something is leaking memory In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2208 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: torvalds@osdl.org Precedence: bulk X-list: netdev On Sun, 4 Jan 2004, Erik Hensema wrote: > Linus Torvalds (torvalds@osdl.org) wrote: > > > > Can you do /proc/slabinfo too? > > Sure, this is of course my currently running system, 4 days, 9:53 > uptime. > > slabinfo - version: 2.0 > # name : tunables : slabdata > tcp6_sock 19729 19732 1024 4 1 : tunables 54 27 0 : slabdata 4933 4933 0 You've got 19 _megabytes_ allocated to "tcp6_sock", and they are all marked as "active". That's almost certainly the leaking bug. Everything else looks reasonably normal. > I do use IPv6. I've got three active tunnels and native IPv6 over > ethernet. Yeah, but there is no way you have 19 MB worth of sockets active for three tunnels. David? Linus From yoshfuji@linux-ipv6.org Sun Jan 4 20:52:40 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 20:52:53 -0800 (PST) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.135.30]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i054qdTa020159 for ; Sun, 4 Jan 2004 20:52:40 -0800 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (Postfix) with ESMTP id ABE3033CA5; Mon, 5 Jan 2004 13:52:52 +0900 (JST) Date: Mon, 05 Jan 2004 13:52:52 +0900 (JST) Message-Id: <20040105.135252.07995935.yoshfuji@linux-ipv6.org> To: erik@hensema.net Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: (usagi-core 16947) Re: 2.6.0: something is leaking memory From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2209 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev In article (at Sun, 4 Jan 2004 21:31:26 +0000 (UTC)), Erik Hensema says: > > Can you do /proc/slabinfo too? > > Sure, this is of course my currently running system, 4 days, 9:53 > uptime. > > slabinfo - version: 2.0 > # name : tunables : slabdata : > tcp6_sock 19729 19732 1024 4 1 : tunables 54 27 0 : slabdata 4933 4933 0 : > > Clearly the memory leak isn't in the page cache, so the most likely source > > is network buffers, and most likely in iptables connection tracking or > > similar. If you actually _use_ IPv6, then that is also more likely to have > > leaks just due to less testing. > > I do use IPv6. I've got three active tunnels and native IPv6 over > ethernet. > > I've always had problems with nscd leaking filedescriptors, all > IPv6 connections to my LDAP server. This started after upgrading > suse 8.0 to 8.2 (I think the problem is in nss_ldap). > I'm restarting nscd using a cronjob every night now. Output of > netstat --inet6 -avpn is below. All sockets in CLOSE_WAIT are > leaked and will go away after a nscd restart. How about /proc/slabinfo just after restarting nss_ldap? > The server isn't very critical, but I do need it. I'm willing to > try some patches (or do an upgrade to -mm), but nothing to wild. > > netstat --inet6 -avpn > > Active Internet connections (servers and established) > Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name > tcp 0 0 :::22 :::* LISTEN 1208/sshd > tcp 0 0 :::119 :::* LISTEN 1364/innd > tcp 0 0 :::25 :::* LISTEN 1433/sendmail: acce > tcp 0 0 :::953 :::* LISTEN 1175/named > tcp 0 0 ::1:6010 :::* LISTEN 19900/sshd > tcp 0 0 ::1:6011 :::* LISTEN 20150/sshd > tcp 1 0 ::1:50565 2001:888:10a1::1:389 CLOSE_WAIT 26536/nscd > tcp 1 0 ::1:50224 2001:888:10a1::1:389 CLOSE_WAIT 26536/nscd > tcp 0 0 2001:888:10a1::1:389 ::1:55936 ESTABLISHED 1145/slapd > tcp 1 0 ::1:50343 2001:888:10a1::1:389 CLOSE_WAIT 26536/nscd > tcp 1 0 ::1:50988 2001:888:10a1::1:389 CLOSE_WAIT 26536/nscd : There're too many sockets in CLOSE_WAIT, but the number is very different from "tcp6_sock." And, what is happened when you use ipv4 in your nscd? -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From davem@pizda.ninka.net Sun Jan 4 20:54:03 2004 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 Jan 2004 20:54:16 -0800 (PST) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i054s2Ta020386 for ; Sun, 4 Jan 2004 20:54:03 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA04880; Sun, 4 Jan 2004 20:48:34 -0800 Date: Sun, 4 Jan 2004 20:48:34 -0800 From: "David S. Miller" To: Linus Torvalds Cc: erik@hensema.net, netdev@oss.sgi.com Subject: Re: 2.6.0: something is leaking memory Message-Id: <20040104204834.40b6ca51.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.6; sparc-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2210 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davem@redhat.com Precedence: bulk X-list: netdev On Sun, 4 Jan 2004 18:30:21 -0800 (PST) Linus Torvalds wrote: > You've got 19 _megabytes_ allocated to "tcp6_sock", and they are all > marked as "active". That's almost certainly the leaking bug. > > Everything else looks reasonably normal. ... > David? Fixed by changeset 1.1496.16.1 which is in 2.6.1-rc1 From madis@cyber.ee Mon Jan 5 04:59:17 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 04:59:30 -0800 (PST) Received: from alien (pc24.host2.starman.ee [62.65.194.24]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05CxFTa015577 for ; Mon, 5 Jan 2004 04:59:17 -0800 Received: from mzz (helo=localhost) by alien with local-esmtp (Exim 3.36 #1 (Debian)) id 1AdUJl-0000Go-00; Mon, 05 Jan 2004 14:58:49 +0200 Date: Mon, 5 Jan 2004 14:58:48 +0200 (EET) From: madis X-X-Sender: mzz@alien To: Carl-Daniel Hailfinger cc: Madis Janson , netdev@oss.sgi.com Subject: Re: forcedeth unknown events 0x21 In-Reply-To: <3FE6678B.5070006@gmx.net> Message-ID: References: <3FE6678B.5070006@gmx.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2211 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: madis@cyber.ee Precedence: bulk X-list: netdev On Mon, 22 Dec 2003, Carl-Daniel Hailfinger wrote: > Madis Janson wrote: > > When trying forcedeth_2_6_patch_v19.txt, i got the following message > > fastly repeating after ifup eth0: > > > > "eth0: received irq with unknown events 0x21. Please report" > > > > and it didn't work eighter (ifup just stalled). > > > > kernel: > > > > 2.6.0 release + patches: > > http://www.held.org.il/patches/patch-lirc-2.6.0-test9-oh.diff.bz2 > > http://www.hailfinger.org/carldani/linux/patches/forcedeth/forcedeth_2_6_patch_v19.txt > > Please try the attached patch on top of it and report back if it works. > the unknown events message disappeared, but the network did not start to work... ======================================================== + if (events & (NVREG_IRQ_RX_ERR)) { + dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably RX fail.\n", + dev->name, events); here were '}' missing. -- mzz From mostrows@watson.ibm.com Mon Jan 5 05:08:00 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 05:08:13 -0800 (PST) Received: from brick.watson.ibm.com (yktgi01e0-s4.watson.ibm.com [129.34.20.23]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05D7xTa016274 for ; Mon, 5 Jan 2004 05:08:00 -0800 Received: by brick.watson.ibm.com (Postfix, from userid 9965) id E5641C024; Mon, 5 Jan 2004 08:07:58 -0500 (EST) Subject: Deadlock in sungem/ip_auto_config/linkwatch From: Michal Ostrowski To: netdev@oss.sgi.com Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-VstyQxFiTA9BMsLFyv50" Message-Id: <1073307882.2041.98320.camel@brick.watson.ibm.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 05 Jan 2004 08:07:58 -0500 X-archive-position: 2212 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mostrows@watson.ibm.com Precedence: bulk X-list: netdev --=-VstyQxFiTA9BMsLFyv50 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I believe I've found a potential deadlock condition. It occurs when we make the following sequence of calls: ip_auto_config ic_open_devs dev_change_flags dev_open gem_open flush_scheduled_work ic_open_devs grabs rtnl_sem with an rtnl_shlock() call. The sungem driver at some point calls gem_init_one, which calls netif_carrier_*, which in turn calls schedule_work (linkwatch_event). linkwatch_event in turn needs rtnl_sem. If we enter the call sequence above and linkwatch_event is still pending, we will deadlock since flush_scheduled_work will wait for completion of linkwatch_event, which is blocked since it cannot get rtnl_sem. In general when can one call flush_scheduled_work? It seems that one can't unless you know your callers aren't holding any locks. --=20 Michal Ostrowski --=-VstyQxFiTA9BMsLFyv50 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/+WDqDMDCqU5zPMARAmTwAJ9ujgnF4BI4AVvkhSQ5YgJXBx+sXACfXT+z rx8XL7PYFznObN8IXIZqAW8= =HBFR -----END PGP SIGNATURE----- --=-VstyQxFiTA9BMsLFyv50-- From amir.noam@intel.com Mon Jan 5 07:25:28 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:25:51 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FPPTa021258 for ; Mon, 5 Jan 2004 07:25:27 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FPBiI018818; Mon, 5 Jan 2004 15:25:11 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FOkwq008552; Mon, 5 Jan 2004 15:25:11 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517251024220 ; Mon, 05 Jan 2004 17:25:10 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FP8hb001043; Mon, 5 Jan 2004 17:25:09 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 0/3] [bonding 2.4] Using per-bond parameters Date: Mon, 5 Jan 2004 17:25:08 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051725.08348.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2213 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev The following patch set makes each bonding interface keep its own set of parameters, rather than use global values. This is the first step necessary to allow the configuration of different parameters to different bonding interfaces. The patches are against the netdev-2.4 tree (after Shmulik's 'update comment blocks' patch). -- Amir From amir.noam@intel.com Mon Jan 5 07:26:50 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:27:04 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FQmTa021453 for ; Mon, 5 Jan 2004 07:26:49 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FQYiI019025; Mon, 5 Jan 2004 15:26:34 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FQYwi008750; Mon, 5 Jan 2004 15:26:34 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517263324268 ; Mon, 05 Jan 2004 17:26:33 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FQXhb001058; Mon, 5 Jan 2004 17:26:33 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 1/3] [bonding 2.4] Save parameters in a per-bond data structure Date: Mon, 5 Jan 2004 17:26:26 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051726.33613.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2214 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev - Save the bonding parameters in a per-bond data structure. - Move all handling of the insmod parameters to bond_check_params(). - Fix the handling of some warning messages regarding parameter use. diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:01 2004 +++ b/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:02 2004 @@ -509,7 +509,6 @@ /* monitor all links that often (in milliseconds). <=0 disables monitoring */ #define BOND_LINK_MON_INTERV 0 #define BOND_LINK_ARP_INTERV 0 -#define MAX_ARP_IP_TARGETS 16 static int max_bonds = BOND_DEFAULT_MAX_BONDS; static int miimon = BOND_LINK_MON_INTERV; @@ -520,7 +519,7 @@ static char *mode = NULL; static char *primary = NULL; static char *lacp_rate = NULL; static int arp_interval = BOND_LINK_ARP_INTERV; -static char *arp_ip_target[MAX_ARP_IP_TARGETS] = { NULL, }; +static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; MODULE_PARM(max_bonds, "i"); MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); @@ -540,7 +539,7 @@ MODULE_PARM(lacp_rate, "s"); MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)"); MODULE_PARM(arp_interval, "i"); MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); -MODULE_PARM(arp_ip_target, "1-" __MODULE_STRING(MAX_ARP_IP_TARGETS) "s"); +MODULE_PARM(arp_ip_target, "1-" __MODULE_STRING(BOND_MAX_ARP_TARGETS) "s"); MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form"); /*----------------------------- Global variables ----------------------------*/ @@ -554,7 +553,7 @@ static LIST_HEAD(bond_dev_list); static struct proc_dir_entry *bond_proc_dir = NULL; #endif -static u32 arp_target[MAX_ARP_IP_TARGETS] = { 0, } ; +static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; static int arp_ip_count = 0; static u32 my_ip = 0; static int bond_mode = BOND_MODE_ROUNDROBIN; @@ -590,6 +589,10 @@ static struct bond_parm_tbl bond_mode_tb { NULL, -1}, }; +/*-------------------------- Forward declarations ---------------------------*/ + +static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode); + /*---------------------------- General routines -----------------------------*/ static const char *bond_mode_name(void) @@ -2236,7 +2239,7 @@ static void bond_arp_send_all(struct sla { int i; - for (i = 0; (idev, my_ip, NULL, slave->dev->dev_addr, NULL); @@ -3755,13 +3758,47 @@ static int bond_accept_fastpath(struct n /*------------------------- Device initialization ---------------------------*/ /* + * set bond mode specific net device operations + */ +static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode) +{ + switch (mode) { + case BOND_MODE_ROUNDROBIN: + bond_dev->hard_start_xmit = bond_xmit_roundrobin; + break; + case BOND_MODE_ACTIVEBACKUP: + bond_dev->hard_start_xmit = bond_xmit_activebackup; + break; + case BOND_MODE_XOR: + bond_dev->hard_start_xmit = bond_xmit_xor; + break; + case BOND_MODE_BROADCAST: + bond_dev->hard_start_xmit = bond_xmit_broadcast; + break; + case BOND_MODE_8023AD: + bond_dev->hard_start_xmit = bond_3ad_xmit_xor; + break; + case BOND_MODE_TLB: + case BOND_MODE_ALB: + bond_dev->hard_start_xmit = bond_alb_xmit; + bond_dev->set_mac_address = bond_alb_set_mac_address; + break; + default: + /* Should never happen, mode already checked */ + printk(KERN_ERR DRV_NAME + ": Error: Unknown bonding mode %d\n", + mode); + break; + } +} + +/* * Does not allocate but creates a /proc entry. * Allowed to fail. */ -static int __init bond_init(struct net_device *bond_dev) +static int __init bond_init(struct net_device *bond_dev, struct bond_params *params) { struct bonding *bond = bond_dev->priv; - int count; dprintk("Begin bond_init for %s\n", bond_dev->name); @@ -3769,6 +3806,8 @@ static int __init bond_init(struct net_d rwlock_init(&bond->lock); rwlock_init(&bond->curr_slave_lock); + bond->params = *params; /* copy params struct */ + /* Initialize pointers */ bond->first_slave = NULL; bond->curr_active_slave = NULL; @@ -3785,33 +3824,7 @@ static int __init bond_init(struct net_d bond_dev->change_mtu = bond_change_mtu; bond_dev->set_mac_address = bond_set_mac_address; - switch (bond_mode) { - case BOND_MODE_ROUNDROBIN: - bond_dev->hard_start_xmit = bond_xmit_roundrobin; - break; - case BOND_MODE_ACTIVEBACKUP: - bond_dev->hard_start_xmit = bond_xmit_activebackup; - break; - case BOND_MODE_XOR: - bond_dev->hard_start_xmit = bond_xmit_xor; - break; - case BOND_MODE_BROADCAST: - bond_dev->hard_start_xmit = bond_xmit_broadcast; - break; - case BOND_MODE_8023AD: - bond_dev->hard_start_xmit = bond_3ad_xmit_xor; /* extern */ - break; - case BOND_MODE_TLB: - case BOND_MODE_ALB: - bond_dev->hard_start_xmit = bond_alb_xmit; /* extern */ - bond_dev->set_mac_address = bond_alb_set_mac_address; /* extern */ - break; - default: - printk(KERN_ERR DRV_NAME - ": Error: Unknown bonding mode %d\n", - bond_mode); - return -EINVAL; - } + bond_set_mode_ops(bond_dev, bond->params.mode); #ifdef CONFIG_NET_FASTROUTE bond_dev->accept_fastpath = bond_accept_fastpath; @@ -3821,27 +3834,6 @@ static int __init bond_init(struct net_d bond_dev->tx_queue_len = 0; bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; - printk(KERN_INFO DRV_NAME ": %s registered with", bond_dev->name); - if (miimon) { - printk(" MII link monitoring set to %d ms", miimon); - updelay /= miimon; - downdelay /= miimon; - } else { - printk("out MII link monitoring"); - } - printk(", in %s mode.\n", bond_mode_name()); - - printk(KERN_INFO DRV_NAME ": %s registered with", bond_dev->name); - if (arp_interval > 0) { - printk(" ARP monitoring set to %d ms with %d target(s):", - arp_interval, arp_ip_count); - for (count=0 ; countmode = bond_mode; + params->miimon = miimon; + params->arp_interval = arp_interval; + params->updelay = updelay; + params->downdelay = downdelay; + params->use_carrier = use_carrier; + params->lacp_fast = lacp_fast; + params->primary[0] = 0; + + if (primary) { + strncpy(params->primary, primary, IFNAMSIZ); + params->primary[IFNAMSIZ - 1] = 0; + } + + memcpy(params->arp_targets, arp_target, sizeof(arp_target)); + return 0; } static int __init bonding_init(void) { + struct bond_params params; int i; int res; printk(KERN_INFO "%s", version); - res = bond_check_params(); + res = bond_check_params(¶ms); if (res) { return res; } @@ -4158,7 +4182,7 @@ static int __init bonding_init(void) * /proc files), but before register_netdevice(), because we * need to set function pointers. */ - res = bond_init(bond_dev); + res = bond_init(bond_dev, ¶ms); if (res < 0) { free_netdev(bond_dev); goto out_err; diff -Nuarp a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h --- a/drivers/net/bonding/bonding.h Mon Jan 5 17:05:01 2004 +++ b/drivers/net/bonding/bonding.h Mon Jan 5 17:05:02 2004 @@ -36,11 +36,13 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.5.3" +#define DRV_VERSION "2.5.4" #define DRV_RELDATE "December 30, 2003" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" +#define BOND_MAX_ARP_TARGETS 16 + #ifdef BONDING_DEBUG #define dprintk(fmt, args...) \ printk(KERN_DEBUG \ @@ -133,6 +135,18 @@ bond_for_each_slave_from(bond, pos, cnt, (bond)->first_slave) +struct bond_params { + int mode; + int miimon; + int arp_interval; + int use_carrier; + int updelay; + int downdelay; + int lacp_fast; + char primary[IFNAMSIZ]; + u32 arp_targets[BOND_MAX_ARP_TARGETS]; +}; + struct slave { struct net_device *dev; /* first - usefull for panic debug */ struct slave *next; @@ -181,6 +195,7 @@ struct bonding { u16 flags; struct ad_bond_info ad_info; struct alb_bond_info alb_info; + struct bond_params params; }; /** From amir.noam@intel.com Mon Jan 5 07:28:05 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:28:19 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FS3Ta022198 for ; Mon, 5 Jan 2004 07:28:04 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FRniI019159; Mon, 5 Jan 2004 15:27:49 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FRFx4008811; Mon, 5 Jan 2004 15:27:48 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517274724296 ; Mon, 05 Jan 2004 17:27:47 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FRlhb001081; Mon, 5 Jan 2004 17:27:48 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 2/3] [bonding 2.4] Use the per-bond value of the bond_mode parameter Date: Mon, 5 Jan 2004 17:27:46 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051727.47839.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2215 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev Change usage of the global 'bond_mode' parameter to the per-bond value. diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:04 2004 +++ b/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:06 2004 @@ -595,9 +595,9 @@ static inline void bond_set_mode_ops(str /*---------------------------- General routines -----------------------------*/ -static const char *bond_mode_name(void) +static const char *bond_mode_name(int mode) { - switch (bond_mode) { + switch (mode) { case BOND_MODE_ROUNDROBIN : return "load balancing (round-robin)"; case BOND_MODE_ACTIVEBACKUP : @@ -803,7 +803,7 @@ static struct dev_mc_list *bond_mc_list_ */ static void bond_set_promiscuity(struct bonding *bond, int inc) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_set_promiscuity(bond->curr_active_slave->dev, inc); @@ -822,7 +822,7 @@ static void bond_set_promiscuity(struct */ static void bond_set_allmulti(struct bonding *bond, int inc) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_set_allmulti(bond->curr_active_slave->dev, inc); @@ -842,7 +842,7 @@ static void bond_set_allmulti(struct bon */ static void bond_mc_add(struct bonding *bond, void *addr, int alen) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); @@ -862,7 +862,7 @@ static void bond_mc_add(struct bonding * */ static void bond_mc_delete(struct bonding *bond, void *addr, int alen) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); @@ -922,13 +922,14 @@ static int bond_mc_list_copy(struct dev_ */ static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev) { + struct bonding *bond = bond_dev->priv; struct dev_mc_list *dmi; for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* del lacpdu mc addr from mc list */ u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; @@ -947,7 +948,7 @@ static void bond_mc_swap(struct bonding { struct dev_mc_list *dmi; - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* nothing to do - mc list is already up-to-date on * all slaves */ @@ -1064,7 +1065,7 @@ static void bond_change_active_slave(str if (new_active) { if (new_active->link == BOND_LINK_BACK) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one %d ms earlier.\n", @@ -1076,16 +1077,16 @@ static void bond_change_active_slave(str new_active->link = BOND_LINK_UP; new_active->jiffies = jiffies; - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { bond_3ad_handle_link_change(new_active, BOND_LINK_UP); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); } } else { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one.\n", @@ -1094,7 +1095,7 @@ static void bond_change_active_slave(str } } - if (bond_mode == BOND_MODE_ACTIVEBACKUP) { + if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { if (old_active) { bond_set_slave_inactive_flags(old_active); } @@ -1104,12 +1105,12 @@ static void bond_change_active_slave(str } } - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { bond_mc_swap(bond, new_active, old_active); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_active_change(bond, new_active); } else { bond->curr_active_slave = new_active; @@ -1264,13 +1265,13 @@ static int bond_enslave(struct net_devic return -EINVAL; } - if ((bond_mode == BOND_MODE_8023AD) || - (bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_8023AD) || + (bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { printk(KERN_ERR DRV_NAME ": Error: to use %s mode, you must upgrade " "ifenslave.\n", - bond_mode_name()); + bond_mode_name(bond->params.mode)); return -EOPNOTSUPP; } } @@ -1326,8 +1327,8 @@ static int bond_enslave(struct net_devic new_slave->dev = slave_dev; - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { /* bond_alb_init_slave() must be called before all other stages since * it might fail and we do not want to have to undo everything */ @@ -1342,7 +1343,7 @@ static int bond_enslave(struct net_devic * curr_active_slave, and that is taken care of later when calling * bond_change_active() */ - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* set promiscuity level to new slave */ if (bond_dev->flags & IFF_PROMISC) { dev_set_promiscuity(slave_dev, 1); @@ -1359,7 +1360,7 @@ static int bond_enslave(struct net_devic } } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* add lacpdu mc addr to mc list */ u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; @@ -1432,7 +1433,7 @@ static int bond_enslave(struct net_devic "forced to 100Mbps, duplex forced to Full.\n", new_slave->dev->name); - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { printk(KERN_WARNING "Operation of 802.3ad mode requires ETHTOOL " "support in base driver for proper aggregator " @@ -1440,14 +1441,14 @@ static int bond_enslave(struct net_devic } } - if (USES_PRIMARY(bond_mode) && primary) { + if (USES_PRIMARY(bond->params.mode) && primary) { /* if there is a primary slave, remember it */ if (strcmp(primary, new_slave->dev->name) == 0) { bond->primary_slave = new_slave; } } - switch (bond_mode) { + switch (bond->params.mode) { case BOND_MODE_ACTIVEBACKUP: /* if we're in active-backup mode, we need one and only one active * interface. The backup interfaces will have their NOARP flag set @@ -1637,7 +1638,7 @@ static int bond_release(struct net_devic } /* Inform AD package of unbinding of slave. */ - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* must be called before the slave is * detached from the list */ @@ -1666,8 +1667,8 @@ static int bond_release(struct net_devic bond_change_active_slave(bond, NULL); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { /* Must be called only after the slave has been * detached from the list and the curr_active_slave * has been cleared (if our_slave == old_current), @@ -1693,7 +1694,7 @@ static int bond_release(struct net_devic * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ if (bond_dev->flags & IFF_PROMISC) { dev_set_promiscuity(slave_dev, -1); @@ -1765,15 +1766,15 @@ static int bond_release_all(struct net_d /* Inform AD package of unbinding of slave * before slave is detached from the list. */ - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { bond_3ad_unbind_slave(slave); } slave_dev = slave->dev; bond_detach_slave(bond, slave); - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { /* must be called only after the slave * has been detached from the list */ @@ -1790,7 +1791,7 @@ static int bond_release_all(struct net_d * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ if (bond_dev->flags & IFF_PROMISC) { dev_set_promiscuity(slave_dev, -1); @@ -1864,6 +1865,10 @@ static int bond_ioctl_change_active(stru struct slave *new_active = NULL; int res = 0; + if (!USES_PRIMARY(bond->params.mode)) { + return -EINVAL; + } + /* Verify that master_dev is indeed the master of slave_dev */ if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) { @@ -1952,7 +1957,7 @@ static int bond_info_query(struct net_de { struct bonding *bond = bond_dev->priv; - info->bond_mode = bond_mode; + info->bond_mode = bond->params.mode; info->miimon = miimon; read_lock_bh(&bond->lock); @@ -2054,7 +2059,7 @@ static void bond_mii_monitor(struct net_ "%d ms.\n", bond_dev->name, IS_UP(slave_dev) - ? ((bond_mode == BOND_MODE_ACTIVEBACKUP) + ? ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) ? ((slave == oldcurrent) ? "active " : "backup ") : "") @@ -2076,8 +2081,8 @@ static void bond_mii_monitor(struct net_ /* in active/backup mode, we must * completely disable this interface */ - if ((bond_mode == BOND_MODE_ACTIVEBACKUP) || - (bond_mode == BOND_MODE_8023AD)) { + if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) || + (bond->params.mode == BOND_MODE_8023AD)) { bond_set_slave_inactive_flags(slave); } @@ -2089,12 +2094,12 @@ static void bond_mii_monitor(struct net_ slave_dev->name); /* notify ad that the link status has changed */ - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { bond_3ad_handle_link_change(slave, BOND_LINK_DOWN); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_link_change(bond, slave, BOND_LINK_DOWN); } @@ -2157,10 +2162,10 @@ static void bond_mii_monitor(struct net_ slave->link = BOND_LINK_UP; slave->jiffies = jiffies; - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* prevent it from being the active one */ slave->state = BOND_STATE_BACKUP; - } else if (bond_mode != BOND_MODE_ACTIVEBACKUP) { + } else if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) { /* make it immediately active */ slave->state = BOND_STATE_ACTIVE; } else if (slave != bond->primary_slave) { @@ -2175,12 +2180,12 @@ static void bond_mii_monitor(struct net_ slave_dev->name); /* notify ad that the link status has changed */ - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { bond_3ad_handle_link_change(slave, BOND_LINK_UP); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_link_change(bond, slave, BOND_LINK_UP); } @@ -2202,7 +2207,7 @@ static void bond_mii_monitor(struct net_ bond_update_speed_duplex(slave); - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { if (old_speed != slave->speed) { bond_3ad_adapter_speed_changed(slave); } @@ -2665,17 +2670,19 @@ static void bond_info_seq_stop(struct se read_unlock(&dev_base_lock); } -static void bond_info_show_master(struct seq_file *seq, struct bonding *bond) +static void bond_info_show_master(struct seq_file *seq) { + struct bonding *bond = seq->private; struct slave *curr; read_lock(&bond->curr_slave_lock); curr = bond->curr_active_slave; read_unlock(&bond->curr_slave_lock); - seq_printf(seq, "Bonding Mode: %s\n", bond_mode_name()); + seq_printf(seq, "Bonding Mode: %s\n", + bond_mode_name(bond->params.mode)); - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { if (curr) { seq_printf(seq, "Currently Active Slave: %s\n", @@ -2688,7 +2695,7 @@ static void bond_info_show_master(struct seq_printf(seq, "Up Delay (ms): %d\n", updelay * miimon); seq_printf(seq, "Down Delay (ms): %d\n", downdelay * miimon); - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { struct ad_info ad_info; seq_puts(seq, "\n802.3ad info\n"); @@ -2720,6 +2727,8 @@ static void bond_info_show_master(struct static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave) { + struct bonding *bond = seq->private; + seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); seq_printf(seq, "MII Status: %s\n", (slave->link == BOND_LINK_UP) ? "up" : "down"); @@ -2737,7 +2746,7 @@ static void bond_info_show_slave(struct slave->perm_hwaddr[5]); } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { const struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; @@ -2754,7 +2763,7 @@ static int bond_info_seq_show(struct seq { if (v == SEQ_START_TOKEN) { seq_printf(seq, "%s\n", version); - bond_info_show_master(seq, seq->private); + bond_info_show_master(seq); } else { bond_info_show_slave(seq, v); } @@ -3030,14 +3039,14 @@ static int bond_open(struct net_device * bond->kill_timers = 0; - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { struct timer_list *alb_timer = &(BOND_ALB_INFO(bond).alb_timer); /* bond_alb_initialize must be called before the timer * is started. */ - if (bond_alb_initialize(bond, (bond_mode == BOND_MODE_ALB))) { + if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { /* something went wrong - fail the open operation */ return -1; } @@ -3061,7 +3070,7 @@ static int bond_open(struct net_device * init_timer(arp_timer); arp_timer->expires = jiffies + 1; arp_timer->data = (unsigned long)bond_dev; - if (bond_mode == BOND_MODE_ACTIVEBACKUP) { + if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { arp_timer->function = (void *)&bond_activebackup_arp_mon; } else { arp_timer->function = (void *)&bond_loadbalance_arp_mon; @@ -3069,7 +3078,7 @@ static int bond_open(struct net_device * add_timer(arp_timer); } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { struct timer_list *ad_timer = &(BOND_AD_INFO(bond).ad_timer); init_timer(ad_timer); ad_timer->expires = jiffies + 1; @@ -3092,7 +3101,7 @@ static int bond_close(struct net_device bond_mc_list_destroy(bond); - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* Unregister the receive of LACPDUs */ bond_unregister_lacpdu(bond); } @@ -3114,7 +3123,7 @@ static int bond_close(struct net_device del_timer_sync(&bond->arp_timer); } - switch (bond_mode) { + switch (bond->params.mode) { case BOND_MODE_8023AD: del_timer_sync(&(BOND_AD_INFO(bond).ad_timer)); break; @@ -3129,8 +3138,8 @@ static int bond_close(struct net_device /* Release the bonded slaves */ bond_release_all(bond_dev); - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { /* Must be called only after all * slaves have been released */ @@ -3310,11 +3319,7 @@ static int bond_do_ioctl(struct net_devi break; case BOND_CHANGE_ACTIVE_OLD: case SIOCBONDCHANGEACTIVE: - if (USES_PRIMARY(bond_mode)) { - res = bond_ioctl_change_active(bond_dev, slave_dev); - } else { - res = -EINVAL; - } + res = bond_ioctl_change_active(bond_dev, slave_dev); break; default: res = -EOPNOTSUPP; @@ -3919,7 +3924,7 @@ static int bond_check_params(struct bond if (bond_mode != BOND_MODE_8023AD) { printk(KERN_INFO DRV_NAME ": lacp_rate param is irrelevant in mode %s\n", - bond_mode_name()); + bond_mode_name(bond_mode)); } else { lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); if (lacp_fast == -1) { @@ -4120,7 +4125,7 @@ static int bond_check_params(struct bond printk(KERN_WARNING DRV_NAME ": Warning: %s primary device specified but has no " "effect in %s mode\n", - primary, bond_mode_name()); + primary, bond_mode_name(bond_mode)); primary = NULL; } From amir.noam@intel.com Mon Jan 5 07:29:00 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:29:14 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FSvTa022693 for ; Mon, 5 Jan 2004 07:28:58 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FShiI019235; Mon, 5 Jan 2004 15:28:43 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FShwi008925; Mon, 5 Jan 2004 15:28:43 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517284124329 ; Mon, 05 Jan 2004 17:28:41 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FSghb001106; Mon, 5 Jan 2004 17:28:42 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 3/3] [bonding 2.4] Use the per-bond values of all remaining parameters Date: Mon, 5 Jan 2004 17:28:41 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051728.42301.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2216 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev Change usage of the all remaining global parameters to the per-bond values. diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:08 2004 +++ b/drivers/net/bonding/bond_main.c Mon Jan 5 17:05:10 2004 @@ -458,6 +458,9 @@ * - Fixed: Releasing the original active slave causes mac address duplication. * - Add support for slaves that use ethtool_ops. * Set version to 2.5.3. + * + * 2004/01/05 - Amir Noam + * - Save bonding parameters per bond instead of using the global values. */ //#define BONDING_DEBUG 1 @@ -699,14 +702,14 @@ verify: * It'd be nice if there was a good way to tell if a driver supports * netif_carrier, but there really isn't. */ -static int bond_check_dev_link(struct net_device *slave_dev, int reporting) +static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_dev, int reporting) { static int (* ioctl)(struct net_device *, struct ifreq *, int); struct ifreq ifr; struct mii_ioctl_data *mii; struct ethtool_value etool; - if (use_carrier) { + if (bond->params.use_carrier) { return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0; } @@ -994,7 +997,7 @@ static struct slave *bond_find_best_slav { struct slave *new_active, *old_active; struct slave *bestslave = NULL; - int mintime; + int mintime = bond->params.updelay; int i; new_active = old_active = bond->curr_active_slave; @@ -1007,15 +1010,13 @@ static struct slave *bond_find_best_slav } } - mintime = updelay; - /* first try the primary link; if arping, a link must tx/rx traffic * before it can be considered the curr_active_slave - also, we would skip * slaves between the curr_active_slave and primary_slave that may be up * and able to arp */ if ((bond->primary_slave) && - (!arp_interval) && + (!bond->params.arp_interval) && (IS_UP(bond->primary_slave->dev))) { new_active = bond->primary_slave; } @@ -1070,7 +1071,7 @@ static void bond_change_active_slave(str ": %s: making interface %s the new " "active one %d ms earlier.\n", bond->dev->name, new_active->dev->name, - (updelay - new_active->delay) * miimon); + (bond->params.updelay - new_active->delay) * bond->params.miimon); } new_active->delay = 0; @@ -1374,10 +1375,10 @@ static int bond_enslave(struct net_devic new_slave->delay = 0; new_slave->link_failure_count = 0; - if (miimon && !use_carrier) { - link_reporting = bond_check_dev_link(slave_dev, 1); + if (bond->params.miimon && !bond->params.use_carrier) { + link_reporting = bond_check_dev_link(bond, slave_dev, 1); - if ((link_reporting == -1) && !arp_interval) { + if ((link_reporting == -1) && !bond->params.arp_interval) { /* * miimon is set but a bonded network driver * does not support ETHTOOL/MII and @@ -1407,13 +1408,13 @@ static int bond_enslave(struct net_devic } /* check for initial state */ - if (!miimon || - (bond_check_dev_link(slave_dev, 0) == BMSR_LSTATUS)) { - if (updelay) { + if (!bond->params.miimon || + (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { + if (bond->params.updelay) { dprintk("Initial state of slave_dev is " "BOND_LINK_BACK\n"); new_slave->link = BOND_LINK_BACK; - new_slave->delay = updelay; + new_slave->delay = bond->params.updelay; } else { dprintk("Initial state of slave_dev is " "BOND_LINK_UP\n"); @@ -1441,9 +1442,9 @@ static int bond_enslave(struct net_devic } } - if (USES_PRIMARY(bond->params.mode) && primary) { + if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { /* if there is a primary slave, remember it */ - if (strcmp(primary, new_slave->dev->name) == 0) { + if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { bond->primary_slave = new_slave; } } @@ -1482,7 +1483,7 @@ static int bond_enslave(struct net_devic * can be called only after the mac address of the bond is set */ bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL, - lacp_fast); + bond->params.lacp_fast); } else { SLAVE_AD_INFO(new_slave).id = SLAVE_AD_INFO(new_slave->prev).id + 1; @@ -1958,7 +1959,7 @@ static int bond_info_query(struct net_de struct bonding *bond = bond_dev->priv; info->bond_mode = bond->params.mode; - info->miimon = miimon; + info->miimon = bond->params.miimon; read_lock_bh(&bond->lock); info->num_slaves = bond->slave_cnt; @@ -2008,11 +2009,13 @@ static void bond_mii_monitor(struct net_ struct bonding *bond = bond_dev->priv; struct slave *slave, *oldcurrent; int do_failover = 0; - int delta_in_ticks = (miimon * HZ) / 1000; + int delta_in_ticks; int i; read_lock(&bond->lock); + delta_in_ticks = (bond->params.miimon * HZ) / 1000; + if (bond->kill_timers) { goto out; } @@ -2037,7 +2040,7 @@ static void bond_mii_monitor(struct net_ u16 old_speed = slave->speed; u8 old_duplex = slave->duplex; - link_state = bond_check_dev_link(slave_dev, 0); + link_state = bond_check_dev_link(bond, slave_dev, 0); switch (slave->link) { case BOND_LINK_UP: /* the link was up */ @@ -2046,13 +2049,13 @@ static void bond_mii_monitor(struct net_ break; } else { /* link going down */ slave->link = BOND_LINK_FAIL; - slave->delay = downdelay; + slave->delay = bond->params.downdelay; if (slave->link_failure_count < UINT_MAX) { slave->link_failure_count++; } - if (downdelay) { + if (bond->params.downdelay) { printk(KERN_INFO DRV_NAME ": %s: link status down for %s " "interface %s, disabling it in " @@ -2065,7 +2068,7 @@ static void bond_mii_monitor(struct net_ : "") : "idle ", slave_dev->name, - downdelay * miimon); + bond->params.downdelay * bond->params.miimon); } } /* no break ! fall through the BOND_LINK_FAIL test to @@ -2117,7 +2120,7 @@ static void bond_mii_monitor(struct net_ ": %s: link status up again after %d " "ms for interface %s.\n", bond_dev->name, - (downdelay - slave->delay) * miimon, + (bond->params.downdelay - slave->delay) * bond->params.miimon, slave_dev->name); } break; @@ -2127,9 +2130,9 @@ static void bond_mii_monitor(struct net_ break; } else { /* link going up */ slave->link = BOND_LINK_BACK; - slave->delay = updelay; + slave->delay = bond->params.updelay; - if (updelay) { + if (bond->params.updelay) { /* if updelay == 0, no need to advertise about a 0 ms delay */ printk(KERN_INFO DRV_NAME @@ -2138,7 +2141,7 @@ static void bond_mii_monitor(struct net_ "in %d ms.\n", bond_dev->name, slave_dev->name, - updelay * miimon); + bond->params.updelay * bond->params.miimon); } } /* no break ! fall through the BOND_LINK_BACK state in @@ -2153,7 +2156,7 @@ static void bond_mii_monitor(struct net_ ": %s: link status down again after %d " "ms for interface %s.\n", bond_dev->name, - (updelay - slave->delay) * miimon, + (bond->params.updelay - slave->delay) * bond->params.miimon, slave_dev->name); } else { /* link stays up */ @@ -2235,17 +2238,20 @@ static void bond_mii_monitor(struct net_ } re_arm: - mod_timer(&bond->mii_timer, jiffies + delta_in_ticks); + if (bond->params.miimon) { + mod_timer(&bond->mii_timer, jiffies + delta_in_ticks); + } out: read_unlock(&bond->lock); } -static void bond_arp_send_all(struct slave *slave) +static void bond_arp_send_all(struct bonding *bond, struct slave *slave) { int i; + u32 *targets = bond->params.arp_targets; - for (i = 0; (i < BOND_MAX_ARP_TARGETS) && arp_target[i]; i++) { - arp_send(ARPOP_REQUEST, ETH_P_ARP, arp_target[i], slave->dev, + for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { + arp_send(ARPOP_REQUEST, ETH_P_ARP, targets[i], slave->dev, my_ip, NULL, slave->dev->dev_addr, NULL); } @@ -2263,11 +2269,13 @@ static void bond_loadbalance_arp_mon(str struct bonding *bond = bond_dev->priv; struct slave *slave, *oldcurrent; int do_failover = 0; - int delta_in_ticks = (arp_interval * HZ) / 1000; + int delta_in_ticks; int i; read_lock(&bond->lock); + delta_in_ticks = (bond->params.arp_interval * HZ) / 1000; + if (bond->kill_timers) { goto out; } @@ -2352,7 +2360,7 @@ static void bond_loadbalance_arp_mon(str * to be unstable during low/no traffic periods */ if (IS_UP(slave->dev)) { - bond_arp_send_all(slave); + bond_arp_send_all(bond, slave); } } @@ -2372,7 +2380,9 @@ static void bond_loadbalance_arp_mon(str } re_arm: - mod_timer(&bond->arp_timer, jiffies + delta_in_ticks); + if (bond->params.arp_interval) { + mod_timer(&bond->arp_timer, jiffies + delta_in_ticks); + } out: read_unlock(&bond->lock); } @@ -2396,11 +2406,13 @@ static void bond_activebackup_arp_mon(st { struct bonding *bond = bond_dev->priv; struct slave *slave; - int delta_in_ticks = (arp_interval * HZ) / 1000; + int delta_in_ticks; int i; read_lock(&bond->lock); + delta_in_ticks = (bond->params.arp_interval * HZ) / 1000; + if (bond->kill_timers) { goto out; } @@ -2559,7 +2571,7 @@ static void bond_activebackup_arp_mon(st * rx traffic */ if (slave && my_ip) { - bond_arp_send_all(slave); + bond_arp_send_all(bond, slave); } } @@ -2580,7 +2592,7 @@ static void bond_activebackup_arp_mon(st if (IS_UP(slave->dev)) { slave->link = BOND_LINK_BACK; bond_set_slave_active_flags(slave); - bond_arp_send_all(slave); + bond_arp_send_all(bond, slave); slave->jiffies = jiffies; bond->current_arp_slave = slave; break; @@ -2612,7 +2624,9 @@ static void bond_activebackup_arp_mon(st } re_arm: - mod_timer(&bond->arp_timer, jiffies + delta_in_ticks); + if (bond->params.arp_interval) { + mod_timer(&bond->arp_timer, jiffies + delta_in_ticks); + } out: read_unlock(&bond->lock); } @@ -2683,22 +2697,27 @@ static void bond_info_show_master(struct bond_mode_name(bond->params.mode)); if (USES_PRIMARY(bond->params.mode)) { - if (curr) { - seq_printf(seq, - "Currently Active Slave: %s\n", - curr->dev->name); - } + seq_printf(seq, "Primary Slave: %s\n", + (bond->params.primary[0]) ? + bond->params.primary : "None"); + + seq_printf(seq, "Currently Active Slave: %s\n", + (curr) ? curr->dev->name : "None"); } seq_printf(seq, "MII Status: %s\n", (curr) ? "up" : "down"); - seq_printf(seq, "MII Polling Interval (ms): %d\n", miimon); - seq_printf(seq, "Up Delay (ms): %d\n", updelay * miimon); - seq_printf(seq, "Down Delay (ms): %d\n", downdelay * miimon); + seq_printf(seq, "MII Polling Interval (ms): %d\n", bond->params.miimon); + seq_printf(seq, "Up Delay (ms): %d\n", + bond->params.updelay * bond->params.miimon); + seq_printf(seq, "Down Delay (ms): %d\n", + bond->params.downdelay * bond->params.miimon); if (bond->params.mode == BOND_MODE_8023AD) { struct ad_info ad_info; seq_puts(seq, "\n802.3ad info\n"); + seq_printf(seq, "LACP rate: %s\n", + (bond->params.lacp_fast) ? "fast" : "slow"); if (bond_3ad_get_active_agg_info(bond, &ad_info)) { seq_printf(seq, "bond %s has no active aggregator\n", @@ -3058,7 +3077,7 @@ static int bond_open(struct net_device * add_timer(alb_timer); } - if (miimon) { /* link check interval, in milliseconds. */ + if (bond->params.miimon) { /* link check interval, in milliseconds. */ init_timer(mii_timer); mii_timer->expires = jiffies + 1; mii_timer->data = (unsigned long)bond_dev; @@ -3066,7 +3085,7 @@ static int bond_open(struct net_device * add_timer(mii_timer); } - if (arp_interval) { /* arp interval, in milliseconds. */ + if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ init_timer(arp_timer); arp_timer->expires = jiffies + 1; arp_timer->data = (unsigned long)bond_dev; @@ -3115,11 +3134,11 @@ static int bond_close(struct net_device * because a running timer might be trying to hold it too */ - if (miimon) { /* link check interval, in milliseconds. */ + if (bond->params.miimon) { /* link check interval, in milliseconds. */ del_timer_sync(&bond->mii_timer); } - if (arp_interval) { /* arp interval, in milliseconds. */ + if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ del_timer_sync(&bond->arp_timer); } @@ -3602,7 +3621,7 @@ static int bond_xmit_activebackup(struct /* if we are sending arp packets, try to at least identify our own ip address */ - if (arp_interval && !my_ip && + if (bond->params.arp_interval && !my_ip && (skb->protocol == __constant_htons(ETH_P_ARP))) { char *the_ip = (char *)skb->data + sizeof(struct ethhdr) + From amir.noam@intel.com Mon Jan 5 07:30:01 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:30:14 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FTxTa023161 for ; Mon, 5 Jan 2004 07:30:00 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FTkiI019313; Mon, 5 Jan 2004 15:29:46 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FTbwm008981; Mon, 5 Jan 2004 15:29:46 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517294524378 ; Mon, 05 Jan 2004 17:29:45 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FTjhb001129; Mon, 5 Jan 2004 17:29:45 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 0/3] [bonding 2.6] Using per-bond parameters Date: Mon, 5 Jan 2004 17:29:45 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051729.45524.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2217 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev The following patch set makes each bonding interface keep its own set of parameters, rather than use global values. This is the first step necessary to allow the configuration of different parameters to different bonding interfaces. The patches are against the net-drivers-2.5-exp tree (after Shmulik's 'update comment blocks' patch). -- Amir From amir.noam@intel.com Mon Jan 5 07:30:12 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:30:25 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FUATa023183 for ; Mon, 5 Jan 2004 07:30:11 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FTsiI019317; Mon, 5 Jan 2004 15:29:54 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FTrwi008988; Mon, 5 Jan 2004 15:29:53 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517295224380 ; Mon, 05 Jan 2004 17:29:52 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FTqhb001132; Mon, 5 Jan 2004 17:29:52 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 1/3] [bonding 2.6] Save parameters in a per-bond data structure Date: Mon, 5 Jan 2004 17:29:51 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051729.52769.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2218 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev - Save the bonding parameters in a per-bond data structure. - Move all handling of the insmod parameters to bond_check_params(). - Fix the handling of some warning messages regarding parameter use. diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Mon Jan 5 17:17:32 2004 +++ b/drivers/net/bonding/bond_main.c Mon Jan 5 17:17:33 2004 @@ -509,7 +509,6 @@ /* monitor all links that often (in milliseconds). <=0 disables monitoring */ #define BOND_LINK_MON_INTERV 0 #define BOND_LINK_ARP_INTERV 0 -#define MAX_ARP_IP_TARGETS 16 static int max_bonds = BOND_DEFAULT_MAX_BONDS; static int miimon = BOND_LINK_MON_INTERV; @@ -520,7 +519,7 @@ static char *mode = NULL; static char *primary = NULL; static char *lacp_rate = NULL; static int arp_interval = BOND_LINK_ARP_INTERV; -static char *arp_ip_target[MAX_ARP_IP_TARGETS] = { NULL, }; +static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; MODULE_PARM(max_bonds, "i"); MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); @@ -540,7 +539,7 @@ MODULE_PARM(lacp_rate, "s"); MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)"); MODULE_PARM(arp_interval, "i"); MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); -MODULE_PARM(arp_ip_target, "1-" __MODULE_STRING(MAX_ARP_IP_TARGETS) "s"); +MODULE_PARM(arp_ip_target, "1-" __MODULE_STRING(BOND_MAX_ARP_TARGETS) "s"); MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form"); /*----------------------------- Global variables ----------------------------*/ @@ -554,7 +553,7 @@ static LIST_HEAD(bond_dev_list); static struct proc_dir_entry *bond_proc_dir = NULL; #endif -static u32 arp_target[MAX_ARP_IP_TARGETS] = { 0, } ; +static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; static int arp_ip_count = 0; static u32 my_ip = 0; static int bond_mode = BOND_MODE_ROUNDROBIN; @@ -590,6 +589,10 @@ static struct bond_parm_tbl bond_mode_tb { NULL, -1}, }; +/*-------------------------- Forward declarations ---------------------------*/ + +static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode); + /*---------------------------- General routines -----------------------------*/ static const char *bond_mode_name(void) @@ -2236,7 +2239,7 @@ static void bond_arp_send_all(struct sla { int i; - for (i = 0; (idev, my_ip, NULL, slave->dev->dev_addr, NULL); @@ -3754,13 +3757,47 @@ static int bond_accept_fastpath(struct n /*------------------------- Device initialization ---------------------------*/ /* + * set bond mode specific net device operations + */ +static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode) +{ + switch (mode) { + case BOND_MODE_ROUNDROBIN: + bond_dev->hard_start_xmit = bond_xmit_roundrobin; + break; + case BOND_MODE_ACTIVEBACKUP: + bond_dev->hard_start_xmit = bond_xmit_activebackup; + break; + case BOND_MODE_XOR: + bond_dev->hard_start_xmit = bond_xmit_xor; + break; + case BOND_MODE_BROADCAST: + bond_dev->hard_start_xmit = bond_xmit_broadcast; + break; + case BOND_MODE_8023AD: + bond_dev->hard_start_xmit = bond_3ad_xmit_xor; + break; + case BOND_MODE_TLB: + case BOND_MODE_ALB: + bond_dev->hard_start_xmit = bond_alb_xmit; + bond_dev->set_mac_address = bond_alb_set_mac_address; + break; + default: + /* Should never happen, mode already checked */ + printk(KERN_ERR DRV_NAME + ": Error: Unknown bonding mode %d\n", + mode); + break; + } +} + +/* * Does not allocate but creates a /proc entry. * Allowed to fail. */ -static int __init bond_init(struct net_device *bond_dev) +static int __init bond_init(struct net_device *bond_dev, struct bond_params *params) { struct bonding *bond = bond_dev->priv; - int count; dprintk("Begin bond_init for %s\n", bond_dev->name); @@ -3768,6 +3805,8 @@ static int __init bond_init(struct net_d rwlock_init(&bond->lock); rwlock_init(&bond->curr_slave_lock); + bond->params = *params; /* copy params struct */ + /* Initialize pointers */ bond->first_slave = NULL; bond->curr_active_slave = NULL; @@ -3784,33 +3823,7 @@ static int __init bond_init(struct net_d bond_dev->change_mtu = bond_change_mtu; bond_dev->set_mac_address = bond_set_mac_address; - switch (bond_mode) { - case BOND_MODE_ROUNDROBIN: - bond_dev->hard_start_xmit = bond_xmit_roundrobin; - break; - case BOND_MODE_ACTIVEBACKUP: - bond_dev->hard_start_xmit = bond_xmit_activebackup; - break; - case BOND_MODE_XOR: - bond_dev->hard_start_xmit = bond_xmit_xor; - break; - case BOND_MODE_BROADCAST: - bond_dev->hard_start_xmit = bond_xmit_broadcast; - break; - case BOND_MODE_8023AD: - bond_dev->hard_start_xmit = bond_3ad_xmit_xor; /* extern */ - break; - case BOND_MODE_TLB: - case BOND_MODE_ALB: - bond_dev->hard_start_xmit = bond_alb_xmit; /* extern */ - bond_dev->set_mac_address = bond_alb_set_mac_address; /* extern */ - break; - default: - printk(KERN_ERR DRV_NAME - ": Error: Unknown bonding mode %d\n", - bond_mode); - return -EINVAL; - } + bond_set_mode_ops(bond_dev, bond->params.mode); bond_dev->destructor = free_netdev; #ifdef CONFIG_NET_FASTROUTE @@ -3821,27 +3834,6 @@ static int __init bond_init(struct net_d bond_dev->tx_queue_len = 0; bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; - printk(KERN_INFO DRV_NAME ": %s registered with", bond_dev->name); - if (miimon) { - printk(" MII link monitoring set to %d ms", miimon); - updelay /= miimon; - downdelay /= miimon; - } else { - printk("out MII link monitoring"); - } - printk(", in %s mode.\n", bond_mode_name()); - - printk(KERN_INFO DRV_NAME ": %s registered with", bond_dev->name); - if (arp_interval > 0) { - printk(" ARP monitoring set to %d ms with %d target(s):", - arp_interval, arp_ip_count); - for (count=0 ; countmode = bond_mode; + params->miimon = miimon; + params->arp_interval = arp_interval; + params->updelay = updelay; + params->downdelay = downdelay; + params->use_carrier = use_carrier; + params->lacp_fast = lacp_fast; + params->primary[0] = 0; + + if (primary) { + strncpy(params->primary, primary, IFNAMSIZ); + params->primary[IFNAMSIZ - 1] = 0; + } + + memcpy(params->arp_targets, arp_target, sizeof(arp_target)); + return 0; } static int __init bonding_init(void) { + struct bond_params params; int i; int res; printk(KERN_INFO "%s", version); - res = bond_check_params(); + res = bond_check_params(¶ms); if (res) { return res; } @@ -4157,7 +4181,7 @@ static int __init bonding_init(void) * /proc files), but before register_netdevice(), because we * need to set function pointers. */ - res = bond_init(bond_dev); + res = bond_init(bond_dev, ¶ms); if (res < 0) { free_netdev(bond_dev); goto out_err; diff -Nuarp a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h --- a/drivers/net/bonding/bonding.h Mon Jan 5 17:17:32 2004 +++ b/drivers/net/bonding/bonding.h Mon Jan 5 17:17:33 2004 @@ -36,11 +36,13 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.5.3" +#define DRV_VERSION "2.5.4" #define DRV_RELDATE "December 30, 2003" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" +#define BOND_MAX_ARP_TARGETS 16 + #ifdef BONDING_DEBUG #define dprintk(fmt, args...) \ printk(KERN_DEBUG \ @@ -133,6 +135,18 @@ bond_for_each_slave_from(bond, pos, cnt, (bond)->first_slave) +struct bond_params { + int mode; + int miimon; + int arp_interval; + int use_carrier; + int updelay; + int downdelay; + int lacp_fast; + char primary[IFNAMSIZ]; + u32 arp_targets[BOND_MAX_ARP_TARGETS]; +}; + struct slave { struct net_device *dev; /* first - usefull for panic debug */ struct slave *next; @@ -181,6 +195,7 @@ struct bonding { u16 flags; struct ad_bond_info ad_info; struct alb_bond_info alb_info; + struct bond_params params; }; /** From amir.noam@intel.com Mon Jan 5 07:30:20 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 Jan 2004 07:30:33 -0800 (PST) Received: from hermes.iil.intel.com (hermes.iil.intel.com [192.198.152.99]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i05FUGTa023186 for ; Mon, 5 Jan 2004 07:30:18 -0800 Received: from petasus.iil.intel.com (petasus.iil.intel.com [143.185.77.3]) by hermes.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-outer.mc,v 1.6 2003/12/18 18:57:17 root Exp $) with ESMTP id i05FU2iI019364; Mon, 5 Jan 2004 15:30:02 GMT Received: from hasmsxvs01.iil.intel.com (hasmsxvs01.iil.intel.com [143.185.63.58]) by petasus.iil.intel.com (8.12.9-20030918-01/8.12.9/d: large-inner.mc,v 1.8 2003/12/18 18:57:16 root Exp $) with SMTP id i05FU1wi009034; Mon, 5 Jan 2004 15:30:02 GMT Received: from sun111.npdj.intel.com ([10.12.254.111]) by hasmsxvs01.iil.intel.com (SAVSMTP 3.1.2.35) with SMTP id M2004010517300024382 ; Mon, 05 Jan 2004 17:30:01 +0200 Received: from jrslxjul4.npdj.intel.com (jrslxjul4 [10.12.220.54]) by sun111.npdj.intel.com (8.12.10/8.12.9/MailSET/Hub) with ESMTP id i05FU1hb001173; Mon, 5 Jan 2004 17:30:01 +0200 (IST) From: Amir Noam To: "Jeff Garzik" , "Jay Vosburgh" Subject: [PATCH 2/3] [bonding 2.6] Use the per-bond value of the bond_mode parameter Date: Mon, 5 Jan 2004 17:30:00 +0200 User-Agent: KMail/1.5.3 Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401051730.01365.amir.noam@intel.com> X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) X-archive-position: 2219 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev Change usage of the global 'bond_mode' parameter to the per-bond value. diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Mon Jan 5 17:17:35 2004 +++ b/drivers/net/bonding/bond_main.c Mon Jan 5 17:17:37 2004 @@ -595,9 +595,9 @@ static inline void bond_set_mode_ops(str /*---------------------------- General routines -----------------------------*/ -static const char *bond_mode_name(void) +static const char *bond_mode_name(int mode) { - switch (bond_mode) { + switch (mode) { case BOND_MODE_ROUNDROBIN : return "load balancing (round-robin)"; case BOND_MODE_ACTIVEBACKUP : @@ -803,7 +803,7 @@ static struct dev_mc_list *bond_mc_list_ */ static void bond_set_promiscuity(struct bonding *bond, int inc) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_set_promiscuity(bond->curr_active_slave->dev, inc); @@ -822,7 +822,7 @@ static void bond_set_promiscuity(struct */ static void bond_set_allmulti(struct bonding *bond, int inc) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_set_allmulti(bond->curr_active_slave->dev, inc); @@ -842,7 +842,7 @@ static void bond_set_allmulti(struct bon */ static void bond_mc_add(struct bonding *bond, void *addr, int alen) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); @@ -862,7 +862,7 @@ static void bond_mc_add(struct bonding * */ static void bond_mc_delete(struct bonding *bond, void *addr, int alen) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) { dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); @@ -922,13 +922,14 @@ static int bond_mc_list_copy(struct dev_ */ static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev) { + struct bonding *bond = bond_dev->priv; struct dev_mc_list *dmi; for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* del lacpdu mc addr from mc list */ u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; @@ -947,7 +948,7 @@ static void bond_mc_swap(struct bonding { struct dev_mc_list *dmi; - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* nothing to do - mc list is already up-to-date on * all slaves */ @@ -1064,7 +1065,7 @@ static void bond_change_active_slave(str if (new_active) { if (new_active->link == BOND_LINK_BACK) { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one %d ms earlier.\n", @@ -1076,16 +1077,16 @@ static void bond_change_active_slave(str new_active->link = BOND_LINK_UP; new_active->jiffies = jiffies; - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { bond_3ad_handle_link_change(new_active, BOND_LINK_UP); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); } } else { - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one.\n", @@ -1094,7 +1095,7 @@ static void bond_change_active_slave(str } } - if (bond_mode == BOND_MODE_ACTIVEBACKUP) { + if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { if (old_active) { bond_set_slave_inactive_flags(old_active); } @@ -1104,12 +1105,12 @@ static void bond_change_active_slave(str } } - if (USES_PRIMARY(bond_mode)) { + if (USES_PRIMARY(bond->params.mode)) { bond_mc_swap(bond, new_active, old_active); } - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { bond_alb_handle_active_change(bond, new_active); } else { bond->curr_active_slave = new_active; @@ -1264,13 +1265,13 @@ static int bond_enslave(struct net_devic return -EINVAL; } - if ((bond_mode == BOND_MODE_8023AD) || - (bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_8023AD) || + (bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { printk(KERN_ERR DRV_NAME ": Error: to use %s mode, you must upgrade " "ifenslave.\n", - bond_mode_name()); + bond_mode_name(bond->params.mode)); return -EOPNOTSUPP; } } @@ -1326,8 +1327,8 @@ static int bond_enslave(struct net_devic new_slave->dev = slave_dev; - if ((bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { + if ((bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { /* bond_alb_init_slave() must be called before all other stages since * it might fail and we do not want to have to undo everything */ @@ -1342,7 +1343,7 @@ static int bond_enslave(struct net_devic * curr_active_slave, and that is taken care of later when calling * bond_change_active() */ - if (!USES_PRIMARY(bond_mode)) { + if (!USES_PRIMARY(bond->params.mode)) { /* set promiscuity level to new slave */ if (bond_dev->flags & IFF_PROMISC) { dev_set_promiscuity(slave_dev, 1); @@ -1359,7 +1360,7 @@ static int bond_enslave(struct net_devic } } - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { /* add lacpdu mc addr to mc list */ u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; @@ -1432,7 +1433,7 @@ static int bond_enslave(struct net_devic "forced to 100Mbps, duplex forced to Full.\n", new_slave->dev->name); - if (bond_mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) { printk(KERN_WARNING "Operation of 802.3ad mode requires ETHTOOL " "support in base driver for proper aggregator " @@ -1440,14 +1441,14 @@ static int bond_enslave(struct net_devic } } - if (USES_PRIMARY(bond_mode) && primary) { + if (USES_PRIMARY(bond->params.mode) && primary) { /* if there is a primary slave, remember it */ if (strcmp(primary, new_slave->dev->name) == 0) { bond->primary_slave = new_slave; } } - switch (bond_mode) { + switch (bond->params.mode) { case BOND_MODE_ACTIVEBACKUP: /* if we're in active-backup mode, we