From davem@pizda.ninka.net Mon Dec 1 00:06:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 00:07:14 -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 hB186sTa017689 for ; Mon, 1 Dec 2003 00:06:54 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id AAA05215; Mon, 1 Dec 2003 00:06:16 -0800 Date: Mon, 1 Dec 2003 00:06:16 -0800 From: "David S. Miller" To: Ben Greear Cc: scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: Problems with e1000 in 2.4.23 Message-Id: <20031201000616.1db7b6f4.davem@redhat.com> In-Reply-To: <3FCAACAD.7090609@candelatech.com> References: <3FCAACAD.7090609@candelatech.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: 1784 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, 30 Nov 2003 18:51:25 -0800 Ben Greear wrote: > Also, I am seeing bogus things on this machine regardless of which > kernel and which e1000 driver I use, so it's quite possible that either > the NIC hardware or the MB/RAM/CPU/Whatever is just plain not quite > right. Ben, I don't want to beat an old dead horse, but is this the same system where you were having all of those overheating problems a long time ago? From casellas@infres.enst.fr Mon Dec 1 06:36:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 06:36:49 -0800 (PST) Received: from infres.enst.fr (infres.enst.fr [137.194.192.1]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1EaXTa012794 for ; Mon, 1 Dec 2003 06:36:34 -0800 Received: from gervaise.enst.fr (gervaise.enst.fr [137.194.160.71]) by infres.enst.fr (Postfix) with ESMTP id 5BAFB18DC for ; Mon, 1 Dec 2003 15:36:27 +0100 (MET) Received: from localhost (casellas@localhost) by gervaise.enst.fr (8.11.6+Sun/8.11.6) with ESMTP id hB1EaQV26056 for ; Mon, 1 Dec 2003 15:36:26 +0100 (MET) X-Authentication-Warning: gervaise.enst.fr: casellas owned process doing -bs Date: Mon, 1 Dec 2003 15:36:26 +0100 (MET) From: Ramon Casellas X-X-Sender: casellas@gervaise.enst.fr To: netdev@oss.sgi.com Subject: Request: Allocate a Netlink Family Number for MPLS Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1785 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: casellas@infres.enst.fr Precedence: bulk X-list: netdev Jamal/Dave/all, We're working in porting mpls for linux to 2.6 and one of the planned features is to move from an IOCTL based approach to a Netlink based one for updating/querying the MPLS FTN/ILM/Label Mapping/... tables from userspace. Since netlink families are public, I would like to know if it is possible to reserve a family for MPLS, even though the MPLS patch is not part of the official kernel. Please let me know who I should contact/forward my request (Dave Miller is listed as the main mantainer of the net core) or if, on the contrary, there are valid reasons to reject our request. Thanks in advance, Ramon Something like this: diff -urN linux-2.6.0-test11/include/linux/netlink.h linux-2.6.0-test11-mpls/include/linux/netlink.h --- linux-2.6.0-test11/include/linux/netlink.h 2003-11-27 14:24:00.000000000 +0100 +++ linux-2.6.0-test11-mpls/include/linux/netlink.h 2003-11-30 13:47:45.000000000 +0100 @@ -12,6 +12,11 @@ #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ #define NETLINK_XFRM 6 /* ipsec */ #define NETLINK_ARPD 8 + +##if defined(CONFIG_MPLS) || defined(CONFIG_MPLS_MODULE) +#define NETLINK_MPLS 9 +#endif + #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ // ------------------------------------------------------------------- // Ramon Casellas - GET/ENST/INFRES/RHD/A508 - casellas@infres.enst.fr From hch@infradead.org Mon Dec 1 07:30:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 07:31:13 -0800 (PST) Received: from phoenix.infradead.org (phoenix.infradead.org [213.86.99.234]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1FUrTa017364 for ; Mon, 1 Dec 2003 07:30:54 -0800 Received: from hch by phoenix.infradead.org with local (Exim 4.22) id 1AQq0i-00011I-J0; Mon, 01 Dec 2003 15:30:52 +0000 Date: Mon, 1 Dec 2003 15:30:52 +0000 From: Christoph Hellwig To: Ramon Casellas Cc: netdev@oss.sgi.com Subject: Re: Request: Allocate a Netlink Family Number for MPLS Message-ID: <20031201153052.A3879@infradead.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from casellas@infres.enst.fr on Mon, Dec 01, 2003 at 03:36:26PM +0100 X-archive-position: 1786 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hch@infradead.org Precedence: bulk X-list: netdev On Mon, Dec 01, 2003 at 03:36:26PM +0100, Ramon Casellas wrote: > #define NETLINK_ARPD 8 > + > +##if defined(CONFIG_MPLS) || defined(CONFIG_MPLS_MODULE) > +#define NETLINK_MPLS 9 > +#endif > + This is bogus - either it's reserved or not, so the ifdef doesn't make sense. Also given that Dave & co are working on mpls already I wonder whether it's a good idea to reserve this, but I'll let him speak for himself :) From greearb@candelatech.com Mon Dec 1 09:26:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 09:27:09 -0800 (PST) Received: from grok.yi.org (evrtwa1-ar2-4-35-049-074.evrtwa1.dsl-verizon.net [4.35.49.74]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1HQtTa026501 for ; Mon, 1 Dec 2003 09:26:56 -0800 Received: from candelatech.com (localhost.localdomain [127.0.0.1]) by grok.yi.org (8.12.8/8.12.8) with ESMTP id hB1HQcKt029022; Mon, 1 Dec 2003 09:26:45 -0800 Message-ID: <3FCB79CE.40409@candelatech.com> Date: Mon, 01 Dec 2003 09:26:38 -0800 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David S. Miller" CC: scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: Problems with e1000 in 2.4.23 References: <3FCAACAD.7090609@candelatech.com> <20031201000616.1db7b6f4.davem@redhat.com> In-Reply-To: <20031201000616.1db7b6f4.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1787 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greearb@candelatech.com Precedence: bulk X-list: netdev David S. Miller wrote: > On Sun, 30 Nov 2003 18:51:25 -0800 > Ben Greear wrote: > > >>Also, I am seeing bogus things on this machine regardless of which >>kernel and which e1000 driver I use, so it's quite possible that either >>the NIC hardware or the MB/RAM/CPU/Whatever is just plain not quite >>right. > > > Ben, I don't want to beat an old dead horse, but is this > the same system where you were having all of those > overheating problems a long time ago? Yep, I put a big ole fan right on the NICs but to no avail. However, it may not be enough, or the chipset/NIC may be so cooked/flaky that it doesn't really matter any more. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com From niv@us.ibm.com Mon Dec 1 10:12:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 10:12:52 -0800 (PST) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.131]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1ICUTa027633 for ; Mon, 1 Dec 2003 10:12:39 -0800 Received: from westrelay03.boulder.ibm.com (westrelay03.boulder.ibm.com [9.17.195.12]) by e33.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB1ICLJh340332; Mon, 1 Dec 2003 13:12:21 -0500 Received: from us.ibm.com (d03av01.boulder.ibm.com [9.17.193.81]) by westrelay03.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB1ICJeF128462; Mon, 1 Dec 2003 11:12:20 -0700 Message-ID: <3FCB8415.7060101@us.ibm.com> Date: Mon, 01 Dec 2003 10:10:29 -0800 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ronnie Sahlberg CC: netdev@oss.sgi.com Subject: Re: TCP retransmission timers, questions References: <010801c3b657$e3093fb0$6501010a@C5043436> In-Reply-To: <010801c3b657$e3093fb0$6501010a@C5043436> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1788 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev Ronnie Sahlberg wrote: > By looking at the kernel sources it seems that the minimum TCP > retransmission timeout is hardcoded to 200ms. > Is this correct? Yes, that is correct. > While I understand why it is important to not be too aggressive in > retransmitting I wounder if it would be possible to get > and interface in proc where one could "tune" this. Currently, not unless you edit the kernel header file yourself and recompile the kernel. Not recommended for several reasons. > The reason for this is that in some applications you do have a completely > private, dedicated network used for one specific application. > Those networks can be dimensioned so that congestion "should" not occur. > However, packets are lost from time to time and sometimes packets will be > lost. > In those isolated dedicated subnets, with end to end network latency in the > sub ms range, would it not be useful to be able to allow > the retransmission timeout to drop down to 5-10ms? Exactly the scheme I was interested in proposing a while ago - provide a env for private networks that would allow more flexible tuning for private nets. > Do anyone know of any work/research in the area of tcp retransmission > timeouts for very high bandwidth, low latency networks? > I have checked both the IETF list of drafts, Sally Floyds pages and google > but could not find anything. Not that I could find last year either. > It seems to me that all research/experimentation in high throughput is for > high bandwidth high latency links and tuning the slowstart/congestion > avoidance algorithms. > What about high throughput, very low latency? Does nayone know of any > papers in that area? I'm doing my own experimentation for this environment - case study a 3 tiered app with a private network between the web front end and the database backend. I'm playing with gigabit but hope to do some 10Gb testing sometime in the near future. Hope to provide a experimental patch to play with, but it wont be soon. Mostly January. We had a thread on this a while ago, and DaveM pointed out that this was really a research area because the 200ms timer limit (BSD inherited) played a rather critical role in all the congestion control, and what its impact might be if changed on Internet traffic really needed to be studied/researched. However, that wouldnt apply to private, non-routable networks. > For specific applications, running on completely isolated dedicated > networks, dimensioned to make congestion unlikely, isolated so it will NEVER > compete about bandwidth with normal TCPs on the internet, to me it would > make sense to allow the retransmission timeout to be allowed to drop > significantly below 200ms. Exactly. > Another question, I think it was RFC2988 (but an not find it again) that > discussed that a TCP may add an artificial delay in sending the packets > based on > the RTT so that when sending an entire window the packets are spaced > equidistantly across the RTT interval instead of in just one big burst. > This to prevent the burstinessd of the traffic and make buffer > overruns/congestion less likely. I havent seen this help for the most part. This is helpful only in very selective situations. If youre studying multiple streams across one network, performance could be equally hurt/helped. Have you any data on this? > I have seen indications that w2k/bsd might in some conditions do this. > Doe Linux do this? my search through the sources came up with nothing. > Does anyone know whether there are other TCPs that do this? > As i said I have seen something that looked like that on a BSD stack but it > could have been related to something else. Linux doesn't, and the others dont either, to my knowledge, but I could be wrong, its been a while since I looked at the other OSs. hth, thanks, Nivedita From shemminger@osdl.org Mon Dec 1 11:32:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 11:33:09 -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 hB1JWtTa028898 for ; Mon, 1 Dec 2003 11:32:56 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB1JWUZ21603; Mon, 1 Dec 2003 11:32:32 -0800 Date: Mon, 1 Dec 2003 11:33:12 -0800 From: Stephen Hemminger To: anand@eis.iisc.ernet.in (SVR Anand) Cc: davem@redhat.com (David S. Miller), netdev@oss.sgi.com Subject: Re: Bridging woes after 3 days Message-Id: <20031201113312.2ce6ec0f.shemminger@osdl.org> In-Reply-To: <200311290944.PAA27304@eis.iisc.ernet.in> References: <20031123152601.67646dc1.davem@redhat.com> <200311290944.PAA27304@eis.iisc.ernet.in> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1789 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev On Sat, 29 Nov 2003 15:14:08 +0530 (GMT+05:30) anand@eis.iisc.ernet.in (SVR Anand) wrote: > Hi, > > After a continous run for 3 days the bridge came down crashing with the > following kernel panic screen dump. The kernel is 2.6.0-test9-bk25 with > kernel preemption disabled. > > The following call stack is what I have seen on the console. The ethernet > cards are RTL8139. Please let me know if you want more information or finer > debugging method, I will pass it on when the bridge fails the next time. Can you hook a serial console to catch the precise wording? Also if you save copies of /proc/slabinfo on a regular interval (like per hour), then it is possible to see if there is a memory leak. From casellas@infres.enst.fr Mon Dec 1 12:00:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 12:00:37 -0800 (PST) Received: from infres.enst.fr (infres.enst.fr [137.194.192.1]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1K0ATa006998 for ; Mon, 1 Dec 2003 12:00:11 -0800 Received: from gervaise.enst.fr (gervaise.enst.fr [137.194.160.71]) by infres.enst.fr (Postfix) with ESMTP id 769F818D1; Mon, 1 Dec 2003 20:26:31 +0100 (MET) Received: from localhost (casellas@localhost) by gervaise.enst.fr (8.11.6+Sun/8.11.6) with ESMTP id hB1JQVE27335; Mon, 1 Dec 2003 20:26:31 +0100 (MET) X-Authentication-Warning: gervaise.enst.fr: casellas owned process doing -bs Date: Mon, 1 Dec 2003 20:26:30 +0100 (MET) From: Ramon Casellas X-X-Sender: casellas@gervaise.enst.fr To: Christoph Hellwig Cc: netdev@oss.sgi.com Subject: Re: Request: Allocate a Netlink Family Number for MPLS In-Reply-To: <20031201153052.A3879@infradead.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1790 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: casellas@infres.enst.fr Precedence: bulk X-list: netdev On Mon, 1 Dec 2003, Christoph Hellwig wrote: > On Mon, Dec 01, 2003 at 03:36:26PM +0100, Ramon Casellas wrote: > > #define NETLINK_ARPD 8 > > + > > +#if defined(CONFIG_MPLS) || defined(CONFIG_MPLS_MODULE) > > +#define NETLINK_MPLS 9 > > +#endif > > + > > This is bogus - either it's reserved or not, so the ifdef doesn't > make sense. Yes of course :) that was just a cut&paste from an interim patch, where we put ifdefs around everything. If you decide to allocate a family number, then ifdefs don't make sense (much like in if_ether.h or ppp_defs.h), but you're right, my mistake, I didn't mean to propose a real patch. > > Also given that Dave & co are working on mpls already I wonder > whether it's a good idea to reserve this, but I'll let him speak > for himself :) Well, we are still coordinating efforts, and Jamal has some design docs around... but regardless of the actual implementation, a mechanism to communicate with userspace will be needed, and IM(Very, very)HO, netlink is a good candidate, analog to rtnetlink, but this is open to discussion. Thanks, R. From herbert@gondor.apana.org.au Mon Dec 1 12:17:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 12:17:21 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1KH2Ta007512 for ; Mon, 1 Dec 2003 12:17:06 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AQuTV-00005l-00; Tue, 02 Dec 2003 07:16:53 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AQuTT-0005G7-00; Tue, 02 Dec 2003 07:16:51 +1100 Date: Tue, 2 Dec 2003 07:16:51 +1100 To: "David S. Miller" , netdev@oss.sgi.com Subject: [ROUTE] PMTU only works on half the time Message-ID: <20031201201651.GA20194@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1791 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Dave: I found out that PMTU only works on those routing cache entries where rt_src != 0. This patch should make it work for all matching entries. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: kernel-source-2.5/net/ipv4/route.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/ipv4/route.c,v retrieving revision 1.3 diff -u -r1.3 route.c --- kernel-source-2.5/net/ipv4/route.c 24 Nov 2003 09:52:04 -0000 1.3 +++ kernel-source-2.5/net/ipv4/route.c 1 Dec 2003 20:15:40 -0000 @@ -1259,9 +1259,9 @@ rth = rth->u.rt_next) { smp_read_barrier_depends(); if (rth->fl.fl4_dst == daddr && - rth->fl.fl4_src == skeys[i] && + (rth->fl.fl4_src == iph->saddr || + rth->rt_src == iph->saddr) && rth->rt_dst == daddr && - rth->rt_src == iph->saddr && rth->fl.fl4_tos == tos && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { --Nq2Wo0NMKNjxTN9z-- From davem@pizda.ninka.net Mon Dec 1 12:46:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 12:46:31 -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 hB1KkHTa011430 for ; Mon, 1 Dec 2003 12:46:17 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA19823; Mon, 1 Dec 2003 12:45:32 -0800 Date: Mon, 1 Dec 2003 12:45:32 -0800 From: "David S. Miller" To: Ramon Casellas Cc: netdev@oss.sgi.com Subject: Re: Request: Allocate a Netlink Family Number for MPLS Message-Id: <20031201124532.3f6b6a65.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: 1792 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 Mon, 1 Dec 2003 15:36:26 +0100 (MET) Ramon Casellas wrote: > We're working in porting mpls for linux to 2.6 and one of the planned > features is to move from an IOCTL based approach to a Netlink based one > for updating/querying the MPLS FTN/ILM/Label Mapping/... tables from > userspace. Since netlink families are public, I would > like to know if it is possible to reserve a family for MPLS, even though > the MPLS patch is not part of the official kernel. You don't need a whole new netlink family. Just create a dummy address family for MPLS (ie. AF_MPLS) and then just use NETLINK_ROUTE. From herbert@gondor.apana.org.au Mon Dec 1 12:47:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 12:47:25 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1Kl8Ta011610 for ; Mon, 1 Dec 2003 12:47:10 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AQuwf-0000D1-00; Tue, 02 Dec 2003 07:47:01 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AQuwe-0005IT-00; Tue, 02 Dec 2003 07:47:00 +1100 Date: Tue, 2 Dec 2003 07:47:00 +1100 To: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-ID: <20031201204700.GA20349@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline In-Reply-To: <20031201201651.GA20194@gondor.apana.org.au> User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1793 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Dec 02, 2003 at 07:16:51AM +1100, herbert wrote: > > I found out that PMTU only works on those routing cache entries where > rt_src != 0. This patch should make it work for all matching entries. That patch removed one line too many. This one should be better. -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: kernel-source-2.5/net/ipv4/route.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/ipv4/route.c,v retrieving revision 1.3 diff -u -r1.3 route.c --- kernel-source-2.5/net/ipv4/route.c 24 Nov 2003 09:52:04 -0000 1.3 +++ kernel-source-2.5/net/ipv4/route.c 1 Dec 2003 20:45:22 -0000 @@ -1260,8 +1260,9 @@ smp_read_barrier_depends(); if (rth->fl.fl4_dst == daddr && rth->fl.fl4_src == skeys[i] && + (rth->fl.fl4_src == iph->saddr || + rth->rt_src == iph->saddr) && rth->rt_dst == daddr && - rth->rt_src == iph->saddr && rth->fl.fl4_tos == tos && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { --YZ5djTAD1cGYuMQK-- From garzik@gtf.org Mon Dec 1 13:02:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 13:03:09 -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 hB1L2sTa020997 for ; Mon, 1 Dec 2003 13:02:54 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id F1C2A66CF; Mon, 1 Dec 2003 15:55:33 -0500 (EST) Date: Mon, 1 Dec 2003 15:55:33 -0500 From: Jeff Garzik To: Octave Cc: Stephen Hemminger , netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: NAPI 8139too.c for 2.4.23 Message-ID: <20031201205533.GA15846@gtf.org> References: <20031201205038.GK10711@ovh.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031201205038.GK10711@ovh.net> User-Agent: Mutt/1.3.28i X-archive-position: 1794 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 Mon, Dec 01, 2003 at 09:50:38PM +0100, Octave wrote: > Stephen, > I get your patch from http://lwn.net/Articles/54815/ for 2.6.X and > I rewrote it for 2.4.23. Tested with 2.4.23 on high load servers. I > have no more "Too much work at interrupt". > > I dropped it on ftp://ftp.ovh.net/made-in-ovh/8139too.c-2.4-0.9.27 > > Hope it helps. > Octave Very cool! Thanks for testing. Is there any chance you could do some benchmark runs with ttcp or somesuch? Jeff From voloterreno@tin.it Mon Dec 1 13:08:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 13:09:07 -0800 (PST) Received: from vsmtp12.tin.it (vsmtp12.tin.it [212.216.176.206]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1L8nTa002620 for ; Mon, 1 Dec 2003 13:08:50 -0800 Received: from tin.it (80.180.66.85) by vsmtp12.tin.it (7.0.019) (authenticated as voloterreno@tin.it) id 3FC8F04600174580; Mon, 1 Dec 2003 22:08:33 +0100 Message-ID: <3FCBAEFF.6000606@tin.it> Date: Mon, 01 Dec 2003 22:13:35 +0100 From: Marcello User-Agent: Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.5) Gecko/20031031 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Octave CC: Stephen Hemminger , Jeff Garzik , netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: NAPI 8139too.c for 2.4.23 References: <20031201205038.GK10711@ovh.net> In-Reply-To: <20031201205038.GK10711@ovh.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1795 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: voloterreno@tin.it Precedence: bulk X-list: netdev Octave ha scritto: >Stephen, >I get your patch from http://lwn.net/Articles/54815/ for 2.6.X and >I rewrote it for 2.4.23. Tested with 2.4.23 on high load servers. I >have no more "Too much work at interrupt". > >I dropped it on ftp://ftp.ovh.net/made-in-ovh/8139too.c-2.4-0.9.27 > >Hope it helps. >Octave > >before: >------- ># ps auxw >root 256 0.0 0.0 0 0 ? SW Nov28 0:00 [eth0] ># ifconfig > RX packets:40940899 errors:250542 dropped:7052 overruns:250542 frame:0 > TX packets:33057049 errors:0 dropped:0 overruns:20 carrier:0 ># dmesg >eth0: Setting 100mbps full-duplex based on auto-negotiated partner ability 41e1. >nfs: server X.X.X.X not responding, still trying >nfs: server X.X.X.X OK >eth0: Too much work at interrupt, IntrStatus=0x0040. > >with NAPI >--------- > RX packets:428253 errors:0 dropped:0 overruns:0 frame:0 > TX packets:357949 errors:0 dropped:0 overruns:0 carrier:0 >8139too Fast Ethernet driver 0.9.27 >PCI: Found IRQ 11 for device 00:0b.0 >eth0: RealTek RTL8139 at 0xec00, 00:e0:4c:91:03:b0, IRQ 11 >eth0: Identified 8139 chip type 'RTL-8100B/8139D' > >- >To unsubscribe from this list: send the line "unsubscribe linux-net" in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html > > > I try immediatly your variant of the driver :) Bye Marcello From oles@ovh.net Mon Dec 1 13:20:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 13:20:30 -0800 (PST) Received: from ping.ovh.net (ping.ovh.net [213.186.33.13]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1LK3Ta003081 for ; Mon, 1 Dec 2003 13:20:04 -0800 Received: by ping.ovh.net (Postfix, from userid 502) id 07BC83B7A0; Mon, 1 Dec 2003 21:50:39 +0100 (CET) Date: Mon, 1 Dec 2003 21:50:38 +0100 From: Octave To: Stephen Hemminger , Jeff Garzik Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: NAPI 8139too.c for 2.4.23 Message-ID: <20031201205038.GK10711@ovh.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.5.4i X-archive-position: 1796 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: oles@ovh.net Precedence: bulk X-list: netdev Stephen, I get your patch from http://lwn.net/Articles/54815/ for 2.6.X and I rewrote it for 2.4.23. Tested with 2.4.23 on high load servers. I have no more "Too much work at interrupt". I dropped it on ftp://ftp.ovh.net/made-in-ovh/8139too.c-2.4-0.9.27 Hope it helps. Octave before: ------- # ps auxw root 256 0.0 0.0 0 0 ? SW Nov28 0:00 [eth0] # ifconfig RX packets:40940899 errors:250542 dropped:7052 overruns:250542 frame:0 TX packets:33057049 errors:0 dropped:0 overruns:20 carrier:0 # dmesg eth0: Setting 100mbps full-duplex based on auto-negotiated partner ability 41e1. nfs: server X.X.X.X not responding, still trying nfs: server X.X.X.X OK eth0: Too much work at interrupt, IntrStatus=0x0040. with NAPI --------- RX packets:428253 errors:0 dropped:0 overruns:0 frame:0 TX packets:357949 errors:0 dropped:0 overruns:0 carrier:0 8139too Fast Ethernet driver 0.9.27 PCI: Found IRQ 11 for device 00:0b.0 eth0: RealTek RTL8139 at 0xec00, 00:e0:4c:91:03:b0, IRQ 11 eth0: Identified 8139 chip type 'RTL-8100B/8139D' From davem@pizda.ninka.net Mon Dec 1 13:52:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 13:53:09 -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 hB1LqqTa012987 for ; Mon, 1 Dec 2003 13:52:52 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id NAA20001; Mon, 1 Dec 2003 13:51:54 -0800 Date: Mon, 1 Dec 2003 13:51:54 -0800 From: "David S. Miller" To: Herbert Xu Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031201135154.6906454c.davem@redhat.com> In-Reply-To: <20031201204700.GA20349@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> 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: 1797 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, 2 Dec 2003 07:47:00 +1100 Herbert Xu wrote: > On Tue, Dec 02, 2003 at 07:16:51AM +1100, herbert wrote: > > > > I found out that PMTU only works on those routing cache entries where > > rt_src != 0. This patch should make it work for all matching entries. > > That patch removed one line too many. This one should be better. Hmmm... Herbert, do you see how the outer loop and the skey[] thing works in this PMTU handling code? This takes care of comparing both iph->saddr and '0' against rt->rt_src. From herbert@gondor.apana.org.au Mon Dec 1 14:05:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 14:05:34 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1M5HTa016835 for ; Mon, 1 Dec 2003 14:05:19 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AQwAI-0000pH-00; Tue, 02 Dec 2003 09:05:10 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AQwAH-0005Q9-00; Tue, 02 Dec 2003 09:05:09 +1100 Date: Tue, 2 Dec 2003 09:05:09 +1100 To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-ID: <20031201220509.GA20827@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031201135154.6906454c.davem@redhat.com> User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1798 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev On Mon, Dec 01, 2003 at 01:51:54PM -0800, David S. Miller wrote: > > Herbert, do you see how the outer loop and the skey[] thing works in > this PMTU handling code? This takes care of comparing both iph->saddr > and '0' against rt->rt_src. It only takes care of fl4_src, not rt_src. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From davem@pizda.ninka.net Mon Dec 1 14:22:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 14:22:37 -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 hB1MMPTa019016 for ; Mon, 1 Dec 2003 14:22:25 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id OAA20104; Mon, 1 Dec 2003 14:21:31 -0800 Date: Mon, 1 Dec 2003 14:21:31 -0800 From: "David S. Miller" To: Herbert Xu Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031201142131.5da50a07.davem@redhat.com> In-Reply-To: <20031201220509.GA20827@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> <20031201220509.GA20827@gondor.apana.org.au> 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: 1799 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, 2 Dec 2003 09:05:09 +1100 Herbert Xu wrote: > On Mon, Dec 01, 2003 at 01:51:54PM -0800, David S. Miller wrote: > > > > Herbert, do you see how the outer loop and the skey[] thing works in > > this PMTU handling code? This takes care of comparing both iph->saddr > > and '0' against rt->rt_src. > > It only takes care of fl4_src, not rt_src. Indeed. At the surface it looks like a bug, but look at the redirect handling tests in ip_rt_redirect(). It's a very similar key comparison as the PMTU code, just structured differently: if (rth->fl.fl4_dst != daddr || rth->fl.fl4_src != skeys[i] || rth->fl.fl4_tos != tos || rth->fl.oif != ikeys[k] || rth->fl.iif != 0) { rthp = &rth->u.rt_next; continue; } if (rth->rt_dst != daddr || rth->rt_src != saddr || rth->u.dst.error || rth->rt_gateway != old_gw || rth->u.dst.dev != dev) break; See? He's not comparing rt->rt_src against skeys[] and therefore '0' here either. I think the tests might be like this for a reason. I could see Alexey constructing this test wrong in one instance, but in two instances where the tests were structured totally different in each case is hard to believe. Let me think about this some more, maybe you're right and the error exists in both of these places. From oles@ovh.net Mon Dec 1 15:02:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 15:02:16 -0800 (PST) Received: from ping.ovh.net (ping.ovh.net [213.186.33.13]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1N20Ta020336 for ; Mon, 1 Dec 2003 15:02:01 -0800 Received: by ping.ovh.net (Postfix, from userid 502) id 5EF083B7A0; Tue, 2 Dec 2003 00:00:13 +0100 (CET) Date: Tue, 2 Dec 2003 00:00:13 +0100 From: Octave To: Jeff Garzik Cc: Stephen Hemminger , netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: NAPI 8139too.c for 2.4.23 Message-ID: <20031201230013.GM4313@ovh.net> References: <20031201205038.GK10711@ovh.net> <20031201205533.GA15846@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20031201205533.GA15846@gtf.org> User-Agent: Mutt/1.5.4i X-archive-position: 1800 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: oles@ovh.net Precedence: bulk X-list: netdev > Is there any chance you could do some benchmark runs with ttcp or > somesuch? I tested on 6-7 servers running with eepro eth0: Intel Corp. 82557/8/9 [Ethernet Pro 100], 00:E0:18:01:78:6C, IRQ 10. realtek 8139too with NAPI 8139too Fast Ethernet driver 0.9.27 realtek 8139too with no NAPI (standard driver with soft polling) If this quick test is correct, realtek 8139too's driver works as good as eepro's driver. Octave >> from realtek (no NAPI) to realtek (no NAPI) ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-r: 327680000 bytes in 42.90 real seconds = 59671.99 Kbit/sec +++ ttcp-r: 224852 I/O calls, msec/call = 0.20, calls/sec = 5241.16 ttcp-r: 0.1user 1.5sys 0:42real 3% 0i+0d 0maxrss 0+2pf 0+0csw >> from eepro to eepro ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-r: 327680000 bytes in 28.33 real seconds = 90379.31 Kbit/sec +++ ttcp-r: 225058 I/O calls, msec/call = 0.13, calls/sec = 7945.54 ttcp-r: 0.2user 4.2sys 0:28real 15% 0i+0d 0maxrss 0+2pf 0+0csw >> from realtek (NAPI) to realtek (NAPI) ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-r: 327680000 bytes in 29.21 real seconds = 87644.11 Kbit/sec +++ ttcp-r: 225735 I/O calls, msec/call = 0.13, calls/sec = 7728.26 ttcp-r: 0.0user 1.7sys 0:29real 6% 0i+0d 0maxrss 0+2pf 0+0csw >> from eepro to realtek (no NAPI) ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-t: 327680000 bytes in 34.32 real seconds = 74594.99 Kbit/sec +++ ttcp-t: 40000 I/O calls, msec/call = 0.88, calls/sec = 1165.55 ttcp-t: 0.0user 1.2sys 0:34real 3% 0i+0d 0maxrss 0+2pf 0+0csw >> from realtek (NAPI) to realtek (no NAPI) ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-r: 327680000 bytes in 32.60 real seconds = 78532.74 Kbit/sec +++ ttcp-r: 225544 I/O calls, msec/call = 0.15, calls/sec = 6918.98 ttcp-r: 0.1user 1.6sys 0:32real 5% 0i+0d 0maxrss 0+2pf 0+0csw >> from realtek (NAPI) to eepro ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001 tcp ttcp-r: socket ttcp-r: accept from ttcp-r: 327680000 bytes in 34.02 real seconds = 75250.05 Kbit/sec +++ ttcp-r: 225685 I/O calls, msec/call = 0.15, calls/sec = 6633.91 ttcp-r: 0.1user 3.7sys 0:34real 11% 0i+0d 0maxrss 0+2pf 0+0csw From davem@pizda.ninka.net Mon Dec 1 15:23:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 15:23:15 -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 hB1NN0Ta021323 for ; Mon, 1 Dec 2003 15:23:00 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id PAA20285; Mon, 1 Dec 2003 15:22:15 -0800 Date: Mon, 1 Dec 2003 15:22:15 -0800 From: "David S. Miller" To: "David S. Miller" Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031201152215.522c2447.davem@redhat.com> In-Reply-To: <20031201142131.5da50a07.davem@redhat.com> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> <20031201220509.GA20827@gondor.apana.org.au> <20031201142131.5da50a07.davem@redhat.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: 1801 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 Mon, 1 Dec 2003 14:21:31 -0800 "David S. Miller" wrote: > Let me think about this some more, maybe you're right and the > error exists in both of these places. Ok, I did my thinking :) rt->rt_src is special. It is the source address we have selected to use with this route. All output packets using this route must use rt->rt_src as iph->saddr. So, in effect, when we say "if (rt->rt_src == iph->saddr)" we are asking the question "did we make this packet?" I think this is why Alexey coded the test in this way. You are speaking of a case of zero source addresses. When would we output such an iph->saddr, by way of a route? Right now this is the only part I'm not seeing. I want to be careful in changing this code, as loosening the key check opens the possibility of new kinds of PMTU lowering attacks. From ja@ssi.bg Mon Dec 1 15:30:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 15:30:25 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1NU0Ta021870 for ; Mon, 1 Dec 2003 15:30:06 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB1NUHSu003229; Tue, 2 Dec 2003 01:30:17 +0200 Date: Tue, 2 Dec 2003 01:30:17 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: Herbert Xu cc: "David S. Miller" , Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031201204700.GA20349@gondor.apana.org.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1802 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Tue, 2 Dec 2003, Herbert Xu wrote: > On Tue, Dec 02, 2003 at 07:16:51AM +1100, herbert wrote: > > > > I found out that PMTU only works on those routing cache entries where > > rt_src != 0. This patch should make it work for all matching entries. > > That patch removed one line too many. This one should be better. IMO, the rt_src check in ip_rt_frag_needed is ok. I would suspect all rth->fl.fl4_tos checks too. It seems we need toskeys[2] and a second for loop if tos!=0. What about rewriting them to (rth->fl.fl4_tos == toskeys[j]). Regards -- Julian Anastasov From greearb@candelatech.com Mon Dec 1 15:39:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 15:39:33 -0800 (PST) Received: from grok.yi.org (evrtwa1-ar2-4-35-049-074.evrtwa1.dsl-verizon.net [4.35.49.74]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB1NdJTa022296 for ; Mon, 1 Dec 2003 15:39:19 -0800 Received: from candelatech.com (localhost.localdomain [127.0.0.1]) by grok.yi.org (8.12.8/8.12.8) with ESMTP id hB1NdCKt012417; Mon, 1 Dec 2003 15:39:13 -0800 Message-ID: <3FCBD120.7070207@candelatech.com> Date: Mon, 01 Dec 2003 15:39:12 -0800 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Octave CC: netdev@oss.sgi.com Subject: Re: NAPI 8139too.c for 2.4.23 References: <20031201205038.GK10711@ovh.net> <20031201205533.GA15846@gtf.org> <20031201230013.GM4313@ovh.net> In-Reply-To: <20031201230013.GM4313@ovh.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1803 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greearb@candelatech.com Precedence: bulk X-list: netdev Octave wrote: >>Is there any chance you could do some benchmark runs with ttcp or >>somesuch? > > > I tested on 6-7 servers running with > eepro eth0: Intel Corp. 82557/8/9 [Ethernet Pro 100], 00:E0:18:01:78:6C, IRQ 10. > realtek 8139too with NAPI 8139too Fast Ethernet driver 0.9.27 > realtek 8139too with no NAPI (standard driver with soft polling) > > If this quick test is correct, realtek 8139too's driver works as good as > eepro's driver. > > Octave Those are some nice numbers! I may have to bring some of my $5 realteks out of retirement! Anyone make a 4-port NIC with realteks on it? Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com From davem@pizda.ninka.net Mon Dec 1 15:50:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 15:51:09 -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 hB1NouTa022835 for ; Mon, 1 Dec 2003 15:50:56 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id PAA20371; Mon, 1 Dec 2003 15:50:05 -0800 Date: Mon, 1 Dec 2003 15:50:05 -0800 From: "David S. Miller" To: Julian Anastasov Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031201155005.1c515793.davem@redhat.com> In-Reply-To: References: <20031201204700.GA20349@gondor.apana.org.au> 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: 1804 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, 2 Dec 2003 01:30:17 +0200 (EET) Julian Anastasov wrote: > I would suspect all rth->fl.fl4_tos checks too. > It seems we need toskeys[2] and a second for loop if tos!=0. > What about rewriting them to (rth->fl.fl4_tos == toskeys[j]). I disagree, and this is related to my most recent email in this thread. This packet we are reacting to for PMTU purposes could only have come from us if the TOS matches precisely. From ja@ssi.bg Mon Dec 1 16:04:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 16:04:12 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB203kTa023780 for ; Mon, 1 Dec 2003 16:03:52 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB204ASu006161; Tue, 2 Dec 2003 02:04:12 +0200 Date: Tue, 2 Dec 2003 02:04:10 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031201155005.1c515793.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1805 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Mon, 1 Dec 2003, David S. Miller wrote: > On Tue, 2 Dec 2003 01:30:17 +0200 (EET) > Julian Anastasov wrote: > > > I would suspect all rth->fl.fl4_tos checks too. > > It seems we need toskeys[2] and a second for loop if tos!=0. > > What about rewriting them to (rth->fl.fl4_tos == toskeys[j]). > > I disagree, and this is related to my most recent email > in this thread. No, only input routes match strictly tos, ip_rt_redirect() is such example that matches input routes. > This packet we are reacting to for PMTU purposes could only > have come from us if the TOS matches precisely. In this case we can react to packet routed with tos=0. We match output routes only. I do not see another place that needs such fix. Example patch (not tested): # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1350 -> 1.1351 # net/ipv4/route.c 1.73 -> 1.74 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/12/02 ja@ssi.bg 1.1351 # [IPV4]: ip_rt_frag_needed: fl4_tos accepts wildcard value for output routes # -------------------------------------------- # diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c --- a/net/ipv4/route.c Tue Dec 2 02:00:54 2003 +++ b/net/ipv4/route.c Tue Dec 2 02:00:54 2003 @@ -1239,19 +1239,21 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) { - int i; + int i, j; unsigned short old_mtu = ntohs(iph->tot_len); struct rtable *rth; u32 skeys[2] = { iph->saddr, 0, }; u32 daddr = iph->daddr; u8 tos = iph->tos & IPTOS_RT_MASK; unsigned short est_mtu = 0; + u8 toskeys[2] = { tos, 0 }; if (ipv4_config.no_pmtu_disc) return 0; + for (j = 0; j < (tos ? 2 : 1); j++) for (i = 0; i < 2; i++) { - unsigned hash = rt_hash_code(daddr, skeys[i], tos); + unsigned hash = rt_hash_code(daddr, skeys[i], toskeys[j]); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; @@ -1261,7 +1263,7 @@ rth->fl.fl4_src == skeys[i] && rth->rt_dst == daddr && rth->rt_src == iph->saddr && - rth->fl.fl4_tos == tos && + rth->fl.fl4_tos == toskeys[j] && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { unsigned short mtu = new_mtu; Regards -- Julian Anastasov From ja@ssi.bg Mon Dec 1 16:06:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 16:06:50 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB206VTa024182 for ; Mon, 1 Dec 2003 16:06:34 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB2070Su006176; Tue, 2 Dec 2003 02:07:00 +0200 Date: Tue, 2 Dec 2003 02:07:00 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031201155005.1c515793.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1806 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Mon, 1 Dec 2003, David S. Miller wrote: > On Tue, 2 Dec 2003 01:30:17 +0200 (EET) > Julian Anastasov wrote: > > > I would suspect all rth->fl.fl4_tos checks too. > > It seems we need toskeys[2] and a second for loop if tos!=0. > > What about rewriting them to (rth->fl.fl4_tos == toskeys[j]). > > I disagree, and this is related to my most recent email > in this thread. > > This packet we are reacting to for PMTU purposes could only > have come from us if the TOS matches precisely. Ops, ip_rt_redirect matches output route to, hm, lets think again about it... Regards -- Julian Anastasov From davem@pizda.ninka.net Mon Dec 1 16:09:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 16:09:15 -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 hB2092Ta024543 for ; Mon, 1 Dec 2003 16:09:03 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA20448; Mon, 1 Dec 2003 16:08:12 -0800 Date: Mon, 1 Dec 2003 16:08:11 -0800 From: "David S. Miller" To: Julian Anastasov Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031201160811.70904c29.davem@redhat.com> In-Reply-To: References: <20031201155005.1c515793.davem@redhat.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: 1807 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, 2 Dec 2003 02:07:00 +0200 (EET) Julian Anastasov wrote: > > On Mon, 1 Dec 2003, David S. Miller wrote: > > > This packet we are reacting to for PMTU purposes could only > > have come from us if the TOS matches precisely. > > Ops, ip_rt_redirect matches output route to, hm, lets think > again about it... Right. I've rewritten emails in this thread probably 3 or 4 times each before actually sending them out, so don't feel bad since my mistakes have been merely hidden :) From romieu@fr.zoreil.com Mon Dec 1 16:13:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 16:14:09 -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 hB20DsTa024933 for ; Mon, 1 Dec 2003 16:13:55 -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 hB206pK7029677; Tue, 2 Dec 2003 01:06:51 +0100 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id hB206n9P029676; Tue, 2 Dec 2003 01:06:49 +0100 Date: Tue, 2 Dec 2003 01:06:49 +0100 From: Francois Romieu To: netdev@oss.sgi.com Cc: =?unknown-8bit?Q?Fernando_Alencar_Mar=F3stica?= , Brad House , jgarzik@pobox.com Subject: [PATCH 2.6] 2.6.0-test11 - more rtl8169 Message-ID: <20031202010649.A27879@electric-eye.fr.zoreil.com> References: <1070212415.1607.17.camel@oxygenium> <20031201020453.A16405@electric-eye.fr.zoreil.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20031201020453.A16405@electric-eye.fr.zoreil.com>; from romieu@fr.zoreil.com on Mon, Dec 01, 2003 at 02:04:53AM +0100 X-Organisation: Land of Sunshine Inc. X-archive-position: 1808 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 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Francois Romieu : [...] > Btw, there is a flaw in r8169-dma-api-rx-buffers.patch so don't bother > testing it. I'll do it again tomorrow. Attached patch should fix it. Executive summary: o Pure 2.6.0-test11: Get: http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2 debuntarzipe and apply/compile/test in following order: r8169-dma-api-tx.patch r8169-dma-api-rx-buffers.patch <-+ Do not test these two patches r8169-dma-api-rx-buffers-ahum.patch <-+ separately r8169-start-xmit-fixes.patch r8169-dma-api-tx-buffers.patch r8169-rx_copybreak.patch r8169-mac-phy-version.patch r8169-init_one.patch r8169-timer.patch r8169-hw_start.patch r8169-missing-tx-stats.patch r8169-intr_mask.patch r8169-suspend.patch The same directory contains each patch alone as well. o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1 Get: http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2 Same thing as above with: r8169-mac-phy-version.patch r8169-init_one.patch r8169-timer.patch r8169-hw_start.patch r8169-missing-tx-stats.patch r8169-intr_mask.patch r8169-suspend.patch r8169-dma-api-rx-buffers-ahum.patch Applying r8169-dma-api-rx-buffers-ahum.patch before r8169-mac-phy-version.patch generates a few offsets but works as well. -- Ueimor --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="r8169-dma-api-rx-buffers-ahum.patch" Brown paper bag time: the Rx descriptors are contiguous and EORbit only marks the last descriptor in the array. OWNbit implicitly marks the end of the Rx descriptors segment which is owned by the nic. drivers/net/r8169.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-) diff -puN drivers/net/r8169.c~r8169-dma-api-rx-buffers-ahum drivers/net/r8169.c --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-dma-api-rx-buffers-ahum 2003-12-02 00:22:41.000000000 +0100 +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-02 00:22:41.000000000 +0100 @@ -283,6 +283,8 @@ enum _DescStatusBit { LSbit = 0x10000000, }; +#define RsvdMask 0x3fffc000 + struct TxDesc { u32 status; u32 vlan_tag; @@ -1121,7 +1123,7 @@ rtl8169_hw_start(struct net_device *dev) static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) { desc->buf_addr = 0xdeadbeef; - desc->status = EORbit; + desc->status &= ~(OWNbit | RsvdMask); } static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, @@ -1141,7 +1143,7 @@ static inline void rtl8169_return_to_asi static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping) { desc->buf_addr = mapping; - desc->status = OWNbit + RX_BUF_SIZE; + desc->status |= OWNbit + RX_BUF_SIZE; } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev, @@ -1209,11 +1211,6 @@ static inline void rtl8169_mark_as_last_ desc->status |= EORbit; } -static inline void rtl8169_unmark_as_last_descriptor(struct RxDesc *desc) -{ - desc->status &= ~EORbit; -} - static int rtl8169_init_ring(struct net_device *dev) { struct rtl8169_private *tp = dev->priv; @@ -1460,14 +1457,9 @@ rtl8169_rx_interrupt(struct net_device * } delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); - if (delta > 0) { - u32 old_last = (tp->dirty_rx - 1) % NUM_RX_DESC; - + if (delta > 0) tp->dirty_rx += delta; - rtl8169_mark_as_last_descriptor(tp->RxDescArray + - (tp->dirty_rx - 1)%NUM_RX_DESC); - rtl8169_unmark_as_last_descriptor(tp->RxDescArray + old_last); - } else if (delta < 0) + else if (delta < 0) printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); /* _ --Kj7319i9nmIyA2yE-- From francois@baligant.net Mon Dec 1 17:32:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 17:32:44 -0800 (PST) Received: from casimir.nikita.cx (casimir.nikita.cx [198.63.211.44]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB21WUTa030061 for ; Mon, 1 Dec 2003 17:32:31 -0800 Received: from fortress (fbaligant.net1.nerim.net [213.41.146.186]) by casimir.nikita.cx (8.12.8/8.12.8) with SMTP id hB21WLh0024881 for ; Mon, 1 Dec 2003 19:32:23 -0600 Message-ID: <072501c3b874$2542ae70$15fea8c0@fortress> From: "Francois Baligant" To: Subject: 2.6.0-test11: dst_cache_overflow causing unresponsive box Date: Tue, 2 Dec 2003 02:32:17 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0722_01C3B87C.80FBB1A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Copied-To: backup@casimir.nikita.cx (by Synonym - http://www.modulo.ro/synonym) X-Scanned-By: MIMEDefang 2.37 X-archive-position: 1809 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: francois@baligant.net Precedence: bulk X-list: netdev This is a multi-part message in MIME format... ------=_NextPart_000_0722_01C3B87C.80FBB1A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We have a problem with a box running 2.6.0-test11-mjb1 and supporting aroun= d 90k simultaneous TCP connection. After a few hours/days of running, when a lots of clients connects/disconnects, the console will start to disp= lay: dst cache overflow NET: 1860 messages suppressed. dst cache overflow NET: 1858 messages suppressed. From there, the box is completely unresponsive, apparently eating all its C= PU in trying to shrink the routing cache. Only solution is reboot. Current sysctl: net.ipv4.route.max_size =3D 655360 # I know we shouldn't rise it that high = but it's only cure for now.. it lasts a bit longer like this net.ipv4.route.gc_min_interval =3D 2 net.ipv4.route.gc_interval =3D 10 net.ipv4.route.gc_timeout =3D 30 rtstat: size IN: hit tot mc no_rt bcast madst masrc OUT: hit tot = mc GC: tot ignored goal_miss ovrf HASH: in_search out_search 139566 12393 123 0 0 0 0 0 184 21 = 0 143 142 0 0 26039 375 138876 13080 136 0 0 0 0 0 159 19 = 0 155 154 0 0 27153 277 139006 12317 125 0 0 0 0 0 180 28 = 0 153 153 0 0 25810 377 139138 13799 140 0 0 0 0 0 159 16 = 0 156 156 0 0 28375 331 139275 11610 128 0 0 0 0 0 177 27 = 0 154 153 0 0 23977 343 139383 12679 124 0 0 0 0 0 173 17 = 0 141 140 0 0 26717 398 139256 11946 135 0 0 0 0 0 166 17 = 0 152 151 0 0 24874 304 139353 11646 109 0 0 0 0 0 174 14 = 0 122 122 0 0 24165 320 138257 12702 116 0 0 0 0 0 180 16 = 0 131 130 0 0 26324 358 138369 12897 115 0 0 0 0 0 166 20 = 0 134 134 0 0 26819 339 138553 11309 133 0 0 0 0 0 158 33 = 0 165 165 0 0 21270 389 138172 17232 182 0 0 0 0 0 125 44 = 0 225 225 0 0 29702 375 138420 17407 182 0 0 0 0 0 165 73 = 0 254 253 0 0 29946 548 138833 17052 257 0 0 0 0 0 195 126 = 0 382 381 0 0 29715 812 139051 16606 224 0 0 0 0 0 238 97 = 0 320 319 0 0 28559 721 139217 18115 176 0 0 0 0 0 268 51 = 0 224 224 0 0 32983 527 139326 17531 178 0 0 0 0 0 291 44 = 0 220 220 0 0 33320 445 139422 15244 140 0 0 0 0 0 357 20 = 0 160 160 0 0 29934 415 139548 13123 142 0 0 0 0 0 281 12 = 0 154 154 0 0 26430 351 139684 13290 142 0 0 0 0 0 235 10 = 0 152 151 0 0 27341 309 OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 142340 142296 99% 0.38K 14234 10 56936K ip_dst_cache Are we tuning the rt_cache in a wrong way ? regards, Francois Francois Baligant - http://www.pingouin.be Change the numbers, change your Life! ------=_NextPart_000_0722_01C3B87C.80FBB1A0-- From jgarzik@pobox.com Mon Dec 1 19:47:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Dec 2003 19:47:40 -0800 (PST) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB23lQTa031575 for ; Mon, 1 Dec 2003 19:47:27 -0800 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:37579 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 1AR1VP-0003kj-8Y; Tue, 02 Dec 2003 03:47:19 +0000 Message-ID: <3FCC0B36.9080901@pobox.com> Date: Mon, 01 Dec 2003 22:47:02 -0500 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ben Greear CC: Octave , netdev@oss.sgi.com Subject: Re: NAPI 8139too.c for 2.4.23 References: <20031201205038.GK10711@ovh.net> <20031201205533.GA15846@gtf.org> <20031201230013.GM4313@ovh.net> <3FCBD120.7070207@candelatech.com> In-Reply-To: <3FCBD120.7070207@candelatech.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1810 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 Ben Greear wrote: > Those are some nice numbers! I may have to bring some of my $5 realteks > out of > retirement! Anyone make a 4-port NIC with realteks on it? hah! I hope not :) (I've never heard of such a beast, but who knows...) Jeff From ja@ssi.bg Tue Dec 2 00:08:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 00:09:04 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB288fTa007374 for ; Tue, 2 Dec 2003 00:08:47 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB21rrSu006664; Tue, 2 Dec 2003 03:53:55 +0200 Date: Tue, 2 Dec 2003 03:53:53 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031201155005.1c515793.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1811 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Mon, 1 Dec 2003, David S. Miller wrote: > I disagree, and this is related to my most recent email > in this thread. > > This packet we are reacting to for PMTU purposes could only > have come from us if the TOS matches precisely. Here is what I have for today. I assume all ip_route_output callers provide valid tos (not a wildcard). As result, only RTO_ONLINK and oif have wildcard value. I'm not sure if ip_rt_frag_needed needs an iif argument, may be yes? Also, it seems ip_rt_redirect needs the 'tos, tos | RTO_ONLINK' array too as in ip_rt_frag_needed. Not included yet. Another problem: it seems __ip_route_output_key does not hash with valid tos key bits, fix included below: --- net/ipv4/route.c.orig Tue Dec 2 03:25:59 2003 +++ net/ipv4/route.c Tue Dec 2 03:37:27 2003 @@ -1239,19 +1239,25 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) { - int i; + int i, j, k; unsigned short old_mtu = ntohs(iph->tot_len); struct rtable *rth; u32 skeys[2] = { iph->saddr, 0, }; u32 daddr = iph->daddr; u8 tos = iph->tos & IPTOS_RT_MASK; unsigned short est_mtu = 0; + u8 toskeys[2] = { tos, tos | RTO_ONLINK }; + int iif = 0; // Can be argument + int ikeys[2] = { iif, 0 }; if (ipv4_config.no_pmtu_disc) return 0; + for (k = 0; k < (iif ? 2 : 1); k++) + for (j = 0; j < 2; j++) for (i = 0; i < 2; i++) { - unsigned hash = rt_hash_code(daddr, skeys[i], tos); + unsigned hash = rt_hash_code(daddr, skeys[i] ^ (ikeys[k] << 5), + toskeys[j]); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; @@ -1261,7 +1267,8 @@ rth->fl.fl4_src == skeys[i] && rth->rt_dst == daddr && rth->rt_src == iph->saddr && - rth->fl.fl4_tos == tos && + rth->fl.fl4_tos == toskeys[j] && + rth->fl.oif == ikeys[k] && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { unsigned short mtu = new_mtu; @@ -2214,7 +2221,8 @@ unsigned hash; struct rtable *rth; - hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), flp->fl4_tos); + hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), + flp->fl4_tos & (IPTOS_RT_MASK | RTO_ONLINK)); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { Regards -- Julian Anastasov From herbert@gondor.apana.org.au Tue Dec 2 02:10:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:11:03 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2AAbTa013648 for ; Tue, 2 Dec 2003 02:10:39 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AR7UD-0003zX-00; Tue, 02 Dec 2003 21:10:29 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AR7U9-0006cM-00; Tue, 02 Dec 2003 21:10:25 +1100 Date: Tue, 2 Dec 2003 21:10:25 +1100 To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-ID: <20031202101025.GA25422@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> <20031201220509.GA20827@gondor.apana.org.au> <20031201142131.5da50a07.davem@redhat.com> <20031201152215.522c2447.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031201152215.522c2447.davem@redhat.com> User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1812 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev On Mon, Dec 01, 2003 at 03:22:15PM -0800, David S. Miller wrote: > > You are speaking of a case of zero source addresses. When would > we output such an iph->saddr, by way of a route? Right now this > is the only part I'm not seeing. You're right. My patch is totally bogus. I misread the ip(8) output. I thought that if src wasn't shown that rt_src must be zero. But in fact it means that rt_src == fl4_src. My problem turns out to be that oif != 0 for the outgoing packets. Since frag_needed only handle cache entries where oif == 0 it never has a chance to work. The application that generated these packets is the RPC code in glibc. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From voloterreno@tin.it Tue Dec 2 02:26:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:26:45 -0800 (PST) Received: from vsmtp3.tin.it (vsmtp3.tin.it [212.216.176.223]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2AQLTa014229 for ; Tue, 2 Dec 2003 02:26:22 -0800 Received: from tin.it (80.117.50.2) by vsmtp3.tin.it (7.0.019) (authenticated as voloterreno@tin.it) id 3FCB9BE9000107FA; Mon, 1 Dec 2003 23:27:58 +0100 Message-ID: <3FCBC18A.4000405@tin.it> Date: Mon, 01 Dec 2003 23:32:42 +0100 From: Marcello User-Agent: Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.5) Gecko/20031031 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Octave CC: Stephen Hemminger , Jeff Garzik , netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: NAPI 8139too.c for 2.4.23 References: <20031201205038.GK10711@ovh.net> In-Reply-To: <20031201205038.GK10711@ovh.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1813 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: voloterreno@tin.it Precedence: bulk X-list: netdev Octave ha scritto: >Stephen, >I get your patch from http://lwn.net/Articles/54815/ for 2.6.X and >I rewrote it for 2.4.23. Tested with 2.4.23 on high load servers. I >have no more "Too much work at interrupt". > >I dropped it on ftp://ftp.ovh.net/made-in-ovh/8139too.c-2.4-0.9.27 > >Hope it helps. >Octave > >before: >------- ># ps auxw >root 256 0.0 0.0 0 0 ? SW Nov28 0:00 [eth0] ># ifconfig > RX packets:40940899 errors:250542 dropped:7052 overruns:250542 frame:0 > TX packets:33057049 errors:0 dropped:0 overruns:20 carrier:0 ># dmesg >eth0: Setting 100mbps full-duplex based on auto-negotiated partner ability 41e1. >nfs: server X.X.X.X not responding, still trying >nfs: server X.X.X.X OK >eth0: Too much work at interrupt, IntrStatus=0x0040. > >with NAPI >--------- > RX packets:428253 errors:0 dropped:0 overruns:0 frame:0 > TX packets:357949 errors:0 dropped:0 overruns:0 carrier:0 >8139too Fast Ethernet driver 0.9.27 >PCI: Found IRQ 11 for device 00:0b.0 >eth0: RealTek RTL8139 at 0xec00, 00:e0:4c:91:03:b0, IRQ 11 >eth0: Identified 8139 chip type 'RTL-8100B/8139D' > >- >To unsubscribe from this list: send the line "unsubscribe linux-net" in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html > > > OCTAVE!! Your rewrite of the driver is great!! You have resolved all my problems with ethernet!! (collisions for now , but I think errors too :) ) You are my new personal HERO!! :D Thanks Marcello From davem@pizda.ninka.net Tue Dec 2 02:28:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:29:02 -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 hB2ASmTa014606 for ; Tue, 2 Dec 2003 02:28:48 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA21879; Tue, 2 Dec 2003 02:27:33 -0800 Date: Tue, 2 Dec 2003 02:27:33 -0800 From: "David S. Miller" To: Herbert Xu Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031202022733.43cf693e.davem@redhat.com> In-Reply-To: <20031202101025.GA25422@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> <20031201220509.GA20827@gondor.apana.org.au> <20031201142131.5da50a07.davem@redhat.com> <20031201152215.522c2447.davem@redhat.com> <20031202101025.GA25422@gondor.apana.org.au> 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: 1814 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, 2 Dec 2003 21:10:25 +1100 Herbert Xu wrote: > My problem turns out to be that oif != 0 for the outgoing packets. > Since frag_needed only handle cache entries where oif == 0 it > never has a chance to work. > > The application that generated these packets is the RPC code in glibc. That behavior of glibc is incorrect, I know about it, and I explained all this to Uli Drepper some time ago and he fixed it. Current glibc should not be doing this. If it still is, since Uli understood my arguments, it probably just slipped under the rug. Tell me this so I can take care of it. What the glibc code was doing was mirroring the input packet parameters (saddr/daddr/if/etc.) into what it used for the output packet sends. From herbert@gondor.apana.org.au Tue Dec 2 02:33:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:33:50 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2AXUTa015049 for ; Tue, 2 Dec 2003 02:33:34 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AR7q6-00046n-00; Tue, 02 Dec 2003 21:33:06 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AR7q4-0006hJ-00; Tue, 02 Dec 2003 21:33:04 +1100 Date: Tue, 2 Dec 2003 21:33:04 +1100 To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-ID: <20031202103304.GA25658@gondor.apana.org.au> References: <20031201201651.GA20194@gondor.apana.org.au> <20031201204700.GA20349@gondor.apana.org.au> <20031201135154.6906454c.davem@redhat.com> <20031201220509.GA20827@gondor.apana.org.au> <20031201142131.5da50a07.davem@redhat.com> <20031201152215.522c2447.davem@redhat.com> <20031202101025.GA25422@gondor.apana.org.au> <20031202022733.43cf693e.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031202022733.43cf693e.davem@redhat.com> User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1815 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev On Tue, Dec 02, 2003 at 02:27:33AM -0800, David S. Miller wrote: > > That behavior of glibc is incorrect, I know about it, and I explained > all this to Uli Drepper some time ago and he fixed it. Cool. I can confirm that this is definitely fixed with a more recent glibc. -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From pp@ee.oulu.fi Tue Dec 2 02:40:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:41:06 -0800 (PST) Received: from ee.oulu.fi (ee.oulu.fi [130.231.61.23]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2AeoTa017107 for ; Tue, 2 Dec 2003 02:40:51 -0800 Received: from tk28.oulu.fi (tk28 [130.231.48.68]) by ee.oulu.fi (8.12.10/8.12.10) with ESMTP id hB2AeRsm003917; Tue, 2 Dec 2003 12:40:27 +0200 (EET) Received: (from pp@localhost) by tk28.oulu.fi (8.12.10/8.12.10/Submit) id hB2AePev009193; Tue, 2 Dec 2003 12:40:25 +0200 (EET) Date: Tue, 2 Dec 2003 12:40:25 +0200 From: Pekka Pietikainen To: netdev@oss.sgi.com Cc: marcelo.tosatti@cyclades.com.br Subject: Re: [patch] 2.4 lacks dummy SET_NETDEV_DEV Message-ID: <20031202104024.GA9163@ee.oulu.fi> References: <20031110181917.GA25846@ee.oulu.fi> <20031110221430.GA26556@ee.oulu.fi> <20031110221429.04732a57.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20031110221429.04732a57.davem@redhat.com> User-Agent: Mutt/1.4.1i X-archive-position: 1816 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pp@ee.oulu.fi Precedence: bulk X-list: netdev On Mon, Nov 10, 2003 at 10:14:29PM -0800, David S. Miller wrote: > On Tue, 11 Nov 2003 00:14:30 +0200 > Pekka Pietikainen wrote: > > > (I still like the idea of being able to use exactly the same driver > > source on 2.4/2.6 though) > > I agree, someone should merge in the dummy SET_NETDEV_DEV once > Marcelo starts up 2.4.24-preX Ping :-) --- linux-2.4.22-1.2115.nptl/include/linux/netdevice.h.orig 2003-11-10 20:08:42.922635848 +0200 +++ linux-2.4.22-1.2115.nptl/include/linux/netdevice.h 2003-11-10 20:09:09.754556776 +0200 @@ -456,6 +456,8 @@ #endif /* CONFIG_NET_DIVERT */ }; +/* 2.6 compatibility */ +#define SET_NETDEV_DEV(net, pdev) do { } while (0) struct packet_type { -- Pekka Pietikainen From Robert.Olsson@data.slu.se Tue Dec 2 02:44:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 02:44:53 -0800 (PST) Received: from mail1.slu.se (mail1.slu.se [130.238.96.11]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2AicTa017488 for ; Tue, 2 Dec 2003 02:44:39 -0800 Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by mail1.slu.se (8.9.3+/8.9.3) with ESMTP id LAA18731; Tue, 2 Dec 2003 11:44:25 +0100 Received: by robur.slu.se (Postfix, from userid 1000) id 86C41EC23B; Tue, 2 Dec 2003 11:44:31 +0100 (CET) From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16332.27919.502097.988522@robur.slu.se> Date: Tue, 2 Dec 2003 11:44:31 +0100 To: "Francois Baligant" Cc: Subject: 2.6.0-test11: dst_cache_overflow causing unresponsive box In-Reply-To: <072501c3b874$2542ae70$15fea8c0@fortress> References: <072501c3b874$2542ae70$15fea8c0@fortress> X-Mailer: VM 7.17 under Emacs 21.3.1 X-archive-position: 1817 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Francois Baligant writes: > We have a problem with a box running 2.6.0-test11-mjb1 and supporting around 90k simultaneous TCP connection. After a few hours/days of running, > when a lots of clients connects/disconnects, the console will start to display: > > dst cache overflow > NET: 1860 messages suppressed. > > >From there, the box is completely unresponsive, apparently eating all its CPU in trying to shrink the routing cache. Only solution is reboot. > Current sysctl: > net.ipv4.route.max_size = 655360 # I know we shouldn't rise it that high but it's only cure for now.. it lasts a bit longer like this > size IN: hit tot mc no_rt bcast madst masrc OUT: hit tot mc GC: tot ignored goal_miss ovrf HASH: in_search out_search > 139566 12393 123 0 0 0 0 0 184 21 0 143 142 0 0 26039 375 > OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME > 142340 142296 99% 0.38K 14234 10 56936K ip_dst_cache > > Are we tuning the rt_cache in a wrong way ? No experience with 90k TCP-flows but it seems GC is not able to free some the dst-entries for some reason. This will slowly kill your box with symptoms you describe. We have ask TCP-experts for timer settings to avoid pending sessions etc. Also check slab for any other objects growing as dst cache overflow is most likely secondary effect in your case. rtstat looks sane expect for the high number of dst-entries. Tuning is another story. Cheers. --ro From herbert@gondor.apana.org.au Tue Dec 2 03:02:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 03:03:00 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2B2bTa018100 for ; Tue, 2 Dec 2003 03:02:42 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1AR8IT-0004F8-00; Tue, 02 Dec 2003 22:02:25 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1AR8IS-0006lP-00; Tue, 02 Dec 2003 22:02:24 +1100 Date: Tue, 2 Dec 2003 22:02:24 +1100 To: "David S. Miller" , netdev@oss.sgi.com Subject: [RTNETLINK] Provide real oif Message-ID: <20031202110224.GA25957@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1818 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Dave: This patch adds a new attribute RTA_PREFOIF to the RTNETLINK interface so that we can send the real oif to user space. Hmm, would RTA_REALOIF be a better name? It really should be called RTA_OIF but that's already taken. Currently if there are two entries in the routing cache that only differ by the value of oif then they will appear identical to user space. The only way to tell them apart would be to export the value of oif from the kernel. Of course this patch by itself doesn't do anything. But once it is in we can extend ip(8) to display it. PS IPv6 doesn't seem to have an oif field so it doesn't need this. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: kernel-source-2.5/include/linux/rtnetlink.h =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/include/linux/rtnetlink.h,v retrieving revision 1.5 diff -u -r1.5 rtnetlink.h --- kernel-source-2.5/include/linux/rtnetlink.h 18 Oct 2003 07:12:47 -0000 1.5 +++ kernel-source-2.5/include/linux/rtnetlink.h 2 Dec 2003 10:52:34 -0000 @@ -200,6 +200,7 @@ RTA_FLOW, RTA_CACHEINFO, RTA_SESSION, + RTA_PREFOIF, }; #define RTA_MAX RTA_SESSION Index: kernel-source-2.5/net//ipv4/route.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/ipv4/route.c,v retrieving revision 1.3 diff -u -r1.3 route.c --- kernel-source-2.5/net//ipv4/route.c 24 Nov 2003 09:52:04 -0000 1.3 +++ kernel-source-2.5/net//ipv4/route.c 2 Dec 2003 10:57:12 -0000 @@ -2347,6 +2347,8 @@ #endif RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); } + if (rt->fl.oif) + RTA_PUT(skb, RTA_PREFOIF, sizeof(int), &rt->fl.oif); nlh->nlmsg_len = skb->tail - b; return skb->len; --ZGiS0Q5IWpPtfppv-- From davem@pizda.ninka.net Tue Dec 2 03:27:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 03:27: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 hB2BR0Ta019330 for ; Tue, 2 Dec 2003 03:27:00 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id DAA22015; Tue, 2 Dec 2003 03:26:06 -0800 Date: Tue, 2 Dec 2003 03:26:06 -0800 From: "David S. Miller" To: Robert Olsson Cc: francois@baligant.net, netdev@oss.sgi.com Subject: Re: 2.6.0-test11: dst_cache_overflow causing unresponsive box Message-Id: <20031202032606.28db927b.davem@redhat.com> In-Reply-To: <16332.27919.502097.988522@robur.slu.se> References: <072501c3b874$2542ae70$15fea8c0@fortress> <16332.27919.502097.988522@robur.slu.se> 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: 1819 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, 2 Dec 2003 11:44:31 +0100 Robert Olsson wrote: > No experience with 90k TCP-flows but it seems GC is not able to free some > the dst-entries for some reason. This will slowly kill your box with > symptoms you describe. We have ask TCP-experts for timer settings to avoid > pending sessions etc. Also check slab for any other objects growing as > dst cache overflow is most likely secondary effect in your case. rtstat > looks sane expect for the high number of dst-entries. Tuning is another > story. Let us assume, for the sake of back of the envelope calculations, that all 90k TCP connections speak to unique destinations. Let us further assume that all of them have at least one packet in flight. This means the routing cache must be able to hold at least 90k entries. All of these routing cache entires will be referenced by the packets in the TCP retransmission queues of all the sockets, and thus the entries are unreclaimable. You are setting net.ipv4.route.max_size to 655360 which should be more than enough. But you also have to make the net.ipv4.route.gc_thresh more reasonable as well, perhaps 90K as a test. If net.ipv4.route.gc_thresh is lower than 90K and my assertions above hold, then the kernel will try to garbage collect too early, all the routing cache entries will be in use and therefore uncollectable, and you'll get the message you're seeing. Try to pump up gc_thresh and see if that helps. From davem@pizda.ninka.net Tue Dec 2 03:29:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 03:29:40 -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 hB2BTQTa019699 for ; Tue, 2 Dec 2003 03:29:26 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id DAA22031; Tue, 2 Dec 2003 03:28:25 -0800 Date: Tue, 2 Dec 2003 03:28:25 -0800 From: "David S. Miller" To: Pekka Pietikainen Cc: netdev@oss.sgi.com, marcelo.tosatti@cyclades.com.br Subject: Re: [patch] 2.4 lacks dummy SET_NETDEV_DEV Message-Id: <20031202032825.12ded81f.davem@redhat.com> In-Reply-To: <20031202104024.GA9163@ee.oulu.fi> References: <20031110181917.GA25846@ee.oulu.fi> <20031110221430.GA26556@ee.oulu.fi> <20031110221429.04732a57.davem@redhat.com> <20031202104024.GA9163@ee.oulu.fi> 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: 1820 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, 2 Dec 2003 12:40:25 +0200 Pekka Pietikainen wrote: > On Mon, Nov 10, 2003 at 10:14:29PM -0800, David S. Miller wrote: > > I agree, someone should merge in the dummy SET_NETDEV_DEV once > > Marcelo starts up 2.4.24-preX > > Ping :-) Yes Marcelo, please apply this. > --- linux-2.4.22-1.2115.nptl/include/linux/netdevice.h.orig 2003-11-10 20:08:42.922635848 +0200 > +++ linux-2.4.22-1.2115.nptl/include/linux/netdevice.h 2003-11-10 20:09:09.754556776 +0200 > @@ -456,6 +456,8 @@ > #endif /* CONFIG_NET_DIVERT */ > }; > > +/* 2.6 compatibility */ > +#define SET_NETDEV_DEV(net, pdev) do { } while (0) > > struct packet_type > { From kuznet@ms2.inr.ac.ru Tue Dec 2 04:40:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 04:41:06 -0800 (PST) Received: from yakov.inr.ac.ru (yakov.inr.ac.ru [193.233.7.111]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2CehTa025892 for ; Tue, 2 Dec 2003 04:40:44 -0800 Received: (from kuznet@localhost) by yakov.inr.ac.ru (8.6.13/ANK) id PAA01536; Tue, 2 Dec 2003 15:40:07 +0300 From: kuznet@ms2.inr.ac.ru Message-Id: <200312021240.PAA01536@yakov.inr.ac.ru> Subject: Re: IPv6 MIB:ipv6PrefixTable implementation To: mashirle@us.ibm.com (Shirley Ma) Date: Tue, 2 Dec 2003 15:40:07 +0300 (MSK) Cc: netdev@oss.sgi.com, xma@us.ibm.com In-Reply-To: <200311191621.38087.mashirle@us.ibm.com> from "Shirley Ma" at îÏÑ 19, 2003 04:21:38 X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 1821 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > One implementation detail question, do you think I need to save all the o= > ther=20 > Prefix Objects: Type, Origin(addrconf, manually, dhcp, others), These two things should be stored right now. Existing implementation is quite a mess, but we definitely want to remember origin of each route in "protocol" and another flags, they are of common interest. > AutonomoueFlag, AdvPreferredLiftTime and ValidLifeTime ValidLifeTime is "expires" on this route. What's about AdvPreferredLiftTime I am puzzled a little, preferred time is not an attribute of a prefix at all, it is attribute of address, is not it? Unless the prefix is used to install local address it does not make sense, right? Alexey From hadi@cyberus.ca Tue Dec 2 04:47:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 04:47:50 -0800 (PST) Received: from mail.cyberus.ca (mail.cyberus.ca [209.197.145.21]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2ClaTa026369 for ; Tue, 2 Dec 2003 04:47:36 -0800 Received: from cpe0030ab124d2f-cm014500000962.cpe.net.cable.rogers.com ([24.103.99.32] helo=[10.0.0.9]) by mail.cyberus.ca with esmtp (Exim 4.20) id 1AR9wE-0006Ty-Pg; Tue, 02 Dec 2003 07:47:35 -0500 Subject: Re: 2.6.0-test11: dst_cache_overflow causing unresponsive box From: jamal Reply-To: hadi@cyberus.ca To: "David S. Miller" Cc: Robert Olsson , francois@baligant.net, netdev@oss.sgi.com In-Reply-To: <20031202032606.28db927b.davem@redhat.com> References: <072501c3b874$2542ae70$15fea8c0@fortress> <16332.27919.502097.988522@robur.slu.se> <20031202032606.28db927b.davem@redhat.com> Content-Type: text/plain Organization: jamalopolis Message-Id: <1070369223.1027.34.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 02 Dec 2003 07:47:03 -0500 Content-Transfer-Encoding: 7bit X-archive-position: 1822 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@cyberus.ca Precedence: bulk X-list: netdev With that many flows the neighbor cache gc may also be killing him. cheers, jamal From Helmut.BA.Berger@partner.bmw.de Tue Dec 2 08:11:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 08:11:34 -0800 (PST) Received: from mailgw2.bmwgroup.com (mailgw2.bmwgroup.com [192.109.190.191]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2GBGTa011959 for ; Tue, 2 Dec 2003 08:11:19 -0800 Received: from mhub1.muc (mhub1.muc [160.50.97.116]) by mailgw2.bmwgroup.com with ESMTP for netdev@oss.sgi.com; Tue, 2 Dec 2003 17:11:11 +0100 Received: from mail03.muc (mail03.muc [160.50.97.30]) by mhub1.muc with ESMTP for netdev@oss.sgi.com; Tue, 2 Dec 2003 17:11:10 +0100 Received: from ztpc451-L.muc ([10.249.235.55] (may be forged)) by mail03.muc (8.8.6 (PHNE_17190+no byaddr 2)/8.8.6) with ESMTP id RAA21375 for ; Tue, 2 Dec 2003 17:11:10 +0100 (MET) Subject: Inserting a layer between TCP and IP From: Helmut Berger To: netdev@oss.sgi.com Message-Id: <1070381465.1793.16.camel@ztpc451-L.MUC> X-Mailer: Ximian Evolution 1.4.4 Date: Tue, 02 Dec 2003 17:11:05 +0100 MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-archive-position: 1823 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Helmut.BA.Berger@partner.bmw.de Precedence: bulk X-list: netdev Hi, I am not sure if this is the right platform for my question. I am not very familiar with linux driver development. If I am wrong here, please be so kind and tell me, where I should better go to. I want to insert an additional layer between the tcp and ip layer with some special functionality and I am not sure how to do this. I fear it cannot be done with system_calls, can it? That would be very comfortable. I could write a loadable kernel module which registers itself on insert and deregisters itself on remove. Is it possible to insert my special layer at runtime without kernel changes? Or do I have to build a special kernel? Which ist the best way to insert a layer between the existing tcp and ip layer? Thanx, Helmut From Robert.Olsson@data.slu.se Tue Dec 2 09:56:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 09:56:56 -0800 (PST) Received: from mail1.slu.se (mail1.slu.se [130.238.96.11]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2HudTa019684 for ; Tue, 2 Dec 2003 09:56:40 -0800 Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by mail1.slu.se (8.9.3+/8.9.3) with ESMTP id SAA24729; Tue, 2 Dec 2003 18:56:21 +0100 Received: by robur.slu.se (Postfix, from userid 1000) id 53C6DEC23B; Tue, 2 Dec 2003 18:56:27 +0100 (CET) From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16332.53835.297235.589786@robur.slu.se> Date: Tue, 2 Dec 2003 18:56:27 +0100 To: "David S. Miller" Cc: Robert Olsson , francois@baligant.net, netdev@oss.sgi.com Subject: Re: 2.6.0-test11: dst_cache_overflow causing unresponsive box In-Reply-To: <20031202032606.28db927b.davem@redhat.com> References: <072501c3b874$2542ae70$15fea8c0@fortress> <16332.27919.502097.988522@robur.slu.se> <20031202032606.28db927b.davem@redhat.com> X-Mailer: VM 7.17 under Emacs 21.3.1 X-archive-position: 1824 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev David S. Miller writes: > Let us assume, for the sake of back of the envelope calculations, that > all 90k TCP connections speak to unique destinations. Let us further > assume that all of them have at least one packet in flight. > > This means the routing cache must be able to hold at least 90k entries. > All of these routing cache entires will be referenced by the packets > in the TCP retransmission queues of all the sockets, and thus the > entries are unreclaimable. > > You are setting net.ipv4.route.max_size to 655360 which should be more > than enough. But you also have to make the net.ipv4.route.gc_thresh > more reasonable as well, perhaps 90K as a test. > > If net.ipv4.route.gc_thresh is lower than 90K and my assertions above > hold, then the kernel will try to garbage collect too early, all the > routing cache entries will be in use and therefore uncollectable, > and you'll get the message you're seeing. > > Try to pump up gc_thresh and see if that helps. Yes better tuning as gc_thresh and max_size is in better balance but max_size is same so I'll guess we collect unreclaimable entries util we see dst overflow still'. The long time before overflow is suspect "hours to days" We have to ask if this has ever worked before? I'll guess number of hash buckets should be increased for systems like this. Cheers. --ro From hadi@cyberus.ca Tue Dec 2 11:29:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 11:29:48 -0800 (PST) Received: from mail.cyberus.ca (mail.cyberus.ca [209.197.145.21]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2JTYTa026404 for ; Tue, 2 Dec 2003 11:29:35 -0800 Received: from cpe0030ab124d2f-cm014500000962.cpe.net.cable.rogers.com ([24.103.99.32] helo=[10.0.0.9]) by mail.cyberus.ca with esmtp (Exim 4.20) id 1AR9hc-0005LY-7N; Tue, 02 Dec 2003 07:32:28 -0500 Subject: Re: [RTNETLINK] Provide real oif From: jamal Reply-To: hadi@cyberus.ca To: Herbert Xu Cc: "David S. Miller" , netdev@oss.sgi.com In-Reply-To: <20031202110224.GA25957@gondor.apana.org.au> References: <20031202110224.GA25957@gondor.apana.org.au> Content-Type: text/plain Organization: jamalopolis Message-Id: <1070368316.1031.30.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 02 Dec 2003 07:31:57 -0500 Content-Transfer-Encoding: 7bit X-archive-position: 1825 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@cyberus.ca Precedence: bulk X-list: netdev On Tue, 2003-12-02 at 06:02, Herbert Xu wrote: > Hi Dave: > > This patch adds a new attribute RTA_PREFOIF to the RTNETLINK interface > so that we can send the real oif to user space. Hmm, would RTA_REALOIF > be a better name? It really should be called RTA_OIF but that's already > taken. > > Currently if there are two entries in the routing cache that only differ > by the value of oif then they will appear identical to user space. The > only way to tell them apart would be to export the value of oif from > the kernel. > Can you provide a real example (output of route display in user space) where this would be valuable? whats wrong with the combo of RTA_OIF and RTA_SRC? cheers, jamal From herbert@gondor.apana.org.au Tue Dec 2 12:54:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 12:54:57 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2KsUTa032602 for ; Tue, 2 Dec 2003 12:54:34 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1ARHXJ-0007RO-00; Wed, 03 Dec 2003 07:54:21 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1ARHXF-0007cM-00; Wed, 03 Dec 2003 07:54:17 +1100 From: Herbert Xu To: hadi@cyberus.ca, netdev@oss.sgi.com Subject: Re: [RTNETLINK] Provide real oif Organization: Core In-Reply-To: <1070368316.1031.30.camel@jzny.localdomain> X-Newsgroups: apana.lists.os.linux.netdev User-Agent: tin/1.7.2-20031002 ("Berneray") (UNIX) (Linux/2.4.22-1-686-smp (i686)) Message-Id: Date: Wed, 03 Dec 2003 07:54:17 +1100 X-archive-position: 1826 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev jamal wrote: > > Can you provide a real example (output of route display in user space) > where this would be valuable? Without the real oif you will see entries like this in the output of ip r l c: 192.168.0.7 dev eth0 src 192.168.0.6 cache mtu 1500 advmss 1460 metric10 64 192.168.0.7 dev eth0 src 192.168.0.6 cache mtu 1500 advmss 1460 metric10 64 One of those has oif == 0 while the other one has oif == eth0. To generate an entry with oif == eth0, just send a UDP packet and bound to eth0. > whats wrong with the combo of RTA_OIF and RTA_SRC? Both of those attributes are independent of the real oif. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From pavlin@possum.icir.org Tue Dec 2 13:19:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 13:19:51 -0800 (PST) Received: from possum.icir.org (possum.icir.org [192.150.187.67]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2LJaTa001015 for ; Tue, 2 Dec 2003 13:19:37 -0800 Received: from possum.icir.org (localhost [127.0.0.1]) by possum.icir.org (8.12.9p1/8.12.3) with ESMTP id hB2LJaSx017575; Tue, 2 Dec 2003 13:19:36 -0800 (PST) (envelope-from pavlin@possum.icir.org) Message-Id: <200312022119.hB2LJaSx017575@possum.icir.org> To: netdev@oss.sgi.com Cc: pavlin@icir.org Subject: A request to add RTPROT_XORP to linux/rtnetlink.h Date: Tue, 02 Dec 2003 13:19:36 -0800 From: Pavlin Radoslavov X-archive-position: 1827 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pavlin@icir.org Precedence: bulk X-list: netdev [If this is not the right mailing list for such request, please let me know where I should send it to.] On behalf of the XORP (eXtensible Open Router Platform) project (http://www.xorp.org), I'd like to ask if the XORP-specific protocol value can be included in linux/rtnetlink.h (similar to the values already assigned to other routing daemons/suites such as GateD, etc.) Below I am including the simple one-line patch against linux-2.6.0-test11. Any chance this can be added to 2.6.0 before its release? :) Thanks, Pavlin --- linux-2.6.0-test11/include/linux/rtnetlink.h.org Wed Nov 26 12:45:11 2003 +++ linux-2.6.0-test11/include/linux/rtnetlink.h Tue Dec 2 12:53:18 2003 @@ -138,6 +138,7 @@ #define RTPROT_ZEBRA 11 /* Zebra */ #define RTPROT_BIRD 12 /* BIRD */ #define RTPROT_DNROUTED 13 /* DECnet routing daemon */ +#define RTPROT_XORP 14 /* XORP */ /* rtm_scope From shemminger@osdl.org Tue Dec 2 14:01:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:01:49 -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 hB2M1ZTa001791 for ; Tue, 2 Dec 2003 14:01:35 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M0XZ01347; Tue, 2 Dec 2003 14:00:33 -0800 Date: Tue, 2 Dec 2003 14:01:15 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (4//8) dscc4 convert to new hdlc_device Message-Id: <20031202140115.239f998f.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1828 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1493 -> 1.1494 # drivers/net/wan/dscc4.c 1.51 -> 1.52 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1494 # Convert to work with hdlc_device that is not embedded. # Use list macros for list of ports on card. # -------------------------------------------- # diff -Nru a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c --- a/drivers/net/wan/dscc4.c Wed Nov 26 12:30:13 2003 +++ b/drivers/net/wan/dscc4.c Wed Nov 26 12:30:13 2003 @@ -185,12 +185,14 @@ spinlock_t lock; struct pci_dev *pdev; - struct dscc4_dev_priv *root; + struct list_head devs; dma_addr_t iqcfg_dma; u32 xtal_hz; }; struct dscc4_dev_priv { + struct list_head dev_list; + struct sk_buff *rx_skbuff[RX_RING_SIZE]; struct sk_buff *tx_skbuff[TX_RING_SIZE]; @@ -228,7 +230,7 @@ unsigned short encoding; unsigned short parity; - hdlc_device hdlc; + hdlc_device *hdlc; sync_serial_settings settings; u32 __pad __attribute__ ((aligned (4))); }; @@ -371,9 +373,17 @@ static int dscc4_tx_poll(struct dscc4_dev_priv *, struct net_device *); #endif +static inline struct dscc4_dev_priv *dscc4_root_priv(struct dscc4_pci_priv *ppriv) +{ + struct list_head *first = ppriv->devs.next; + + return (first == &ppriv->devs) ? NULL + : list_entry(first, struct dscc4_dev_priv, dev_list); +} + static inline struct dscc4_dev_priv *dscc4_priv(struct net_device *dev) { - return list_entry(dev, struct dscc4_dev_priv, hdlc.netdev); + return dev_to_hdlc(dev)->dev_data; } static void scc_patchl(u32 mask, u32 value, struct dscc4_dev_priv *dpriv, @@ -636,7 +646,7 @@ struct net_device *dev) { struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE; - struct net_device_stats *stats = &dpriv->hdlc.stats; + struct net_device_stats *stats = &dpriv->hdlc->stats; struct pci_dev *pdev = dpriv->pci_priv->pdev; struct sk_buff *skb; int pkt_len; @@ -681,19 +691,16 @@ static void dscc4_free1(struct pci_dev *pdev) { - struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; - int i; + struct dscc4_pci_priv *ppriv = pci_get_drvdata(pdev); + struct dscc4_dev_priv *dpriv, *dnext; - ppriv = pci_get_drvdata(pdev); - root = ppriv->root; - - for (i = 0; i < dev_per_card; i++) - unregister_hdlc_device(&root[i].hdlc); + list_for_each_entry_safe(dpriv, dnext, &ppriv->devs, dev_list) { + unregister_hdlc_device(dpriv->hdlc); + free_hdlc_device(dpriv->hdlc); + } pci_set_drvdata(pdev, NULL); - kfree(root); kfree(ppriv); } @@ -704,7 +711,6 @@ struct dscc4_dev_priv *dpriv; static int cards_found = 0; unsigned long ioaddr; - int i; printk(KERN_DEBUG "%s", version); @@ -743,7 +749,8 @@ priv = (struct dscc4_pci_priv *)pci_get_drvdata(pdev); - if (request_irq(pdev->irq, &dscc4_irq, SA_SHIRQ, DRV_NAME, priv->root)){ + if (request_irq(pdev->irq, &dscc4_irq, SA_SHIRQ, DRV_NAME, + dscc4_root_priv(priv))) { printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq); goto err_out_free1; } @@ -772,21 +779,19 @@ * SCC 0-3 private rx/tx irq structures * IQRX/TXi needs to be set soon. Learned it the hard way... */ - for (i = 0; i < dev_per_card; i++) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); if (!dpriv->iqtx) goto err_out_free_iqtx; - writel(dpriv->iqtx_dma, ioaddr + IQTX0 + i*4); + writel(dpriv->iqtx_dma, ioaddr + IQTX0 + dpriv->dev_id*4); } - for (i = 0; i < dev_per_card; i++) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); if (!dpriv->iqrx) goto err_out_free_iqrx; - writel(dpriv->iqrx_dma, ioaddr + IQRX0 + i*4); + writel(dpriv->iqrx_dma, ioaddr + IQRX0 + dpriv->dev_id*4); } /* Cf application hint. Beware of hard-lock condition on threshold. */ @@ -804,22 +809,19 @@ return 0; err_out_free_iqrx: - while (--i >= 0) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqrx, dpriv->iqrx_dma); } - i = dev_per_card; err_out_free_iqtx: - while (--i >= 0) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqtx, dpriv->iqtx_dma); } pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), priv->iqcfg, priv->iqcfg_dma); err_out_free_irq: - free_irq(pdev->irq, priv->root); + free_irq(pdev->irq, dscc4_root_priv(priv)); err_out_free1: dscc4_free1(pdev); err_out_iounmap: @@ -863,29 +865,27 @@ static int dscc4_found1(struct pci_dev *pdev, unsigned long ioaddr) { struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; + struct dscc4_dev_priv *dpriv, *dnext; int i, ret = -ENOMEM; - root = (struct dscc4_dev_priv *) - kmalloc(dev_per_card*sizeof(*root), GFP_KERNEL); - if (!root) { - printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); - goto err_out; - } - memset(root, 0, dev_per_card*sizeof(*root)); - ppriv = (struct dscc4_pci_priv *) kmalloc(sizeof(*ppriv), GFP_KERNEL); if (!ppriv) { printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); - goto err_free_dev; + goto err_out; } memset(ppriv, 0, sizeof(struct dscc4_pci_priv)); + INIT_LIST_HEAD(&ppriv->devs); for (i = 0; i < dev_per_card; i++) { - struct dscc4_dev_priv *dpriv = root + i; - hdlc_device *hdlc = &dpriv->hdlc; - struct net_device *d = hdlc_to_dev(hdlc); + hdlc_device *hdlc = alloc_hdlc_device(sizeof(*dpriv)); + struct net_device *d; + + if (!hdlc) { + ret = -ENOMEM; + goto err_unregister; + } + d = hdlc_to_dev(hdlc); d->base_addr = ioaddr; d->init = NULL; d->irq = pdev->irq; @@ -898,6 +898,8 @@ SET_MODULE_OWNER(d); SET_NETDEV_DEV(d, &pdev->dev); + dpriv = dscc4_priv(d); + dpriv->hdlc = hdlc; dpriv->dev_id = i; dpriv->pci_priv = ppriv; spin_lock_init(&dpriv->lock); @@ -920,23 +922,25 @@ unregister_hdlc_device(hdlc); goto err_unregister; } + list_add_tail(&dpriv->dev_list, &ppriv->devs); } - ret = dscc4_set_quartz(root, quartz); + + + ret = dscc4_set_quartz(dscc4_root_priv(ppriv), quartz); if (ret < 0) goto err_unregister; - ppriv->root = root; + spin_lock_init(&ppriv->lock); pci_set_drvdata(pdev, ppriv); return ret; err_unregister: - while (--i >= 0) { - dscc4_release_ring(root + i); - unregister_hdlc_device(&root[i].hdlc); + list_for_each_entry_safe(dpriv, dnext, &ppriv->devs, dev_list) { + dscc4_release_ring(dpriv); + unregister_hdlc_device(dpriv->hdlc); + free_hdlc_device(dpriv->hdlc); } kfree(ppriv); -err_free_dev: - kfree(root); err_out: return ret; }; @@ -964,7 +968,7 @@ sync_serial_settings *settings = &dpriv->settings; if (settings->loopback && (settings->clock_type != CLOCK_INT)) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); printk(KERN_INFO "%s: loopback requires clock\n", dev->name); return -1; @@ -1015,7 +1019,7 @@ static int dscc4_open(struct net_device *dev) { struct dscc4_dev_priv *dpriv = dscc4_priv(dev); - hdlc_device *hdlc = &dpriv->hdlc; + hdlc_device *hdlc = dpriv->hdlc; struct dscc4_pci_priv *ppriv; int ret = -EAGAIN; @@ -1467,7 +1471,7 @@ int i, handled = 1; priv = root->pci_priv; - dev = hdlc_to_dev(&root->hdlc); + dev = hdlc_to_dev(root->hdlc); spin_lock_irqsave(&priv->lock, flags); @@ -1518,7 +1522,7 @@ static inline void dscc4_tx_irq(struct dscc4_pci_priv *ppriv, struct dscc4_dev_priv *dpriv) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); u32 state; int cur, loop = 0; @@ -1549,7 +1553,7 @@ if (state & SccEvt) { if (state & Alls) { - struct net_device_stats *stats = &dpriv->hdlc.stats; + struct net_device_stats *stats = &dpriv->hdlc->stats; struct sk_buff *skb; struct TxFD *tx_fd; @@ -1687,7 +1691,7 @@ static inline void dscc4_rx_irq(struct dscc4_pci_priv *priv, struct dscc4_dev_priv *dpriv) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); u32 state; int cur; @@ -1954,23 +1958,21 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev) { struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; + struct dscc4_dev_priv *root, *dpriv; unsigned long ioaddr; - int i; ppriv = pci_get_drvdata(pdev); - root = ppriv->root; + root = dscc4_root_priv(ppriv); - ioaddr = hdlc_to_dev(&root->hdlc)->base_addr; + ioaddr = hdlc_to_dev(root->hdlc)->base_addr; dscc4_pci_reset(pdev, ioaddr); free_irq(pdev->irq, root); pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), ppriv->iqcfg, ppriv->iqcfg_dma); - for (i = 0; i < dev_per_card; i++) { - struct dscc4_dev_priv *dpriv = root + i; + list_for_each_entry(dpriv, &ppriv->devs, dev_list) { dscc4_release_ring(dpriv); pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqrx, dpriv->iqrx_dma); From shemminger@osdl.org Tue Dec 2 14:01:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:01:49 -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 hB2M1XTa001790 for ; Tue, 2 Dec 2003 14:01:34 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M0KZ01320; Tue, 2 Dec 2003 14:00:21 -0800 Date: Tue, 2 Dec 2003 14:01:03 -0800 From: Stephen Hemminger To: Jeff Garzik , Krzysztof Halas Cc: netdev@oss.sgi.com Subject: [PATCH] (1/8) hdlc wan device disembedding Message-Id: <20031202140103.6bb2deb4.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1829 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev Change the hdlc wan device's to not have the net_device structure embedded inside the hdlc_device structure. This won't work on 2.6 where the net_device structure may need to live after module unload due to sysfs. Instead, use alloc_netdev and setup so that netdev->priv = hdlc and have hdlc->dev_data for device private data. Patch is against net-drivers-2.5-exp tree. This portion breaks the actual hardware drivers but that is fixed in parts 2-5. I don't have any of this hardware so the code has only been tested by compiling and loading the modules. # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1502 -> 1.1503 # drivers/net/wan/hdlc_generic.c 1.14 -> 1.15 # drivers/net/wan/hdlc_cisco.c 1.9 -> 1.10 # drivers/net/wan/hdlc_fr.c 1.9 -> 1.10 # include/linux/hdlc.h 1.10 -> 1.11 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/12/01 shemminger@osdl.org 1.1503 # 1-hdlc_device # -------------------------------------------- # diff -Nru a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c --- a/drivers/net/wan/hdlc_cisco.c Mon Dec 1 14:45:08 2003 +++ b/drivers/net/wan/hdlc_cisco.c Mon Dec 1 14:45:08 2003 @@ -222,8 +222,8 @@ hdlc->state.cisco.settings.timeout * HZ) { hdlc->state.cisco.up = 0; printk(KERN_INFO "%s: Link down\n", hdlc_to_name(hdlc)); - if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + if (netif_carrier_ok(hdlc->netdev)) + netif_carrier_off(hdlc->netdev); } cisco_keepalive_send(hdlc, CISCO_KEEPALIVE_REQ, @@ -256,8 +256,8 @@ static void cisco_stop(hdlc_device *hdlc) { del_timer_sync(&hdlc->state.cisco.timer); - if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + if (netif_carrier_ok(hdlc->netdev)) + netif_carrier_off(hdlc->netdev); } diff -Nru a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c --- a/drivers/net/wan/hdlc_fr.c Mon Dec 1 14:45:08 2003 +++ b/drivers/net/wan/hdlc_fr.c Mon Dec 1 14:45:08 2003 @@ -543,8 +543,8 @@ hdlc->state.fr.reliable = reliable; if (reliable) { - if (!netif_carrier_ok(&hdlc->netdev)) - netif_carrier_on(&hdlc->netdev); + if (!netif_carrier_ok(hdlc->netdev)) + netif_carrier_on(hdlc->netdev); hdlc->state.fr.n391cnt = 0; /* Request full status */ hdlc->state.fr.dce_changed = 1; @@ -558,8 +558,8 @@ } } } else { - if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + if (netif_carrier_ok(hdlc->netdev)) + netif_carrier_off(hdlc->netdev); while (pvc) { /* Deactivate all PVCs */ pvc_carrier(0, pvc); @@ -938,8 +938,8 @@ printk(KERN_DEBUG "fr_start\n"); #endif if (hdlc->state.fr.settings.lmi != LMI_NONE) { - if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + if (netif_carrier_ok(hdlc->netdev)) + netif_carrier_off(hdlc->netdev); hdlc->state.fr.last_poll = 0; hdlc->state.fr.reliable = 0; hdlc->state.fr.dce_changed = 1; diff -Nru a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c --- a/drivers/net/wan/hdlc_generic.c Mon Dec 1 14:45:08 2003 +++ b/drivers/net/wan/hdlc_generic.c Mon Dec 1 14:45:08 2003 @@ -71,6 +71,7 @@ void hdlc_set_carrier(int on, hdlc_device *hdlc) { + struct net_device *dev = hdlc_to_dev(hdlc); on = on ? 1 : 0; #ifdef DEBUG_LINK @@ -92,14 +93,14 @@ if (hdlc->carrier) { if (hdlc->proto.start) hdlc->proto.start(hdlc); - else if (!netif_carrier_ok(&hdlc->netdev)) - netif_carrier_on(&hdlc->netdev); + else if (!netif_carrier_ok(dev)) + netif_carrier_on(dev); } else { /* no carrier */ if (hdlc->proto.stop) hdlc->proto.stop(hdlc); - else if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + else if (netif_carrier_ok(dev)) + netif_carrier_off(dev); } carrier_exit: @@ -110,6 +111,8 @@ /* Must be called by hardware driver when HDLC device is being opened */ int hdlc_open(hdlc_device *hdlc) { + struct net_device *dev = hdlc_to_dev(hdlc); + #ifdef DEBUG_LINK printk(KERN_DEBUG "hdlc_open carrier %i open %i\n", hdlc->carrier, hdlc->open); @@ -129,11 +132,11 @@ if (hdlc->carrier) { if (hdlc->proto.start) hdlc->proto.start(hdlc); - else if (!netif_carrier_ok(&hdlc->netdev)) - netif_carrier_on(&hdlc->netdev); + else if (!netif_carrier_ok(dev)) + netif_carrier_on(dev); - } else if (netif_carrier_ok(&hdlc->netdev)) - netif_carrier_off(&hdlc->netdev); + } else if (netif_carrier_ok(dev)) + netif_carrier_off(dev); hdlc->open = 1; @@ -224,11 +227,9 @@ } - -int register_hdlc_device(hdlc_device *hdlc) +static void hdlc_setup(struct net_device *dev) { - int result; - struct net_device *dev = hdlc_to_dev(hdlc); + hdlc_device *hdlc = dev->priv; dev->get_stats = hdlc_get_stats; dev->change_mtu = hdlc_change_mtu; @@ -245,17 +246,13 @@ hdlc->open = 0; spin_lock_init(&hdlc->state_lock); - result = dev_alloc_name(dev, "hdlc%d"); - if (result < 0) - return result; - - result = register_netdev(dev); - if (result != 0) - return -EIO; - - return 0; + hdlc->dev_data = (hdlc + 1); } +int register_hdlc_device(hdlc_device *hdlc) +{ + return register_netdev(hdlc_to_dev(hdlc)); +} void unregister_hdlc_device(hdlc_device *hdlc) @@ -266,7 +263,17 @@ rtnl_unlock(); } +hdlc_device *alloc_hdlc_device(int sizeof_priv) +{ + struct net_device *dev = alloc_netdev(sizeof_priv + sizeof(hdlc_device), + "hdlc%d", hdlc_setup); + return dev ? dev_to_hdlc(dev) : NULL; +} +void free_hdlc_device(hdlc_device *hdlc) +{ + free_netdev(hdlc_to_dev(hdlc)); +} MODULE_AUTHOR("Krzysztof Halasa "); MODULE_DESCRIPTION("HDLC support module"); @@ -278,6 +285,8 @@ EXPORT_SYMBOL(hdlc_ioctl); EXPORT_SYMBOL(register_hdlc_device); EXPORT_SYMBOL(unregister_hdlc_device); +EXPORT_SYMBOL(alloc_hdlc_device); +EXPORT_SYMBOL(free_hdlc_device); static struct packet_type hdlc_packet_type = { .type = __constant_htons(ETH_P_HDLC), diff -Nru a/include/linux/hdlc.h b/include/linux/hdlc.h --- a/include/linux/hdlc.h Mon Dec 1 14:45:08 2003 +++ b/include/linux/hdlc.h Mon Dec 1 14:45:08 2003 @@ -96,7 +96,9 @@ typedef struct hdlc_device_struct { /* To be initialized by hardware driver */ - struct net_device netdev; /* master net device - must be first */ + struct net_device *netdev; /* master net device */ + void *dev_data; + struct net_device_stats stats; /* used by HDLC layer to take control over HDLC device from hw driver*/ @@ -180,6 +182,8 @@ /* Exported from hdlc.o */ +hdlc_device *alloc_hdlc_device(int sizeof_priv); +void free_hdlc_device(hdlc_device *hdlc); /* Called by hardware driver when a user requests HDLC service */ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); @@ -188,18 +192,15 @@ int register_hdlc_device(hdlc_device *hdlc); void unregister_hdlc_device(hdlc_device *hdlc); - static __inline__ struct net_device* hdlc_to_dev(hdlc_device *hdlc) { - return &hdlc->netdev; + return hdlc->netdev; } - -static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) +static __inline__ hdlc_device *dev_to_hdlc(struct net_device *dev) { - return (hdlc_device*)dev; + return dev->priv; } - static __inline__ pvc_device* dev_to_pvc(struct net_device *dev) { From shemminger@osdl.org Tue Dec 2 14:02:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:02: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 hB2M2TTa002051 for ; Tue, 2 Dec 2003 14:02:29 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M1YZ01464; Tue, 2 Dec 2003 14:01:34 -0800 Date: Tue, 2 Dec 2003 14:02:17 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (5/8) farsync - hdlc_device conversion Message-Id: <20031202140217.776fdff6.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1830 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1494 -> 1.1495 # drivers/net/wan/farsync.c 1.18 -> 1.19 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1495 # Convert from embedding hdlc_device (with embedded net_device) # to hdlc_device pointer. # -------------------------------------------- # diff -Nru a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c --- a/drivers/net/wan/farsync.c Wed Nov 26 12:31:27 2003 +++ b/drivers/net/wan/farsync.c Wed Nov 26 12:31:28 2003 @@ -328,7 +328,7 @@ /* Per port (line or channel) information */ struct fst_port_info { - hdlc_device hdlc; /* HDLC device struct - must be first */ + hdlc_device *hdlc; /* HDLC device struct */ struct fst_card_info *card; /* Card we're associated with */ int index; /* Port index on the card */ int hwif; /* Line hardware (lineInterface copy) */ @@ -353,13 +353,16 @@ spinlock_t card_lock; /* Lock for SMP access */ unsigned short pci_conf; /* PCI card config in I/O space */ /* Per port info */ - struct fst_port_info ports[ FST_MAX_PORTS ]; + struct fst_port_info *ports[ FST_MAX_PORTS ]; }; /* Convert an HDLC device pointer into a port info pointer and similar */ -#define hdlc_to_port(H) ((struct fst_port_info *)(H)) +static __inline__ struct fst_port_info *hdlc_to_port(hdlc_device *hdlc) +{ + return hdlc->dev_data; +} #define dev_to_port(D) hdlc_to_port(dev_to_hdlc(D)) -#define port_to_dev(P) hdlc_to_dev(&(P)->hdlc) +#define port_to_dev(P) hdlc_to_dev(P->hdlc) /* @@ -678,24 +681,24 @@ len ); if ( dmabits != ( RX_STP | RX_ENP ) || len > LEN_RX_BUFFER - 2 ) { - port->hdlc.stats.rx_errors++; + port->hdlc->stats.rx_errors++; /* Update error stats and discard buffer */ if ( dmabits & RX_OFLO ) { - port->hdlc.stats.rx_fifo_errors++; + port->hdlc->stats.rx_fifo_errors++; } if ( dmabits & RX_CRC ) { - port->hdlc.stats.rx_crc_errors++; + port->hdlc->stats.rx_crc_errors++; } if ( dmabits & RX_FRAM ) { - port->hdlc.stats.rx_frame_errors++; + port->hdlc->stats.rx_frame_errors++; } if ( dmabits == ( RX_STP | RX_ENP )) { - port->hdlc.stats.rx_length_errors++; + port->hdlc->stats.rx_length_errors++; } /* Discard buffer descriptors until we see the end of packet @@ -732,7 +735,7 @@ { dbg ( DBG_RX,"intr_rx: can't allocate buffer\n"); - port->hdlc.stats.rx_dropped++; + port->hdlc->stats.rx_dropped++; /* Return descriptor to card */ FST_WRB ( card, rxDescrRing[pi][rxp].bits, DMA_OWN ); @@ -756,12 +759,12 @@ port->rxpos = rxp; /* Update stats */ - port->hdlc.stats.rx_packets++; - port->hdlc.stats.rx_bytes += len; + port->hdlc->stats.rx_packets++; + port->hdlc->stats.rx_bytes += len; /* Push upstream */ skb->mac.raw = skb->data; - skb->dev = hdlc_to_dev ( &port->hdlc ); + skb->dev = hdlc_to_dev ( port->hdlc ); skb->protocol = hdlc_type_trans(skb, skb->dev); netif_rx ( skb ); @@ -806,7 +809,7 @@ { event = FST_RDB ( card, interruptEvent.evntbuff[rdidx]); - port = &card->ports[event & 0x03]; + port = card->ports[event & 0x03]; dbg ( DBG_INTR,"intr: %x\n", event ); @@ -835,8 +838,8 @@ * always load up the entire packet for DMA. */ dbg ( DBG_TX,"Tx underflow port %d\n", event & 0x03 ); - port->hdlc.stats.tx_errors++; - port->hdlc.stats.tx_fifo_errors++; + port->hdlc->stats.tx_errors++; + port->hdlc->stats.tx_fifo_errors++; break; case INIT_CPLT: @@ -859,9 +862,10 @@ } FST_WRB ( card, interruptEvent.rdindex, rdidx ); - for ( pi = 0, port = card->ports ; pi < card->nports ; pi++, port++ ) + for ( pi = 0 ; pi < card->nports ; pi++ ) { - if ( ! port->run ) + port = card->ports[pi]; + if ( !port || ! port->run ) continue; /* Check for rx completions */ @@ -1346,8 +1350,8 @@ port = dev_to_port ( dev ); - port->hdlc.stats.tx_errors++; - port->hdlc.stats.tx_aborted_errors++; + port->hdlc->stats.tx_errors++; + port->hdlc->stats.tx_aborted_errors++; if ( port->txcnt > 0 ) fst_issue_cmd ( port, ABORTTX ); @@ -1374,8 +1378,8 @@ if ( ! netif_carrier_ok ( dev )) { dev_kfree_skb ( skb ); - port->hdlc.stats.tx_errors++; - port->hdlc.stats.tx_carrier_errors++; + port->hdlc->stats.tx_errors++; + port->hdlc->stats.tx_carrier_errors++; return 0; } @@ -1385,7 +1389,7 @@ dbg ( DBG_TX,"Packet too large %d vs %d\n", skb->len, LEN_TX_BUFFER ); dev_kfree_skb ( skb ); - port->hdlc.stats.tx_errors++; + port->hdlc->stats.tx_errors++; return 0; } @@ -1399,7 +1403,7 @@ spin_unlock_irqrestore ( &card->card_lock, flags ); dbg ( DBG_TX,"Out of Tx buffers\n"); dev_kfree_skb ( skb ); - port->hdlc.stats.tx_errors++; + port->hdlc->stats.tx_errors++; return 0; } if ( ++port->txpos >= NUM_TX_BUFFER ) @@ -1419,8 +1423,8 @@ FST_WRW ( card, txDescrRing[pi][txp].bcnt, cnv_bcnt ( skb->len )); FST_WRB ( card, txDescrRing[pi][txp].bits, DMA_OWN | TX_STP | TX_ENP ); - port->hdlc.stats.tx_packets++; - port->hdlc.stats.tx_bytes += skb->len; + port->hdlc->stats.tx_packets++; + port->hdlc->stats.tx_bytes += skb->len; dev_kfree_skb ( skb ); @@ -1455,11 +1459,23 @@ */ for ( i = 0 ; i < card->nports ; i++ ) { - card->ports[i].card = card; - card->ports[i].index = i; - card->ports[i].run = 0; + hdlc_device *hdlc; + struct fst_port_info *port; + + hdlc = alloc_hdlc_device(sizeof(*port)); + if (!hdlc) { + printk_err ("Cannot allcoate HDLC device for port %d", i); + card->nports = i; + break; + } - dev = hdlc_to_dev ( &card->ports[i].hdlc ); + card->ports[i] = port = hdlc->dev_data; + port->hdlc = hdlc; + port->card = card; + port->index = i; + port->run = 0; + + dev = hdlc_to_dev ( hdlc ); /* Fill in the net device info */ /* Since this is a PCI setup this is purely @@ -1479,10 +1495,11 @@ dev->do_ioctl = fst_ioctl; dev->watchdog_timeo = FST_TX_TIMEOUT; dev->tx_timeout = fst_tx_timeout; - card->ports[i].hdlc.attach = fst_attach; - card->ports[i].hdlc.xmit = fst_start_xmit; + hdlc->attach = fst_attach; + hdlc->xmit = fst_start_xmit; - if (( err = register_hdlc_device ( &card->ports[i].hdlc )) < 0 ) + err = register_hdlc_device ( hdlc ); + if (err) { printk_err ("Cannot register HDLC device for port %d" " (errno %d)\n", i, -err ); @@ -1494,8 +1511,8 @@ spin_lock_init ( &card->card_lock ); printk ( KERN_INFO "%s-%s: %s IRQ%d, %d ports\n", - hdlc_to_dev(&card->ports[0].hdlc)->name, - hdlc_to_dev(&card->ports[card->nports-1].hdlc)->name, + hdlc_to_dev(card->ports[0]->hdlc)->name, + hdlc_to_dev(card->ports[card->nports-1]->hdlc)->name, type_strings[card->type], card->irq, card->nports ); } @@ -1641,13 +1658,14 @@ fst_remove_one ( struct pci_dev *pdev ) { struct fst_card_info *card; - int i; + int i; card = pci_get_drvdata(pdev); - for ( i = 0 ; i < card->nports ; i++ ) - { - unregister_hdlc_device ( &card->ports[i].hdlc ); + for ( i = 0 ; i < card->nports ; i++ ) { + hdlc_device *hdlc = card->ports[i]->hdlc; + unregister_hdlc_device (hdlc); + free_hdlc_device (hdlc); } fst_disable_intr ( card ); From shemminger@osdl.org Tue Dec 2 14:02:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:02:49 -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 hB2M2YTa002052 for ; Tue, 2 Dec 2003 14:02:35 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M1eZ01475; Tue, 2 Dec 2003 14:01:40 -0800 Date: Tue, 2 Dec 2003 14:02:23 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (6/8) wanxl - hdlc device conversion Message-Id: <20031202140223.636f178d.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1831 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1495 -> 1.1496 # drivers/net/wan/wanxl.c 1.2 -> 1.3 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1496 # Convert from embedded hdlc_device with embedded net_device to # hdlc_device pointer. # Use explicit error unwind goto's to handle early errors in initialization. # C99 initializers. # -------------------------------------------- # diff -Nru a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c --- a/drivers/net/wan/wanxl.c Wed Nov 26 12:37:49 2003 +++ b/drivers/net/wan/wanxl.c Wed Nov 26 12:37:50 2003 @@ -51,7 +51,7 @@ typedef struct { - hdlc_device hdlc; /* HDLC device struct - must be first */ + hdlc_device *hdlc; /* HDLC device struct - must be first */ struct card_t *card; spinlock_t lock; /* for wanxl_xmit */ int node; /* physical port #0 - 3 */ @@ -84,7 +84,7 @@ static inline port_t* hdlc_to_port(hdlc_device *hdlc) { - return (port_t*)hdlc; + return hdlc->dev_data; } @@ -96,13 +96,13 @@ static inline struct net_device *port_to_dev(port_t* port) { - return hdlc_to_dev(&port->hdlc); + return hdlc_to_dev(port->hdlc); } static inline const char* port_name(port_t *port) { - return hdlc_to_name((hdlc_device*)port); + return hdlc_to_name(port->hdlc); } @@ -172,7 +172,7 @@ printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", port_name(port), pm, dte, cable, dsr, dcd); - hdlc_set_carrier(value & STATUS_CABLE_DCD, &port->hdlc); + hdlc_set_carrier(value & STATUS_CABLE_DCD, port->hdlc); } @@ -191,13 +191,13 @@ return; case PACKET_UNDERRUN: - port->hdlc.stats.tx_errors++; - port->hdlc.stats.tx_fifo_errors++; + port->hdlc->stats.tx_errors++; + port->hdlc->stats.tx_fifo_errors++; break; default: - port->hdlc.stats.tx_packets++; - port->hdlc.stats.tx_bytes += skb->len; + port->hdlc->stats.tx_packets++; + port->hdlc->stats.tx_bytes += skb->len; } desc->stat = PACKET_EMPTY; /* Free descriptor */ pci_unmap_single(port->card->pdev, desc->address, skb->len, @@ -224,7 +224,7 @@ " nonexistent port\n", card_name(card->pdev)); else if (!skb) - port->hdlc.stats.rx_dropped++; + port->hdlc->stats.rx_dropped++; else { pci_unmap_single(card->pdev, desc->address, @@ -236,8 +236,8 @@ skb->len); debug_frame(skb); #endif - port->hdlc.stats.rx_packets++; - port->hdlc.stats.rx_bytes += skb->len; + port->hdlc->stats.rx_packets++; + port->hdlc->stats.rx_bytes += skb->len; skb->mac.raw = skb->data; skb->dev = dev; dev->last_rx = jiffies; @@ -530,7 +530,7 @@ -static void wanxl_pci_remove_one(struct pci_dev *pdev) +static void __devexit wanxl_pci_remove_one(struct pci_dev *pdev) { card_t *card = pci_get_drvdata(pdev); int i; @@ -539,9 +539,13 @@ if (card->irq) free_irq(card->irq, card); - for (i = 0; i < 4; i++) - if (card->ports[i]) - unregister_hdlc_device(&card->ports[i]->hdlc); + for (i = 0; i < 4; i++) { + port_t *port = card->ports[i]; + if (port) { + unregister_hdlc_device(port->hdlc); + free_hdlc_device(port->hdlc); + } + } wanxl_reset(card); @@ -577,7 +581,7 @@ u32 plx_phy; /* PLX PCI base address */ u32 mem_phy; /* memory PCI base addr */ u8 *mem; /* memory virtual base addr */ - int i, ports, alloc_size; + int i, err, ports; #ifndef MODULE static int printed_version; @@ -587,9 +591,9 @@ } #endif - i = pci_enable_device(pdev); - if (i) - return i; + err = pci_enable_device(pdev); + if (err) + goto err_1; /* QUICC can only access first 256 MB of host RAM directly, but PLX9060 DMA does 32-bits for actual packet data transfers */ @@ -601,28 +605,28 @@ if (pci_set_consistent_dma_mask(pdev, 0x0FFFFFFF) || pci_set_dma_mask(pdev, 0x0FFFFFFF)) { printk(KERN_ERR "No usable DMA configuration\n"); - return -EIO; + err = -EIO; + goto err_1; } - i = pci_request_regions(pdev, "wanXL"); - if (i) - return i; + err = pci_request_regions(pdev, "wanXL"); + if (err) + goto err_1; switch (pdev->device) { case PCI_DEVICE_ID_SBE_WANXL100: ports = 1; break; case PCI_DEVICE_ID_SBE_WANXL200: ports = 2; break; default: ports = 4; } - - alloc_size = sizeof(card_t) + ports * sizeof(port_t); - card = kmalloc(alloc_size, GFP_KERNEL); + + card = kmalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { printk(KERN_ERR "wanXL %s: unable to allocate memory\n", card_name(pdev)); - pci_release_regions(pdev); - return -ENOBUFS; + err = -ENOBUFS; + goto err_2; } - memset(card, 0, alloc_size); + memset(card, 0, sizeof(card_t)); pci_set_drvdata(pdev, card); card->pdev = pdev; @@ -631,8 +635,8 @@ card->status = pci_alloc_consistent(pdev, sizeof(card_status_t), &card->status_address); if (card->status == NULL) { - wanxl_pci_remove_one(pdev); - return -ENOBUFS; + err = -ENOBUFS; + goto err_3; } #ifdef DEBUG_PCI @@ -647,8 +651,8 @@ if (pci_set_consistent_dma_mask(pdev, 0xFFFFFFFF) || pci_set_dma_mask(pdev, 0xFFFFFFFF)) { printk(KERN_ERR "No usable DMA configuration\n"); - wanxl_pci_remove_one(pdev); - return -EIO; + err = -EIO; + goto err_4; } /* set up PLX mapping */ @@ -660,12 +664,12 @@ #endif timeout = jiffies + 20 * HZ; + err = -ENODEV; while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) { if (time_before(timeout, jiffies)) { printk(KERN_WARNING "wanXL %s: timeout waiting for" " PUTS to complete\n", card_name(pdev)); - wanxl_pci_remove_one(pdev); - return -ENODEV; + goto err_4; } switch(stat & 0xC0) { @@ -676,8 +680,7 @@ default: printk(KERN_WARNING "wanXL %s: PUTS test 0x%X" " failed\n", card_name(pdev), stat & 0x30); - wanxl_pci_remove_one(pdev); - return -ENODEV; + goto err_4; } schedule(); @@ -697,50 +700,61 @@ " (%u bytes detected, %u bytes required)\n", card_name(pdev), ramsize, BUFFERS_ADDR + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports); - wanxl_pci_remove_one(pdev); - return -ENODEV; + goto err_4; } if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) { printk(KERN_WARNING "wanXL %s: unable to Set Byte Swap" " Mode\n", card_name(pdev)); - wanxl_pci_remove_one(pdev); - return -ENODEV; + goto err_4; } for (i = 0; i < ports; i++) { - port_t *port = (void *)card + sizeof(card_t) + - i * sizeof(port_t); - struct net_device *dev = hdlc_to_dev(&port->hdlc); + hdlc_device *hdlc; + port_t *port; + struct net_device *dev; + + hdlc = alloc_hdlc_device(sizeof(*port)); + if (!hdlc) { + err = -ENOBUFS; + goto err_5; + } + + port = hdlc->dev_data; + port->hdlc = hdlc; + dev = hdlc_to_dev(hdlc); + spin_lock_init(&port->lock); SET_MODULE_OWNER(dev); dev->tx_queue_len = 50; dev->do_ioctl = wanxl_ioctl; dev->open = wanxl_open; dev->stop = wanxl_close; - port->hdlc.attach = wanxl_attach; - port->hdlc.xmit = wanxl_xmit; - if(register_hdlc_device(&port->hdlc)) { + dev->get_stats = wanxl_get_stats; + hdlc->attach = wanxl_attach; + hdlc->xmit = wanxl_xmit; + port->card = card; + port->node = i; + + err = register_hdlc_device(hdlc); + if (err) { printk(KERN_ERR "wanXL %s: unable to register hdlc" " device\n", card_name(pdev)); - wanxl_pci_remove_one(pdev); - return -ENOBUFS; + goto err_5; } card->ports[i] = port; - dev->get_stats = wanxl_get_stats; - port->card = card; - port->node = i; get_status(port)->clocking = CLOCK_EXT; } for (i = 0; i < RX_QUEUE_LENGTH; i++) { struct sk_buff *skb = dev_alloc_skb(BUFFER_LENGTH); card->rx_skbs[i] = skb; - if (skb) - card->status->rx_descs[i].address = - pci_map_single(card->pdev, skb->data, - BUFFER_LENGTH, - PCI_DMA_FROMDEVICE); + if (!skb) + goto err_6; + card->status->rx_descs[i].address = + pci_map_single(card->pdev, skb->data, + BUFFER_LENGTH, + PCI_DMA_FROMDEVICE); } mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); @@ -760,8 +774,8 @@ if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) { printk(KERN_WARNING "wanXL %s: unable to Abort and Jump\n", card_name(pdev)); - wanxl_pci_remove_one(pdev); - return -ENODEV; + err = -ENODEV; + goto err_6; } stat = 0; @@ -770,13 +784,13 @@ if ((stat = readl(card->plx + PLX_MAILBOX_5)) != 0) break; schedule(); - }while (time_after(timeout, jiffies)); + } while (time_after(timeout, jiffies)); if (!stat) { printk(KERN_WARNING "wanXL %s: timeout while initializing card" "firmware\n", card_name(pdev)); - wanxl_pci_remove_one(pdev); - return -ENODEV; + err = -ENODEV; + goto err_6; } #if DETECT_RAM @@ -796,12 +810,40 @@ if(request_irq(pdev->irq, wanxl_intr, SA_SHIRQ, "wanXL", card)) { printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", card_name(pdev), pdev->irq); - wanxl_pci_remove_one(pdev); - return -EBUSY; + err = -EBUSY; + goto err_7; } card->irq = pdev->irq; return 0; + + err_7: + wanxl_reset(card); + err_6: + for (i = 0; i < RX_QUEUE_LENGTH; i++) + if (card->rx_skbs[i]) { + pci_unmap_single(card->pdev, + card->status->rx_descs[i].address, + BUFFER_LENGTH, PCI_DMA_FROMDEVICE); + dev_kfree_skb(card->rx_skbs[i]); + } + err_5: + for (i = 0; i < ports; i++) { + port_t *port = card->ports[i]; + if (port) { + unregister_hdlc_device(port->hdlc); + free_hdlc_device(port->hdlc); + } + } + err_4: + pci_free_consistent(pdev, sizeof(card_status_t), + card->status, card->status_address); + err_3: + kfree(card); + err_2: + pci_release_regions(pdev); + err_1: + return err; } static struct pci_device_id wanxl_pci_tbl[] __devinitdata = { @@ -816,10 +858,10 @@ static struct pci_driver wanxl_pci_driver = { - name: "wanXL", - id_table: wanxl_pci_tbl, - probe: wanxl_pci_init_one, - remove: wanxl_pci_remove_one, + .name = "wanXL", + .id_table = wanxl_pci_tbl, + .probe = wanxl_pci_init_one, + .remove = __devexit_p(wanxl_pci_remove_one), }; From shemminger@osdl.org Tue Dec 2 14:02:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:02:55 -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 hB2M2fTa002143 for ; Tue, 2 Dec 2003 14:02:41 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M1hZ01479; Tue, 2 Dec 2003 14:01:43 -0800 Date: Tue, 2 Dec 2003 14:02:26 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (7/8) pc300 hdlc_device conversion Message-Id: <20031202140226.266abaac.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1832 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1496 -> 1.1497 # drivers/net/wan/pc300.h 1.3 -> 1.4 # drivers/net/wan/pc300_drv.c 1.15 -> 1.16 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1497 # Convert for hdlc_device without embedded net_device. # This device was overriding dev->priv to be the pc300 device, this # breaks the hdlc_device interface's assumptions. # Make hdlc_device private pointer be pc300 device and adjust to fix. # -------------------------------------------- # diff -Nru a/drivers/net/wan/pc300.h b/drivers/net/wan/pc300.h --- a/drivers/net/wan/pc300.h Wed Nov 26 12:35:58 2003 +++ b/drivers/net/wan/pc300.h Wed Nov 26 12:35:58 2003 @@ -391,7 +391,7 @@ typedef struct pc300ch { struct pc300 *card; int channel; - pc300dev_t d; + pc300dev_t *d; pc300chconf_t conf; ucchar tx_first_bd; /* First TX DMA block descr. w/ data */ ucchar tx_next_bd; /* Next free TX DMA block descriptor */ diff -Nru a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c --- a/drivers/net/wan/pc300_drv.c Wed Nov 26 12:35:58 2003 +++ b/drivers/net/wan/pc300_drv.c Wed Nov 26 12:35:58 2003 @@ -615,7 +615,7 @@ while (cpc_readb(falcbase + F_REG(SIS, ch)) & SIS_CEC) { if (i++ >= PC300_FALC_MAXLOOP) { printk("%s: FALC command locked(cmd=0x%x).\n", - card->chan[ch].d.name, cmd); + card->chan[ch].d->name, cmd); break; } } @@ -1361,7 +1361,7 @@ pfalc->loss_mfa || pfalc->blue_alarm) { if (pfalc->sync) { pfalc->sync = 0; - chan->d.line_off++; + chan->d->line_off++; cpc_writeb(falcbase + card->hw.cpld_reg2, cpc_readb(falcbase + card->hw.cpld_reg2) & ~(CPLD_REG2_FALC_LED2 << (2 * ch))); @@ -1369,7 +1369,7 @@ } else { if (!pfalc->sync) { pfalc->sync = 1; - chan->d.line_on++; + chan->d->line_on++; cpc_writeb(falcbase + card->hw.cpld_reg2, cpc_readb(falcbase + card->hw.cpld_reg2) | (CPLD_REG2_FALC_LED2 << (2 * ch))); @@ -1771,7 +1771,8 @@ void cpc_tx_timeout(struct net_device *dev) { - pc300dev_t *d = (pc300dev_t *) dev->priv; + hdlc_device *hdlc = dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *) d->chan; pc300_t *card = (pc300_t *) chan->card; struct net_device_stats *stats = &d->hdlc->stats; @@ -1799,7 +1800,8 @@ int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) { - pc300dev_t *d = (pc300dev_t *) dev->priv; + hdlc_device *hdlc = dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *) d->chan; pc300_t *card = (pc300_t *) chan->card; struct net_device_stats *stats = &d->hdlc->stats; @@ -1883,7 +1885,7 @@ void cpc_net_rx(hdlc_device * hdlc) { struct net_device *dev = hdlc_to_dev(hdlc); - pc300dev_t *d = (pc300dev_t *) dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *) d->chan; pc300_t *card = (pc300_t *) chan->card; struct net_device_stats *stats = &d->hdlc->stats; @@ -2016,7 +2018,7 @@ while ((status = cpc_readl(scabase + ISR0)) != 0) { for (ch = 0; ch < card->hw.nchan; ch++) { pc300ch_t *chan = &card->chan[ch]; - pc300dev_t *d = &chan->d; + pc300dev_t *d = chan->d; hdlc_device *hdlc = d->hdlc; struct net_device *dev = hdlc_to_dev(hdlc); @@ -2162,7 +2164,7 @@ netif_carrier_off(dev); #endif - card->chan[ch].d.line_off++; + card->chan[ch].d->line_off++; } else { /* DCD = 1 */ printk ("%s: DCD is ON. Going administrative up.\n", dev->name); @@ -2171,7 +2173,7 @@ /* verify if driver is not TTY */ #endif netif_carrier_on(dev); - card->chan[ch].d.line_on++; + card->chan[ch].d->line_on++; } } } @@ -2536,7 +2538,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { hdlc_device *hdlc = dev_to_hdlc(dev); - pc300dev_t *d = (pc300dev_t *) dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *) d->chan; pc300_t *card = (pc300_t *) chan->card; pc300conf_t conf_aux; @@ -2616,8 +2618,8 @@ memset(&pc300stats, 0, sizeof(pc300stats_t)); pc300stats.hw_type = card->hw.type; - pc300stats.line_on = card->chan[ch].d.line_on; - pc300stats.line_off = card->chan[ch].d.line_off; + pc300stats.line_on = card->chan[ch].d->line_on; + pc300stats.line_off = card->chan[ch].d->line_off; memcpy(&pc300stats.gen_stats, &hdlc->stats, sizeof(struct net_device_stats)); if (card->hw.type == PC300_TE) @@ -2818,7 +2820,8 @@ static struct net_device_stats *cpc_get_stats(struct net_device *dev) { - pc300dev_t *d = (pc300dev_t *) dev->priv; + hdlc_device *hdlc = dev->priv; + pc300dev_t *d = hdlc->dev_data; if (d) return &d->hdlc->stats; @@ -3067,8 +3070,7 @@ static int cpc_attach(hdlc_device * hdlc, unsigned short encoding, unsigned short parity) { - struct net_device * dev = hdlc_to_dev(hdlc); - pc300dev_t *d = (pc300dev_t *)dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *)d->chan; pc300_t *card = (pc300_t *)chan->card; pc300chconf_t *conf = (pc300chconf_t *)&chan->conf; @@ -3145,7 +3147,7 @@ int cpc_open(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); - pc300dev_t *d = (pc300dev_t *) dev->priv; + pc300dev_t *d = hdlc->dev_data; struct ifreq ifr; int result; @@ -3158,9 +3160,6 @@ } result = hdlc_open(hdlc); - if (hdlc->proto.id == IF_PROTO_PPP) { - dev->priv = d; - } if (result) { return result; } @@ -3174,7 +3173,7 @@ int cpc_close(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); - pc300dev_t *d = (pc300dev_t *) dev->priv; + pc300dev_t *d = hdlc->dev_data; pc300ch_t *chan = (pc300ch_t *) d->chan; pc300_t *card = (pc300_t *) chan->card; uclong flags; @@ -3316,10 +3315,17 @@ for (i = 0; i < card->hw.nchan; i++) { pc300ch_t *chan = &card->chan[i]; - pc300dev_t *d = &chan->d; + pc300dev_t *d; hdlc_device *hdlc; struct net_device *dev; + hdlc = alloc_hdlc_device(sizeof(*d)); + if (hdlc == NULL) + continue; + d = hdlc->dev_data; + d->hdlc = hdlc; + dev = hdlc_to_dev(hdlc); + chan->card = card; chan->channel = i; chan->conf.phys_settings.clock_rate = 0; @@ -3358,12 +3364,6 @@ d->line_on = 0; d->line_off = 0; - d->hdlc = (hdlc_device *) kmalloc(sizeof(hdlc_device), GFP_KERNEL); - if (d->hdlc == NULL) - continue; - memset(d->hdlc, 0, sizeof(hdlc_device)); - - hdlc = d->hdlc; hdlc->xmit = cpc_queue_xmit; hdlc->attach = cpc_attach; @@ -3387,7 +3387,6 @@ dev->do_ioctl = cpc_ioctl; if (register_hdlc_device(hdlc) == 0) { - dev->priv = d; /* We need 'priv', hdlc doesn't */ printk("%s: Cyclades-PC300/", dev->name); switch (card->hw.type) { case PC300_TE: @@ -3647,7 +3646,9 @@ cpc_readw(card->hw.plxbase + card->hw.intctl_reg) & ~(0x0040)); for (i = 0; i < card->hw.nchan; i++) { - unregister_hdlc_device(card->chan[i].d.hdlc); + hdlc_device *hdlc = card->chan[i].d->hdlc; + unregister_hdlc_device(hdlc); + free_hdlc_device(hdlc); } iounmap((void *) card->hw.plxbase); iounmap((void *) card->hw.scabase); From shemminger@osdl.org Tue Dec 2 14:02:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:03:04 -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 hB2M2lTa002210 for ; Tue, 2 Dec 2003 14:02:47 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M1kZ01498; Tue, 2 Dec 2003 14:01:46 -0800 Date: Tue, 2 Dec 2003 14:00:43 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (8/8) pc300_tty cleanup. Message-Id: <20031202140043.4da79ac3.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1833 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1500 -> 1.1501 # drivers/net/wan/pc300_tty.c 1.14 -> 1.15 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/12/01 shemminger@osdl.org 1.1501 # * make local variables static # * initialize tty_driver struct at compile time # * don't expect net_device to be first in pc300 struct # * don't depend on name being hdlcX # -------------------------------------------- # diff -Nru a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c --- a/drivers/net/wan/pc300_tty.c Tue Dec 2 13:55:55 2003 +++ b/drivers/net/wan/pc300_tty.c Tue Dec 2 13:55:55 2003 @@ -102,20 +102,17 @@ volatile struct st_cpc_rx_list buf_rx; /* ptr. to reception buffer */ unsigned char* buf_tx; /* ptr. to transmission buffer */ pc300dev_t* pc300dev; /* ptr. to info struct in PC300 driver */ - unsigned char name[20]; /* interf. name + "-tty" */ + unsigned char name[IFNAMSIZ+6]; /* interf. name + "-tty" */ struct tty_struct *tty; struct work_struct tty_tx_work; /* tx work - tx interrupt */ struct work_struct tty_rx_work; /* rx work - rx interrupt */ } st_cpc_tty_area; -/* TTY data structures */ -static struct tty_driver serial_drv; - /* local variables */ -st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; +static st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; -int cpc_tty_cnt=0; /* number of intrfaces configured with MLPPP */ -int cpc_tty_unreg_flag = 0; +static int cpc_tty_cnt=0; /* number of intrfaces configured with MLPPP */ +static int cpc_tty_unreg_flag = 0; /* TTY functions prototype */ static int cpc_tty_open(struct tty_struct *tty, struct file *flip); @@ -152,8 +149,8 @@ int ch = pc300chan->channel; unsigned long flags; - CPC_TTY_DBG("%s-tty: Clear signal DTR\n", - ((struct net_device*)(pc300dev->hdlc))->name); + CPC_TTY_DBG("%s-tty: Clear signal DTR\n", + pc300dev->hdlc->netdev->name); CPC_TTY_LOCK(card, flags); cpc_writeb(card->hw.scabase + M_REG(CTL,ch), cpc_readb(card->hw.scabase+M_REG(CTL,ch))& CTL_DTR); @@ -171,13 +168,34 @@ unsigned long flags; CPC_TTY_DBG("%s-tty: Set signal DTR\n", - ((struct net_device*)(pc300dev->hdlc))->name); + pc300dev->hdlc->netdev->name); CPC_TTY_LOCK(card, flags); cpc_writeb(card->hw.scabase + M_REG(CTL,ch), cpc_readb(card->hw.scabase+M_REG(CTL,ch))& ~CTL_DTR); CPC_TTY_UNLOCK(card,flags); } +static struct tty_driver serial_drv = { + .magic = TTY_DRIVER_MAGIC, + .owner = THIS_MODULE, + .driver_name = "pc300_tty", + .name = "ttyCP", + .major = CPC_TTY_MAJOR, + .minor_start = CPC_TTY_MINOR_START, + .num = CPC_TTY_NPORTS, + .type = TTY_DRIVER_TYPE_SERIAL, + .subtype = SERIAL_TYPE_NORMAL, + .flags = TTY_DRIVER_REAL_RAW, + .open = cpc_tty_open, + .close = cpc_tty_close, + .write = cpc_tty_write, + .write_room = cpc_tty_write_room, + .chars_in_buffer = cpc_tty_chars_in_buffer, + .ioctl = cpc_tty_ioctl, + .flush_buffer = cpc_tty_flush_buffer, + .hangup = cpc_tty_hangup, +}; + /* * PC300 TTY initialization routine * @@ -190,48 +208,26 @@ */ void cpc_tty_init(pc300dev_t *pc300dev) { - int port, aux; + struct net_device *dev = pc300dev->hdlc->netdev; + unsigned port; st_cpc_tty_area * cpc_tty; /* hdlcX - X=interface number */ - port = ((struct net_device*)(pc300dev->hdlc))->name[4] - '0'; - if (port >= CPC_TTY_NPORTS) { + if (sscanf(dev->name, "hdlc%u", &port) != 1 + || port >= CPC_TTY_NPORTS) { printk("%s-tty: invalid interface selected (0-%i): %i", - ((struct net_device*)(pc300dev->hdlc))->name, - CPC_TTY_NPORTS-1,port); + dev->name, CPC_TTY_NPORTS-1,port); return; } if (cpc_tty_cnt == 0) { /* first TTY connection -> register driver */ CPC_TTY_DBG("%s-tty: driver init, major:%i, minor range:%i=%i\n", - ((struct net_device*)(pc300dev->hdlc))->name, - CPC_TTY_MAJOR, CPC_TTY_MINOR_START, - CPC_TTY_MINOR_START+CPC_TTY_NPORTS); - /* initialize tty driver struct */ - memset(&serial_drv,0,sizeof(struct tty_driver)); - serial_drv.magic = TTY_DRIVER_MAGIC; - serial_drv.owner = THIS_MODULE; - serial_drv.driver_name = "pc300_tty"; - serial_drv.name = "ttyCP"; - serial_drv.major = CPC_TTY_MAJOR; - serial_drv.minor_start = CPC_TTY_MINOR_START; - serial_drv.num = CPC_TTY_NPORTS; - serial_drv.type = TTY_DRIVER_TYPE_SERIAL; - serial_drv.subtype = SERIAL_TYPE_NORMAL; + dev->name, + CPC_TTY_MAJOR, CPC_TTY_MINOR_START, + CPC_TTY_MINOR_START+CPC_TTY_NPORTS); serial_drv.init_termios = tty_std_termios; serial_drv.init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; - serial_drv.flags = TTY_DRIVER_REAL_RAW; - - /* interface routines from the upper tty layer to the tty driver */ - serial_drv.open = cpc_tty_open; - serial_drv.close = cpc_tty_close; - serial_drv.write = cpc_tty_write; - serial_drv.write_room = cpc_tty_write_room; - serial_drv.chars_in_buffer = cpc_tty_chars_in_buffer; - serial_drv.ioctl = cpc_tty_ioctl; - serial_drv.flush_buffer = cpc_tty_flush_buffer; - serial_drv.hangup = cpc_tty_hangup; /* register the TTY driver */ if (tty_register_driver(&serial_drv)) { @@ -241,7 +237,7 @@ } memset((void *)cpc_tty_area, 0, - sizeof(st_cpc_tty_area) * CPC_TTY_NPORTS); + sizeof(st_cpc_tty_area) * CPC_TTY_NPORTS); } cpc_tty = &cpc_tty_area[port]; @@ -265,11 +261,8 @@ pc300dev->cpc_tty = (void *)cpc_tty; - aux = strlen(((struct net_device*)(pc300dev->hdlc))->name); - memcpy(cpc_tty->name,((struct net_device*)(pc300dev->hdlc))->name,aux); - memcpy(&cpc_tty->name[aux], "-tty", 5); - - cpc_open((struct net_device *)pc300dev->hdlc); + snprintf(cpc_tty->name, sizeof(cpc_tty->name)-1, "%s-tty", dev->name); + cpc_open(pc300dev->hdlc->netdev); cpc_tty_dtr_off(pc300dev); CPC_TTY_DBG("%s: Initializing TTY Sync Driver, tty major#%d minor#%i\n", @@ -997,22 +990,23 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx) { struct sk_buff *skb; + struct net_device *netdev = dev->hdlc->netdev; if ((skb = dev_alloc_skb(10 + len)) == NULL) { /* out of memory */ CPC_TTY_DBG("%s: tty_trace - out of memory\n", - ((struct net_device *)(dev->hdlc))->name); + netdev->name); return; } skb_put (skb, 10 + len); - skb->dev = (struct net_device *) dev->hdlc; + skb->dev = netdev; skb->protocol = htons(ETH_P_CUST); skb->mac.raw = skb->data; skb->pkt_type = PACKET_HOST; skb->len = 10 + len; - memcpy(skb->data,((struct net_device *)(dev->hdlc))->name,5); + memcpy(skb->data,netdev->name,5); skb->data[5] = '['; skb->data[6] = rxtx; skb->data[7] = ']'; @@ -1035,14 +1029,14 @@ if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == 0) { CPC_TTY_DBG("%s: interface is not TTY\n", - ((struct net_device *)(pc300dev->hdlc))->name); + pc300dev->hdlc->netdev->name); return; } CPC_TTY_DBG("%s: cpc_tty_unregister_service", cpc_tty->name); if (cpc_tty->pc300dev != pc300dev) { CPC_TTY_DBG("%s: invalid tty ptr=%s\n", - ((struct net_device *)(pc300dev->hdlc))->name, cpc_tty->name); + pc300dev->hdlc->netdev->name, cpc_tty->name); return; } @@ -1091,8 +1085,7 @@ int i ; CPC_TTY_DBG("hdlcX-tty: reset variables\n"); - /* reset the tty_driver structure - serial_drv */ - memset(&serial_drv, 0, sizeof(struct tty_driver)); + for (i=0; i < CPC_TTY_NPORTS; i++){ memset(&cpc_tty_area[i],0, sizeof(st_cpc_tty_area)); } From shemminger@osdl.org Tue Dec 2 14:02:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:03:07 -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 hB2M2qTa002276 for ; Tue, 2 Dec 2003 14:02:52 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M1kZ01494; Tue, 2 Dec 2003 14:01:46 -0800 Date: Tue, 2 Dec 2003 13:58:46 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (4//8) dscc4 convert to new hdlc_device Message-Id: <20031202135846.28a93010.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1834 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1493 -> 1.1494 # drivers/net/wan/dscc4.c 1.51 -> 1.52 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1494 # Convert to work with hdlc_device that is not embedded. # Use list macros for list of ports on card. # -------------------------------------------- # diff -Nru a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c --- a/drivers/net/wan/dscc4.c Wed Nov 26 12:30:13 2003 +++ b/drivers/net/wan/dscc4.c Wed Nov 26 12:30:13 2003 @@ -185,12 +185,14 @@ spinlock_t lock; struct pci_dev *pdev; - struct dscc4_dev_priv *root; + struct list_head devs; dma_addr_t iqcfg_dma; u32 xtal_hz; }; struct dscc4_dev_priv { + struct list_head dev_list; + struct sk_buff *rx_skbuff[RX_RING_SIZE]; struct sk_buff *tx_skbuff[TX_RING_SIZE]; @@ -228,7 +230,7 @@ unsigned short encoding; unsigned short parity; - hdlc_device hdlc; + hdlc_device *hdlc; sync_serial_settings settings; u32 __pad __attribute__ ((aligned (4))); }; @@ -371,9 +373,17 @@ static int dscc4_tx_poll(struct dscc4_dev_priv *, struct net_device *); #endif +static inline struct dscc4_dev_priv *dscc4_root_priv(struct dscc4_pci_priv *ppriv) +{ + struct list_head *first = ppriv->devs.next; + + return (first == &ppriv->devs) ? NULL + : list_entry(first, struct dscc4_dev_priv, dev_list); +} + static inline struct dscc4_dev_priv *dscc4_priv(struct net_device *dev) { - return list_entry(dev, struct dscc4_dev_priv, hdlc.netdev); + return dev_to_hdlc(dev)->dev_data; } static void scc_patchl(u32 mask, u32 value, struct dscc4_dev_priv *dpriv, @@ -636,7 +646,7 @@ struct net_device *dev) { struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE; - struct net_device_stats *stats = &dpriv->hdlc.stats; + struct net_device_stats *stats = &dpriv->hdlc->stats; struct pci_dev *pdev = dpriv->pci_priv->pdev; struct sk_buff *skb; int pkt_len; @@ -681,19 +691,16 @@ static void dscc4_free1(struct pci_dev *pdev) { - struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; - int i; + struct dscc4_pci_priv *ppriv = pci_get_drvdata(pdev); + struct dscc4_dev_priv *dpriv, *dnext; - ppriv = pci_get_drvdata(pdev); - root = ppriv->root; - - for (i = 0; i < dev_per_card; i++) - unregister_hdlc_device(&root[i].hdlc); + list_for_each_entry_safe(dpriv, dnext, &ppriv->devs, dev_list) { + unregister_hdlc_device(dpriv->hdlc); + free_hdlc_device(dpriv->hdlc); + } pci_set_drvdata(pdev, NULL); - kfree(root); kfree(ppriv); } @@ -704,7 +711,6 @@ struct dscc4_dev_priv *dpriv; static int cards_found = 0; unsigned long ioaddr; - int i; printk(KERN_DEBUG "%s", version); @@ -743,7 +749,8 @@ priv = (struct dscc4_pci_priv *)pci_get_drvdata(pdev); - if (request_irq(pdev->irq, &dscc4_irq, SA_SHIRQ, DRV_NAME, priv->root)){ + if (request_irq(pdev->irq, &dscc4_irq, SA_SHIRQ, DRV_NAME, + dscc4_root_priv(priv))) { printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq); goto err_out_free1; } @@ -772,21 +779,19 @@ * SCC 0-3 private rx/tx irq structures * IQRX/TXi needs to be set soon. Learned it the hard way... */ - for (i = 0; i < dev_per_card; i++) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); if (!dpriv->iqtx) goto err_out_free_iqtx; - writel(dpriv->iqtx_dma, ioaddr + IQTX0 + i*4); + writel(dpriv->iqtx_dma, ioaddr + IQTX0 + dpriv->dev_id*4); } - for (i = 0; i < dev_per_card; i++) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); if (!dpriv->iqrx) goto err_out_free_iqrx; - writel(dpriv->iqrx_dma, ioaddr + IQRX0 + i*4); + writel(dpriv->iqrx_dma, ioaddr + IQRX0 + dpriv->dev_id*4); } /* Cf application hint. Beware of hard-lock condition on threshold. */ @@ -804,22 +809,19 @@ return 0; err_out_free_iqrx: - while (--i >= 0) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqrx, dpriv->iqrx_dma); } - i = dev_per_card; err_out_free_iqtx: - while (--i >= 0) { - dpriv = priv->root + i; + list_for_each_entry(dpriv, &priv->devs, dev_list) { pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqtx, dpriv->iqtx_dma); } pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), priv->iqcfg, priv->iqcfg_dma); err_out_free_irq: - free_irq(pdev->irq, priv->root); + free_irq(pdev->irq, dscc4_root_priv(priv)); err_out_free1: dscc4_free1(pdev); err_out_iounmap: @@ -863,29 +865,27 @@ static int dscc4_found1(struct pci_dev *pdev, unsigned long ioaddr) { struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; + struct dscc4_dev_priv *dpriv, *dnext; int i, ret = -ENOMEM; - root = (struct dscc4_dev_priv *) - kmalloc(dev_per_card*sizeof(*root), GFP_KERNEL); - if (!root) { - printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); - goto err_out; - } - memset(root, 0, dev_per_card*sizeof(*root)); - ppriv = (struct dscc4_pci_priv *) kmalloc(sizeof(*ppriv), GFP_KERNEL); if (!ppriv) { printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); - goto err_free_dev; + goto err_out; } memset(ppriv, 0, sizeof(struct dscc4_pci_priv)); + INIT_LIST_HEAD(&ppriv->devs); for (i = 0; i < dev_per_card; i++) { - struct dscc4_dev_priv *dpriv = root + i; - hdlc_device *hdlc = &dpriv->hdlc; - struct net_device *d = hdlc_to_dev(hdlc); + hdlc_device *hdlc = alloc_hdlc_device(sizeof(*dpriv)); + struct net_device *d; + + if (!hdlc) { + ret = -ENOMEM; + goto err_unregister; + } + d = hdlc_to_dev(hdlc); d->base_addr = ioaddr; d->init = NULL; d->irq = pdev->irq; @@ -898,6 +898,8 @@ SET_MODULE_OWNER(d); SET_NETDEV_DEV(d, &pdev->dev); + dpriv = dscc4_priv(d); + dpriv->hdlc = hdlc; dpriv->dev_id = i; dpriv->pci_priv = ppriv; spin_lock_init(&dpriv->lock); @@ -920,23 +922,25 @@ unregister_hdlc_device(hdlc); goto err_unregister; } + list_add_tail(&dpriv->dev_list, &ppriv->devs); } - ret = dscc4_set_quartz(root, quartz); + + + ret = dscc4_set_quartz(dscc4_root_priv(ppriv), quartz); if (ret < 0) goto err_unregister; - ppriv->root = root; + spin_lock_init(&ppriv->lock); pci_set_drvdata(pdev, ppriv); return ret; err_unregister: - while (--i >= 0) { - dscc4_release_ring(root + i); - unregister_hdlc_device(&root[i].hdlc); + list_for_each_entry_safe(dpriv, dnext, &ppriv->devs, dev_list) { + dscc4_release_ring(dpriv); + unregister_hdlc_device(dpriv->hdlc); + free_hdlc_device(dpriv->hdlc); } kfree(ppriv); -err_free_dev: - kfree(root); err_out: return ret; }; @@ -964,7 +968,7 @@ sync_serial_settings *settings = &dpriv->settings; if (settings->loopback && (settings->clock_type != CLOCK_INT)) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); printk(KERN_INFO "%s: loopback requires clock\n", dev->name); return -1; @@ -1015,7 +1019,7 @@ static int dscc4_open(struct net_device *dev) { struct dscc4_dev_priv *dpriv = dscc4_priv(dev); - hdlc_device *hdlc = &dpriv->hdlc; + hdlc_device *hdlc = dpriv->hdlc; struct dscc4_pci_priv *ppriv; int ret = -EAGAIN; @@ -1467,7 +1471,7 @@ int i, handled = 1; priv = root->pci_priv; - dev = hdlc_to_dev(&root->hdlc); + dev = hdlc_to_dev(root->hdlc); spin_lock_irqsave(&priv->lock, flags); @@ -1518,7 +1522,7 @@ static inline void dscc4_tx_irq(struct dscc4_pci_priv *ppriv, struct dscc4_dev_priv *dpriv) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); u32 state; int cur, loop = 0; @@ -1549,7 +1553,7 @@ if (state & SccEvt) { if (state & Alls) { - struct net_device_stats *stats = &dpriv->hdlc.stats; + struct net_device_stats *stats = &dpriv->hdlc->stats; struct sk_buff *skb; struct TxFD *tx_fd; @@ -1687,7 +1691,7 @@ static inline void dscc4_rx_irq(struct dscc4_pci_priv *priv, struct dscc4_dev_priv *dpriv) { - struct net_device *dev = hdlc_to_dev(&dpriv->hdlc); + struct net_device *dev = hdlc_to_dev(dpriv->hdlc); u32 state; int cur; @@ -1954,23 +1958,21 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev) { struct dscc4_pci_priv *ppriv; - struct dscc4_dev_priv *root; + struct dscc4_dev_priv *root, *dpriv; unsigned long ioaddr; - int i; ppriv = pci_get_drvdata(pdev); - root = ppriv->root; + root = dscc4_root_priv(ppriv); - ioaddr = hdlc_to_dev(&root->hdlc)->base_addr; + ioaddr = hdlc_to_dev(root->hdlc)->base_addr; dscc4_pci_reset(pdev, ioaddr); free_irq(pdev->irq, root); pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), ppriv->iqcfg, ppriv->iqcfg_dma); - for (i = 0; i < dev_per_card; i++) { - struct dscc4_dev_priv *dpriv = root + i; + list_for_each_entry(dpriv, &ppriv->devs, dev_list) { dscc4_release_ring(dpriv); pci_free_consistent(pdev, IRQ_RING_SIZE*sizeof(u32), dpriv->iqrx, dpriv->iqrx_dma); From shemminger@osdl.org Tue Dec 2 14:06:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:06:50 -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 hB2M6bTa004599 for ; Tue, 2 Dec 2003 14:06:37 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2M0PZ01334; Tue, 2 Dec 2003 14:00:25 -0800 Date: Tue, 2 Dec 2003 14:01:08 -0800 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (2/8) hdlc_fr - use alloc_ether/netdev Message-Id: <20031202140108.24c1dd6b.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1835 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev The HDLC frame relay device use's kmalloc directly to create the network device. This patch switches to alloc_netdev/alloc_etherdev as necessary. # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1499 -> 1.1500 # drivers/net/wan/hdlc_fr.c 1.10 -> 1.11 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/12/01 shemminger@osdl.org 1.1500 # Make PVC net_devices use alloc_netdev # -------------------------------------------- # diff -Nru a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c --- a/drivers/net/wan/hdlc_fr.c Mon Dec 1 13:53:42 2003 +++ b/drivers/net/wan/hdlc_fr.c Mon Dec 1 13:53:42 2003 @@ -986,7 +986,13 @@ } } - +static void fr_dlci_setup(struct net_device *dev) +{ + dev->type = ARPHRD_DLCI; + dev->flags = IFF_POINTOPOINT; + dev->hard_header_len = 10; + dev->addr_len = 2; +} static int fr_add_pvc(hdlc_device *hdlc, unsigned int dlci, int type) { @@ -1009,26 +1015,26 @@ used = pvc_is_used(pvc); - dev = kmalloc(sizeof(struct net_device) + - sizeof(struct net_device_stats), GFP_KERNEL); + if (type == ARPHRD_ETHER) { + dev = alloc_etherdev(sizeof(struct net_device_stats)); + prefix = "pvceth%d" ; + } else { + dev = alloc_netdev(sizeof(struct net_device_stats), + "pvc", fr_dlci_setup); + prefix = "pvc%d"; + } + if (!dev) { printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", hdlc_to_name(hdlc)); delete_unused_pvcs(hdlc); return -ENOBUFS; } - memset(dev, 0, sizeof(struct net_device) + - sizeof(struct net_device_stats)); if (type == ARPHRD_ETHER) { - ether_setup(dev); memcpy(dev->dev_addr, "\x00\x01", 2); get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2); } else { - dev->type = ARPHRD_DLCI; - dev->flags = IFF_POINTOPOINT; - dev->hard_header_len = 10; - dev->addr_len = 2; *(u16*)dev->dev_addr = htons(dlci); dlci_to_q922(dev->broadcast, dlci); } @@ -1044,13 +1050,13 @@ result = dev_alloc_name(dev, prefix); if (result < 0) { - kfree(dev); + free_netdev(dev); delete_unused_pvcs(hdlc); return result; } if (register_netdevice(dev) != 0) { - kfree(dev); + free_netdev(dev); delete_unused_pvcs(hdlc); return -EIO; } From samo.pogacnik@s5.net Tue Dec 2 14:25:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:25:19 -0800 (PST) Received: from ikar.perftech.si (ikar.perftech.si [195.246.0.20]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2MP0Ta005412 for ; Tue, 2 Dec 2003 14:25:01 -0800 Message-Id: <200312022225.hB2MP0Ta005412@oss.sgi.com> Received: from there ([195.246.28.105]) by ikar.perftech.si (IKAR [127.0.0.1]) (MDaemon.PRO.v6.8.5.R) with ESMTP id 27-md50000000093.tmp for ; Tue, 02 Dec 2003 22:59:01 +0100 Content-Type: text/plain; charset="iso-8859-2" From: Samo Pogacnik To: netdev@oss.sgi.com Subject: network interface groups Date: Tue, 2 Dec 2003 22:43:42 +0100 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Processed: IKAR, Tue, 02 Dec 2003 22:59:01 +0100 (not processed: message size (17774) exceeds max size (15360)) X-MDRemoteIP: 195.246.28.105 X-Return-Path: samo.pogacnik@s5.net X-MDaemon-Deliver-To: netdev@oss.sgi.com X-archive-position: 1836 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: samo.pogacnik@s5.net Precedence: bulk X-list: netdev hi, i made a small modification of the linux networking code, that might be interesting to someone. So here is the description of what i did and a linux patch at the end of the description. The following URL: http://friends.s5.net/pogacnik/net_if_grp.html leeds to linux (2.4.18 and 2.6.0-test11) and ifconfig patches. ---------------------------------------------------------------------- Network interface groups 1. Introduction Provided modification gives you the possibility to assign a set of group numbers between 0 and 31 to each network interface in the system and to configure your networking services to be accessible on those groups of interfaces, as you like. The linux patch implements this functionality (IPv4 only), while the net-tools (ifconfig) patch adds the ability to manage group numbers of each network interface. 2. How this works or How I think that this works? This code extends the ability of a socket to accept packets on ANY of your network interfaces into the ability to accept packets on a selected group of network interfaces. The goal was achived in a way, that an interface group mask number has been added to the net_device structure and another one to the inet_opt structure. When the received packet looks for its socket, the group mask of the associated network interface has to match the socket's group mask at least in one bit. This way a bind system call with the desired interface group number as its parameter (instead of an IP or INADDR_ANY), selects a group of interfaces that may provide packets on this socket. By default all network interfaces belong only to group 0, as well as all sockets initialise its group mask to group 0. You may change group mask of network interfaces while network services are running, using the patched ifconfig tool. For example, the result of changing the group mask number of an interface may be, that a network service stops accepting connections via this interface, while the existing connections remain operational until they are closed. The same way a network service may start accepting connections via the desired interface. The good thing about this solution is, that the default behaviour of this extension should not make any significant difference (correct me if i'm wrong), because all network interfaces fall into group zero by default. 3. What is it good for? Separating network services, moving services between interfaces, better security, ....??? 4. To think about Can we use this aproach on IPv6? Do we need more than 32 groups? 5. Note: To be able to build the patched ifconfig tool, you have to synchronise changes of linux headers if.h and sockios.h with coresponding libc headers (net/if.h and bits/ioctls.h - on my system) and correctly set the Linux headers path. Comments appreciated:) Samo samo.pogacnik@s5.net -------------------------------------------------------------------------- diff -Nur linux-2.6.0-test11/include/linux/if.h linux-2.6.0-test11-ifgrp/include/linux/if.h --- linux-2.6.0-test11/include/linux/if.h Wed Nov 26 21:43:51 2003 +++ linux-2.6.0-test11-ifgrp/include/linux/if.h Tue Dec 2 19:58:09 2003 @@ -141,6 +141,7 @@ short ifru_flags; int ifru_ivalue; int ifru_mtu; + unsigned int ifru_group; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; @@ -158,6 +159,7 @@ #define ifr_flags ifr_ifru.ifru_flags /* flags */ #define ifr_metric ifr_ifru.ifru_ivalue /* metric */ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_group ifr_ifru.ifru_group /* device group */ #define ifr_map ifr_ifru.ifru_map /* device map */ #define ifr_slave ifr_ifru.ifru_slave /* slave device */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */ diff -Nur linux-2.6.0-test11/include/linux/ip.h linux-2.6.0-test11-ifgrp/include/linux/ip.h --- linux-2.6.0-test11/include/linux/ip.h Wed Nov 26 21:43:28 2003 +++ linux-2.6.0-test11-ifgrp/include/linux/ip.h Tue Dec 2 20:17:23 2003 @@ -144,6 +144,7 @@ u32 addr; struct flowi fl; } cork; + __u32 if_group; /* Bound network interface group mask */ }; #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ diff -Nur linux-2.6.0-test11/include/linux/netdevice.h linux-2.6.0-test11-ifgrp/include/linux/netdevice.h --- linux-2.6.0-test11/include/linux/netdevice.h Wed Nov 26 21:45:38 2003 +++ linux-2.6.0-test11-ifgrp/include/linux/netdevice.h Tue Dec 2 19:59:42 2003 @@ -295,6 +295,10 @@ int ifindex; int iflink; + /* The 'ifgroup' field adds support for binding services to a group + * of interfaces. + */ + unsigned int ifgroup; struct net_device_stats* (*get_stats)(struct net_device *dev); struct iw_statistics* (*get_wireless_stats)(struct net_device *dev); diff -Nur linux-2.6.0-test11/include/linux/sockios.h linux-2.6.0-test11-ifgrp/include/linux/sockios.h --- linux-2.6.0-test11/include/linux/sockios.h Wed Nov 26 21:42:50 2003 +++ linux-2.6.0-test11-ifgrp/include/linux/sockios.h Tue Dec 2 20:07:01 2003 @@ -116,6 +116,12 @@ #define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ #define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ +/* Interface group configuration calls */ + +#define SIOCGIFGROUP 0x89A0 /* Get device group numbers */ +#define SIOCAIFGROUP 0x89A1 /* Add device group number */ +#define SIOCRIFGROUP 0x89A2 /* Remove device group number */ + /* Device private ioctl calls */ /* diff -Nur linux-2.6.0-test11/include/net/raw.h linux-2.6.0-test11-ifgrp/include/net/raw.h --- linux-2.6.0-test11/include/net/raw.h Wed Nov 26 21:45:37 2003 +++ linux-2.6.0-test11-ifgrp/include/net/raw.h Tue Dec 2 20:08:34 2003 @@ -35,7 +35,7 @@ extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, unsigned long raddr, unsigned long laddr, - int dif); + int dif, u32 grp); extern void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); diff -Nur linux-2.6.0-test11/include/net/tcp.h linux-2.6.0-test11-ifgrp/include/net/tcp.h --- linux-2.6.0-test11/include/net/tcp.h Wed Nov 26 21:43:05 2003 +++ linux-2.6.0-test11-ifgrp/include/net/tcp.h Tue Dec 2 20:18:06 2003 @@ -161,7 +161,7 @@ extern void tcp_bucket_destroy(struct tcp_bind_bucket *tb); extern void tcp_bucket_unlock(struct sock *sk); extern int tcp_port_rover; -extern struct sock *tcp_v4_lookup_listener(u32 addr, unsigned short hnum, int dif); +extern struct sock *tcp_v4_lookup_listener(u32 addr, unsigned short hnum, int dif, u32 grp); /* These are AF independent. */ static __inline__ int tcp_bhashfn(__u16 lport) diff -Nur linux-2.6.0-test11/net/core/dev.c linux-2.6.0-test11-ifgrp/net/core/dev.c --- linux-2.6.0-test11/net/core/dev.c Wed Nov 26 21:44:11 2003 +++ linux-2.6.0-test11-ifgrp/net/core/dev.c Tue Dec 2 20:32:10 2003 @@ -2340,6 +2340,22 @@ dev->tx_queue_len = ifr->ifr_qlen; return 0; + case SIOCGIFGROUP: + ifr->ifr_group = dev->ifgroup; + return 0; + + case SIOCAIFGROUP: + if (ifr->ifr_group > 31) + return -EINVAL; + dev->ifgroup |= (1 << ifr->ifr_group); + return 0; + + case SIOCRIFGROUP: + if (ifr->ifr_group > 31) + return -EINVAL; + dev->ifgroup &= ~(1 << ifr->ifr_group); + return 0; + case SIOCSIFNAME: if (dev->flags & IFF_UP) return -EBUSY; @@ -2452,6 +2468,7 @@ case SIOCGIFMAP: case SIOCGIFINDEX: case SIOCGIFTXQLEN: + case SIOCGIFGROUP: dev_load(ifr.ifr_name); read_lock(&dev_base_lock); ret = dev_ifsioc(&ifr, cmd); @@ -2518,6 +2535,8 @@ case SIOCDELMULTI: case SIOCSIFHWBROADCAST: case SIOCSIFTXQLEN: + case SIOCAIFGROUP: + case SIOCRIFGROUP: case SIOCSIFNAME: case SIOCSMIIREG: case SIOCBONDENSLAVE: @@ -2658,6 +2677,7 @@ goto out; dev->iflink = -1; + dev->ifgroup = 1; /* Init, if this function is available */ if (dev->init) { diff -Nur linux-2.6.0-test11/net/ipv4/af_inet.c linux-2.6.0-test11-ifgrp/net/ipv4/af_inet.c --- linux-2.6.0-test11/net/ipv4/af_inet.c Wed Nov 26 21:43:06 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/af_inet.c Tue Dec 2 20:47:02 2003 @@ -403,6 +403,7 @@ inet->mc_ttl = 1; inet->mc_index = 0; inet->mc_list = NULL; + inet->if_group = 1; #ifdef INET_REFCNT_DEBUG atomic_inc(&inet_sock_nr); @@ -476,6 +477,7 @@ unsigned short snum; int chk_addr_ret; int err; + __u32 grp; /* If the socket has its own bind function then use it. (RAW) */ if (sk->sk_prot->bind) { @@ -527,12 +529,17 @@ if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) inet->saddr = 0; /* Use device */ + inet->if_group = 1; /* Make sure we are allowed to bind here. */ if (sk->sk_prot->get_port(sk, snum)) { inet->saddr = inet->rcv_saddr = 0; err = -EADDRINUSE; goto out_release_sock; } + + grp = ntohl(inet->rcv_saddr); + if (grp < 32) + inet->if_group = 1 << grp; if (inet->rcv_saddr) sk->sk_userlocks |= SOCK_BINDADDR_LOCK; diff -Nur linux-2.6.0-test11/net/ipv4/icmp.c linux-2.6.0-test11-ifgrp/net/ipv4/icmp.c --- linux-2.6.0-test11/net/ipv4/icmp.c Wed Nov 26 21:45:38 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/icmp.c Tue Dec 2 20:49:24 2003 @@ -696,7 +696,7 @@ if ((raw_sk = sk_head(&raw_v4_htable[hash])) != NULL) { while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr, iph->saddr, - skb->dev->ifindex)) != NULL) { + skb->dev->ifindex, skb->dev->ifgroup)) != NULL) { raw_err(raw_sk, skb, info); raw_sk = sk_next(raw_sk); iph = (struct iphdr *)skb->data; diff -Nur linux-2.6.0-test11/net/ipv4/raw.c linux-2.6.0-test11-ifgrp/net/ipv4/raw.c --- linux-2.6.0-test11/net/ipv4/raw.c Wed Nov 26 21:44:20 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/raw.c Tue Dec 2 20:55:16 2003 @@ -104,7 +104,7 @@ struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, unsigned long raddr, unsigned long laddr, - int dif) + int dif, u32 grp) { struct hlist_node *node; @@ -113,7 +113,7 @@ if (inet->num == num && !(inet->daddr && inet->daddr != raddr) && - !(inet->rcv_saddr && inet->rcv_saddr != laddr) && + !(!(inet->if_group & grp) && inet->rcv_saddr != laddr) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) goto found; /* gotcha */ } @@ -158,7 +158,7 @@ goto out; sk = __raw_v4_lookup(__sk_head(head), iph->protocol, iph->saddr, iph->daddr, - skb->dev->ifindex); + skb->dev->ifindex, skb->dev->ifgroup); while (sk) { if (iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) { @@ -170,7 +170,7 @@ } sk = __raw_v4_lookup(sk_next(sk), iph->protocol, iph->saddr, iph->daddr, - skb->dev->ifindex); + skb->dev->ifindex, skb->dev->ifgroup); } out: read_unlock(&raw_v4_lock); diff -Nur linux-2.6.0-test11/net/ipv4/tcp_diag.c linux-2.6.0-test11-ifgrp/net/ipv4/tcp_diag.c --- linux-2.6.0-test11/net/ipv4/tcp_diag.c Wed Nov 26 21:42:49 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/tcp_diag.c Tue Dec 2 20:57:22 2003 @@ -206,7 +206,7 @@ return -1; } -extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif); +extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif, u32 grp); #ifdef CONFIG_IPV6 extern struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport, struct in6_addr *daddr, u16 dport, @@ -223,7 +223,7 @@ if (req->tcpdiag_family == AF_INET) { sk = tcp_v4_lookup(req->id.tcpdiag_dst[0], req->id.tcpdiag_dport, req->id.tcpdiag_src[0], req->id.tcpdiag_sport, - req->id.tcpdiag_if); + req->id.tcpdiag_if, 1); } #ifdef CONFIG_IPV6 else if (req->tcpdiag_family == AF_INET6) { diff -Nur linux-2.6.0-test11/net/ipv4/tcp_ipv4.c linux-2.6.0-test11-ifgrp/net/ipv4/tcp_ipv4.c --- linux-2.6.0-test11/net/ipv4/tcp_ipv4.c Wed Nov 26 21:43:32 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/tcp_ipv4.c Tue Dec 2 21:10:39 2003 @@ -412,7 +412,7 @@ * during the search since they can never be otherwise. */ static struct sock *__tcp_v4_lookup_listener(struct hlist_head *head, u32 daddr, - unsigned short hnum, int dif) + unsigned short hnum, int dif, u32 grp) { struct sock *result = NULL, *sk; struct hlist_node *node; @@ -424,9 +424,10 @@ if (inet->num == hnum && !ipv6_only_sock(sk)) { __u32 rcv_saddr = inet->rcv_saddr; + __u32 if_group = inet->if_group; score = (sk->sk_family == PF_INET ? 1 : 0); - if (rcv_saddr) { + if (!(if_group & grp)) { if (rcv_saddr != daddr) continue; score+=2; @@ -449,7 +450,7 @@ /* Optimize the common listener case. */ inline struct sock *tcp_v4_lookup_listener(u32 daddr, unsigned short hnum, - int dif) + int dif, u32 grp) { struct sock *sk = NULL; struct hlist_head *head; @@ -460,11 +461,11 @@ struct inet_opt *inet = inet_sk((sk = __sk_head(head))); if (inet->num == hnum && !sk->sk_node.next && - (!inet->rcv_saddr || inet->rcv_saddr == daddr) && + ((inet->if_group & grp) || inet->rcv_saddr == daddr) && (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && !sk->sk_bound_dev_if) goto sherry_cache; - sk = __tcp_v4_lookup_listener(head, daddr, hnum, dif); + sk = __tcp_v4_lookup_listener(head, daddr, hnum, dif, grp); } if (sk) { sherry_cache: @@ -515,21 +516,21 @@ } static inline struct sock *__tcp_v4_lookup(u32 saddr, u16 sport, - u32 daddr, u16 hnum, int dif) + u32 daddr, u16 hnum, int dif, u32 grp) { struct sock *sk = __tcp_v4_lookup_established(saddr, sport, daddr, hnum, dif); - return sk ? : tcp_v4_lookup_listener(daddr, hnum, dif); + return sk ? : tcp_v4_lookup_listener(daddr, hnum, dif, grp); } inline struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, - u16 dport, int dif) + u16 dport, int dif, u32 grp) { struct sock *sk; local_bh_disable(); - sk = __tcp_v4_lookup(saddr, sport, daddr, ntohs(dport), dif); + sk = __tcp_v4_lookup(saddr, sport, daddr, ntohs(dport), dif, grp); local_bh_enable(); return sk; @@ -1003,7 +1004,7 @@ } sk = tcp_v4_lookup(iph->daddr, th->dest, iph->saddr, - th->source, tcp_v4_iif(skb)); + th->source, tcp_v4_iif(skb), skb->dev->ifgroup); if (!sk) { ICMP_INC_STATS_BH(IcmpInErrors); return; @@ -1774,7 +1775,7 @@ sk = __tcp_v4_lookup(skb->nh.iph->saddr, th->source, skb->nh.iph->daddr, ntohs(th->dest), - tcp_v4_iif(skb)); + tcp_v4_iif(skb), skb->dev->ifgroup); if (!sk) goto no_tcp_socket; @@ -1837,7 +1838,8 @@ case TCP_TW_SYN: { struct sock *sk2 = tcp_v4_lookup_listener(skb->nh.iph->daddr, ntohs(th->dest), - tcp_v4_iif(skb)); + tcp_v4_iif(skb), + skb->dev->ifgroup); if (sk2) { tcp_tw_deschedule((struct tcp_tw_bucket *)sk); tcp_tw_put((struct tcp_tw_bucket *)sk); diff -Nur linux-2.6.0-test11/net/ipv4/udp.c linux-2.6.0-test11-ifgrp/net/ipv4/udp.c --- linux-2.6.0-test11/net/ipv4/udp.c Wed Nov 26 21:43:09 2003 +++ linux-2.6.0-test11-ifgrp/net/ipv4/udp.c Tue Dec 2 21:17:05 2003 @@ -219,7 +219,7 @@ /* UDP is nearly always wildcards out the wazoo, it makes no sense to try * harder than this. -DaveM */ -struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif) +struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif, u32 grp) { struct sock *sk, *result = NULL; struct hlist_node *node; @@ -231,7 +231,7 @@ if (inet->num == hnum && !ipv6_only_sock(sk)) { int score = (sk->sk_family == PF_INET ? 1 : 0); - if (inet->rcv_saddr) { + if (!(inet->if_group & grp)) { if (inet->rcv_saddr != daddr) continue; score+=2; @@ -263,12 +263,12 @@ return result; } -__inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif) +__inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif, u32 grp) { struct sock *sk; read_lock(&udp_hash_lock); - sk = udp_v4_lookup_longway(saddr, sport, daddr, dport, dif); + sk = udp_v4_lookup_longway(saddr, sport, daddr, dport, dif, grp); if (sk) sock_hold(sk); read_unlock(&udp_hash_lock); @@ -325,7 +325,7 @@ int harderr; int err; - sk = udp_v4_lookup(iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex); + sk = udp_v4_lookup(iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex, skb->dev->ifgroup); if (sk == NULL) { ICMP_INC_STATS_BH(IcmpInErrors); return; /* No socket for error */ @@ -1187,7 +1187,7 @@ if(rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) return udp_v4_mcast_deliver(skb, uh, saddr, daddr); - sk = udp_v4_lookup(saddr, uh->source, daddr, uh->dest, skb->dev->ifindex); + sk = udp_v4_lookup(saddr, uh->source, daddr, uh->dest, skb->dev->ifindex, skb->dev->ifgroup); if (sk != NULL) { int ret = udp_queue_rcv_skb(sk, skb); From romieu@fr.zoreil.com Tue Dec 2 14:50:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 14:50: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 hB2MoTTa006117 for ; Tue, 2 Dec 2003 14:50:30 -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 hB2MmBxg010541; Tue, 2 Dec 2003 23:48:11 +0100 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id hB2MmBOH010540; Tue, 2 Dec 2003 23:48:11 +0100 Date: Tue, 2 Dec 2003 23:48:11 +0100 From: Francois Romieu To: Stephen Hemminger Cc: Krzysztof Halas , Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] (4/8) dscc4 convert to new hdlc_device Message-ID: <20031202234811.A10194@electric-eye.fr.zoreil.com> References: <20031202135846.28a93010.shemminger@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20031202135846.28a93010.shemminger@osdl.org>; from shemminger@osdl.org on Tue, Dec 02, 2003 at 01:58:46PM -0800 X-Organisation: Land of Sunshine Inc. X-archive-position: 1837 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 Stephen Hemminger : [...] drivers/net/wan/dscc4.c:1502: i = dev_per_card - 1; do { dscc4_rx_irq(priv, root + i); ^^^^^^^^ -> __BOOOOM__ } while (--i >= 0); Anyway it is a long expected change, I'll fix/test it. -- Ueimor From shemminger@osdl.org Tue Dec 2 15:32:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 15:32:40 -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 hB2NWPTa007431 for ; Tue, 2 Dec 2003 15:32:25 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB2NW3Z16862; Tue, 2 Dec 2003 15:32:03 -0800 Date: Tue, 2 Dec 2003 15:32:46 -0800 From: Stephen Hemminger To: Krzysztof Halas , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (3/8) n2 and c101 hdlc dis-embedding Message-Id: <20031202153246.57ef7c43.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1838 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev Change the n2 and c101 drivers to allocate the hdlc device structure and use hdlc->dev_data for their private data. # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1492 -> 1.1493 # drivers/net/wan/hd6457x.c 1.8 -> 1.9 # drivers/net/wan/n2.c 1.13 -> 1.14 # drivers/net/wan/c101.c 1.12 -> 1.13 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/26 shemminger@osdl.org 1.1493 # Change to work with hdlc_device without embedded net_device. # -------------------------------------------- # diff -Nru a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c --- a/drivers/net/wan/c101.c Wed Nov 26 12:28:38 2003 +++ b/drivers/net/wan/c101.c Wed Nov 26 12:28:38 2003 @@ -54,7 +54,7 @@ typedef struct card_s { - hdlc_device hdlc; /* HDLC device struct - must be first */ + hdlc_device *hdlc; /* HDLC device struct - must be first */ spinlock_t lock; /* TX lock */ u8 *win0base; /* ISA window base address */ u32 phy_winbase; /* ISA physical base address */ @@ -128,8 +128,8 @@ sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, card); if (stat & ST1_UDRN) { - port->hdlc.stats.tx_errors++; /* TX Underrun error detected */ - port->hdlc.stats.tx_fifo_errors++; + port->hdlc->stats.tx_errors++; /* TX Underrun error detected */ + port->hdlc->stats.tx_fifo_errors++; } /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ @@ -137,7 +137,7 @@ if (stat & ST1_CDCD) hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), - &port->hdlc); + port->hdlc); } @@ -288,13 +288,14 @@ release_mem_region(card->phy_winbase, C101_MAPPED_RAM_SIZE); } - kfree(card); + free_hdlc_device(card->hdlc); } static int __init c101_run(unsigned long irq, unsigned long winbase) { + hdlc_device *hdlc; struct net_device *dev; card_t *card; int result; @@ -309,12 +310,13 @@ return -ENODEV; } - card = kmalloc(sizeof(card_t), GFP_KERNEL); - if (card == NULL) { + hdlc = alloc_hdlc_device(sizeof(card_t)); + if (!hdlc) { printk(KERN_ERR "c101: unable to allocate memory\n"); return -ENOBUFS; } - memset(card, 0, sizeof(card_t)); + card = hdlc->dev_data; + card->hdlc = hdlc; if (request_irq(irq, sca_intr, 0, devname, card)) { printk(KERN_ERR "c101: could not allocate IRQ\n"); @@ -347,7 +349,7 @@ sca_init(card, 0); - dev = hdlc_to_dev(&card->hdlc); + dev = hdlc_to_dev(hdlc); spin_lock_init(&card->lock); SET_MODULE_OWNER(dev); @@ -358,11 +360,11 @@ dev->do_ioctl = c101_ioctl; dev->open = c101_open; dev->stop = c101_close; - card->hdlc.attach = sca_attach; - card->hdlc.xmit = sca_xmit; + hdlc->attach = sca_attach; + hdlc->xmit = sca_xmit; card->settings.clock_type = CLOCK_EXT; - result = register_hdlc_device(&card->hdlc); + result = register_hdlc_device(hdlc); if (result) { printk(KERN_WARNING "c101: unable to register hdlc device\n"); c101_destroy_card(card); @@ -371,11 +373,11 @@ sca_init_sync_port(card); /* Set up C101 memory */ hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), - &card->hdlc); + card->hdlc); printk(KERN_INFO "%s: Moxa C101 on IRQ%u," " using %u TX + %u RX packets rings\n", - hdlc_to_name(&card->hdlc), card->irq, + hdlc_to_name(card->hdlc), card->irq, card->tx_ring_buffers, card->rx_ring_buffers); *new_card = card; @@ -424,7 +426,7 @@ while (card) { card_t *ptr = card; card = card->next_card; - unregister_hdlc_device(&ptr->hdlc); + unregister_hdlc_device(ptr->hdlc); c101_destroy_card(ptr); } } diff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c --- a/drivers/net/wan/hd6457x.c Wed Nov 26 12:28:38 2003 +++ b/drivers/net/wan/hd6457x.c Wed Nov 26 12:28:38 2003 @@ -114,7 +114,7 @@ static inline port_t* hdlc_to_port(hdlc_device *hdlc) { - return (port_t*)hdlc; + return hdlc->dev_data; } @@ -245,7 +245,7 @@ } hdlc_set_carrier(!(sca_in(get_msci(port) + ST3, card) & ST3_DCD), - &port->hdlc); + port->hdlc); } @@ -262,13 +262,13 @@ sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card); if (stat & ST1_UDRN) { - port->hdlc.stats.tx_errors++; /* TX Underrun error detected */ - port->hdlc.stats.tx_fifo_errors++; + port->hdlc->stats.tx_errors++; /* TX Underrun error detected */ + port->hdlc->stats.tx_fifo_errors++; } if (stat & ST1_CDCD) hdlc_set_carrier(!(sca_in(msci + ST3, card) & ST3_DCD), - &port->hdlc); + port->hdlc); } #endif @@ -287,7 +287,7 @@ len = readw(&desc->len); skb = dev_alloc_skb(len); if (!skb) { - port->hdlc.stats.rx_dropped++; + port->hdlc->stats.rx_dropped++; return; } @@ -316,12 +316,12 @@ printk(KERN_DEBUG "%s RX(%i):", hdlc_to_name(&port->hdlc), skb->len); debug_frame(skb); #endif - port->hdlc.stats.rx_packets++; - port->hdlc.stats.rx_bytes += skb->len; + port->hdlc->stats.rx_packets++; + port->hdlc->stats.rx_bytes += skb->len; skb->mac.raw = skb->data; - skb->dev = hdlc_to_dev(&port->hdlc); + skb->dev = hdlc_to_dev(port->hdlc); skb->dev->last_rx = jiffies; - skb->protocol = hdlc_type_trans(skb, hdlc_to_dev(&port->hdlc)); + skb->protocol = hdlc_type_trans(skb, hdlc_to_dev(port->hdlc)); netif_rx(skb); } @@ -333,7 +333,7 @@ u16 dmac = get_dmac_rx(port); card_t *card = port_to_card(port); u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ - struct net_device_stats *stats = &port->hdlc.stats; + struct net_device_stats *stats = &port->hdlc->stats; /* Reset DSR status bits */ sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, @@ -401,13 +401,13 @@ break; /* Transmitter is/will_be sending this frame */ desc = desc_address(port, port->txlast, 1); - port->hdlc.stats.tx_packets++; - port->hdlc.stats.tx_bytes += readw(&desc->len); + port->hdlc->stats.tx_packets++; + port->hdlc->stats.tx_bytes += readw(&desc->len); writeb(0, &desc->stat); /* Free descriptor */ port->txlast = next_desc(port, port->txlast, 1); } - netif_wake_queue(hdlc_to_dev(&port->hdlc)); + netif_wake_queue(hdlc_to_dev(port->hdlc)); spin_unlock(&port->lock); } @@ -790,7 +790,7 @@ desc = desc_address(port, port->txin + 1, 1); if (readb(&desc->stat)) /* allow 1 packet gap */ - netif_stop_queue(hdlc_to_dev(&port->hdlc)); + netif_stop_queue(hdlc_to_dev(port->hdlc)); spin_unlock_irq(&port->lock); diff -Nru a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c --- a/drivers/net/wan/n2.c Wed Nov 26 12:28:38 2003 +++ b/drivers/net/wan/n2.c Wed Nov 26 12:28:38 2003 @@ -92,11 +92,10 @@ typedef struct port_s { - hdlc_device hdlc; /* HDLC device struct - must be first */ + hdlc_device *hdlc; /* HDLC device struct */ struct card_s *card; spinlock_t lock; /* TX lock */ sync_serial_settings settings; - int valid; /* port enabled */ int rxpart; /* partial frame received, next frame invalid*/ unsigned short encoding; unsigned short parity; @@ -120,7 +119,7 @@ u16 tx_ring_buffers; u8 irq; /* IRQ (3-15) */ - port_t ports[2]; + port_t *ports[2]; struct card_s *next_card; }card_t; @@ -141,8 +140,7 @@ #define phy_node(port) ((port)->phy_node) #define winsize(card) (USE_WINDOWSIZE) #define winbase(card) ((card)->winbase) -#define get_port(card, port) ((card)->ports[port].valid ? \ - &(card)->ports[port] : NULL) +#define get_port(card, port) ((card)->ports[port]) @@ -311,9 +309,13 @@ { int cnt; - for (cnt = 0; cnt < 2; cnt++) - if (card->ports[cnt].card) - unregister_hdlc_device(&card->ports[cnt].hdlc); + for (cnt = 0; cnt < 2; cnt++) { + port_t *port = card->ports[cnt]; + if (port) { + unregister_hdlc_device(port->hdlc); + free_hdlc_device(port->hdlc); + } + } if (card->irq) free_irq(card->irq, card); @@ -434,14 +436,25 @@ sca_init(card, 0); for (cnt = 0; cnt < 2; cnt++) { - port_t *port = &card->ports[cnt]; - struct net_device *dev = hdlc_to_dev(&port->hdlc); + hdlc_device *hdlc; + port_t *port; + struct net_device *dev; + int err; if ((cnt == 0 && !valid0) || (cnt == 1 && !valid1)) continue; + hdlc = alloc_hdlc_device(sizeof(*port)); + if (!hdlc) { + printk(KERN_WARNING "n2: unable to allocate hdlc device\n"); + n2_destroy_card(card); + return -ENOMEM; + } + + dev = hdlc_to_dev(hdlc); + port = hdlc->dev_data; + port->hdlc = hdlc; port->phy_node = cnt; - port->valid = 1; if ((cnt == 1) && valid0) port->log_node = 1; @@ -455,21 +468,23 @@ dev->do_ioctl = n2_ioctl; dev->open = n2_open; dev->stop = n2_close; - port->hdlc.attach = sca_attach; - port->hdlc.xmit = sca_xmit; + hdlc->attach = sca_attach; + hdlc->xmit = sca_xmit; port->settings.clock_type = CLOCK_EXT; - if (register_hdlc_device(&port->hdlc)) { + err = register_hdlc_device(hdlc); + if (err) { printk(KERN_WARNING "n2: unable to register hdlc " "device\n"); n2_destroy_card(card); - return -ENOBUFS; + return err; } port->card = card; sca_init_sync_port(port); /* Set up SCA memory */ + card->ports[i] = port; printk(KERN_INFO "%s: RISCom/N2 node %d\n", - hdlc_to_name(&port->hdlc), port->phy_node); + hdlc_to_name(hdlc), port->phy_node); } *new_card = card; From ja@ssi.bg Tue Dec 2 15:39:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 15:40:13 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2NdlTa008115 for ; Tue, 2 Dec 2003 15:39:52 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB2Ne6ee008997; Wed, 3 Dec 2003 01:40:08 +0200 Date: Wed, 3 Dec 2003 01:40:06 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031201155005.1c515793.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1839 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, I'm appending new version that handles all missing cases for hashed values on icmp error: - ip_rt_frag_needed now provides interface index - ip_rt_redirect checks for tos|RTO_ONLINK too - ip_rt_frag_needed checks also for tos|RTO_ONLINK and oif!=0 - __ip_route_output_key now ignores illegal bits (bit 1) from tos Please review and edit if needed. diff -Nru a/include/net/route.h b/include/net/route.h --- a/include/net/route.h Tue Dec 2 23:37:17 2003 +++ b/include/net/route.h Tue Dec 2 23:37:17 2003 @@ -122,7 +122,7 @@ extern int ip_route_output_key(struct rtable **, struct flowi *flp); extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); -extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); +extern unsigned short ip_rt_frag_needed(int iif, struct iphdr *iph, unsigned short new_mtu); extern void ip_rt_send_redirect(struct sk_buff *skb); extern unsigned inet_addr_type(u32 addr); diff -Nru a/net/ipv4/icmp.c b/net/ipv4/icmp.c --- a/net/ipv4/icmp.c Tue Dec 2 23:37:17 2003 +++ b/net/ipv4/icmp.c Tue Dec 2 23:37:17 2003 @@ -626,7 +626,7 @@ "and DF set.\n", NIPQUAD(iph->daddr)); } else { - info = ip_rt_frag_needed(iph, + info = ip_rt_frag_needed(skb->dev->ifindex, iph, ntohs(icmph->un.frag.mtu)); if (!info) goto out; diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c --- a/net/ipv4/route.c Tue Dec 2 23:37:17 2003 +++ b/net/ipv4/route.c Tue Dec 2 23:37:17 2003 @@ -967,11 +967,12 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, u32 saddr, u8 tos, struct net_device *dev) { - int i, k; + int i, j, k; struct in_device *in_dev = in_dev_get(dev); struct rtable *rth, **rthp; u32 skeys[2] = { saddr, 0 }; int ikeys[2] = { dev->ifindex, 0 }; + u8 toskeys[2]; tos &= IPTOS_RT_MASK; @@ -992,11 +993,15 @@ goto reject_redirect; } + toskeys[0] = tos; + toskeys[1] = tos | RTO_ONLINK; + if (saddr && daddr) + for (j = 0; j < 2; j++) for (i = 0; i < 2; i++) { for (k = 0; k < 2; k++) { unsigned hash = rt_hash_code(daddr, skeys[i] ^ (ikeys[k] << 5), - tos); + toskeys[j]); rthp=&rt_hash_table[hash].chain; @@ -1007,7 +1012,7 @@ smp_read_barrier_depends(); if (rth->fl.fl4_dst != daddr || rth->fl.fl4_src != skeys[i] || - rth->fl.fl4_tos != tos || + rth->fl.fl4_tos != toskeys[j] || rth->fl.oif != ikeys[k] || rth->fl.iif != 0) { rthp = &rth->u.rt_next; @@ -1237,21 +1242,26 @@ return 68; } -unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) +unsigned short ip_rt_frag_needed(int iif, struct iphdr *iph, unsigned short new_mtu) { - int i; + int i, j, k; unsigned short old_mtu = ntohs(iph->tot_len); struct rtable *rth; u32 skeys[2] = { iph->saddr, 0, }; u32 daddr = iph->daddr; u8 tos = iph->tos & IPTOS_RT_MASK; unsigned short est_mtu = 0; + u8 toskeys[2] = { tos, tos | RTO_ONLINK }; + int ikeys[2] = { iif, 0 }; if (ipv4_config.no_pmtu_disc) return 0; + for (k = 0; k < (iif ? 2 : 1); k++) + for (j = 0; j < 2; j++) for (i = 0; i < 2; i++) { - unsigned hash = rt_hash_code(daddr, skeys[i], tos); + unsigned hash = rt_hash_code(daddr, skeys[i] ^ (ikeys[k] << 5), + toskeys[j]); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; @@ -1261,7 +1271,8 @@ rth->fl.fl4_src == skeys[i] && rth->rt_dst == daddr && rth->rt_src == iph->saddr && - rth->fl.fl4_tos == tos && + rth->fl.fl4_tos == toskeys[j] && + rth->fl.oif == ikeys[k] && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { unsigned short mtu = new_mtu; @@ -2213,8 +2224,9 @@ { unsigned hash; struct rtable *rth; + u8 tos = flp->fl4_tos & (IPTOS_RT_MASK | RTO_ONLINK); - hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), flp->fl4_tos); + hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), tos); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { @@ -2226,8 +2238,7 @@ #ifdef CONFIG_IP_ROUTE_FWMARK rth->fl.fl4_fwmark == flp->fl4_fwmark && #endif - !((rth->fl.fl4_tos ^ flp->fl4_tos) & - (IPTOS_RT_MASK | RTO_ONLINK))) { + rth->fl.fl4_tos == tos) { rth->u.dst.lastuse = jiffies; dst_hold(&rth->u.dst); rth->u.dst.__use++; Regards -- Julian Anastasov From ja@ssi.bg Tue Dec 2 15:48:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 15:48:23 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB2Nm4Ta008633 for ; Tue, 2 Dec 2003 15:48:08 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB2NnCee009074; Wed, 3 Dec 2003 01:49:12 +0200 Date: Wed, 3 Dec 2003 01:49:12 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: netdev@oss.sgi.com cc: Sridhar Samudrala , "David S. Miller" Subject: [2.6 PATCH] sctp - provide valid tos and oif values for ip_route_output_key Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1607745702-506488201-1070408952=:1237" X-archive-position: 1840 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --1607745702-506488201-1070408952=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello, I'm not sure if this change is needed (it is not tested). Is SO_BINDTODEVICE supported for SCTP? It seems it is bad for PMTUD not to provide valid tos and oif values for the routing call. Regards -- Julian Anastasov --1607745702-506488201-1070408952=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="tos-sctp-1.diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: SCTP tos and oif Content-Disposition: attachment; filename="tos-sctp-1.diff" IyBUaGlzIGlzIGEgQml0S2VlcGVyIGdlbmVyYXRlZCBwYXRjaCBmb3IgdGhl IGZvbGxvd2luZyBwcm9qZWN0Og0KIyBQcm9qZWN0IE5hbWU6IExpbnV4IGtl cm5lbCB0cmVlDQojIFRoaXMgcGF0Y2ggZm9ybWF0IGlzIGludGVuZGVkIGZv ciBHTlUgcGF0Y2ggY29tbWFuZCB2ZXJzaW9uIDIuNSBvciBoaWdoZXIuDQoj IFRoaXMgcGF0Y2ggaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBkZWx0YXM6DQoj CSAgICAgICAgICAgQ2hhbmdlU2V0CTEuMTM1NCAgLT4gMS4xMzU1IA0KIwkg bmV0L3NjdHAvcHJvdG9jb2wuYwkxLjU4ICAgIC0+IDEuNTkgICANCiMNCiMg VGhlIGZvbGxvd2luZyBpcyB0aGUgQml0S2VlcGVyIENoYW5nZVNldCBMb2cN CiMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0NCiMgMDMvMTIvMDMJamFAc3NpLmJnCTEuMTM1NQ0KIyBbU0NUUF06IHBy b3ZpZGUgdmFsaWQgdG9zIGFuZCBvaWYgdmFsdWVzIGZvciBpcF9yb3V0ZV9v dXRwdXRfa2V5DQojIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tDQojDQpkaWZmIC1OcnUgYS9uZXQvc2N0cC9wcm90b2Nv bC5jIGIvbmV0L3NjdHAvcHJvdG9jb2wuYw0KLS0tIGEvbmV0L3NjdHAvcHJv dG9jb2wuYwlXZWQgRGVjICAzIDAxOjA4OjMxIDIwMDMNCisrKyBiL25ldC9z Y3RwL3Byb3RvY29sLmMJV2VkIERlYyAgMyAwMTowODozMSAyMDAzDQpAQCAt NDQ0LDYgKzQ0NCw4IEBADQogDQogCW1lbXNldCgmZmwsIDB4MCwgc2l6ZW9m KHN0cnVjdCBmbG93aSkpOw0KIAlmbC5mbDRfZHN0ICA9IGRhZGRyLT52NC5z aW5fYWRkci5zX2FkZHI7DQorCWZsLmZsNF90b3MgID0gUlRfQ09OTl9GTEFH Uyhhc29jLT5iYXNlLnNrKTsNCisJZmwub2lmICAgICAgPSBhc29jLT5iYXNl LnNrLT5za19ib3VuZF9kZXZfaWY7DQogCWZsLnByb3RvID0gSVBQUk9UT19T Q1RQOw0KIA0KIAlpZiAoc2FkZHIpDQo= --1607745702-506488201-1070408952=:1237-- From ja@ssi.bg Tue Dec 2 16:02:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:02:42 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB302LTa009802 for ; Tue, 2 Dec 2003 16:02:27 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB303Kee009180; Wed, 3 Dec 2003 02:03:20 +0200 Date: Wed, 3 Dec 2003 02:03:20 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: netdev@oss.sgi.com cc: Bart De Schuymer , Stephen Hemminger , "David S. Miller" Subject: [2.6 PATCH] bridge - provide valid tos value for ip_route_output_key Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1607745702-1706568113-1070409800=:1237" X-archive-position: 1841 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --1607745702-1706568113-1070409800=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello, The attached patch changes bridging to provide valid tos value to routing. Regards -- Julian Anastasov --1607745702-1706568113-1070409800=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="tos-bridge-1.diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: bridge tos Content-Disposition: attachment; filename="tos-bridge-1.diff" IyBUaGlzIGlzIGEgQml0S2VlcGVyIGdlbmVyYXRlZCBwYXRjaCBmb3IgdGhl IGZvbGxvd2luZyBwcm9qZWN0Og0KIyBQcm9qZWN0IE5hbWU6IExpbnV4IGtl cm5lbCB0cmVlDQojIFRoaXMgcGF0Y2ggZm9ybWF0IGlzIGludGVuZGVkIGZv ciBHTlUgcGF0Y2ggY29tbWFuZCB2ZXJzaW9uIDIuNSBvciBoaWdoZXIuDQoj IFRoaXMgcGF0Y2ggaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBkZWx0YXM6DQoj CSAgICAgICAgICAgQ2hhbmdlU2V0CTEuMTM1MSAgLT4gMS4xMzUyIA0KIwlu ZXQvYnJpZGdlL2JyX25ldGZpbHRlci5jCTEuMTUgICAgLT4gMS4xNiAgIA0K Iw0KIyBUaGUgZm9sbG93aW5nIGlzIHRoZSBCaXRLZWVwZXIgQ2hhbmdlU2V0 IExvZw0KIyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLQ0KIyAwMy8xMi8wMglqYUBzc2kuYmcJMS4xMzUyDQojIFtCUklE R0VdOiBwcm92aWRlIHZhbGlkIHRvcyB2YWx1ZSBmb3IgaXBfcm91dGVfb3V0 cHV0X2tleQ0KIyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLQ0KIw0KZGlmZiAtTnJ1IGEvbmV0L2JyaWRnZS9icl9uZXRm aWx0ZXIuYyBiL25ldC9icmlkZ2UvYnJfbmV0ZmlsdGVyLmMNCi0tLSBhL25l dC9icmlkZ2UvYnJfbmV0ZmlsdGVyLmMJVHVlIERlYyAgMiAyMzo1NTozMCAy MDAzDQorKysgYi9uZXQvYnJpZGdlL2JyX25ldGZpbHRlci5jCVR1ZSBEZWMg IDIgMjM6NTU6MzAgMjAwMw0KQEAgLTE4MCw3ICsxODAsNyBAQA0KIAkJCXN0 cnVjdCBydGFibGUgKnJ0Ow0KIAkJCXN0cnVjdCBmbG93aSBmbCA9IHsgLm5s X3UgPSANCiAJCQl7IC5pcDRfdSA9IHsgLmRhZGRyID0gaXBoLT5kYWRkciwg LnNhZGRyID0gMCAsDQotCQkJCSAgICAgLnRvcyA9IGlwaC0+dG9zfSB9LCAu cHJvdG8gPSAwfTsNCisJCQkJICAgICAudG9zID0gUlRfVE9TKGlwaC0+dG9z KX0gfSwgLnByb3RvID0gMH07DQogDQogCQkJaWYgKCFpcF9yb3V0ZV9vdXRw dXRfa2V5KCZydCwgJmZsKSkgew0KIAkJCQkvKiBCcmlkZ2VkLWFuZC1ETkFU J2VkIHRyYWZmaWMgZG9lc24ndA0K --1607745702-1706568113-1070409800=:1237-- From davem@pizda.ninka.net Tue Dec 2 16:08:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:08:53 -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 hB308eTa010246 for ; Tue, 2 Dec 2003 16:08:40 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA04395; Tue, 2 Dec 2003 16:07:38 -0800 Date: Tue, 2 Dec 2003 16:07:38 -0800 From: "David S. Miller" To: Julian Anastasov Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031202160738.439f9f0d.davem@redhat.com> In-Reply-To: References: <20031201155005.1c515793.davem@redhat.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: 1842 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 Wed, 3 Dec 2003 01:40:06 +0200 (EET) Julian Anastasov wrote: > Please review and edit if needed. Thanks Julian, I will review your patch today. But I want to mention something about this. TOS checks I think are pretty unreliable. TOS has meaning within a network realm, right? This means that if we make a packet with TOS X, once it leaves our realm the TOS value may be arbitrarily changed so that the TOS in the packet has meaning within that new realm. If a PMTU or other routing ICMP gets sent back to us after TOS changes have been made, there is absolutely no way to reliably match the routes properly for update. Therefore TOS based routes cannot handle ICMP messages reliably in the global internet. In fact, it is possible and even likely to apply an ICMP for the wrong TOS variant of a given route when this TOS rewriting occurs. From hadi@cyberus.ca Tue Dec 2 16:08:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:09:06 -0800 (PST) Received: from mail.cyberus.ca (mail.cyberus.ca [209.197.145.21]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB308oTa010251 for ; Tue, 2 Dec 2003 16:08:53 -0800 Received: from cpe0030ab124d2f-cm014500000962.cpe.net.cable.rogers.com ([24.103.99.32] helo=[10.0.0.9]) by mail.cyberus.ca with esmtp (Exim 4.20) id 1ARKZU-0006P8-JB; Tue, 02 Dec 2003 19:08:48 -0500 Subject: Re: [RTNETLINK] Provide real oif From: jamal Reply-To: hadi@cyberus.ca To: Herbert Xu Cc: netdev@oss.sgi.com In-Reply-To: References: Content-Type: text/plain Organization: jamalopolis Message-Id: <1070410097.1038.27.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 02 Dec 2003 19:08:17 -0500 Content-Transfer-Encoding: 7bit X-archive-position: 1843 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@cyberus.ca Precedence: bulk X-list: netdev On Tue, 2003-12-02 at 15:54, Herbert Xu wrote: > jamal wrote: > > > > Can you provide a real example (output of route display in user space) > > where this would be valuable? > > Without the real oif you will see entries like this in the output of > ip r l c: > > 192.168.0.7 dev eth0 src 192.168.0.6 > cache mtu 1500 advmss 1460 metric10 64 > 192.168.0.7 dev eth0 src 192.168.0.6 > cache mtu 1500 advmss 1460 metric10 64 > > One of those has oif == 0 while the other one has oif == eth0. > They both seem to have an oif of eth0, no? > To generate an entry with oif == eth0, just send a UDP packet and > bound to eth0. Sorry, i am a bit slow - i think i may know where you are going with this but help me out; By binding to eth0, you mean socket bind() or msg_dontroute of the udp packet via eth0? Is it unicast? Do you have a small sample proggie i could use to check this? > > whats wrong with the combo of RTA_OIF and RTA_SRC? > > Both of those attributes are independent of the real oif. They are related in the rt selection. If you have a small program i can use to create the above cacheinfo i would appreaciate it. Is the same IP attached to multiple interfaces that you need to select a prefered OIF? cheers, jamal From francois@baligant.net Tue Dec 2 16:15:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:15:54 -0800 (PST) Received: from casimir.nikita.cx (casimir.nikita.cx [198.63.211.44]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30FfTa011055 for ; Tue, 2 Dec 2003 16:15:41 -0800 Received: from fortress (fbaligant.net1.nerim.net [213.41.146.186]) by casimir.nikita.cx (8.12.8/8.12.8) with SMTP id hB30Fbh0021361 for ; Tue, 2 Dec 2003 18:15:38 -0600 Message-ID: <078f01c3b932$97919630$15fea8c0@fortress> From: "Francois Baligant" Cc: References: <072501c3b874$2542ae70$15fea8c0@fortress><16332.27919.502097.988522@robur.slu.se> <20031202032606.28db927b.davem@redhat.com> Subject: Re: 2.6.0-test11: dst_cache_overflow causing unresponsive box Date: Wed, 3 Dec 2003 01:15:42 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Copied-To: backup@casimir.nikita.cx (by Synonym - http://www.modulo.ro/synonym) X-Scanned-By: MIMEDefang 2.37 X-archive-position: 1844 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: francois@baligant.net Precedence: bulk X-list: netdev Thanks all for your suggestions. Actually I have noticed that with 90k establish TCP sessions, I have around the double amount of entries in the routing cache. For each TCP session there is an inbound and outbond cache entry like this: 39.125.111.131 81.64.64.96 39.125.111.129 1500 0 0 eth0 81.64.64.96 39.125.111.131 39.125.111.131 l 0 0 0 lo This system has accepted that many sessions before when running 2.4 and this problem surfaced with 2.6. Now, I can't be sure that traffic pattern are exactly the same so Im not drawing conclusions about 2.6 I will try to raise gc_tresh and keep you informed. Thanks, Francois ----- Original Message ----- From: "David S. Miller" To: "Robert Olsson" Cc: ; Sent: Tuesday, December 02, 2003 12:26 PM Subject: Re: 2.6.0-test11: dst_cache_overflow causing unresponsive box > On Tue, 2 Dec 2003 11:44:31 +0100 > Robert Olsson wrote: > > > No experience with 90k TCP-flows but it seems GC is not able to free some > > the dst-entries for some reason. This will slowly kill your box with > > symptoms you describe. We have ask TCP-experts for timer settings to avoid > > pending sessions etc. Also check slab for any other objects growing as > > dst cache overflow is most likely secondary effect in your case. rtstat > > looks sane expect for the high number of dst-entries. Tuning is another > > story. > > Let us assume, for the sake of back of the envelope calculations, that > all 90k TCP connections speak to unique destinations. Let us further > assume that all of them have at least one packet in flight. > > This means the routing cache must be able to hold at least 90k entries. > All of these routing cache entires will be referenced by the packets > in the TCP retransmission queues of all the sockets, and thus the > entries are unreclaimable. > > You are setting net.ipv4.route.max_size to 655360 which should be more > than enough. But you also have to make the net.ipv4.route.gc_thresh > more reasonable as well, perhaps 90K as a test. > > If net.ipv4.route.gc_thresh is lower than 90K and my assertions above > hold, then the kernel will try to garbage collect too early, all the > routing cache entries will be in use and therefore uncollectable, > and you'll get the message you're seeing. > > Try to pump up gc_thresh and see if that helps. > From davem@pizda.ninka.net Tue Dec 2 16:23:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:23:30 -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 hB30NGTa014310 for ; Tue, 2 Dec 2003 16:23:17 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA04448; Tue, 2 Dec 2003 16:22:08 -0800 Date: Tue, 2 Dec 2003 16:22:08 -0800 From: "David S. Miller" To: Julian Anastasov Cc: netdev@oss.sgi.com, laforge@gnumonks.org Subject: Re: [2.6 PATCH] ipchains masquerade must select maddr correctly Message-Id: <20031202162208.04629dab.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: 1845 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 Wed, 3 Dec 2003 01:55:28 +0200 (EET) Julian Anastasov wrote: > The attached patch fixes ipchains masquerade to use > correctly the routing. This bug-to-bug compatibility with 2.2 > is not valid from long time. Also, a missing unlock is added. Slow down. I don't think it's always desirable to specify a specific TOS when we're working with an input packet. In fact, what you're doing all over the tree is going to cause the routing cache size to explode in some very real usage. From davem@pizda.ninka.net Tue Dec 2 16:31:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:31:44 -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 hB30VVTa014783 for ; Tue, 2 Dec 2003 16:31:31 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA04523; Tue, 2 Dec 2003 16:30:35 -0800 Date: Tue, 2 Dec 2003 16:30:35 -0800 From: "David S. Miller" To: Pavlin Radoslavov Cc: netdev@oss.sgi.com, pavlin@icir.org Subject: Re: A request to add RTPROT_XORP to linux/rtnetlink.h Message-Id: <20031202163035.698533e7.davem@redhat.com> In-Reply-To: <200312022119.hB2LJaSx017575@possum.icir.org> References: <200312022119.hB2LJaSx017575@possum.icir.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: 1846 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, 02 Dec 2003 13:19:36 -0800 Pavlin Radoslavov wrote: > On behalf of the XORP (eXtensible Open Router Platform) project > (http://www.xorp.org), I'd like to ask if the XORP-specific protocol > value can be included in linux/rtnetlink.h (similar to the values > already assigned to other routing daemons/suites such as GateD, > etc.) Patch applied, thanks. From pavlin@possum.icir.org Tue Dec 2 16:32:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:32:50 -0800 (PST) Received: from possum.icir.org (possum.icir.org [192.150.187.67]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30WbTa014987 for ; Tue, 2 Dec 2003 16:32:37 -0800 Received: from possum.icir.org (localhost [127.0.0.1]) by possum.icir.org (8.12.9p1/8.12.3) with ESMTP id hB30WaSx019988; Tue, 2 Dec 2003 16:32:36 -0800 (PST) (envelope-from pavlin@possum.icir.org) Message-Id: <200312030032.hB30WaSx019988@possum.icir.org> To: "David S. Miller" cc: Pavlin Radoslavov , netdev@oss.sgi.com Subject: Re: A request to add RTPROT_XORP to linux/rtnetlink.h In-Reply-To: Message from "David S. Miller" of "Tue, 02 Dec 2003 16:30:35 PST." <20031202163035.698533e7.davem@redhat.com> Date: Tue, 02 Dec 2003 16:32:36 -0800 From: Pavlin Radoslavov X-archive-position: 1847 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pavlin@icir.org Precedence: bulk X-list: netdev > On Tue, 02 Dec 2003 13:19:36 -0800 > Pavlin Radoslavov wrote: > > > On behalf of the XORP (eXtensible Open Router Platform) project > > (http://www.xorp.org), I'd like to ask if the XORP-specific protocol > > value can be included in linux/rtnetlink.h (similar to the values > > already assigned to other routing daemons/suites such as GateD, > > etc.) > > Patch applied, thanks. Great! Thanks!! Pavlin From xma@us.ibm.com Tue Dec 2 16:34:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:34:20 -0800 (PST) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.129]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30Y7Ta015512 for ; Tue, 2 Dec 2003 16:34:07 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e31.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB30XKb0531060; Tue, 2 Dec 2003 19:33:20 -0500 Received: from d03nm124.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB30XF1k164826; Tue, 2 Dec 2003 17:33:19 -0700 Importance: Normal Sensitivity: Subject: Re: IPv6 MIB:ipv6PrefixTable implementation To: kuznet@ms2.inr.ac.ru Cc: mashirle@us.ibm.com, netdev@oss.sgi.com X-Mailer: Lotus Notes Release 5.0.3 (Intl) 21 March 2000 Message-ID: From: Shirley Ma Date: Tue, 2 Dec 2003 16:33:13 -0800 X-MIMETrack: Serialize by Router on D03NM124/03/M/IBM(Release 6.0.2CF2|July 23, 2003) at 12/02/2003 17:33:18 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-archive-position: 1848 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: xma@us.ibm.com Precedence: bulk X-list: netdev Hi, Alexy, > preferred time is not an attribute of a prefix at all, > it is attribute of address, is not it? Unless the prefix is used > to install local address it does not make sense, right? The new IPv6 MIBs said that the preferred time is saved in the prefix table, not in the address table. Also, not every onlink prefix is saved in the routing table, for example, if there is already a manual address configured for an interface with the same prefix. Thanks Shirley Ma IBM Linux Technology Center 15300 SW Koll Parkway Beaverton, OR 97006-6063 Phone: (503) 578-7638 FAX: (503) 578-3228 From davem@pizda.ninka.net Tue Dec 2 16:40:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:40:17 -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 hB30e4Ta015954 for ; Tue, 2 Dec 2003 16:40:04 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA04574; Tue, 2 Dec 2003 16:39:02 -0800 Date: Tue, 2 Dec 2003 16:39:02 -0800 From: "David S. Miller" To: Julian Anastasov Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com Subject: Re: [ROUTE] PMTU only works on half the time Message-Id: <20031202163902.2deb43a7.davem@redhat.com> In-Reply-To: References: <20031201155005.1c515793.davem@redhat.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: 1849 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 Wed, 3 Dec 2003 01:40:06 +0200 (EET) Julian Anastasov wrote: > - ip_rt_frag_needed now provides interface index I disagree with this. There is no connection between the route (and thus output device) we used to send a packet and the interface on which an ICMP for that packet comes back upon. Think assymetric routes. You changes mean that for routes with specific output interfaces, we will ignore ICMPs for those routes that arrive on other interfaces due to assymetric routing. Why don't you create a seperate patch that just has the TOS masking changes? That's much less controversial and thus something I'm likely to apply. From ja@ssi.bg Tue Dec 2 16:42:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:42:38 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30gJTa016319 for ; Tue, 2 Dec 2003 16:42:22 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB2NtSee009114; Wed, 3 Dec 2003 01:55:29 +0200 Date: Wed, 3 Dec 2003 01:55:28 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: netdev@oss.sgi.com cc: Harald Welte , "David S. Miller" Subject: [2.6 PATCH] ipchains masquerade must select maddr correctly Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1607745702-1400563270-1070409328=:1237" X-archive-position: 1850 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --1607745702-1400563270-1070409328=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello, The attached patch fixes ipchains masquerade to use correctly the routing. This bug-to-bug compatibility with 2.2 is not valid from long time. Also, a missing unlock is added. Regards -- Julian Anastasov --1607745702-1400563270-1070409328=:1237 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ipchains-masq-1.diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: ipchains maddr Content-Disposition: attachment; filename="ipchains-masq-1.diff" IyBUaGlzIGlzIGEgQml0S2VlcGVyIGdlbmVyYXRlZCBwYXRjaCBmb3IgdGhl IGZvbGxvd2luZyBwcm9qZWN0Og0KIyBQcm9qZWN0IE5hbWU6IExpbnV4IGtl cm5lbCB0cmVlDQojIFRoaXMgcGF0Y2ggZm9ybWF0IGlzIGludGVuZGVkIGZv ciBHTlUgcGF0Y2ggY29tbWFuZCB2ZXJzaW9uIDIuNSBvciBoaWdoZXIuDQoj IFRoaXMgcGF0Y2ggaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBkZWx0YXM6DQoj CSAgICAgICAgICAgQ2hhbmdlU2V0CTEuMTM1MiAgLT4gMS4xMzUzIA0KIwlu ZXQvaXB2NC9uZXRmaWx0ZXIvaXBfZndfY29tcGF0X21hc3EuYwkxLjExICAg IC0+IDEuMTIgICANCiMNCiMgVGhlIGZvbGxvd2luZyBpcyB0aGUgQml0S2Vl cGVyIENoYW5nZVNldCBMb2cNCiMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0NCiMgMDMvMTIvMDMJamFAc3NpLmJnCTEu MTM1Mw0KIyBbSVBDSEFJTlNdOiBtYXNxdWVyYWRlIG11c3Qgc2VsZWN0IG1h ZGRyIGNvcnJlY3RseQ0KIyANCiMgLSBJdCBpcyBmaXhlZCBpbiBMaW51eCAy LjIgZnJvbSBhZ2VzDQojIC0gQWRkIG1pc3NpbmcgV1JJVEVfVU5MT0NLIG9u IHJvdXRlIGVycm9yDQojIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tDQojDQpkaWZmIC1OcnUgYS9uZXQvaXB2NC9uZXRm aWx0ZXIvaXBfZndfY29tcGF0X21hc3EuYyBiL25ldC9pcHY0L25ldGZpbHRl ci9pcF9md19jb21wYXRfbWFzcS5jDQotLS0gYS9uZXQvaXB2NC9uZXRmaWx0 ZXIvaXBfZndfY29tcGF0X21hc3EuYwlXZWQgRGVjICAzIDAwOjMyOjA1IDIw MDMNCisrKyBiL25ldC9pcHY0L25ldGZpbHRlci9pcF9md19jb21wYXRfbWFz cS5jCVdlZCBEZWMgIDMgMDA6MzI6MDUgMjAwMw0KQEAgLTY3LDE4ICs2Nywy MyBAQA0KIAkvKiBTZXR1cCB0aGUgbWFzcXVlcmFkZSwgaWYgbm90IGFscmVh ZHkgKi8NCiAJaWYgKCFpbmZvLT5pbml0aWFsaXplZCkgew0KIAkJdV9pbnQz Ml90IG5ld3NyYzsNCi0JCXN0cnVjdCBmbG93aSBmbCA9IHsgLm5sX3UgPSB7 IC5pcDRfdSA9IHsgLmRhZGRyID0gKCpwc2tiKS0+bmguaXBoLT5kYWRkciB9 IH0gfTsNCisJCXN0cnVjdCBmbG93aSBmbCA9IHsgLm5sX3UgPSB7DQorCQkJ CQkuaXA0X3UgPSB7DQorCQkJCQkJLmRhZGRyID0gKCpwc2tiKS0+bmguaXBo LT5kYWRkciwNCisJCQkJCQkudG9zID0gUlRfVE9TKCgqcHNrYiktPm5oLmlw aC0+dG9zKSwNCisJCQkJCX0gfSwNCisJCQkJICAgIC5vaWYgPSAoKnBza2Ip LT5kc3QtPmRldi0+aWZpbmRleCB9Ow0KIAkJc3RydWN0IHJ0YWJsZSAqcnQ7 DQogCQlzdHJ1Y3QgaXBfbmF0X211bHRpX3JhbmdlIHJhbmdlOw0KIA0KIAkJ LyogUGFzcyAwIGluc3RlYWQgb2Ygc2FkZHIsIHNpbmNlIGl0J3MgZ29pbmcg dG8gYmUgY2hhbmdlZA0KIAkJICAgYW55d2F5LiAqLw0KIAkJaWYgKGlwX3Jv dXRlX291dHB1dF9rZXkoJnJ0LCAmZmwpICE9IDApIHsNCisJCQlXUklURV9V TkxPQ0soJmlwX25hdF9sb2NrKTsNCiAJCQlERUJVR1AoImlwbmF0X3J1bGVf bWFzcXVlcmFkZTogQ2FuJ3QgcmVyb3V0ZS5cbiIpOw0KIAkJCXJldHVybiBO Rl9EUk9QOw0KIAkJfQ0KLQkJbmV3c3JjID0gaW5ldF9zZWxlY3RfYWRkcihy dC0+dS5kc3QuZGV2LCBydC0+cnRfZ2F0ZXdheSwNCi0JCQkJCSAgUlRfU0NP UEVfVU5JVkVSU0UpOw0KKwkJbmV3c3JjID0gcnQtPnJ0X3NyYzsNCiAJCWlw X3J0X3B1dChydCk7DQogCQlyYW5nZSA9ICgoc3RydWN0IGlwX25hdF9tdWx0 aV9yYW5nZSkNCiAJCQkgeyAxLA0K --1607745702-1400563270-1070409328=:1237-- From khc@pm.waw.pl Tue Dec 2 16:43:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:43:50 -0800 (PST) Received: from hq.pm.waw.pl (hq.pm.waw.pl [195.116.170.10]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30haTa016701 for ; Tue, 2 Dec 2003 16:43:37 -0800 Received: by hq.pm.waw.pl (Postfix, from userid 10) id AD7B6365; Wed, 3 Dec 2003 01:43:32 +0100 (CET) Received: by defiant.pm.waw.pl (Postfix, from userid 500) id AE258302D4; Wed, 3 Dec 2003 00:03:30 +0100 (CET) To: Stephen Hemminger Cc: Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] (1/8) hdlc wan device disembedding References: <20031202140103.6bb2deb4.shemminger@osdl.org> From: Krzysztof Halasa Date: Wed, 03 Dec 2003 00:03:30 +0100 In-Reply-To: <20031202140103.6bb2deb4.shemminger@osdl.org> (Stephen Hemminger's message of "Tue, 2 Dec 2003 14:01:03 -0800") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 1851 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: khc@pm.waw.pl Precedence: bulk X-list: netdev Stephen Hemminger writes: > Change the hdlc wan device's to not have the net_device structure embedded > inside the hdlc_device structure. This won't work on 2.6 where the > net_device > structure may need to live after module unload due to sysfs. > Instead, use alloc_netdev and setup so that netdev->priv = hdlc > and have hdlc->dev_data for device private data. Hmm... I always wanted dev->priv to be available for hw drivers (and yes, PPP proto doesn't currently meet that). Any other idea maybe? It seems the whole WAN (drivers/net/wan) needs some major rewrite, as the recent patches (starting with last 2.5.x ones) have broken few things (at least for me) which are not all fixed. First I would duplicate syncppp.c code in hdlc_ppp.c (removing Cisco HDLC support and polishing it to suit generic HDLC needs) so it no longer depends on syncppp (long-term I plan switching to generic PPP but it's certainly post-2.6 thing and I'm not even sure how to do it). This would result in few hundred lines of duplicated code, though. The positive side is that I can test the generic HDLC + hw drivers for C101, N2, wanXL, PCI200SYN (being merged) and PC300. The other thing would be converting drivers using syncppp.c to use generic HDLC instead (it would add support for X.25, Frame-Relay and raw HDLC). While I can probably make a patch I can't test it. The remaining drivers use either Sangoma (sdla/dlci/wanpipe/wanrouter) or comx code. Not sure about their status, are they both maintained? Comments? -- Krzysztof Halasa, B*FH From ja@ssi.bg Tue Dec 2 16:50:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 16:50:15 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB30ntTa017246 for ; Tue, 2 Dec 2003 16:49:58 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB30ouee009404; Wed, 3 Dec 2003 02:50:57 +0200 Date: Wed, 3 Dec 2003 02:50:56 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: netdev@oss.sgi.com, Subject: Re: [2.6 PATCH] ipchains masquerade must select maddr correctly In-Reply-To: <20031202162208.04629dab.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1852 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Tue, 2 Dec 2003, David S. Miller wrote: > > The attached patch fixes ipchains masquerade to use > > correctly the routing. This bug-to-bug compatibility with 2.2 > > is not valid from long time. Also, a missing unlock is added. > > Slow down. > > I don't think it's always desirable to specify a specific TOS when > we're working with an input packet. In fact, what you're doing all > over the tree is going to cause the routing cache size to explode in > some very real usage. Yes, it can grow up to 8 times (IPTOS_RT_MASK is 3 bits) if we detect different rt tos values. In fact, ipchains is the only case where tos is not provided :) For some users may be this is not only a maddr selection, may be they have real routes by tos for this public IP. Perhaps, TOS matching and hash key should be a sysctl/compile time option? Then a site that does not use tos for routing can safely run PMTUD without problems. I think, it is a common case not to route by tos. The good news is that for ipchains this is in->out traffic and may be there is only one tos value per path. Regards -- Julian Anastasov From davem@pizda.ninka.net Tue Dec 2 16:59:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 17:00:08 -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 hB30xsTa017690 for ; Tue, 2 Dec 2003 16:59:55 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id QAA04690; Tue, 2 Dec 2003 16:58:50 -0800 Date: Tue, 2 Dec 2003 16:58:50 -0800 From: "David S. Miller" To: Julian Anastasov Cc: netdev@oss.sgi.com, laforge@gnumonks.org Subject: Re: [2.6 PATCH] ipchains masquerade must select maddr correctly Message-Id: <20031202165850.3f8c16c4.davem@redhat.com> In-Reply-To: References: <20031202162208.04629dab.davem@redhat.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: 1853 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 Wed, 3 Dec 2003 02:50:56 +0200 (EET) Julian Anastasov wrote: > TOS matching and hash key should be > a sysctl/compile time option? It already is, CONFIG_IP_ROUTE_TOS. But the issue is that all dist vendors enable that. Also note that what you propose could potentially break some setups. From ja@ssi.bg Tue Dec 2 18:06:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 18:06:43 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB326ITa019786 for ; Tue, 2 Dec 2003 18:06:22 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB31h2ee009586; Wed, 3 Dec 2003 03:43:04 +0200 Date: Wed, 3 Dec 2003 03:43:02 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031202163902.2deb43a7.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1854 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Tue, 2 Dec 2003, David S. Miller wrote: > > - ip_rt_frag_needed now provides interface index > > I disagree with this. > > There is no connection between the route (and thus output > device) we used to send a packet and the interface on which > an ICMP for that packet comes back upon. Think assymetric > routes. Agreed. This is a very bad case for PMTUD. It can be even a multipath route with different PMTUs. > You changes mean that for routes with specific output interfaces, > we will ignore ICMPs for those routes that arrive on other interfaces > due to assymetric routing. They are already ignored because the oif is a hash key. With the current code I do not think we can find other oif values in the current row when the oif hash key is 0. With the changes, we are trying to walk the rows for oif=IIF and oif=0. We can not learn how many paths and oifs we have before the smallest pmtu that generates ICMPs. We are even not sure when the ICMP comes if the originating packet was routed with oif 0 or not 0. So, may be it is better to set the smallest pmtu for all these paths, for oif 0 as before and now for oif=IIF. About CONFIG_IP_ROUTE_TOS, why it is not propagated to the routing cache? Then for the fl4_tos value we will have only two cases, onlink or not onlink. In essence, I see it as defining IPTOS_RT_MASK to 0 when CONFIG_IP_ROUTE_TOS is not defined. If this is working it solves so many problems: cache size, PMTUD. Is it really so easy? CONFIG_IP_ROUTE_TOS disables tos match in rules and routes, so why we have to waste memory for the route cache when all these routes receive same path no matter the tos value? > Why don't you create a seperate patch that just has the TOS masking > changes? That's much less controversial and thus something I'm likely > to apply. ok, may be after some days for rethinking :) let me know for the final thoughts and I can create patch(es) after reading some standards. Regards -- Julian Anastasov From hadi@cyberus.ca Tue Dec 2 19:09:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 19:09:23 -0800 (PST) Received: from mail.cyberus.ca (mail.cyberus.ca [209.197.145.21]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3395Ta020844 for ; Tue, 2 Dec 2003 19:09:06 -0800 Received: from [216.209.86.2] (helo=[10.0.0.9]) by mail.cyberus.ca with esmtp (Exim 4.20) id 1AQvJ6-0006PF-0p; Mon, 01 Dec 2003 16:10:12 -0500 Subject: Re: Request: Allocate a Netlink Family Number for MPLS From: jamal Reply-To: hadi@cyberus.ca To: Ramon Casellas Cc: Christoph Hellwig , netdev@oss.sgi.com In-Reply-To: References: Content-Type: text/plain Organization: jamalopolis Message-Id: <1070313011.1107.39.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 01 Dec 2003 16:10:11 -0500 Content-Transfer-Encoding: 7bit X-archive-position: 1855 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@cyberus.ca Precedence: bulk X-list: netdev On Mon, 2003-12-01 at 14:26, Ramon Casellas wrote: > > Well, we are still coordinating efforts, and Jamal has some design docs > around... but regardless of the actual implementation, a mechanism to > communicate with userspace will be needed, and IM(Very, very)HO, netlink > is a good candidate, analog to rtnetlink, but this is open to discussion. > Please leave this alone because the code i have is taking care of this (i.e it uses netlink). And the grander plan is to use the same code for bridging and VLANs as well. I will share the code once James and everybody else reviews things. cheers, jamal From davem@pizda.ninka.net Tue Dec 2 19:46:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Dec 2003 19:46:37 -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 hB33kATa021533 for ; Tue, 2 Dec 2003 19:46:13 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id TAA05015; Tue, 2 Dec 2003 19:44:15 -0800 Date: Tue, 2 Dec 2003 19:44:15 -0800 From: "David S. Miller" To: Xose Vazquez Perez Cc: netdev@oss.sgi.com, jgarzik@pobox.com Subject: Re: Level One LXT1001 GE chip Message-Id: <20031202194415.076637f4.davem@redhat.com> In-Reply-To: <3FC616CE.2060208@wanadoo.es> References: <3FC3FB99.70700@wanadoo.es> <20031127010324.061cac3b.davem@redhat.com> <3FC616CE.2060208@wanadoo.es> 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: 1856 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, 27 Nov 2003 16:22:54 +0100 Xose Vazquez Perez wrote: > I thought that you already got homework, tg3TsoFwText > firmware ;-) 8-P~~~ Ok, I threw this together and I'll probably merge it upstream soon. (Jeff I'll take care of this and the bug tg3 fixes I worked on yesterday... this email is just a FYI) ===== drivers/net/tg3.c 1.116 vs edited ===== --- 1.116/drivers/net/tg3.c Tue Dec 2 02:35:11 2003 +++ edited/drivers/net/tg3.c Tue Dec 2 17:46:31 2003 @@ -2688,7 +2688,13 @@ mss |= (tsflags << 11); } } else { - mss += tcp_opt_len; + if (tcp_opt_len || skb->nh.iph->ihl > 5) { + int tsflags; + + tsflags = ((skb->nh.iph->ihl - 5) + + (tcp_opt_len >> 2)); + base_flags |= tsflags << 12; + } } } #else @@ -2895,7 +2901,13 @@ mss |= (tsflags << 11); } } else { - mss += tcp_opt_len; + if (tcp_opt_len || skb->nh.iph->ihl > 5) { + int tsflags; + + tsflags = ((skb->nh.iph->ihl - 5) + + (tcp_opt_len >> 2)); + base_flags |= tsflags << 12; + } } } #else @@ -3860,180 +3872,181 @@ #if TG3_TSO_SUPPORT != 0 #define TG3_TSO_FW_RELEASE_MAJOR 0x1 -#define TG3_TSO_FW_RELASE_MINOR 0x3 +#define TG3_TSO_FW_RELASE_MINOR 0x4 #define TG3_TSO_FW_RELEASE_FIX 0x0 #define TG3_TSO_FW_START_ADDR 0x08000000 #define TG3_TSO_FW_TEXT_ADDR 0x08000000 -#define TG3_TSO_FW_TEXT_LEN 0x1ac0 -#define TG3_TSO_FW_RODATA_ADDR 0x08001650 +#define TG3_TSO_FW_TEXT_LEN 0x1a90 +#define TG3_TSO_FW_RODATA_ADDR 0x08001a900 #define TG3_TSO_FW_RODATA_LEN 0x60 -#define TG3_TSO_FW_DATA_ADDR 0x080016a0 +#define TG3_TSO_FW_DATA_ADDR 0x08001b20 #define TG3_TSO_FW_DATA_LEN 0x20 -#define TG3_TSO_FW_SBSS_ADDR 0x080016c0 +#define TG3_TSO_FW_SBSS_ADDR 0x08001b40 #define TG3_TSO_FW_SBSS_LEN 0x2c -#define TG3_TSO_FW_BSS_ADDR 0x080016e0 -#define TG3_TSO_FW_BSS_LEN 0x890 +#define TG3_TSO_FW_BSS_ADDR 0x08001b70 +#define TG3_TSO_FW_BSS_LEN 0x894 static u32 tg3TsoFwText[] = { 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c1d0800, 0x37bd4000, 0x03a0f021, 0x3c100800, 0x26100000, 0x0e000010, 0x00000000, 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0x3c04fefe, - 0xafbf0018, 0x0e0005e0, 0x34840002, 0x0e000670, 0x00000000, 0x3c030800, - 0x90631b78, 0x24020002, 0x3c040800, 0x24841acc, 0x14620003, 0x24050001, - 0x3c040800, 0x24841ac0, 0x24060002, 0x00003821, 0xafa00010, 0x0e000684, + 0xafbf0018, 0x0e0005d4, 0x34840002, 0x0e000664, 0x00000000, 0x3c030800, + 0x90631b58, 0x24020002, 0x3c040800, 0x24841a9c, 0x14620003, 0x24050001, + 0x3c040800, 0x24841a90, 0x24060003, 0x00003821, 0xafa00010, 0x0e000678, 0xafa00014, 0x8f625c50, 0x34420001, 0xaf625c50, 0x8f625c90, 0x34420001, 0xaf625c90, 0x2402ffff, 0x0e000034, 0xaf625404, 0x8fbf0018, 0x03e00008, - 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf0018, - 0xafb10014, 0x0e000052, 0xafb00010, 0x24110001, 0x8f706820, 0x32020100, - 0x10400003, 0x00000000, 0x0e0000b2, 0x00000000, 0x8f706820, 0x32022000, - 0x10400004, 0x32020001, 0x0e0001e3, 0x24040001, 0x32020001, 0x10400003, - 0x00000000, 0x0e00009a, 0x00000000, 0x0a00003a, 0xaf715028, 0x8fbf0018, - 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800, - 0x24841ae0, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, - 0x0e000684, 0xafa00014, 0x3c040800, 0x248423e8, 0xa4800000, 0x3c010800, - 0xa0201ba8, 0x3c010800, 0xac201bac, 0x3c010800, 0xac201bb0, 0x3c010800, - 0xac201bb4, 0x3c010800, 0xac201bbc, 0x3c010800, 0xac201bc8, 0x3c010800, - 0xac201bcc, 0x8f624434, 0x3c010800, 0xac221b98, 0x8f624438, 0x3c010800, - 0xac221b9c, 0x8f624410, 0xac80f7a8, 0x3c010800, 0xac201b94, 0x3c010800, - 0xac2023f0, 0x3c010800, 0xac2023d8, 0x3c010800, 0xac2023dc, 0x3c010800, - 0xac202410, 0x3c010800, 0xac221ba0, 0x8f620068, 0x24030007, 0x00021702, - 0x10430005, 0x00000000, 0x8f620068, 0x00021702, 0x14400004, 0x24020001, - 0x3c010800, 0x0a00008e, 0xac20241c, 0xac820034, 0x3c040800, 0x24841aec, - 0x3c050800, 0x8ca5241c, 0x00003021, 0x00003821, 0xafa00010, 0x0e000684, - 0xafa00014, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800, - 0x24841af8, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, - 0x0e000684, 0xafa00014, 0x0e000052, 0x00000000, 0x0e0000ab, 0x00002021, - 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x24020001, 0x8f636820, 0x00821004, - 0x00021027, 0x00621824, 0x03e00008, 0xaf636820, 0x27bdffd0, 0xafbf002c, - 0xafb60028, 0xafb50024, 0xafb40020, 0xafb3001c, 0xafb20018, 0xafb10014, - 0xafb00010, 0x8f665c5c, 0x3c030800, 0x24631bcc, 0x8c620000, 0x14460005, - 0x3c0200ff, 0x3c020800, 0x90421ba8, 0x14400115, 0x3c0200ff, 0x3442fff8, - 0x00c28824, 0xac660000, 0x00111902, 0x306300ff, 0x30c20003, 0x000211c0, - 0x00623825, 0x00e02821, 0x00061602, 0x3c030800, 0x90631ba8, 0x3044000f, - 0x1460002b, 0x00804021, 0x24020001, 0x3c010800, 0xa0221ba8, 0x00071100, - 0x00821025, 0x3c010800, 0xac201bac, 0x3c010800, 0xac201bb0, 0x3c010800, - 0xac201bb4, 0x3c010800, 0xac201bbc, 0x3c010800, 0xac201bc8, 0x3c010800, - 0xac201bc0, 0x3c010800, 0xac201bc4, 0x3c010800, 0xa42223e8, 0x9623000c, - 0x30628000, 0x10400008, 0x30627fff, 0x2442003e, 0x3c010800, 0xa4221ba6, - 0x24020001, 0x3c010800, 0x0a0000f9, 0xac222404, 0x24620036, 0x3c010800, - 0xa4221ba6, 0x3c010800, 0xac202404, 0x3c010800, 0xac202400, 0x3c010800, - 0x0a000101, 0xac202408, 0x9622000c, 0x3c010800, 0xa42223fc, 0x3c040800, - 0x24841bac, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac311bd8, - 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac261bdc, 0x8c820000, - 0x24a30001, 0x306701ff, 0x00021100, 0x3c010800, 0x00220821, 0xac271be0, - 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac281be4, 0x96230008, - 0x3c020800, 0x8c421bbc, 0x00432821, 0x3c010800, 0xac251bbc, 0x9622000a, - 0x30420004, 0x14400018, 0x00071100, 0x8f630c14, 0x3063000f, 0x2c620002, - 0x1440000b, 0x3c02c000, 0x8f630c14, 0x3c020800, 0x8c421b50, 0x3063000f, - 0x24420001, 0x3c010800, 0xac221b50, 0x2c620002, 0x1040fff7, 0x3c02c000, - 0x00c21825, 0xaf635c5c, 0x8f625c50, 0x30420002, 0x10400014, 0x00000000, - 0x0a000133, 0x00000000, 0x3c030800, 0x8c631b90, 0x3c040800, 0x94841ba4, - 0x01021025, 0x3c010800, 0xa42223ea, 0x24020001, 0x3c010800, 0xac221bc8, - 0x24630001, 0x0085202a, 0x3c010800, 0x10800003, 0xac231b90, 0x3c010800, - 0xa4251ba4, 0x3c060800, 0x24c61bac, 0x8cc20000, 0x24420001, 0xacc20000, - 0x28420080, 0x14400005, 0x00000000, 0x0e00065e, 0x24040002, 0x0a0001d9, - 0x00000000, 0x3c020800, 0x8c421bc8, 0x1040007f, 0x24020001, 0x3c040800, - 0x90841ba8, 0x14820077, 0x24020003, 0x3c150800, 0x96b51ba6, 0x3c050800, - 0x8ca51bbc, 0x32a3ffff, 0x00a3102a, 0x14400073, 0x00000000, 0x14a30003, - 0x00000000, 0x3c010800, 0xac242400, 0x10600061, 0x00009021, 0x24d60004, - 0x0060a021, 0x24d30014, 0x8ec20000, 0x00028100, 0x3c110800, 0x02308821, - 0x0e00062d, 0x8e311bd8, 0x00403021, 0x10c00059, 0x00000000, 0x9628000a, - 0x31020040, 0x10400004, 0x2407180c, 0x8e22000c, 0x2407188c, 0xacc20018, - 0x31021000, 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, 0x00623825, - 0x3c030800, 0x00701821, 0x8c631be0, 0x3c020800, 0x00501021, 0x8c421be4, - 0x00031d00, 0x00021400, 0x00621825, 0xacc30014, 0x8ec30004, 0x96220008, - 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, 0x0282102a, 0x14400002, - 0x02b22823, 0x00802821, 0x8e620000, 0x30a4ffff, 0x00441021, 0xae620000, - 0x8e220000, 0xacc20000, 0x8e220004, 0x8e63fff4, 0x00431021, 0xacc20004, - 0xa4c5000e, 0x8e62fff4, 0x00441021, 0xae62fff4, 0x96230008, 0x0043102a, - 0x14400005, 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, 0xae62fff0, - 0xacc00008, 0x3242ffff, 0x14540008, 0x24020305, 0x31020080, 0x54400001, - 0x34e70010, 0x24020905, 0xa4c2000c, 0x0a0001bc, 0x34e70020, 0xa4c2000c, - 0x3c020800, 0x8c422400, 0x10400003, 0x3c024b65, 0x0a0001c4, 0x34427654, - 0x3c02b49a, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005aa, - 0x00c02021, 0x3242ffff, 0x0054102b, 0x1440ffa4, 0x00000000, 0x24020002, - 0x3c010800, 0x0a0001d9, 0xa0221ba8, 0x8ec2083c, 0x24420001, 0x0a0001d9, - 0xaec2083c, 0x14820003, 0x00000000, 0x0e0004b9, 0x00000000, 0x8fbf002c, + 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c, + 0xafb20018, 0xafb10014, 0x0e00005b, 0xafb00010, 0x24120002, 0x24110001, + 0x8f706820, 0x32020100, 0x10400003, 0x00000000, 0x0e0000bb, 0x00000000, + 0x8f706820, 0x32022000, 0x10400004, 0x32020001, 0x0e0001ef, 0x24040001, + 0x32020001, 0x10400003, 0x00000000, 0x0e0000a3, 0x00000000, 0x3c020800, + 0x90421b88, 0x14520003, 0x00000000, 0x0e0004bf, 0x00000000, 0x0a00003c, + 0xaf715028, 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, + 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ab0, 0x00002821, 0x00003021, + 0x00003821, 0xafbf0018, 0xafa00010, 0x0e000678, 0xafa00014, 0x3c040800, + 0x248423c8, 0xa4800000, 0x3c010800, 0xa0201b88, 0x3c010800, 0xac201b8c, + 0x3c010800, 0xac201b90, 0x3c010800, 0xac201b94, 0x3c010800, 0xac201b9c, + 0x3c010800, 0xac201ba8, 0x3c010800, 0xac201bac, 0x8f624434, 0x3c010800, + 0xac221b78, 0x8f624438, 0x3c010800, 0xac221b7c, 0x8f624410, 0xac80f7a8, + 0x3c010800, 0xac201b74, 0x3c010800, 0xac2023d0, 0x3c010800, 0xac2023b8, + 0x3c010800, 0xac2023bc, 0x3c010800, 0xac2023f0, 0x3c010800, 0xac221b80, + 0x8f620068, 0x24030007, 0x00021702, 0x10430005, 0x00000000, 0x8f620068, + 0x00021702, 0x14400004, 0x24020001, 0x3c010800, 0x0a000097, 0xac2023fc, + 0xac820034, 0x3c040800, 0x24841abc, 0x3c050800, 0x8ca523fc, 0x00003021, + 0x00003821, 0xafa00010, 0x0e000678, 0xafa00014, 0x8fbf0018, 0x03e00008, + 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ac8, 0x00002821, 0x00003021, + 0x00003821, 0xafbf0018, 0xafa00010, 0x0e000678, 0xafa00014, 0x0e00005b, + 0x00000000, 0x0e0000b4, 0x00002021, 0x8fbf0018, 0x03e00008, 0x27bd0020, + 0x24020001, 0x8f636820, 0x00821004, 0x00021027, 0x00621824, 0x03e00008, + 0xaf636820, 0x27bdffd0, 0xafbf002c, 0xafb60028, 0xafb50024, 0xafb40020, + 0xafb3001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x8f675c5c, 0x3c030800, + 0x24631bac, 0x8c620000, 0x14470005, 0x3c0200ff, 0x3c020800, 0x90421b88, + 0x14400118, 0x3c0200ff, 0x3442fff8, 0x00e28824, 0xac670000, 0x00111902, + 0x306300ff, 0x30e20003, 0x000211c0, 0x00622825, 0x00a04021, 0x00071602, + 0x3c030800, 0x90631b88, 0x3044000f, 0x14600036, 0x00804821, 0x24020001, + 0x3c010800, 0xa0221b88, 0x00051100, 0x00821025, 0x3c010800, 0xac201b8c, + 0x3c010800, 0xac201b90, 0x3c010800, 0xac201b94, 0x3c010800, 0xac201b9c, + 0x3c010800, 0xac201ba8, 0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4, + 0x3c010800, 0xa42223c8, 0x9622000c, 0x30437fff, 0x3c010800, 0xa4222400, + 0x30428000, 0x3c010800, 0xa4231bb6, 0x10400005, 0x24020001, 0x3c010800, + 0xac2223e4, 0x0a000102, 0x2406003e, 0x24060036, 0x3c010800, 0xac2023e4, + 0x9622000a, 0x3c030800, 0x94631bb6, 0x3c010800, 0xac2023e0, 0x3c010800, + 0xac2023e8, 0x00021302, 0x00021080, 0x00c21021, 0x00621821, 0x3c010800, + 0xa42223c0, 0x3c010800, 0x0a000115, 0xa4231b86, 0x9622000c, 0x3c010800, + 0xa42223dc, 0x3c040800, 0x24841b8c, 0x8c820000, 0x00021100, 0x3c010800, + 0x00220821, 0xac311bb8, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, + 0xac271bbc, 0x8c820000, 0x25030001, 0x306601ff, 0x00021100, 0x3c010800, + 0x00220821, 0xac261bc0, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, + 0xac291bc4, 0x96230008, 0x3c020800, 0x8c421b9c, 0x00432821, 0x3c010800, + 0xac251b9c, 0x9622000a, 0x30420004, 0x14400018, 0x00061100, 0x8f630c14, + 0x3063000f, 0x2c620002, 0x1440000b, 0x3c02c000, 0x8f630c14, 0x3c020800, + 0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30, 0x2c620002, + 0x1040fff7, 0x3c02c000, 0x00e21825, 0xaf635c5c, 0x8f625c50, 0x30420002, + 0x10400014, 0x00000000, 0x0a000147, 0x00000000, 0x3c030800, 0x8c631b70, + 0x3c040800, 0x94841b84, 0x01221025, 0x3c010800, 0xa42223ca, 0x24020001, + 0x3c010800, 0xac221ba8, 0x24630001, 0x0085202a, 0x3c010800, 0x10800003, + 0xac231b70, 0x3c010800, 0xa4251b84, 0x3c060800, 0x24c61b8c, 0x8cc20000, + 0x24420001, 0xacc20000, 0x28420080, 0x14400005, 0x00000000, 0x0e000652, + 0x24040002, 0x0a0001e5, 0x00000000, 0x3c020800, 0x8c421ba8, 0x10400077, + 0x24020001, 0x3c050800, 0x90a51b88, 0x14a20071, 0x00000000, 0x3c150800, + 0x96b51b86, 0x3c040800, 0x8c841b9c, 0x32a3ffff, 0x0083102a, 0x1440006b, + 0x00000000, 0x14830003, 0x00000000, 0x3c010800, 0xac2523e0, 0x1060005b, + 0x00009021, 0x24d60004, 0x0060a021, 0x24d30014, 0x8ec20000, 0x00028100, + 0x3c110800, 0x02308821, 0x0e000621, 0x8e311bb8, 0x00402821, 0x10a00053, + 0x00000000, 0x9628000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e22000c, + 0x2407188c, 0xaca20018, 0x3c030800, 0x00701821, 0x8c631bc0, 0x3c020800, + 0x00501021, 0x8c421bc4, 0x00031d00, 0x00021400, 0x00621825, 0xaca30014, + 0x8ec30004, 0x96220008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, + 0x0282102a, 0x14400002, 0x02b23023, 0x00803021, 0x8e620000, 0x30c4ffff, + 0x00441021, 0xae620000, 0x8e220000, 0xaca20000, 0x8e220004, 0x8e63fff4, + 0x00431021, 0xaca20004, 0xa4a6000e, 0x8e62fff4, 0x00441021, 0xae62fff4, + 0x96230008, 0x0043102a, 0x14400005, 0x02469021, 0x8e62fff0, 0xae60fff4, + 0x24420001, 0xae62fff0, 0xaca00008, 0x3242ffff, 0x14540008, 0x24020305, + 0x31020080, 0x54400001, 0x34e70010, 0x24020905, 0xa4a2000c, 0x0a0001ca, + 0x34e70020, 0xa4a2000c, 0x3c020800, 0x8c4223e0, 0x10400003, 0x3c024b65, + 0x0a0001d2, 0x34427654, 0x3c02b49a, 0x344289ab, 0xaca2001c, 0x30e2ffff, + 0xaca20010, 0x0e00059f, 0x00a02021, 0x3242ffff, 0x0054102b, 0x1440ffaa, + 0x00000000, 0x24020002, 0x3c010800, 0x0a0001e5, 0xa0221b88, 0x8ec2083c, + 0x24420001, 0x0a0001e5, 0xaec2083c, 0x0e0004bf, 0x00000000, 0x8fbf002c, 0x8fb60028, 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0030, 0x27bdffd0, 0xafbf0028, 0xafb30024, 0xafb20020, 0xafb1001c, 0xafb00018, 0x8f725c9c, 0x3c0200ff, 0x3442fff8, - 0x3c060800, 0x24c61bc4, 0x02428824, 0x9623000e, 0x8cc20000, 0x00431021, - 0xacc20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821, 0x0e000643, + 0x3c060800, 0x24c61ba4, 0x02428824, 0x9623000e, 0x8cc20000, 0x00431021, + 0xacc20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821, 0x0e000637, 0x02202021, 0x3c02c000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x10400121, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1040011c, - 0x00000000, 0x0a000200, 0x00000000, 0x8e240008, 0x8e230014, 0x00041402, + 0x00000000, 0x0a00020c, 0x00000000, 0x8e240008, 0x8e230014, 0x00041402, 0x000241c0, 0x00031502, 0x304201ff, 0x2442ffff, 0x3042007f, 0x00031942, 0x30637800, 0x00021100, 0x24424000, 0x00625021, 0x9542000a, 0x3084ffff, - 0x30420008, 0x104000b3, 0x000429c0, 0x3c020800, 0x8c422410, 0x1440002d, - 0x25050008, 0x95020014, 0x3c010800, 0xa42223e0, 0x8d070010, 0x00071402, - 0x3c010800, 0xa42223e2, 0x3c010800, 0xa42723e4, 0x9502000e, 0x30e3ffff, - 0x00431023, 0x3c010800, 0xac222418, 0x8f626800, 0x3c030010, 0x00431024, - 0x10400005, 0x00000000, 0x9503001a, 0x9502001c, 0x0a000235, 0x00431021, - 0x9502001a, 0x3c010800, 0xac22240c, 0x3c02c000, 0x02421825, 0x3c010800, - 0xac282410, 0x3c010800, 0xac322414, 0xaf635c9c, 0x8f625c90, 0x30420002, + 0x30420008, 0x104000b3, 0x000429c0, 0x3c020800, 0x8c4223f0, 0x1440002d, + 0x25050008, 0x95020014, 0x3c010800, 0xa42223c0, 0x8d070010, 0x00071402, + 0x3c010800, 0xa42223c2, 0x3c010800, 0xa42723c4, 0x9502000e, 0x30e3ffff, + 0x00431023, 0x3c010800, 0xac2223f8, 0x8f626800, 0x3c030010, 0x00431024, + 0x10400005, 0x00000000, 0x9503001a, 0x9502001c, 0x0a000241, 0x00431021, + 0x9502001a, 0x3c010800, 0xac2223ec, 0x3c02c000, 0x02421825, 0x3c010800, + 0xac2823f0, 0x3c010800, 0xac3223f4, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000df, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000da, - 0x00000000, 0x0a000242, 0x00000000, 0x9502000e, 0x3c030800, 0x946323e4, + 0x00000000, 0x0a00024e, 0x00000000, 0x9502000e, 0x3c030800, 0x946323c4, 0x00434823, 0x3123ffff, 0x2c620008, 0x1040001c, 0x00000000, 0x95020014, 0x24420028, 0x00a22821, 0x00031042, 0x1840000b, 0x00002021, 0x24c60848, 0x00403821, 0x94a30000, 0x8cc20000, 0x24840001, 0x00431021, 0xacc20000, 0x0087102a, 0x1440fff9, 0x24a50002, 0x31220001, 0x1040001f, 0x3c024000, - 0x3c040800, 0x2484240c, 0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021, - 0x0a000281, 0xac820000, 0x8f626800, 0x3c030010, 0x00431024, 0x10400009, - 0x00000000, 0x9502001a, 0x3c030800, 0x8c63240c, 0x00431021, 0x3c010800, - 0xac22240c, 0x0a000282, 0x3c024000, 0x9502001a, 0x9504001c, 0x3c030800, - 0x8c63240c, 0x00441023, 0x00621821, 0x3c010800, 0xac23240c, 0x3c024000, + 0x3c040800, 0x248423ec, 0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021, + 0x0a00028d, 0xac820000, 0x8f626800, 0x3c030010, 0x00431024, 0x10400009, + 0x00000000, 0x9502001a, 0x3c030800, 0x8c6323ec, 0x00431021, 0x3c010800, + 0xac2223ec, 0x0a00028e, 0x3c024000, 0x9502001a, 0x9504001c, 0x3c030800, + 0x8c6323ec, 0x00441023, 0x00621821, 0x3c010800, 0xac2323ec, 0x3c024000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, - 0x9542000a, 0x30420010, 0x10400095, 0x00000000, 0x3c060800, 0x24c62410, - 0x3c020800, 0x944223e4, 0x8cc50000, 0x3c040800, 0x8c842418, 0x24420030, - 0x00a22821, 0x94a20004, 0x3c030800, 0x8c63240c, 0x00441023, 0x00621821, + 0x9542000a, 0x30420010, 0x10400095, 0x00000000, 0x3c060800, 0x24c623f0, + 0x3c020800, 0x944223c4, 0x8cc50000, 0x3c040800, 0x8c8423f8, 0x24420030, + 0x00a22821, 0x94a20004, 0x3c030800, 0x8c6323ec, 0x00441023, 0x00621821, 0x00603821, 0x00032402, 0x30e2ffff, 0x00823821, 0x00071402, 0x00e23821, - 0x00071027, 0x3c010800, 0xac23240c, 0xa4a20006, 0x3c030800, 0x8c632414, + 0x00071027, 0x3c010800, 0xac2323ec, 0xa4a20006, 0x3c030800, 0x8c6323f4, 0x3c0200ff, 0x3442fff8, 0x00628824, 0x96220008, 0x24040001, 0x24034000, 0x000241c0, 0x00e01021, 0xa502001a, 0xa500001c, 0xacc00000, 0x3c010800, - 0xac241b70, 0xaf635cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000, - 0x3c010800, 0xac201b70, 0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002, - 0x10400003, 0x00000000, 0x3c010800, 0xac201b70, 0x3c020800, 0x8c421b70, - 0x1040ffec, 0x00000000, 0x3c040800, 0x0e000643, 0x8c842414, 0x0a000320, - 0x00000000, 0x3c030800, 0x90631ba8, 0x24020002, 0x14620003, 0x3c034b65, - 0x0a0002d7, 0x00008021, 0x8e22001c, 0x34637654, 0x10430002, 0x24100002, - 0x24100001, 0x01002021, 0x0e000346, 0x02003021, 0x24020003, 0x3c010800, - 0xa0221ba8, 0x24020002, 0x1202000a, 0x24020001, 0x3c030800, 0x8c632400, - 0x10620006, 0x00000000, 0x3c020800, 0x944223e8, 0x00021400, 0x0a000315, - 0xae220014, 0x3c040800, 0x248423ea, 0x94820000, 0x00021400, 0xae220014, - 0x3c020800, 0x8c421bcc, 0x3c03c000, 0x3c010800, 0xa0201ba8, 0x00431025, + 0xac241b50, 0xaf635cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000, + 0x3c010800, 0xac201b50, 0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002, + 0x10400003, 0x00000000, 0x3c010800, 0xac201b50, 0x3c020800, 0x8c421b50, + 0x1040ffec, 0x00000000, 0x3c040800, 0x0e000637, 0x8c8423f4, 0x0a00032c, + 0x00000000, 0x3c030800, 0x90631b88, 0x24020002, 0x14620003, 0x3c034b65, + 0x0a0002e3, 0x00008021, 0x8e22001c, 0x34637654, 0x10430002, 0x24100002, + 0x24100001, 0x01002021, 0x0e000352, 0x02003021, 0x24020003, 0x3c010800, + 0xa0221b88, 0x24020002, 0x1202000a, 0x24020001, 0x3c030800, 0x8c6323e0, + 0x10620006, 0x00000000, 0x3c020800, 0x944223c8, 0x00021400, 0x0a000321, + 0xae220014, 0x3c040800, 0x248423ca, 0x94820000, 0x00021400, 0xae220014, + 0x3c020800, 0x8c421bac, 0x3c03c000, 0x3c010800, 0xa0201b88, 0x00431025, 0xaf625c5c, 0x8f625c50, 0x30420002, 0x10400009, 0x00000000, 0x2484f7e2, 0x8c820000, 0x00431025, 0xaf625c5c, 0x8f625c50, 0x30420002, 0x1440fffa, - 0x00000000, 0x3c020800, 0x24421b94, 0x8c430000, 0x24630001, 0xac430000, + 0x00000000, 0x3c020800, 0x24421b74, 0x8c430000, 0x24630001, 0xac430000, 0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000c, 0x3c024000, 0x8f630c14, - 0x3c020800, 0x8c421b50, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b50, + 0x3c020800, 0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30, 0x2c620002, 0x1040fff7, 0x00000000, 0x3c024000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, 0x12600003, 0x00000000, - 0x0e0004b9, 0x00000000, 0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c, - 0x8fb00018, 0x03e00008, 0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b98, + 0x0e0004bf, 0x00000000, 0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c, + 0x8fb00018, 0x03e00008, 0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b78, 0x8c820000, 0x00031c02, 0x0043102b, 0x14400007, 0x3c038000, 0x8c840004, 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3c024000, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00805821, - 0x14c00017, 0x256e0008, 0x3c020800, 0x8c422404, 0x1040000a, 0x2402003e, - 0x3c010800, 0xa42223e0, 0x24020016, 0x3c010800, 0xa42223e2, 0x2402002a, - 0x3c010800, 0x0a000360, 0xa42223e4, 0x95620014, 0x3c010800, 0xa42223e0, - 0x8d670010, 0x00071402, 0x3c010800, 0xa42223e2, 0x3c010800, 0xa42723e4, - 0x3c040800, 0x948423e4, 0x3c030800, 0x946323e2, 0x95cf0006, 0x3c020800, - 0x944223e0, 0x00832023, 0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821, + 0x14c00011, 0x256e0008, 0x3c020800, 0x8c4223e4, 0x10400007, 0x24020016, + 0x3c010800, 0xa42223c2, 0x2402002a, 0x3c010800, 0x0a000366, 0xa42223c4, + 0x8d670010, 0x00071402, 0x3c010800, 0xa42223c2, 0x3c010800, 0xa42723c4, + 0x3c040800, 0x948423c4, 0x3c030800, 0x946323c2, 0x95cf0006, 0x3c020800, + 0x944223c0, 0x00832023, 0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821, 0x3082ffff, 0x14c0001a, 0x01226021, 0x9582000c, 0x3042003f, 0x3c010800, - 0xa42223e6, 0x95820004, 0x95830006, 0x3c010800, 0xac2023f4, 0x3c010800, - 0xac2023f8, 0x00021400, 0x00431025, 0x3c010800, 0xac221bd0, 0x95220004, - 0x3c010800, 0xa4221bd4, 0x95230002, 0x01e51023, 0x0043102a, 0x10400010, - 0x24020001, 0x3c010800, 0x0a000394, 0xac222408, 0x3c030800, 0x8c6323f8, - 0x3c020800, 0x94421bd4, 0x00431021, 0xa5220004, 0x3c020800, 0x94421bd0, - 0xa5820004, 0x3c020800, 0x8c421bd0, 0xa5820006, 0x3c020800, 0x8c422400, - 0x3c0d0800, 0x8dad23f4, 0x3c0a0800, 0x144000e5, 0x8d4a23f8, 0x3c020800, - 0x94421bd4, 0x004a1821, 0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d, - 0x01435023, 0x3c020800, 0x944223e6, 0x30420009, 0x10400008, 0x00000000, - 0x9582000c, 0x3042fff6, 0xa582000c, 0x3c020800, 0x944223e6, 0x30420009, - 0x01a26823, 0x3c020800, 0x8c422408, 0x1040004a, 0x01203821, 0x3c020800, - 0x944223e2, 0x00004021, 0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff, + 0xa42223c6, 0x95820004, 0x95830006, 0x3c010800, 0xac2023d4, 0x3c010800, + 0xac2023d8, 0x00021400, 0x00431025, 0x3c010800, 0xac221bb0, 0x95220004, + 0x3c010800, 0xa4221bb4, 0x95230002, 0x01e51023, 0x0043102a, 0x10400010, + 0x24020001, 0x3c010800, 0x0a00039a, 0xac2223e8, 0x3c030800, 0x8c6323d8, + 0x3c020800, 0x94421bb4, 0x00431021, 0xa5220004, 0x3c020800, 0x94421bb0, + 0xa5820004, 0x3c020800, 0x8c421bb0, 0xa5820006, 0x3c020800, 0x8c4223e0, + 0x3c0d0800, 0x8dad23d4, 0x3c0a0800, 0x144000e5, 0x8d4a23d8, 0x3c020800, + 0x94421bb4, 0x004a1821, 0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d, + 0x01435023, 0x3c020800, 0x944223c6, 0x30420009, 0x10400008, 0x00000000, + 0x9582000c, 0x3042fff6, 0xa582000c, 0x3c020800, 0x944223c6, 0x30420009, + 0x01a26823, 0x3c020800, 0x8c4223e8, 0x1040004a, 0x01203821, 0x3c020800, + 0x944223c2, 0x00004021, 0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff, 0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, @@ -4044,131 +4057,127 @@ 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008, 0x0109102a, 0x1440fff3, 0x00000000, 0x30820001, 0x10400005, 0x00061c02, 0xa0e00001, 0x94e20000, 0x00c23021, 0x00061c02, - 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x0a000479, 0x30c6ffff, - 0x24020002, 0x14c20081, 0x00000000, 0x3c020800, 0x8c42241c, 0x14400007, - 0x00000000, 0x3c020800, 0x944223e2, 0x95230002, 0x01e21023, 0x10620077, - 0x00000000, 0x3c020800, 0x944223e2, 0x01e21023, 0xa5220002, 0x3c020800, - 0x8c42241c, 0x1040001a, 0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421ba6, + 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x0a00047f, 0x30c6ffff, + 0x24020002, 0x14c20081, 0x00000000, 0x3c020800, 0x8c4223fc, 0x14400007, + 0x00000000, 0x3c020800, 0x944223c2, 0x95230002, 0x01e21023, 0x10620077, + 0x00000000, 0x3c020800, 0x944223c2, 0x01e21023, 0xa5220002, 0x3c020800, + 0x8c4223fc, 0x1040001a, 0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421b86, 0x00e04021, 0x00072c02, 0x00aa2021, 0x00431023, 0x00823823, 0x00072402, 0x30e2ffff, 0x00823821, 0x00071027, 0xa522000a, 0x3102ffff, 0x3c040800, - 0x948423e4, 0x00453023, 0x00e02821, 0x00641823, 0x006d1821, 0x00c33021, - 0x00061c02, 0x30c2ffff, 0x0a000479, 0x00623021, 0x01203821, 0x00004021, + 0x948423c4, 0x00453023, 0x00e02821, 0x00641823, 0x006d1821, 0x00c33021, + 0x00061c02, 0x30c2ffff, 0x0a00047f, 0x00623021, 0x01203821, 0x00004021, 0x3082ffff, 0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, 0x00003021, 0x2527000c, 0x00004021, 0x94e20000, 0x25080001, 0x00c23021, 0x2d020004, 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021, 0x91230009, 0x00442023, 0x01803821, 0x3082ffff, 0xa4e00010, 0x3c040800, - 0x948423e4, 0x00621821, 0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021, - 0x00061c02, 0x3c020800, 0x944223e0, 0x00c34821, 0x00441023, 0x00021fc2, + 0x948423c4, 0x00621821, 0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021, + 0x00061c02, 0x3c020800, 0x944223c0, 0x00c34821, 0x00441023, 0x00021fc2, 0x00431021, 0x00021043, 0x18400010, 0x00003021, 0x00402021, 0x94e20000, 0x24e70002, 0x00c23021, 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008, 0x0104102a, 0x1440fff3, - 0x00000000, 0x3c020800, 0x944223fc, 0x00c23021, 0x3122ffff, 0x00c23021, + 0x00000000, 0x3c020800, 0x944223dc, 0x00c23021, 0x3122ffff, 0x00c23021, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021, - 0x00061027, 0xa5820010, 0xadc00014, 0x0a000499, 0xadc00000, 0x8dc70010, + 0x00061027, 0xa5820010, 0xadc00014, 0x0a00049f, 0xadc00000, 0x8dc70010, 0x00e04021, 0x11400007, 0x00072c02, 0x00aa3021, 0x00061402, 0x30c3ffff, 0x00433021, 0x00061402, 0x00c22821, 0x00051027, 0xa522000a, 0x3c030800, - 0x946323e4, 0x3102ffff, 0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02, + 0x946323c4, 0x3102ffff, 0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021, 0x00061027, 0xa5820010, 0x3102ffff, 0x00051c00, 0x00431025, 0xadc20010, 0x3c020800, - 0x8c422404, 0x10400002, 0x25e2fff2, 0xa5c20034, 0x3c020800, 0x8c4223f8, - 0x3c040800, 0x8c8423f4, 0x24420001, 0x3c010800, 0xac2223f8, 0x3c020800, - 0x8c421bd0, 0x3303ffff, 0x00832021, 0x3c010800, 0xac2423f4, 0x00431821, - 0x0062102b, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223f4, 0x3c010800, - 0xac231bd0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800, 0x24a51ba8, + 0x8c4223e4, 0x10400002, 0x25e2fff2, 0xa5c20034, 0x3c020800, 0x8c4223d8, + 0x3c040800, 0x8c8423d4, 0x24420001, 0x3c010800, 0xac2223d8, 0x3c020800, + 0x8c421bb0, 0x3303ffff, 0x00832021, 0x3c010800, 0xac2423d4, 0x00431821, + 0x0062102b, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223d4, 0x3c010800, + 0xac231bb0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800, 0x24a51b86, 0xafbf0044, 0xafbe0040, 0xafb7003c, 0xafb60038, 0xafb50034, 0xafb40030, - 0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x90a30000, 0x24020003, - 0x146200d5, 0x00000000, 0x3c090800, 0x95291ba6, 0x3c020800, 0x944223e0, - 0x3c030800, 0x8c631bc0, 0x3c040800, 0x8c841bbc, 0x01221023, 0x0064182a, - 0xa7a9001e, 0x106000c8, 0xa7a20016, 0x24be0020, 0x97b6001e, 0x24b30018, - 0x24b70014, 0x8fc20000, 0x14400008, 0x00000000, 0x8fc2fff8, 0x97a30016, - 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000ba, 0x00000000, 0x97d50818, - 0x32a2ffff, 0x104000ad, 0x00009021, 0x0040a021, 0x00008821, 0x0e00062d, - 0x00000000, 0x00403021, 0x14c00007, 0x00000000, 0x3c020800, 0x8c4223ec, - 0x24420001, 0x3c010800, 0x0a00059e, 0xac2223ec, 0x3c100800, 0x02118021, - 0x8e101bd8, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c, - 0x2407188c, 0xacc20018, 0x31021000, 0x10400004, 0x34e32000, 0x00081040, - 0x3042c000, 0x00623825, 0x31020080, 0x54400001, 0x34e70010, 0x3c020800, - 0x00511021, 0x8c421be0, 0x3c030800, 0x00711821, 0x8c631be4, 0x00021500, - 0x00031c00, 0x00431025, 0xacc20014, 0x96040008, 0x3242ffff, 0x00821021, - 0x0282102a, 0x14400002, 0x02b22823, 0x00802821, 0x8e020000, 0x02459021, - 0xacc20000, 0x8e020004, 0x00c02021, 0x26310010, 0xac820004, 0x30e2ffff, - 0xac800008, 0xa485000e, 0xac820010, 0x24020305, 0x0e0005aa, 0xa482000c, - 0x3242ffff, 0x0054102b, 0x1440ffc0, 0x3242ffff, 0x0a000596, 0x00000000, - 0x8e620000, 0x8e63fffc, 0x0043102a, 0x1040006c, 0x00000000, 0x8e62fff0, - 0x00028900, 0x3c100800, 0x02118021, 0x0e00062d, 0x8e101bd8, 0x00403021, - 0x14c00005, 0x00000000, 0x8e62082c, 0x24420001, 0x0a00059e, 0xae62082c, - 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c, 0x2407188c, - 0xacc20018, 0x31021000, 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, - 0x00623825, 0x3c020800, 0x00511021, 0x8c421be0, 0x3c030800, 0x00711821, - 0x8c631be4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014, 0x8e63fff4, - 0x96020008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, 0x02c2102a, - 0x10400003, 0x00802821, 0x97a9001e, 0x01322823, 0x8e620000, 0x30a4ffff, - 0x00441021, 0xae620000, 0xa4c5000e, 0x8e020000, 0xacc20000, 0x8e020004, - 0x8e63fff4, 0x00431021, 0xacc20004, 0x8e63fff4, 0x96020008, 0x00641821, - 0x0062102a, 0x14400006, 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, - 0x0a000579, 0xae62fff0, 0xae63fff4, 0xacc00008, 0x3242ffff, 0x10560003, - 0x31020004, 0x10400006, 0x24020305, 0x31020080, 0x54400001, 0x34e70010, - 0x34e70020, 0x24020905, 0xa4c2000c, 0x8ee30000, 0x8ee20004, 0x14620007, - 0x3c02b49a, 0x8ee20860, 0x54400001, 0x34e70400, 0x3c024b65, 0x0a000590, - 0x34427654, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005aa, - 0x00c02021, 0x3242ffff, 0x0056102b, 0x1440ff96, 0x00000000, 0x8e620000, - 0x8e63fffc, 0x0043102a, 0x1440ff3e, 0x00000000, 0x8fbf0044, 0x8fbe0040, - 0x8fb7003c, 0x8fb60038, 0x8fb50034, 0x8fb40030, 0x8fb3002c, 0x8fb20028, - 0x8fb10024, 0x8fb00020, 0x03e00008, 0x27bd0048, 0x27bdffe8, 0xafbf0014, - 0xafb00010, 0x8f624450, 0x8f634410, 0x0a0005b9, 0x00808021, 0x8f626820, - 0x30422000, 0x10400003, 0x00000000, 0x0e0001e3, 0x00002021, 0x8f624450, - 0x8f634410, 0x3042ffff, 0x0043102b, 0x1440fff5, 0x00000000, 0x8f630c14, - 0x3063000f, 0x2c620002, 0x1440000b, 0x00000000, 0x8f630c14, 0x3c020800, - 0x8c421b50, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b50, 0x2c620002, - 0x1040fff7, 0x00000000, 0xaf705c18, 0x8f625c10, 0x30420002, 0x10400009, - 0x00000000, 0x8f626820, 0x30422000, 0x1040fff8, 0x00000000, 0x0e0001e3, - 0x00002021, 0x0a0005cc, 0x00000000, 0x8fbf0014, 0x8fb00010, 0x03e00008, - 0x27bd0018, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000, + 0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x94a90000, 0x3c020800, + 0x944223c0, 0x3c030800, 0x8c631ba0, 0x3c040800, 0x8c841b9c, 0x01221023, + 0x0064182a, 0xa7a9001e, 0x106000bc, 0xa7a20016, 0x24be0022, 0x97b6001e, + 0x24b3001a, 0x24b70016, 0x8fc20000, 0x14400008, 0x00000000, 0x8fc2fff8, + 0x97a30016, 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000ae, 0x00000000, + 0x97d50818, 0x32a2ffff, 0x104000a1, 0x00009021, 0x0040a021, 0x00008821, + 0x0e000621, 0x00000000, 0x00403021, 0x14c00007, 0x00000000, 0x3c020800, + 0x8c4223cc, 0x24420001, 0x3c010800, 0x0a000593, 0xac2223cc, 0x3c100800, + 0x02118021, 0x8e101bb8, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, + 0x8e02000c, 0x2407188c, 0xacc20018, 0x31020080, 0x54400001, 0x34e70010, + 0x3c020800, 0x00511021, 0x8c421bc0, 0x3c030800, 0x00711821, 0x8c631bc4, + 0x00021500, 0x00031c00, 0x00431025, 0xacc20014, 0x96040008, 0x3242ffff, + 0x00821021, 0x0282102a, 0x14400002, 0x02b22823, 0x00802821, 0x8e020000, + 0x02459021, 0xacc20000, 0x8e020004, 0x00c02021, 0x26310010, 0xac820004, + 0x30e2ffff, 0xac800008, 0xa485000e, 0xac820010, 0x24020305, 0x0e00059f, + 0xa482000c, 0x3242ffff, 0x0054102b, 0x1440ffc6, 0x3242ffff, 0x0a00058b, + 0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a, 0x10400066, 0x00000000, + 0x8e62fff0, 0x00028900, 0x3c100800, 0x02118021, 0x0e000621, 0x8e101bb8, + 0x00403021, 0x14c00005, 0x00000000, 0x8e62082c, 0x24420001, 0x0a000593, + 0xae62082c, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c, + 0x2407188c, 0xacc20018, 0x3c020800, 0x00511021, 0x8c421bc0, 0x3c030800, + 0x00711821, 0x8c631bc4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014, + 0x8e63fff4, 0x96020008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, + 0x02c2102a, 0x10400003, 0x00802821, 0x97a9001e, 0x01322823, 0x8e620000, + 0x30a4ffff, 0x00441021, 0xae620000, 0xa4c5000e, 0x8e020000, 0xacc20000, + 0x8e020004, 0x8e63fff4, 0x00431021, 0xacc20004, 0x8e63fff4, 0x96020008, + 0x00641821, 0x0062102a, 0x14400006, 0x02459021, 0x8e62fff0, 0xae60fff4, + 0x24420001, 0x0a00056e, 0xae62fff0, 0xae63fff4, 0xacc00008, 0x3242ffff, + 0x10560003, 0x31020004, 0x10400006, 0x24020305, 0x31020080, 0x54400001, + 0x34e70010, 0x34e70020, 0x24020905, 0xa4c2000c, 0x8ee30000, 0x8ee20004, + 0x14620007, 0x3c02b49a, 0x8ee20860, 0x54400001, 0x34e70400, 0x3c024b65, + 0x0a000585, 0x34427654, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010, + 0x0e00059f, 0x00c02021, 0x3242ffff, 0x0056102b, 0x1440ff9c, 0x00000000, + 0x8e620000, 0x8e63fffc, 0x0043102a, 0x1440ff4a, 0x00000000, 0x8fbf0044, + 0x8fbe0040, 0x8fb7003c, 0x8fb60038, 0x8fb50034, 0x8fb40030, 0x8fb3002c, + 0x8fb20028, 0x8fb10024, 0x8fb00020, 0x03e00008, 0x27bd0048, 0x27bdffe8, + 0xafbf0014, 0xafb00010, 0x8f624450, 0x8f634410, 0x0a0005ae, 0x00808021, + 0x8f626820, 0x30422000, 0x10400003, 0x00000000, 0x0e0001ef, 0x00002021, + 0x8f624450, 0x8f634410, 0x3042ffff, 0x0043102b, 0x1440fff5, 0x00000000, + 0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000b, 0x00000000, 0x8f630c14, + 0x3c020800, 0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30, + 0x2c620002, 0x1040fff7, 0x00000000, 0xaf705c18, 0x8f625c10, 0x30420002, + 0x10400009, 0x00000000, 0x8f626820, 0x30422000, 0x1040fff8, 0x00000000, + 0x0e0001ef, 0x00002021, 0x0a0005c1, 0x00000000, 0x8fbf0014, 0x8fb00010, + 0x03e00008, 0x27bd0018, 0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010, 0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804, - 0x8f634000, 0x24020b50, 0x3c010800, 0xac221b64, 0x24020b78, 0x3c010800, - 0xac221b74, 0x34630002, 0xaf634000, 0x0e00060d, 0x00808021, 0x3c010800, - 0xa0221b78, 0x304200ff, 0x24030002, 0x14430005, 0x00000000, 0x3c020800, - 0x8c421b64, 0x0a000600, 0xac5000c0, 0x3c020800, 0x8c421b64, 0xac5000bc, - 0x8f624434, 0x8f634438, 0x8f644410, 0x3c010800, 0xac221b6c, 0x3c010800, - 0xac231b7c, 0x3c010800, 0xac241b68, 0x8fbf0014, 0x8fb00010, 0x03e00008, + 0x8f634000, 0x24020b50, 0x3c010800, 0xac221b44, 0x24020b78, 0x3c010800, + 0xac221b54, 0x34630002, 0xaf634000, 0x0e000601, 0x00808021, 0x3c010800, + 0xa0221b58, 0x304200ff, 0x24030002, 0x14430005, 0x00000000, 0x3c020800, + 0x8c421b44, 0x0a0005f4, 0xac5000c0, 0x3c020800, 0x8c421b44, 0xac5000bc, + 0x8f624434, 0x8f634438, 0x8f644410, 0x3c010800, 0xac221b4c, 0x3c010800, + 0xac231b5c, 0x3c010800, 0xac241b48, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c040800, 0x8c870000, 0x3c03aa55, 0x3463aa55, 0x3c06c003, 0xac830000, 0x8cc20000, 0x14430007, 0x24050002, 0x3c0355aa, 0x346355aa, 0xac830000, 0x8cc20000, 0x50430001, 0x24050001, 0x3c020800, 0xac470000, 0x03e00008, 0x00a01021, 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c, 0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9, - 0x00000000, 0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b6c, - 0x00031c02, 0x0043102b, 0x14400008, 0x3c038000, 0x3c040800, 0x8c841b7c, + 0x00000000, 0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b4c, + 0x00031c02, 0x0043102b, 0x14400008, 0x3c038000, 0x3c040800, 0x8c841b5c, 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3082ffff, 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000, - 0x0a000650, 0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, + 0x0a000644, 0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00001021, 0x03e00008, 0x00000000, 0x8f624450, 0x3c030800, - 0x8c631b68, 0x0a000659, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, + 0x8c631b48, 0x0a00064d, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821, - 0x3c040800, 0x24841b10, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, - 0x0e000684, 0xafa00014, 0x0a000668, 0x00000000, 0x8fbf0018, 0x03e00008, + 0x3c040800, 0x24841ae0, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, + 0x0e000678, 0xafa00014, 0x0a00065c, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x3c020800, 0x34423000, - 0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac221b84, - 0x24020040, 0x3c010800, 0xac221b88, 0x3c010800, 0xac201b80, 0xac600000, + 0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac221b64, + 0x24020040, 0x3c010800, 0xac221b68, 0x3c010800, 0xac201b60, 0xac600000, 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000, - 0x00804821, 0x8faa0010, 0x3c020800, 0x8c421b80, 0x3c040800, 0x8c841b88, - 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac231b80, 0x14400003, - 0x00004021, 0x3c010800, 0xac201b80, 0x3c020800, 0x8c421b80, 0x3c030800, - 0x8c631b84, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001, - 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b80, - 0x3c030800, 0x8c631b84, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008, + 0x00804821, 0x8faa0010, 0x3c020800, 0x8c421b60, 0x3c040800, 0x8c841b68, + 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac231b60, 0x14400003, + 0x00004021, 0x3c010800, 0xac201b60, 0x3c020800, 0x8c421b60, 0x3c030800, + 0x8c631b64, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001, + 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b60, + 0x3c030800, 0x8c631b64, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008, 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c, 0x00000000, 0x00000000, }; u32 tg3TsoFwRodata[] = { - 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, - 0x00000000, 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, - 0x496e0000, 0x73746b6f, 0x66662a2a, 0x00000000, 0x53774576, - 0x656e7430, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x66617461, 0x6c457272, 0x00000000, 0x00000000, 0x00000000 + 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, 0x00000000, + 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x496e0000, 0x73746b6f, + 0x66662a2a, 0x00000000, 0x53774576, 0x656e7430, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x66617461, 0x6c457272, 0x00000000, 0x00000000, }; #if 0 /* All zeros, don't eat up space with it. */ From vnuorval@tcs.hut.fi Wed Dec 3 02:26:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 02:26:33 -0800 (PST) Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3AQ6Ta003330 for ; Wed, 3 Dec 2003 02:26:07 -0800 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 8A4128001C6; Wed, 3 Dec 2003 12:26:04 +0200 (EET) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.6) with ESMTP id hB3AQ4sj029629; Wed, 3 Dec 2003 12:26:04 +0200 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.6) with ESMTP id hB3AQ21D029625; Wed, 3 Dec 2003 12:26:03 +0200 Date: Wed, 3 Dec 2003 12:26:02 +0200 (EET) From: Ville Nuorvala To: dahinds@users.sourceforge.net, akpm@digeo.com, jgarzik@pobox.com Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: [2.6 PATCH]: Fix deadlock in driver 3c574_cs.c In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1857 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: vnuorval@tcs.hut.fi Precedence: bulk X-list: netdev Hello, I already sent a report about this to linux-net earlier, but I guess it went unnoticed due to thanksgiving... The deadlock occurs when update_stats() is called from el3_interrupt(), which already holds the lp->window_lock. The patch below fixes this behavior. Thanks, Ville ===== drivers/net/pcmcia/3c574_cs.c 1.25 vs edited ===== --- 1.25/drivers/net/pcmcia/3c574_cs.c Sat Sep 6 22:50:44 2003 +++ edited/drivers/net/pcmcia/3c574_cs.c Thu Nov 27 10:26:34 2003 @@ -1092,8 +1092,12 @@ { struct el3_private *lp = (struct el3_private *)dev->priv; - if (netif_device_present(dev)) + if (netif_device_present(dev)) { + unsigned long flags; + spin_lock_irqsave(&lp->window_lock, flags); update_stats(dev); + spin_unlock_irqrestore(&lp->window_lock, flags); + } return &lp->stats; } @@ -1105,7 +1109,6 @@ { struct el3_private *lp = (struct el3_private *)dev->priv; ioaddr_t ioaddr = dev->base_addr; - unsigned long flags; u8 rx, tx, up; DEBUG(2, "%s: updating the statistics.\n", dev->name); @@ -1113,8 +1116,6 @@ if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ return; - spin_lock_irqsave(&lp->window_lock, flags); - /* Unlike the 3c509 we need not turn off stats updates while reading. */ /* Switch to the stats window, and read everything. */ EL3WINDOW(6); @@ -1139,7 +1140,6 @@ lp->stats.tx_bytes += tx + ((up & 0xf0) << 12); EL3WINDOW(1); - spin_unlock_irqrestore(&lp->window_lock, flags); } static int el3_rx(struct net_device *dev, int worklimit) @@ -1281,6 +1281,8 @@ DEBUG(2, "%s: shutting down ethercard.\n", dev->name); if (DEV_OK(link)) { + unsigned long flags; + /* Turn off statistics ASAP. We update lp->stats below. */ outw(StatsDisable, ioaddr + EL3_CMD); @@ -1290,8 +1292,9 @@ /* Note: Switching to window 0 may disable the IRQ. */ EL3WINDOW(0); - + spin_lock_irqsave(&lp->window_lock, flags); update_stats(dev); + spin_unlock_irqrestore(&lp->window_lock, flags); } link->open--; -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From herbert@gondor.apana.org.au Wed Dec 3 02:35:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 02:35:54 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3AZbTa003784 for ; Wed, 3 Dec 2003 02:35:38 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1ARULc-0003Xs-00; Wed, 03 Dec 2003 21:35:08 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1ARULX-0000Ny-00; Wed, 03 Dec 2003 21:35:03 +1100 From: Herbert Xu To: hadi@cyberus.ca, netdev@oss.sgi.com Subject: Re: [RTNETLINK] Provide real oif Organization: Core In-Reply-To: <1070410097.1038.27.camel@jzny.localdomain> X-Newsgroups: apana.lists.os.linux.netdev User-Agent: tin/1.7.2-20031002 ("Berneray") (UNIX) (Linux/2.4.22-1-686-smp (i686)) Message-Id: Date: Wed, 03 Dec 2003 21:35:03 +1100 X-archive-position: 1858 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev jamal wrote: >> >> Without the real oif you will see entries like this in the output of >> ip r l c: >> >> 192.168.0.7 dev eth0 src 192.168.0.6 >> cache mtu 1500 advmss 1460 metric10 64 >> 192.168.0.7 dev eth0 src 192.168.0.6 >> cache mtu 1500 advmss 1460 metric10 64 >> >> One of those has oif == 0 while the other one has oif == eth0. >> > > They both seem to have an oif of eth0, no? They both have an RTA_OIF of eth0. But RTA_OIF != rt->fl.oif. In fact, RTA_OIF is the value of rt->u.dst.dev. Perhaps a program would be easier to understand. Run the attached program with the arguments x.x.x.x eth0, assuming that x.x.x.x is routed via eth0 on your system. You should then see the apparent duplicate entries in your routing cache. Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- #include #include #include #include #include #include #include #include int main(int argc, char **argv) { struct sockaddr_in addr; int s; char msg = 0; int true = 1; struct { struct cmsghdr hdr; struct in_pktinfo pktinfo; } ctrl; struct ifreq req; struct msghdr hdr; struct iovec iov; if (argc < 3) return 1; addr.sin_family = AF_INET; inet_aton(argv[1], &addr.sin_addr); addr.sin_port = ntohs(30000); memset(&ctrl.pktinfo, 0, sizeof(ctrl.pktinfo)); ctrl.hdr.cmsg_len = sizeof(ctrl); ctrl.hdr.cmsg_level = SOL_IP; ctrl.hdr.cmsg_type = IP_PKTINFO; strcpy(req.ifr_name, argv[2]); iov.iov_base = &msg; iov.iov_len = 1; hdr.msg_name = &addr; hdr.msg_namelen = sizeof(addr); hdr.msg_iov = &iov; hdr.msg_iovlen = 1; hdr.msg_control = &ctrl; hdr.msg_controllen = sizeof(ctrl); hdr.msg_flags = 0; s = socket(AF_INET, SOCK_DGRAM, 0); setsockopt(s, SOL_IP, IP_PKTINFO, &true, sizeof(true)); ioctl(s, SIOCGIFINDEX, &req); ctrl.pktinfo.ipi_ifindex = req.ifr_ifindex; sendto(s, &msg, 1, 0, (struct sockaddr *)&addr, sizeof(addr)); sendmsg(s, &hdr, 0); return 0; } From prasanna@in.ibm.com Wed Dec 3 05:51:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 05:51:42 -0800 (PST) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.130]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3DpNTa016856 for ; Wed, 3 Dec 2003 05:51:24 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e32.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB3DpHrE066300; Wed, 3 Dec 2003 08:51:17 -0500 Received: from nightmon.in.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB3DpCxa157808; Wed, 3 Dec 2003 06:51:16 -0700 Received: by nightmon.in.ibm.com (Postfix, from userid 500) id 10EB4FB84; Wed, 3 Dec 2003 13:52:17 +0000 (UTC) Date: Wed, 3 Dec 2003 19:22:16 +0530 From: Prasanna S Panchamukhi To: jgarzik@pobox.com Cc: mpm@selenic.com, suparna@in.ibm.com, netdev@oss.sgi.com Subject: [1/4]pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Message-ID: <20031203135216.GA13465@in.ibm.com> Reply-To: prasanna@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 1859 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: prasanna@in.ibm.com Precedence: bulk X-list: netdev Hi Jeff, Below is the pollcontroller patch for e100. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch diff -urNp linux.orig/drivers/net/e100/e100_main.c linux-2.6.0-test10/drivers/net/e100/e100_main.c --- linux.orig/drivers/net/e100/e100_main.c 2003-11-26 03:57:38.000000000 +0530 +++ linux-2.6.0-test10/drivers/net/e100/e100_main.c 2003-11-26 03:59:15.554978648 +0530 @@ -544,6 +544,22 @@ e100_trigger_SWI(struct e100_private *bd readw(&(bdp->scb->scb_status)); /* flushes last write, read-safe */ } +#ifdef CONFIG_NET_POLL_CONTROLLER + +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void +e100_poll(struct net_device *dev) +{ + disable_irq(dev->irq); + e100intr(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif + static int __devinit e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent) { @@ -562,6 +578,9 @@ e100_found1(struct pci_dev *pcid, const SET_MODULE_OWNER(dev); +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = &e100_poll; +#endif if (first_time) { first_time = false; printk(KERN_NOTICE "%s - version %s\n", -- Thanks & Regards Prasanna S Panchamukhi Linux Technology Center India Software Labs, IBM Bangalore Ph: 91-80-5044632 From prasanna@in.ibm.com Wed Dec 3 05:56:33 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 05:56:47 -0800 (PST) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.129]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3DuXTa017253 for ; Wed, 3 Dec 2003 05:56:33 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e31.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB3DuRb0102234; Wed, 3 Dec 2003 08:56:27 -0500 Received: from nightmon.in.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB3DuNxa168940; Wed, 3 Dec 2003 06:56:26 -0700 Received: by nightmon.in.ibm.com (Postfix, from userid 500) id E4DD1FB88; Wed, 3 Dec 2003 13:57:28 +0000 (UTC) Date: Wed, 3 Dec 2003 19:27:28 +0530 From: Prasanna S Panchamukhi To: jgarzik@pobox.com Cc: mpm@selenic.com, suparna@in.ibm.com, netdev@oss.sgi.com Subject: [2/4] pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Message-ID: <20031203135728.GA13585@in.ibm.com> Reply-To: prasanna@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 1860 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: prasanna@in.ibm.com Precedence: bulk X-list: netdev Hi Jeff, Below is the pollcontroller patch for e1000. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch diff -urNp linux-netdrvr/drivers/net/e1000/e1000_main.c linux-2.6.0-test10/drivers/net/e1000/e1000_main.c --- linux-netdrvr/drivers/net/e1000/e1000_main.c 2003-12-04 11:18:03.000000000 +0530 +++ linux-2.6.0-test10/drivers/net/e1000/e1000_main.c 2003-12-04 11:43:35.412199928 +0530 @@ -338,6 +338,15 @@ e1000_reset(struct e1000_adapter *adapte e1000_phy_get_info(&adapter->hw, &adapter->phy_info); } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void e1000_poll(struct net_device *dev) +{ + disable_irq(dev->irq); + e1000_intr(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif + /** * e1000_probe - Device Initialization Routine * @pdev: PCI device information struct @@ -439,6 +448,9 @@ e1000_probe(struct pci_dev *pdev, adapter->bd_number = cards_found; +#ifdef CONFIG_NET_POLL_CONTROLLER + netdev->poll_controller = &e1000_poll; +#endif /* setup the private structure */ if((err = e1000_sw_init(adapter))) -- Thanks & Regards Prasanna S Panchamukhi Linux Technology Center India Software Labs, IBM Bangalore Ph: 91-80-5044632 From prasanna@in.ibm.com Wed Dec 3 05:59:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 05:59:27 -0800 (PST) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.105]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3DxETa017622 for ; Wed, 3 Dec 2003 05:59:14 -0800 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e5.ny.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB3Dx69n554556; Wed, 3 Dec 2003 08:59:06 -0500 Received: from nightmon.in.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB3Dx2ar106574; Wed, 3 Dec 2003 08:59:04 -0500 Received: by nightmon.in.ibm.com (Postfix, from userid 500) id A9FF8FB88; Wed, 3 Dec 2003 14:00:07 +0000 (UTC) Date: Wed, 3 Dec 2003 19:30:07 +0530 From: Prasanna S Panchamukhi To: jgarzik@pobox.com Cc: mpm@selenic.com, suparna@in.ibm.com, netdev@oss.sgi.com Subject: [3/4]pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Message-ID: <20031203140007.GB13585@in.ibm.com> Reply-To: prasanna@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 1861 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: prasanna@in.ibm.com Precedence: bulk X-list: netdev Hi Jeff, Below is the pollcontroller patch for smc ultra net driver. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch diff -urNp linux.orig/drivers/net/smc-ultra.c linux-2.6.0-test10/drivers/net/smc-ultra.c --- linux.orig/drivers/net/smc-ultra.c 2003-11-26 03:57:39.000000000 +0530 +++ linux-2.6.0-test10/drivers/net/smc-ultra.c 2003-11-26 03:59:15.630967096 +0530 @@ -121,6 +121,14 @@ MODULE_DEVICE_TABLE(isapnp, ultra_device #define ULTRA_IO_EXTENT 32 #define EN0_ERWCNT 0x08 /* Early receive warning count. */ +#ifdef CONFIG_NET_POLL_CONTROLLER +static void ultra_poll(struct net_device *dev) +{ + disable_irq(dev->irq); + ei_interrupt(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif /* Probe for the Ultra. This looks like a 8013 with the station address PROM at I/O ports +8 to +13, with a checksum following. @@ -134,6 +142,9 @@ static int __init do_ultra_probe(struct SET_MODULE_OWNER(dev); +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = &ultra_poll; +#endif if (base_addr > 0x1ff) /* Check a single specified location. */ return ultra_probe1(dev, base_addr); else if (base_addr != 0) /* Don't probe at all. */ -- Thanks & Regards Prasanna S Panchamukhi Linux Technology Center India Software Labs, IBM Bangalore Ph: 91-80-5044632 From prasanna@in.ibm.com Wed Dec 3 06:01:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 06:01:40 -0800 (PST) Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.133]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3E1RTa018040 for ; Wed, 3 Dec 2003 06:01:28 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e35.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB3E1Lcp394034; Wed, 3 Dec 2003 09:01:21 -0500 Received: from nightmon.in.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB3E19xa026978; Wed, 3 Dec 2003 07:01:12 -0700 Received: by nightmon.in.ibm.com (Postfix, from userid 500) id D963BFB88; Wed, 3 Dec 2003 14:02:14 +0000 (UTC) Date: Wed, 3 Dec 2003 19:32:14 +0530 From: Prasanna S Panchamukhi To: jgarzik@pobox.com Cc: mpm@selenic.com, suparna@in.ibm.com, netdev@oss.sgi.com Subject: [4/4]pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Message-ID: <20031203140214.GC13585@in.ibm.com> Reply-To: prasanna@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 1862 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: prasanna@in.ibm.com Precedence: bulk X-list: netdev Hi Jeff, Below is the pollcontroller patch for tlan network device driver. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch diff -urNp linux-netdrvr/drivers/net/tlan.c linux-2.6.0-test10/drivers/net/tlan.c --- linux-netdrvr/drivers/net/tlan.c 2003-11-24 07:01:12.000000000 +0530 +++ linux-2.6.0-test10/drivers/net/tlan.c 2003-12-04 11:56:16.536491448 +0530 @@ -814,6 +814,14 @@ static void __init TLan_EisaProbe (void } /* TLan_EisaProbe */ +#ifdef CONFIG_NET_POLL_CONTROLLER +static void TLan_Poll(struct net_device *dev) +{ + disable_irq(dev->irq); + TLan_HandleInterrupt(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif @@ -893,6 +901,9 @@ static int TLan_Init( struct net_device dev->get_stats = &TLan_GetStats; dev->set_multicast_list = &TLan_SetMulticastList; dev->do_ioctl = &TLan_ioctl; +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = &TLan_Poll; +#endif dev->tx_timeout = &TLan_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; -- Thanks & Regards Prasanna S Panchamukhi Linux Technology Center India Software Labs, IBM Bangalore Ph: 91-80-5044632 From bdschuym@pandora.be Wed Dec 3 11:13:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 11:13:41 -0800 (PST) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3JDDTa026111 for ; Wed, 3 Dec 2003 11:13:14 -0800 Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 0AB862E6A8C; Wed, 3 Dec 2003 19:38:19 +0100 (MET) Received: from 192.168.0.138 (D5762BBC.kabel.telenet.be [213.118.43.188]) by poros.telenet-ops.be (Postfix) with ESMTP id 8045D2E6AE0; Wed, 3 Dec 2003 19:38:02 +0100 (MET) From: Bart De Schuymer To: Julian Anastasov , netdev@oss.sgi.com Subject: Re: [2.6 PATCH] bridge - provide valid tos value for ip_route_output_key Date: Wed, 3 Dec 2003 19:38:22 +0100 User-Agent: KMail/1.5 Cc: Stephen Hemminger , "David S. Miller" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200312031938.22925.bdschuym@pandora.be> X-archive-position: 1863 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: bdschuym@pandora.be Precedence: bulk X-list: netdev Hi Dave, If you haven't already applied the patch from Julian Anastasov below, please do. cheers, Bart On Wednesday 03 December 2003 01:03, Julian Anastasov wrote: > The attached patch changes bridging to provide valid > tos value to routing. diff -Nru a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c --- a/net/bridge/br_netfilter.c Tue Dec 2 23:55:30 2003 +++ b/net/bridge/br_netfilter.c Tue Dec 2 23:55:30 2003 @@ -180,7 +180,7 @@ struct rtable *rt; struct flowi fl = { .nl_u = { .ip4_u = { .daddr = iph->daddr, .saddr = 0 , - .tos = iph->tos} }, .proto = 0}; + .tos = RT_TOS(iph->tos)} }, .proto = 0}; if (!ip_route_output_key(&rt, &fl)) { /* Bridged-and-DNAT'ed traffic doesn't From herbert@gondor.apana.org.au Wed Dec 3 11:51:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 11:52:05 -0800 (PST) Received: from arnor.me.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3JplTa026822 for ; Wed, 3 Dec 2003 11:51:49 -0800 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.me.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1ARd2A-0006yw-00; Thu, 04 Dec 2003 06:51:38 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1ARd26-0001CK-00; Thu, 04 Dec 2003 06:51:34 +1100 Date: Thu, 4 Dec 2003 06:51:34 +1100 To: jamal Cc: netdev@oss.sgi.com Subject: Re: [RTNETLINK] Provide real oif Message-ID: <20031203195134.GD4482@gondor.apana.org.au> References: <1070459463.1036.179.camel@jzny.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1070459463.1036.179.camel@jzny.localdomain> User-Agent: Mutt/1.5.4i From: Herbert Xu X-archive-position: 1864 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev On Wed, Dec 03, 2003 at 08:51:03AM -0500, jamal wrote: > > I am wondering if they should have been the same resolved > cache entry to begin with. i.e the fl->oif should not have > been 0 rather the ifindex of eth0. > Even in the case of multipath routing, you have to wait for > the cache to expire before selecting the next one in the slow > path; so fl->oif of zero may not be a very useful artifact. That would be good. In fact, I think that's how IPv6 works. Dave, is this acceptable? -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From garzik@gtf.org Wed Dec 3 12:13:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 12:13:24 -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 hB3KD3Ta027761 for ; Wed, 3 Dec 2003 12:13:03 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id 8FCFD670C; Wed, 3 Dec 2003 15:09:29 -0500 (EST) Date: Wed, 3 Dec 2003 15:09:29 -0500 From: Jeff Garzik To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: [PATCH] 2.6.x net driver updates Message-ID: <20031203200929.GA22839@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 1865 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 Patch: http://www.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.6/2.6.0-test11-netdrvr-exp1.patch.bz2 BK users: bk://gkernel.bkbits.net/net-drivers-2.5-exp Nothing new in this patch, just a rediff versus 2.6.0-test11 release. From ddillow@idleaire.com Wed Dec 3 13:43:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 13:43:13 -0800 (PST) Received: from iasrv1.idleaire.net (NS1.idleaire.net [65.220.16.2]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3LgxTa003878 for ; Wed, 3 Dec 2003 13:42:59 -0800 Received: by iasrv1.idleaire.net (Postfix, from userid 300) id 684B3236E82; Wed, 3 Dec 2003 16:42:54 -0500 (EST) Received: from corp4.idleaire.com (corp4.idleaire.com [10.1.66.36]) by iasrv1.idleaire.net (Postfix) with ESMTP id ED526236E54; Wed, 3 Dec 2003 16:42:53 -0500 (EST) Received: from [10.1.66.124] ([10.1.66.124]) by corp4.idleaire.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 3 Dec 2003 16:42:53 -0500 Subject: [PATCH RESEND] Typhoon (3CR990) updates for 2.4 From: Dave Dillow To: Jeff Garzik Cc: Netdev X-Originating-IP: [216.153.89.133] X-Authentication-Warning: ori.thedillows.org: il1 set sender to dave@thedillows.org using -f X-archive-position: 1708 X-ecartis-version: Ecartis v1.0.0 X-original-sender: dave@thedillows.org X-list: netdev Content-Type: text/plain Organization: Message-Id: <1070487773.5062.6.camel@dillow.idleaire.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 03 Dec 2003 16:42:53 -0500 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Dec 2003 21:42:53.0990 (UTC) FILETIME=[684B7C60:01C3B9E6] X-archive-position: 1866 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ddillow@idleaire.com Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1063.4.32 -> 1.1063.47.1 # drivers/net/typhoon.c 1.4 -> 1.8 # # The following is the BitKeeper ChangeSet Log # -- # 03/11/25 dave@thedillows.org 1.1063.47.1 # Bug fixes: # * Avoid short timeouts when waiting for a reset # * Support newer versions of the sleep image # * Fix link status reporting # -- # diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c -- a/drivers/net/typhoon.c Wed Nov 26 00:45:39 2003 +++ b/drivers/net/typhoon.c Wed Nov 26 00:45:39 2003 @@ -85,8 +85,8 @@ #define PKT_BUF_SZ 1536 #define DRV_MODULE_NAME "typhoon" -#define DRV_MODULE_VERSION "1.4.1" -#define DRV_MODULE_RELDATE "03/06/26" +#define DRV_MODULE_VERSION "1.4.2" +#define DRV_MODULE_RELDATE "03/11/25" #define PFX DRV_MODULE_NAME ": " #define ERR_PFX KERN_ERR PFX @@ -127,7 +127,7 @@ static char version[] __devinitdata = "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; -MODULE_AUTHOR("David Dillow "); +MODULE_AUTHOR("David Dillow "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("3Com Typhoon Family (3C990, 3CR990, and variants)"); MODULE_PARM(rx_copybreak, "i"); @@ -146,11 +146,12 @@ int capabilities; }; -#define TYPHOON_CRYPTO_NONE 0 -#define TYPHOON_CRYPTO_DES 1 -#define TYPHOON_CRYPTO_3DES 2 -#define TYPHOON_CRYPTO_VARIABLE 4 -#define TYPHOON_FIBER 8 +#define TYPHOON_CRYPTO_NONE 0x00 +#define TYPHOON_CRYPTO_DES 0x01 +#define TYPHOON_CRYPTO_3DES 0x02 +#define TYPHOON_CRYPTO_VARIABLE 0x04 +#define TYPHOON_FIBER 0x08 +#define TYPHOON_WAKEUP_NEEDS_RESET 0x10 enum typhoon_cards { TYPHOON_TX = 0, TYPHOON_TX95, TYPHOON_TX97, TYPHOON_SVR, @@ -307,7 +308,8 @@ /* We'll wait up to six seconds for a reset, and half a second normally. */ #define TYPHOON_UDELAY 50 -#define TYPHOON_RESET_TIMEOUT (6 * HZ) +#define TYPHOON_RESET_TIMEOUT_SLEEP (6 * HZ) +#define TYPHOON_RESET_TIMEOUT_NOSLEEP ((6 * 1000000) / TYPHOON_UDELAY) #define TYPHOON_WAIT_TIMEOUT ((1000000 / 2) / TYPHOON_UDELAY) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 28) @@ -375,10 +377,12 @@ typhoon_reset(unsigned long ioaddr, int wait_type) { int i, err = 0; - int timeout = TYPHOON_RESET_TIMEOUT; + int timeout; if(wait_type == WaitNoSleep) - timeout = (timeout * 1000000) / (HZ * TYPHOON_UDELAY); + timeout = TYPHOON_RESET_TIMEOUT_NOSLEEP; + else + timeout = TYPHOON_RESET_TIMEOUT_SLEEP; writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK); writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS); @@ -1857,6 +1861,11 @@ if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_SLEEPING) < 0) return -ETIMEDOUT; + /* Since we cannot monitor the status of the link while sleeping, + * tell the world it went away. + */ + netif_carrier_off(tp->dev); + pci_enable_wake(tp->pdev, state, 1); pci_disable_device(pdev); return pci_set_power_state(pdev, state); @@ -1871,8 +1880,13 @@ pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); + /* Post 2.x.x versions of the Sleep Image require a reset before + * we can download the Runtime Image. But let's not make users of + * the old firmware pay for the reset. + */ writel(TYPHOON_BOOTCMD_WAKEUP, ioaddr + TYPHOON_REG_COMMAND); - if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) + if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0 || + (tp->capabilities & TYPHOON_WAKEUP_NEEDS_RESET)) return typhoon_reset(ioaddr, wait_type); return 0; @@ -2250,7 +2264,7 @@ void *shared; dma_addr_t shared_dma; struct cmd_desc xp_cmd; - struct resp_desc xp_resp; + struct resp_desc xp_resp[3]; int i; int err = 0; @@ -2378,15 +2392,15 @@ } INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS); - if(typhoon_issue_command(tp, 1, &xp_cmd, 1, &xp_resp) < 0) { + if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) { printk(ERR_PFX "%s: cannot read MAC address\n", pdev->slot_name); err = -EIO; goto error_out_reset; } - *(u16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp.parm1)); - *(u32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp.parm2)); + *(u16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1)); + *(u32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); if(!is_valid_ether_addr(dev->dev_addr)) { printk(ERR_PFX "%s: Could not obtain valid ethernet address, " @@ -2394,6 +2408,28 @@ goto error_out_reset; } + /* Read the Sleep Image version last, so the response is valid + * later when we print out the version reported. + */ + INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); + if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { + printk(ERR_PFX "%s: Could not get Sleep Image version\n", + pdev->slot_name); + goto error_out_reset; + } + + tp->capabilities = typhoon_card_info[card_id].capabilities; + tp->xcvr_select = TYPHOON_XCVR_AUTONEG; + + /* Typhoon 1.0 Sleep Images return one response descriptor to the + * READ_VERSIONS command. Those versions are OK after waking up + * from sleep without needing a reset. Typhoon 1.1+ Sleep Images + * seem to need a little extra help to get started. Since we don't + * know how to nudge it along, just kick it. + */ + if(xp_resp[0].numDesc != 0) + tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET; + if(typhoon_sleep(tp, 3, 0) < 0) { printk(ERR_PFX "%s: cannot put adapter to sleep\n", pdev->slot_name); @@ -2401,9 +2437,6 @@ goto error_out_reset; } - tp->capabilities = typhoon_card_info[card_id].capabilities; - tp->xcvr_select = TYPHOON_XCVR_AUTONEG; - /* The chip-specific entries in the device structure. */ dev->open = typhoon_open; dev->hard_start_xmit = typhoon_start_tx; @@ -2440,6 +2473,32 @@ printk("%2.2x:", dev->dev_addr[i]); printk("%2.2x\n", dev->dev_addr[i]); + /* xp_resp still contains the response to the READ_VERSIONS command. + * For debugging, let the user know what version he has. + */ + if(xp_resp[0].numDesc == 0) { + /* This is the Typhoon 1.0 type Sleep Image, last 16 bits + * of version is Month/Day of build. + */ + u16 monthday = le32_to_cpu(xp_resp[0].parm2) & 0xffff; + printk(KERN_INFO "%s: Typhoon 1.0 Sleep Image built " + "%02u/%02u/2000\n", dev->name, monthday >> 8, + monthday & 0xff); + } else if(xp_resp[0].numDesc == 2) { + /* This is the Typhoon 1.1+ type Sleep Image + */ + u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); + u8 *ver_string = (u8 *) &xp_resp[1]; + ver_string[25] = 0; + printk(KERN_INFO "%s: Typhoon 1.1+ Sleep Image version " + "%u.%u.%u.%u %s\n", dev->name, HIPQUAD(sleep_ver), + ver_string); + } else { + printk(KERN_WARNING "%s: Unknown Sleep Image version " + "(%u:%04x)\n", dev->name, xp_resp[0].numDesc, + le32_to_cpu(xp_resp[0].parm2)); + } + return 0; error_out_reset: From ddillow@idleaire.com Wed Dec 3 13:43:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 13:43:16 -0800 (PST) Received: from iasrv1.idleaire.net (NS1.idleaire.net [65.220.16.2]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3Lh2Ta003880 for ; Wed, 3 Dec 2003 13:43:03 -0800 Received: by iasrv1.idleaire.net (Postfix, from userid 300) id D0F15236E84; Wed, 3 Dec 2003 16:42:56 -0500 (EST) Received: from corp4.idleaire.com (corp4.idleaire.com [10.1.66.36]) by iasrv1.idleaire.net (Postfix) with ESMTP id 64195236E54; Wed, 3 Dec 2003 16:42:56 -0500 (EST) Received: from [10.1.66.124] ([10.1.66.124]) by corp4.idleaire.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 3 Dec 2003 16:42:56 -0500 Subject: [PATCH RESEND] Typhoon (3CR990) updates for 2.5 From: Dave Dillow To: Jeff Garzik Cc: Netdev X-Originating-IP: [216.153.89.133] X-Authentication-Warning: ori.thedillows.org: il1 set sender to dave@thedillows.org using -f X-archive-position: 1710 X-ecartis-version: Ecartis v1.0.0 X-original-sender: dave@thedillows.org X-list: netdev Content-Type: text/plain Organization: Message-Id: <1070487776.5062.10.camel@dillow.idleaire.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 03 Dec 2003 16:42:56 -0500 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Dec 2003 21:42:56.0412 (UTC) FILETIME=[69BD0DC0:01C3B9E6] X-archive-position: 1868 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ddillow@idleaire.com Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1486 -> 1.1487 # drivers/net/typhoon.c 1.8 -> 1.12 # # The following is the BitKeeper ChangeSet Log # -- # 03/11/26 dave@thedillows.org 1.1487 # Bug fixes: # * Avoid short timeouts when waiting for a reset # * Fix issue with loading runtime image on newer versions of the sleep image # * Fix link status reporting # -- # diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c -- a/drivers/net/typhoon.c Wed Nov 26 01:28:53 2003 +++ b/drivers/net/typhoon.c Wed Nov 26 01:28:53 2003 @@ -85,8 +85,8 @@ #define PKT_BUF_SZ 1536 #define DRV_MODULE_NAME "typhoon" -#define DRV_MODULE_VERSION "1.5.1" -#define DRV_MODULE_RELDATE "03/06/26" +#define DRV_MODULE_VERSION "1.5.2" +#define DRV_MODULE_RELDATE "03/11/25" #define PFX DRV_MODULE_NAME ": " #define ERR_PFX KERN_ERR PFX @@ -127,7 +127,7 @@ static char version[] __devinitdata = "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; -MODULE_AUTHOR("David Dillow "); +MODULE_AUTHOR("David Dillow "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("3Com Typhoon Family (3C990, 3CR990, and variants)"); MODULE_PARM(rx_copybreak, "i"); @@ -146,11 +146,12 @@ int capabilities; }; -#define TYPHOON_CRYPTO_NONE 0 -#define TYPHOON_CRYPTO_DES 1 -#define TYPHOON_CRYPTO_3DES 2 -#define TYPHOON_CRYPTO_VARIABLE 4 -#define TYPHOON_FIBER 8 +#define TYPHOON_CRYPTO_NONE 0x00 +#define TYPHOON_CRYPTO_DES 0x01 +#define TYPHOON_CRYPTO_3DES 0x02 +#define TYPHOON_CRYPTO_VARIABLE 0x04 +#define TYPHOON_FIBER 0x08 +#define TYPHOON_WAKEUP_NEEDS_RESET 0x10 enum typhoon_cards { TYPHOON_TX = 0, TYPHOON_TX95, TYPHOON_TX97, TYPHOON_SVR, @@ -307,7 +308,8 @@ /* We'll wait up to six seconds for a reset, and half a second normally. */ #define TYPHOON_UDELAY 50 -#define TYPHOON_RESET_TIMEOUT (6 * HZ) +#define TYPHOON_RESET_TIMEOUT_SLEEP (6 * HZ) +#define TYPHOON_RESET_TIMEOUT_NOSLEEP ((6 * 1000000) / TYPHOON_UDELAY) #define TYPHOON_WAIT_TIMEOUT ((1000000 / 2) / TYPHOON_UDELAY) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 28) @@ -375,10 +377,12 @@ typhoon_reset(unsigned long ioaddr, int wait_type) { int i, err = 0; - int timeout = TYPHOON_RESET_TIMEOUT; + int timeout; if(wait_type == WaitNoSleep) - timeout = (timeout * 1000000) / (HZ * TYPHOON_UDELAY); + timeout = TYPHOON_RESET_TIMEOUT_NOSLEEP; + else + timeout = TYPHOON_RESET_TIMEOUT_SLEEP; writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK); writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS); @@ -1858,6 +1862,11 @@ if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_SLEEPING) < 0) return -ETIMEDOUT; + /* Since we cannot monitor the status of the link while sleeping, + * tell the world it went away. + */ + netif_carrier_off(tp->dev); + pci_enable_wake(tp->pdev, state, 1); pci_disable_device(pdev); return pci_set_power_state(pdev, state); @@ -1872,8 +1881,13 @@ pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); + /* Post 2.x.x versions of the Sleep Image require a reset before + * we can download the Runtime Image. But let's not make users of + * the old firmware pay for the reset. + */ writel(TYPHOON_BOOTCMD_WAKEUP, ioaddr + TYPHOON_REG_COMMAND); - if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) + if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0 || + (tp->capabilities & TYPHOON_WAKEUP_NEEDS_RESET)) return typhoon_reset(ioaddr, wait_type); return 0; @@ -2251,7 +2265,7 @@ void *shared; dma_addr_t shared_dma; struct cmd_desc xp_cmd; - struct resp_desc xp_resp; + struct resp_desc xp_resp[3]; int i; int err = 0; @@ -2380,15 +2394,15 @@ } INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS); - if(typhoon_issue_command(tp, 1, &xp_cmd, 1, &xp_resp) < 0) { + if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) { printk(ERR_PFX "%s: cannot read MAC address\n", pci_name(pdev)); err = -EIO; goto error_out_reset; } - *(u16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp.parm1)); - *(u32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp.parm2)); + *(u16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1)); + *(u32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); if(!is_valid_ether_addr(dev->dev_addr)) { printk(ERR_PFX "%s: Could not obtain valid ethernet address, " @@ -2396,6 +2410,28 @@ goto error_out_reset; } + /* Read the Sleep Image version last, so the response is valid + * later when we print out the version reported. + */ + INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); + if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { + printk(ERR_PFX "%s: Could not get Sleep Image version\n", + pdev->slot_name); + goto error_out_reset; + } + + tp->capabilities = typhoon_card_info[card_id].capabilities; + tp->xcvr_select = TYPHOON_XCVR_AUTONEG; + + /* Typhoon 1.0 Sleep Images return one response descriptor to the + * READ_VERSIONS command. Those versions are OK after waking up + * from sleep without needing a reset. Typhoon 1.1+ Sleep Images + * seem to need a little extra help to get started. Since we don't + * know how to nudge it along, just kick it. + */ + if(xp_resp[0].numDesc != 0) + tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET; + if(typhoon_sleep(tp, 3, 0) < 0) { printk(ERR_PFX "%s: cannot put adapter to sleep\n", pci_name(pdev)); @@ -2403,9 +2439,6 @@ goto error_out_reset; } - tp->capabilities = typhoon_card_info[card_id].capabilities; - tp->xcvr_select = TYPHOON_XCVR_AUTONEG; - /* The chip-specific entries in the device structure. */ dev->open = typhoon_open; dev->hard_start_xmit = typhoon_start_tx; @@ -2442,6 +2475,32 @@ printk("%2.2x:", dev->dev_addr[i]); printk("%2.2x\n", dev->dev_addr[i]); + /* xp_resp still contains the response to the READ_VERSIONS command. + * For debugging, let the user know what version he has. + */ + if(xp_resp[0].numDesc == 0) { + /* This is the Typhoon 1.0 type Sleep Image, last 16 bits + * of version is Month/Day of build. + */ + u16 monthday = le32_to_cpu(xp_resp[0].parm2) & 0xffff; + printk(KERN_INFO "%s: Typhoon 1.0 Sleep Image built " + "%02u/%02u/2000\n", dev->name, monthday >> 8, + monthday & 0xff); + } else if(xp_resp[0].numDesc == 2) { + /* This is the Typhoon 1.1+ type Sleep Image + */ + u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); + u8 *ver_string = (u8 *) &xp_resp[1]; + ver_string[25] = 0; + printk(KERN_INFO "%s: Typhoon 1.1+ Sleep Image version " + "%u.%u.%u.%u %s\n", dev->name, HIPQUAD(sleep_ver), + ver_string); + } else { + printk(KERN_WARNING "%s: Unknown Sleep Image version " + "(%u:%04x)\n", dev->name, xp_resp[0].numDesc, + le32_to_cpu(xp_resp[0].parm2)); + } + return 0; error_out_reset: From ddillow@idleaire.com Wed Dec 3 13:43:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 13:43:14 -0800 (PST) Received: from iasrv1.idleaire.net (NS1.idleaire.net [65.220.16.2]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3Lh1Ta003879 for ; Wed, 3 Dec 2003 13:43:01 -0800 Received: by iasrv1.idleaire.net (Postfix, from userid 300) id 23381236E83; Wed, 3 Dec 2003 16:42:56 -0500 (EST) Received: from corp4.idleaire.com (corp4.idleaire.com [10.1.66.36]) by iasrv1.idleaire.net (Postfix) with ESMTP id A5C39236E54; Wed, 3 Dec 2003 16:42:55 -0500 (EST) Received: from [10.1.66.124] ([10.1.66.124]) by corp4.idleaire.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 3 Dec 2003 16:42:55 -0500 Subject: [BK RESEND Typhoon (3CR990) updates for 2.5 From: Dave Dillow To: Jeff Garzik Cc: Netdev X-Originating-IP: [216.153.89.133] X-Authentication-Warning: ori.thedillows.org: il1 set sender to dave@thedillows.org using -f X-archive-position: 1709 X-ecartis-version: Ecartis v1.0.0 X-original-sender: dave@thedillows.org X-list: netdev Content-Type: text/plain Organization: Message-Id: <1070487775.5062.8.camel@dillow.idleaire.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 03 Dec 2003 16:42:55 -0500 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Dec 2003 21:42:55.0693 (UTC) FILETIME=[694F57D0:01C3B9E6] X-archive-position: 1867 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ddillow@idleaire.com Precedence: bulk X-list: netdev Jeff, please do a bk pull http://typhoon.bkbits.net/typhoon-2.5 This will update the following files: drivers/net/typhoon.c | 97 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 19 deletions(-) through these ChangeSets: (03/11/26 1.1487) Bug fixes: * Avoid short timeouts when waiting for a reset * Fix issue with loading runtime image on newer versions of the sleep image * Fix link status reporting From ja@ssi.bg Wed Dec 3 14:03:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 14:03:18 -0800 (PST) Received: from u.domain.uli (ja.mac.ssi.bg [217.79.71.194]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3M2sTa005223 for ; Wed, 3 Dec 2003 14:02:57 -0800 Received: from localhost (localhost [127.0.0.1]) by u.domain.uli (8.12.10/8.12.10) with ESMTP id hB3M3KjV001862; Thu, 4 Dec 2003 00:03:22 +0200 Date: Thu, 4 Dec 2003 00:03:20 +0200 (EET) From: Julian Anastasov X-X-Sender: ja@u.domain.uli To: "David S. Miller" cc: herbert@gondor.apana.org.au, Subject: Re: [ROUTE] PMTU only works on half the time In-Reply-To: <20031202163902.2deb43a7.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 1869 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ja@ssi.bg Precedence: bulk X-list: netdev Hello, On Tue, 2 Dec 2003, David S. Miller wrote: > You changes mean that for routes with specific output interfaces, > we will ignore ICMPs for those routes that arrive on other interfaces > due to assymetric routing. > > Why don't you create a seperate patch that just has the TOS masking > changes? That's much less controversial and thus something I'm likely > to apply. Here is a new version, all changes are: - ip_rt_redirect works for entries oif=IIF and oif=0 as before - ip_rt_redirect now supports RTO_ONLINK - ip_rt_frag_needed now supports RTO_ONLINK and all oif!=0 - ifindex is not anymore a hash key. This is required for ip_rt_frag_needed to deliver the event to all entries no matter the oif key. I'm not sure if this is for good or for bad for the hash table distribution. I hope jenkins hash is ready for this as it is not a common case to have multiple oifs per one saddr-daddr-tos. - __ip_route_output_key now ignores illegal bits (bit 1) from tos diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c --- a/net/ipv4/route.c Wed Dec 3 23:37:00 2003 +++ b/net/ipv4/route.c Wed Dec 3 23:37:00 2003 @@ -967,11 +967,11 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, u32 saddr, u8 tos, struct net_device *dev) { - int i, k; + int i, j; struct in_device *in_dev = in_dev_get(dev); struct rtable *rth, **rthp; u32 skeys[2] = { saddr, 0 }; - int ikeys[2] = { dev->ifindex, 0 }; + u8 toskeys[2]; tos &= IPTOS_RT_MASK; @@ -992,11 +992,12 @@ goto reject_redirect; } + toskeys[0] = tos; + toskeys[1] = tos | RTO_ONLINK; + if (saddr && daddr) for (i = 0; i < 2; i++) { - for (k = 0; k < 2; k++) { - unsigned hash = rt_hash_code(daddr, - skeys[i] ^ (ikeys[k] << 5), - tos); + for (j = 0; j < 2; j++) { + unsigned hash = rt_hash_code(daddr, skeys[i], toskeys[j]); rthp=&rt_hash_table[hash].chain; @@ -1007,8 +1008,9 @@ smp_read_barrier_depends(); if (rth->fl.fl4_dst != daddr || rth->fl.fl4_src != skeys[i] || - rth->fl.fl4_tos != tos || - rth->fl.oif != ikeys[k] || + rth->fl.fl4_tos != toskeys[j] || + (rth->fl.oif && + rth->fl.oif != dev->ifindex) || rth->fl.iif != 0) { rthp = &rth->u.rt_next; continue; @@ -1105,8 +1107,7 @@ } else if ((rt->rt_flags & RTCF_REDIRECTED) || rt->u.dst.expires) { unsigned hash = rt_hash_code(rt->fl.fl4_dst, - rt->fl.fl4_src ^ - (rt->fl.oif << 5), + rt->fl.fl4_src, rt->fl.fl4_tos); #if RT_CACHE_DEBUG >= 1 printk(KERN_DEBUG "ip_rt_advice: redirect to " @@ -1239,19 +1240,21 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) { - int i; + int i, j; unsigned short old_mtu = ntohs(iph->tot_len); struct rtable *rth; u32 skeys[2] = { iph->saddr, 0, }; u32 daddr = iph->daddr; u8 tos = iph->tos & IPTOS_RT_MASK; unsigned short est_mtu = 0; + u8 toskeys[2] = { tos, tos | RTO_ONLINK }; if (ipv4_config.no_pmtu_disc) return 0; + for (j = 0; j < 2; j++) for (i = 0; i < 2; i++) { - unsigned hash = rt_hash_code(daddr, skeys[i], tos); + unsigned hash = rt_hash_code(daddr, skeys[i], toskeys[j]); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; @@ -1261,7 +1264,7 @@ rth->fl.fl4_src == skeys[i] && rth->rt_dst == daddr && rth->rt_src == iph->saddr && - rth->fl.fl4_tos == tos && + rth->fl.fl4_tos == toskeys[j] && rth->fl.iif == 0 && !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { unsigned short mtu = new_mtu; @@ -1503,7 +1506,7 @@ RT_CACHE_STAT_INC(in_slow_mc); in_dev_put(in_dev); - hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5), tos); + hash = rt_hash_code(daddr, saddr, tos); return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); e_nobufs: @@ -1554,7 +1557,7 @@ if (!in_dev) goto out; - hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5), tos); + hash = rt_hash_code(daddr, saddr, tos); /* Check for the most weird martians, which can be not detected by fib_lookup. @@ -1847,7 +1850,7 @@ int iif = dev->ifindex; tos &= IPTOS_RT_MASK; - hash = rt_hash_code(daddr, saddr ^ (iif << 5), tos); + hash = rt_hash_code(daddr, saddr, tos); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { @@ -2190,7 +2193,7 @@ rth->rt_flags = flags; - hash = rt_hash_code(oldflp->fl4_dst, oldflp->fl4_src ^ (oldflp->oif << 5), tos); + hash = rt_hash_code(oldflp->fl4_dst, oldflp->fl4_src, tos); err = rt_intern_hash(hash, rth, rp); done: if (free_res) @@ -2213,8 +2216,9 @@ { unsigned hash; struct rtable *rth; + u8 tos = flp->fl4_tos & (IPTOS_RT_MASK | RTO_ONLINK); - hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), flp->fl4_tos); + hash = rt_hash_code(flp->fl4_dst, flp->fl4_src, tos); rcu_read_lock(); for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { @@ -2226,8 +2230,7 @@ #ifdef CONFIG_IP_ROUTE_FWMARK rth->fl.fl4_fwmark == flp->fl4_fwmark && #endif - !((rth->fl.fl4_tos ^ flp->fl4_tos) & - (IPTOS_RT_MASK | RTO_ONLINK))) { + rth->fl.fl4_tos == tos) { rth->u.dst.lastuse = jiffies; dst_hold(&rth->u.dst); rth->u.dst.__use++; Regards -- Julian Anastasov From johnip@sgi.com Wed Dec 3 14:12:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 14:12:50 -0800 (PST) Received: from tolkor.sgi.com (tolkor.SGI.COM [198.149.18.6]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3MCbTa005737 for ; Wed, 3 Dec 2003 14:12:37 -0800 Received: from flecktone.americas.sgi.com (flecktone.americas.sgi.com [192.48.203.135]) by tolkor.sgi.com (8.12.9/8.12.9/linux-outbound_gateway-1.1) with ESMTP id hB3MXeHc011599 for ; Wed, 3 Dec 2003 16:33:40 -0600 Received: from daisy-e236.americas.sgi.com (daisy-e236.americas.sgi.com [128.162.236.214]) by flecktone.americas.sgi.com (8.12.9/8.12.9/generic_config-1.2) with ESMTP id hB3MBVP516945186; Wed, 3 Dec 2003 16:11:31 -0600 (CST) Received: from sgi.com (fundament.americas.sgi.com [128.162.233.56]) by daisy-e236.americas.sgi.com (8.12.9/SGI-server-1.8) with ESMTP id hB3MBFRn350607139; Wed, 3 Dec 2003 16:11:20 -0600 (CST) Message-ID: <3FCE5F8A.9010503@sgi.com> Date: Wed, 03 Dec 2003 16:11:22 -0600 From: John Partridge Reply-To: johnip@sgi.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031120 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jeff Garzik CC: "David S. Miller" , ak@suse.de, netdev@oss.sgi.com, jes@sgi.com Subject: Re: Tigon3 5701 PCI-X recv performance problem References: <3F844578.40306@sgi.com> <20031008101046.376abc3b.davem@redhat.com> <3F8455BE.8080300@sgi.com> <20031008183742.GA24822@wotan.suse.de> <20031008122223.1ba5ac79.davem@redhat.com> <20031008202248.GA15611@oldwotan.suse.de> <3F8702FF.70500@sgi.com> <20031010192036.GA31727@wotan.suse.de> <3F8802E6.5030601@sgi.com> <20031011131921.GC21763@wotan.suse.de> <20031011105054.0e16a607.davem@redhat.com> <3F8C290A.3010508@sgi.com> <20031014095323.71c8b9fe.davem@redhat.com> <3FB03A56.7000709@sgi.com> <20031110182911.2c5a121b.davem@redhat.com> <3FB140E2.1070007@sgi.com> <20031111122403.2d7bcf28.davem@redhat.com> <3FB153F1.8040708@sgi.com> <3FB15550.8020807@pobox.com> In-Reply-To: <3FB15550.8020807@pobox.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1870 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: johnip@sgi.com Precedence: bulk X-list: netdev Jeff, I have not seen the change for this go into 2.6 is there something else I should be doing ? Thanks John Jeff Garzik wrote: > John Partridge wrote: > >> David S. Miller wrote: >> >>> On Tue, 11 Nov 2003 14:04:50 -0600 >>> Why are you depending upon MCKINLEY? Don't all ia64 cpus >>> give traps for unaligned memory accesses? >> >> >> >> I have no evidence of a problem with Itanium1, only on Itanium2 >> (MCKINLEY) >> I have seen it on HP and SGI MCKINLEY > > > > Ask the other David M about eepro100.c patches he wanted to send to me... > > Jeff > > > -- John Partridge Silicon Graphics Inc Tel: 651-683-3428 Vnet: 233-3428 E-Mail: johnip@sgi.com From ddillow@idleaire.com Wed Dec 3 14:22:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 14:22:41 -0800 (PST) Received: from iasrv1.idleaire.net (NS1.idleaire.net [65.220.16.2]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3MM7Ta006583 for ; Wed, 3 Dec 2003 14:22:08 -0800 Received: by iasrv1.idleaire.net (Postfix, from userid 300) id 24A8D236E5C; Wed, 3 Dec 2003 16:42:53 -0500 (EST) Received: from corp4.idleaire.com (corp4.idleaire.com [10.1.66.36]) by iasrv1.idleaire.net (Postfix) with ESMTP id 9A637236E54; Wed, 3 Dec 2003 16:42:52 -0500 (EST) Received: from [10.1.66.124] ([10.1.66.124]) by corp4.idleaire.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 3 Dec 2003 16:42:52 -0500 Subject: [BK RESEND] Typhoon (3CR990) updates for 2.4 From: Dave Dillow To: Jeff Garzik Cc: Netdev X-Originating-IP: [216.153.89.133] X-Authentication-Warning: ori.thedillows.org: il1 set sender to dave@thedillows.org using -f X-archive-position: 1707 X-ecartis-version: Ecartis v1.0.0 X-original-sender: dave@thedillows.org X-list: netdev Content-Type: text/plain Organization: Message-Id: <1070487769.5062.4.camel@dillow.idleaire.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 03 Dec 2003 16:42:49 -0500 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Dec 2003 21:42:52.0646 (UTC) FILETIME=[677E6860:01C3B9E6] X-archive-position: 1871 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ddillow@idleaire.com Precedence: bulk X-list: netdev Jeff, please do a bk pull http://typhoon.bkbits.net/typhoon-2.4 This will update the following files: drivers/net/typhoon.c | 97 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 19 deletions(-) through these ChangeSets: (03/11/25 1.1063.47.1) Bug fixes: * Avoid short timeouts when waiting for a reset * Support newer versions of the sleep image * Fix link status reporting From hadi@cyberus.ca Wed Dec 3 14:31:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 14:32:03 -0800 (PST) Received: from mail.cyberus.ca (mail.cyberus.ca [209.197.145.21]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB3MVnTa007023 for ; Wed, 3 Dec 2003 14:31:50 -0800 Received: from cpe0030ab124d2f-cm014500000962.cpe.net.cable.rogers.com ([24.103.99.32] helo=[10.0.0.9]) by mail.cyberus.ca with esmtp (Exim 4.20) id 1ARXPi-0003ME-Hu; Wed, 03 Dec 2003 08:51:34 -0500 Subject: Re: [RTNETLINK] Provide real oif From: jamal Reply-To: hadi@cyberus.ca To: Herbert Xu Cc: netdev@oss.sgi.com In-Reply-To: References: Content-Type: text/plain Organization: jamalopolis Message-Id: <1070459463.1036.179.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 03 Dec 2003 08:51:03 -0500 Content-Transfer-Encoding: 7bit X-archive-position: 1872 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@cyberus.ca Precedence: bulk X-list: netdev Hi, On Wed, 2003-12-03 at 05:35, Herbert Xu wrote: > They both have an RTA_OIF of eth0. But RTA_OIF != rt->fl.oif. In fact, > RTA_OIF is the value of rt->u.dst.dev. (to be precise: rt->u.dst.dev->ifindex) Ok, now i understand what you are saying. In one case you taught the kernel the oif to use in the other you let it select the default. i.e: ip r g x.x.x.x dev eth0 and to select the default: ip r g x.x.x.x ip r l c should show them to be exact. In your case your selection and the default just happen to be the same device. I am wondering if they should have been the same resolved cache entry to begin with. i.e the fl->oif should not have been 0 rather the ifindex of eth0. Even in the case of multipath routing, you have to wait for the cache to expire before selecting the next one in the slow path; so fl->oif of zero may not be a very useful artifact. cheers, jamal From romieu@fr.zoreil.com Wed Dec 3 15:26:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 15:26:53 -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 hB3NQaTa008009 for ; Wed, 3 Dec 2003 15:26:37 -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 hB3NQDxg025696; Thu, 4 Dec 2003 00:26:13 +0100 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id hB3NQAp3025695; Thu, 4 Dec 2003 00:26:10 +0100 Date: Thu, 4 Dec 2003 00:26:10 +0100 From: Francois Romieu To: netdev@oss.sgi.com Cc: =?unknown-8bit?Q?Fernando_Alencar_Mar=F3stica?= , Brad House , Matthew Gregan , jgarzik@pobox.com Subject: [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness Message-ID: <20031204002610.A25405@electric-eye.fr.zoreil.com> References: <1070212415.1607.17.camel@oxygenium> <20031201020453.A16405@electric-eye.fr.zoreil.com> <20031202010649.A27879@electric-eye.fr.zoreil.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20031202010649.A27879@electric-eye.fr.zoreil.com>; from romieu@fr.zoreil.com on Tue, Dec 02, 2003 at 01:06:49AM +0100 X-Organisation: Land of Sunshine Inc. X-archive-position: 1873 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 --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline See patch in attachment. Francois Romieu : [...] > o Pure 2.6.0-test11: > > Get: > http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2 > debuntarzipe and apply/compile/test in following order: > r8169-dma-api-tx.patch [...] > r8169-suspend.patch Insert here. [...] > o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1 > > Get: > http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2 > Same thing as above with: > r8169-mac-phy-version.patch [...] > r8169-suspend.patch > r8169-dma-api-rx-buffers-ahum.patch Or here. -- Ueimor --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="r8169-endianness.patch" Endianness update (original idea from Alexandra N. Kossovsky): - descriptors status (bitfields enumerated as _DescStatusBit); - address of buffers stored in Rx/Tx descriptors. drivers/net/r8169.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff -puN drivers/net/r8169.c~r8169-endianness drivers/net/r8169.c --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-endianness 2003-12-03 23:29:40.000000000 +0100 +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-03 23:50:54.000000000 +0100 @@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev) static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) { desc->buf_addr = 0xdeadbeef; - desc->status &= ~(OWNbit | RsvdMask); + desc->status &= ~cpu_to_le32(OWNbit | RsvdMask); } static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, struct RxDesc *desc) { - pci_unmap_single(pdev, desc->buf_addr, RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), RX_BUF_SIZE, + PCI_DMA_FROMDEVICE); dev_kfree_skb(*sk_buff); *sk_buff = NULL; rtl8169_make_unusable_by_asic(desc); @@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct p static inline void rtl8169_return_to_asic(struct RxDesc *desc) { - desc->status |= OWNbit + RX_BUF_SIZE; + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE); } static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping) { - desc->buf_addr = mapping; - desc->status |= OWNbit + RX_BUF_SIZE; + desc->buf_addr = cpu_to_le32(mapping); + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE); } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev, @@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816 static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc) { - desc->status |= EORbit; + desc->status |= cpu_to_le32(EORbit); } static int rtl8169_init_ring(struct net_device *dev) @@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct { u32 len = sk_buff[0]->len; - pci_unmap_single(pdev, desc->buf_addr, len < ETH_ZLEN ? ETH_ZLEN : len, - PCI_DMA_TODEVICE); + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), + len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE); desc->buf_addr = 0x00; *sk_buff = NULL; } @@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb, spin_lock_irq(&tp->lock); - if ((tp->TxDescArray[entry].status & OWNbit) == 0) { + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) { dma_addr_t mapping; mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); tp->Tx_skbuff[entry] = skb; - tp->TxDescArray[entry].buf_addr = mapping; + tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping); - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len | - (EORbit * !((entry + 1) % NUM_TX_DESC)); + tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit | + LSbit | len | (EORbit * !((entry + 1) % NUM_TX_DESC))); RTL_W8(TxPoll, 0x40); //set polling bit @@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device * tx_left = tp->cur_tx - dirty_tx; while (tx_left > 0) { - if ((tp->TxDescArray[entry].status & OWNbit) == 0) { + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) { int cur = dirty_tx % NUM_TX_DESC; struct sk_buff *skb = tp->Tx_skbuff[cur]; @@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device * cur_rx = tp->cur_rx % RX_BUF_SIZE; - while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) { - u32 status = tp->RxDescArray[cur_rx].status; + while (!(le32_to_cpu(tp->RxDescArray[cur_rx].status) & OWNbit)) { + u32 status = le32_to_cpu(tp->RxDescArray[cur_rx].status); if (status & RxRES) { printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name); _ --6c2NcOVqGQ03X4Wi-- From brad@mainstreetsoftworks.com Wed Dec 3 15:30:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 15:31:08 -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 hB3NUsTa010258 for ; Wed, 3 Dec 2003 15:30:54 -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 7B2EA8527C; Wed, 3 Dec 2003 18:45:20 -0500 (EST) Message-ID: <3FCE7224.4000106@mainstreetsoftworks.com> Date: Wed, 03 Dec 2003 18:30:44 -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, =?ISO-8859-1?Q?Fernando_Alencar_Mar=F3stica?= , Brad House , Matthew Gregan , jgarzik@pobox.com Subject: Re: [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness References: <1070212415.1607.17.camel@oxygenium> <20031201020453.A16405@electric-eye.fr.zoreil.com> <20031202010649.A27879@electric-eye.fr.zoreil.com> <20031204002610.A25405@electric-eye.fr.zoreil.com> In-Reply-To: <20031204002610.A25405@electric-eye.fr.zoreil.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1874 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 k, cool ... I should have time to test all this tonight ... -Brad Francois Romieu wrote: > See patch in attachment. > > Francois Romieu : > [...] > >>o Pure 2.6.0-test11: >> >>Get: >>http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2 >>debuntarzipe and apply/compile/test in following order: >>r8169-dma-api-tx.patch > > [...] > >>r8169-suspend.patch > > > Insert here. > > [...] > >>o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1 >> >>Get: >>http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2 >>Same thing as above with: >>r8169-mac-phy-version.patch > > [...] > >>r8169-suspend.patch >>r8169-dma-api-rx-buffers-ahum.patch > > > Or here. > > -- > Ueimor > > > ------------------------------------------------------------------------ > > > Endianness update (original idea from Alexandra N. Kossovsky): > - descriptors status (bitfields enumerated as _DescStatusBit); > - address of buffers stored in Rx/Tx descriptors. > > > > drivers/net/r8169.c | 31 ++++++++++++++++--------------- > 1 files changed, 16 insertions(+), 15 deletions(-) > > diff -puN drivers/net/r8169.c~r8169-endianness drivers/net/r8169.c > --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-endianness 2003-12-03 23:29:40.000000000 +0100 > +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-03 23:50:54.000000000 +0100 > @@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev) > static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) > { > desc->buf_addr = 0xdeadbeef; > - desc->status &= ~(OWNbit | RsvdMask); > + desc->status &= ~cpu_to_le32(OWNbit | RsvdMask); > } > > static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, > struct RxDesc *desc) > { > - pci_unmap_single(pdev, desc->buf_addr, RX_BUF_SIZE, PCI_DMA_FROMDEVICE); > + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), RX_BUF_SIZE, > + PCI_DMA_FROMDEVICE); > dev_kfree_skb(*sk_buff); > *sk_buff = NULL; > rtl8169_make_unusable_by_asic(desc); > @@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct p > > static inline void rtl8169_return_to_asic(struct RxDesc *desc) > { > - desc->status |= OWNbit + RX_BUF_SIZE; > + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE); > } > > static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping) > { > - desc->buf_addr = mapping; > - desc->status |= OWNbit + RX_BUF_SIZE; > + desc->buf_addr = cpu_to_le32(mapping); > + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE); > } > > static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev, > @@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816 > > static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc) > { > - desc->status |= EORbit; > + desc->status |= cpu_to_le32(EORbit); > } > > static int rtl8169_init_ring(struct net_device *dev) > @@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct > { > u32 len = sk_buff[0]->len; > > - pci_unmap_single(pdev, desc->buf_addr, len < ETH_ZLEN ? ETH_ZLEN : len, > - PCI_DMA_TODEVICE); > + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), > + len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE); > desc->buf_addr = 0x00; > *sk_buff = NULL; > } > @@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb, > > spin_lock_irq(&tp->lock); > > - if ((tp->TxDescArray[entry].status & OWNbit) == 0) { > + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) { > dma_addr_t mapping; > > mapping = pci_map_single(tp->pci_dev, skb->data, len, > PCI_DMA_TODEVICE); > > tp->Tx_skbuff[entry] = skb; > - tp->TxDescArray[entry].buf_addr = mapping; > + tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping); > > - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len | > - (EORbit * !((entry + 1) % NUM_TX_DESC)); > + tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit | > + LSbit | len | (EORbit * !((entry + 1) % NUM_TX_DESC))); > > RTL_W8(TxPoll, 0x40); //set polling bit > > @@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device * > tx_left = tp->cur_tx - dirty_tx; > > while (tx_left > 0) { > - if ((tp->TxDescArray[entry].status & OWNbit) == 0) { > + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) { > int cur = dirty_tx % NUM_TX_DESC; > struct sk_buff *skb = tp->Tx_skbuff[cur]; > > @@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device * > > cur_rx = tp->cur_rx % RX_BUF_SIZE; > > - while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) { > - u32 status = tp->RxDescArray[cur_rx].status; > + while (!(le32_to_cpu(tp->RxDescArray[cur_rx].status) & OWNbit)) { > + u32 status = le32_to_cpu(tp->RxDescArray[cur_rx].status); > > if (status & RxRES) { > printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name); > > _ From scott.feldman@intel.com Wed Dec 3 18:26:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Dec 2003 18:26:24 -0800 (PST) Received: from caduceus.jf.intel.com (fmr06.intel.com [134.134.136.7]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB42Q9Ta015917 for ; Wed, 3 Dec 2003 18:26:10 -0800 Received: from petasus.jf.intel.com (petasus.jf.intel.com [10.7.209.6]) by caduceus.jf.intel.com (8.12.9-20030918-01/8.12.9/d: major-outer.mc,v 1.11 2003/12/03 18:29:28 root Exp $) with ESMTP id hB42QKvY003816; Thu, 4 Dec 2003 02:26:20 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) by petasus.jf.intel.com (8.11.6-20030918-01/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id hB42JkG06097; Thu, 4 Dec 2003 02:19:46 GMT Received: from orsmsx332.amr.corp.intel.com ([192.168.65.60]) by orsmsxvs040.jf.intel.com (SAVSMTP 3.1.1.32) with SMTP id M2003120318254621192 ; Wed, 03 Dec 2003 18:25:46 -0800 Received: from orsmsx402.amr.corp.intel.com ([192.168.65.208]) by orsmsx332.amr.corp.intel.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 3 Dec 2003 18:25:46 -0800 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: RE: [2/4] pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Date: Wed, 3 Dec 2003 18:25:46 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [2/4] pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 Thread-Index: AcO5pVKFKO1/5MqkTyaatG+4vg7ZuAAaSxqg From: "Feldman, Scott" To: , Cc: , , X-OriginalArrivalTime: 04 Dec 2003 02:25:46.0597 (UTC) FILETIME=[ECC1C950:01C3BA0D] 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 hB42Q9Ta015917 X-archive-position: 1875 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 > Below is the pollcontroller patch for e1000. > This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch Did you test this w/ and w/o CONFIG_E1000_NAPI? -scott From uucp@coruscant.gnumonks.org Thu Dec 4 02:14:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 02:14:25 -0800 (PST) Received: from coruscant.gnumonks.org (coruscant.franken.de [193.174.159.226]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB4AE7Ta030791 for ; Thu, 4 Dec 2003 02:14:08 -0800 Received: from uucp by coruscant.gnumonks.org with local-bsmtp (Exim 4.20) id 1ARpNt-0000qI-Tj for netdev@oss.sgi.com; Thu, 04 Dec 2003 10:02:53 +0100 Received: from laforge by obroa-skai.gnumonks.org with local (Exim 3.36 #1) id 1ARpMl-0000XH-00; Thu, 04 Dec 2003 14:31:21 +0530 Date: Thu, 4 Dec 2003 14:31:21 +0530 From: Harald Welte To: "David S. Miller" Cc: netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org Subject: [PATCH 2.4.x] IPv6 multicast (MLD,IGMP) code bypasses netfilter hooks Message-ID: <20031204090121.GD16635@obroa-skai.de.gnumonks.org> Mail-Followup-To: Harald Welte , "David S. Miller" , netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org References: <20031122090330.GB2745@obroa-skai.de.gnumonks.org> <20031123154344.3e2b0b1a.davem@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oj4kGyHlBMXGt3Le" Content-Disposition: inline In-Reply-To: <20031123154344.3e2b0b1a.davem@redhat.com> X-Operating-System: Linux obroa-skai.de.gnumonks.org 2.4.23-pre7-ben0 X-Date: Today is Pungenday, the 46th day of The Aftermath in the YOLD 3169 User-Agent: Mutt/1.5.4i X-archive-position: 1876 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 --oj4kGyHlBMXGt3Le Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 23, 2003 at 03:43:22PM -0800, David S. Miller wrote: > If the fix is simple enough (1 or 2 one-liner changes) and easy > to verify, I would consider it for 2.6.0 >=20 > I may even look into this myself. Now that the other Dave's fix has made it in 2.6.0-test11, I have merged it (untested, but compiles) with 2.4.x. Dave, would you consider applying this to to 2.4.x ? Thanks. Greetings (still from India), Harald. --- linux.old/net/ipv6/mcast.c 2003-11-28 23:55:59.000000000 +0530 +++ linux/net/ipv6/mcast.c 2003-12-04 14:21:42.000000000 +0530 @@ -45,6 +45,9 @@ #include #include =20 +#include +#include + #include #include =20 @@ -1262,7 +1265,7 @@ { struct ipv6hdr *pip6 =3D skb->nh.ipv6h; struct mld2_report *pmr =3D (struct mld2_report *)skb->h.raw; - int payload_len, mldlen; + int payload_len, mldlen, err; =20 payload_len =3D skb->tail - (unsigned char *)skb->nh.ipv6h - sizeof(struct ipv6hdr); @@ -1271,8 +1274,10 @@ =20 pmr->csum =3D csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0)); - dev_queue_xmit(skb); - ICMP6_INC_STATS(Icmp6OutMsgs); + err =3D NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, + dev_queue_xmit); + if (!err) + ICMP6_INC_STATS(Icmp6OutMsgs); } =20 static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) @@ -1596,12 +1601,16 @@ IPPROTO_ICMPV6, csum_partial((__u8 *) hdr, len, 0)); =20 - dev_queue_xmit(skb); - if (type =3D=3D ICMPV6_MGM_REDUCTION) - ICMP6_INC_STATS(Icmp6OutGroupMembReductions); - else - ICMP6_INC_STATS(Icmp6OutGroupMembResponses); - ICMP6_INC_STATS(Icmp6OutMsgs); + err =3D NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, + dev_queue_xmit); + if (!err) { + if (type =3D=3D ICMPV6_MGM_REDUCTION) + ICMP6_INC_STATS(Icmp6OutGroupMembReductions); + else + ICMP6_INC_STATS(Icmp6OutGroupMembResponses); + ICMP6_INC_STATS(Icmp6OutMsgs); + } + return; =20 out: --=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 --oj4kGyHlBMXGt3Le Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/zvf2XaXGVTD0i/8RAgyPAJ9pxdEJHaHwVGipMPVP4FtEzYVPAwCfUKNd t66omr9VmxcY9XO13onkzl0= =XLO5 -----END PGP SIGNATURE----- --oj4kGyHlBMXGt3Le-- From uucp@coruscant.gnumonks.org Thu Dec 4 05:40:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 05:41:07 -0800 (PST) Received: from coruscant.gnumonks.org (coruscant.franken.de [193.174.159.226]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB4DeqTa021792 for ; Thu, 4 Dec 2003 05:40:53 -0800 Received: from uucp by coruscant.gnumonks.org with local-bsmtp (Exim 4.20) id 1ARrqn-0001pw-8Y for netdev@oss.sgi.com; Thu, 04 Dec 2003 12:40:53 +0100 Received: from laforge by obroa-skai.gnumonks.org with local (Exim 3.36 #1) id 1ARrpg-0006Lb-00; Thu, 04 Dec 2003 17:09:22 +0530 Date: Thu, 4 Dec 2003 17:09:22 +0530 From: Harald Welte To: Michael Bussmann Cc: netdev@oss.sgi.com, Netfilter Development Mailinglist Subject: Re: [Bug 155] Outgoing MLD packets are not traversing netfilter Message-ID: <20031204113922.GB7680@obroa-skai.de.gnumonks.org> Mail-Followup-To: Harald Welte , Michael Bussmann , netdev@oss.sgi.com, Netfilter Development Mailinglist References: <20031204092816.GC28403@ruf098.fkie.fgan.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <20031204092816.GC28403@ruf098.fkie.fgan.de> X-Operating-System: Linux obroa-skai.de.gnumonks.org 2.4.23-pre7-ben0 X-Date: Today is Pungenday, the 46th day of The Aftermath in the YOLD 3169 User-Agent: Mutt/1.5.4i X-archive-position: 1877 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 --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 04, 2003 at 10:27:54AM +0100, Michael Bussmann wrote: > However, I still notice an oddity: MLD packets are not recognised as > icmpv6 messages. That's bad. Are you talking about MLDv1 or MLDv2 packets? > I set up a simple set of rules that directs both icmpv6 packets and "any" > packets (just for testing purposes) to the QUEUE target. An application > program (using libipq) dumps all packets: Ouch. We have two issues here: 1) ip6_tables not matching it as icmp6 packet This basically means that skb->nh.ipv6h is not initialized, or points to skb->raw instead of the ipv6 header. I cannot see how this could happen in the mld_sendpack(), since itself dereferences skb->nh.ipv6h =20 In the igmp6_send() case, ip6_nd_hdr() initializes skb->nh correct, so I also cannot see this happen. 2) ip6_queue copying the linklayer header to userspace This means that skb->data does not point at the beginning of the ipv6 packet (i.e. skb->data !=3D skb->nh.ip6h), but to the beginning of the hardware header (i.e. skb->data =3D=3D skb->head). This is because mcast.c writes the full packet including the hardware header and _then_ calls NF_HOOK. All other code (ipv6 or ipv4) is building the layer 3 packet, then calling NF_HOOK and later on (via ipX_outpur_finish() or dst_output()) adding the hardware header. > I'm not sure whether this is a bug, but it seems to be inconsistent that > some icmpv6 packets are dumped with the LL and others are not. of course it is a bug. So the fundamental question (with regard to the ipv6 gods) is: Is it really necessarry that the ipv6 mcast code bypasses the destination cache? IPv4 multicast just uses the dst_cache, and thus sends the packet using the normal dst_output() functions. I have to admit that I'm not as fluent with the code to decide why ipv6 multicast is the only code in ipv4/ipv6 that manually adds the hardware header and bypasses the normal dst_otput() way?. Can somebody explain? > Let me know if you need further information. As I am currently travelling, I cannot really play with any multicast networking (just a single notebook machine here, and it is ppc, so no user-mode-linux). > Best regards, > MB --=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 --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/zx0AXaXGVTD0i/8RAh0SAKCziMP8L76fLxyvBxxC9XI3d7yFDACfUXuX O76opGIfnXi5iO1h47XPnH8= =Sk4I -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp-- From dlstevens@us.ibm.com Thu Dec 4 09:59:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 09:59:17 -0800 (PST) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.131]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB4HwtTa030671 for ; Thu, 4 Dec 2003 09:59:04 -0800 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e33.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB4HwXJh123062; Thu, 4 Dec 2003 12:58:33 -0500 Received: from d03nm121.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay02.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB4HwTQQ065278; Thu, 4 Dec 2003 10:58:30 -0700 Importance: Normal Sensitivity: Subject: Re: [Bug 155] Outgoing MLD packets are not traversing netfilter To: Harald Welte Cc: Michael Bussmann , netdev@oss.sgi.com, Netfilter Development Mailinglist X-Mailer: Lotus Notes Release 5.0.4a July 24, 2000 Message-ID: From: David Stevens Date: Thu, 4 Dec 2003 09:58:27 -0800 X-MIMETrack: Serialize by Router on D03NM121/03/M/IBM(Release 6.0.2CF2HF92 | October 15, 2003) at 12/04/2003 10:58:29 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-archive-position: 1878 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: dlstevens@us.ibm.com Precedence: bulk X-list: netdev Harald, >1) ip6_tables not matching it as icmp6 packet > Just a guess, but if netfilter6 doesn't go through all the extension headers, then the protocol won't look like ICMP6 because of the router alert option. >2) ip6_queue copying the linklayer header to userspace > >This means that skb->data does not point at the beginning of the >ipv6 packet (i.e. skb->data != skb->nh.ip6h), but to the beginning of >the hardware header (i.e. skb->data == skb->head). > >This is because mcast.c writes the full packet including the hardware >header and _then_ calls NF_HOOK. All other code (ipv6 or ipv4) is >building the layer 3 packet, then calling NF_HOOK and later on (via >ipX_outpur_finish() or dst_output()) adding the hardware header. ... >So the fundamental question (with regard to the ipv6 gods) is: Is it >really necessarry that the ipv6 mcast code bypasses the destination >cache? It can't go through the routing table. The advertisements are only meaningful on the particular interface, whether or not there is a route pointing output multicasts to a different interface (which is useful frequently, but MLD packets can't go there too). +-DLS From davem@pizda.ninka.net Thu Dec 4 10:38:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 10:38:50 -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 hB4IcaTa032156 for ; Thu, 4 Dec 2003 10:38:37 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id KAA22520; Thu, 4 Dec 2003 10:37:19 -0800 Date: Thu, 4 Dec 2003 10:37:19 -0800 From: "David S. Miller" To: Harald Welte Cc: netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org Subject: Re: [PATCH 2.4.x] IPv6 multicast (MLD,IGMP) code bypasses netfilter hooks Message-Id: <20031204103719.56038dba.davem@redhat.com> In-Reply-To: <20031204090121.GD16635@obroa-skai.de.gnumonks.org> References: <20031122090330.GB2745@obroa-skai.de.gnumonks.org> <20031123154344.3e2b0b1a.davem@redhat.com> <20031204090121.GD16635@obroa-skai.de.gnumonks.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: 1879 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, 4 Dec 2003 14:31:21 +0530 Harald Welte wrote: > Now that the other Dave's fix has made it in 2.6.0-test11, I have merged > it (untested, but compiles) with 2.4.x. > > Dave, would you consider applying this to to 2.4.x ? Done, thanks for catching this Harald. From kumarkr@us.ibm.com Thu Dec 4 13:26:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 13:26:41 -0800 (PST) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.132]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB4LQJTa012725 for ; Thu, 4 Dec 2003 13:26:28 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e34.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB4LQD6t363666 for ; Thu, 4 Dec 2003 16:26:13 -0500 Received: from d03nm801.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB4LQCQ1116638 for ; Thu, 4 Dec 2003 14:26:13 -0700 Subject: Gratuitous ARP To: netdev@oss.sgi.com X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: Krishna Kumar Date: Thu, 4 Dec 2003 13:24:57 -0800 X-MIMETrack: Serialize by Router on D03NM801/03/M/IBM(Release 6.0.2CF2HF92 | October 15, 2003) at 12/04/2003 14:26:12 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-archive-position: 1880 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kumarkr@us.ibm.com Precedence: bulk X-list: netdev Hi, I am trying to find out why gratuitous ARP isn't implemented for IPv4 duplicate address detection, though a comment is present in the arp.c that it was added. Was it removed for any reason ? I went through netdev archives and found some threads relating to this, but no comments were there on why this feature is absent or removed. Could it be to avoid a flood arp attack ? If so, any reason why it cannot be implemented under a configuration param ? I would appreciate if someone can throw any light on this. Thanks, - KK From shemminger@osdl.org Thu Dec 4 16:38:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 16:39:05 -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 hB50cpTa021744 for ; Thu, 4 Dec 2003 16:38:51 -0800 Received: from dell_ss3.pdx.osdl.net (IDENT:2997@dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id hB50chZ06302; Thu, 4 Dec 2003 16:38:43 -0800 Date: Thu, 4 Dec 2003 16:39:28 -0800 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com, Alexander Viro Subject: [PATCH] skfddi - convert to new pci model. Message-Id: <20031204163928.0f34d5d1.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 1881 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1502 -> 1.1503 # drivers/net/skfp/skfddi.c 1.20 -> 1.21 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/12/04 shemminger@osdl.org 1.1503 # Convert skfddi device to 2.6. # * use new pci device bus initialization # * allocate network device with alloc_fddidev # and use dev->priv # * get rid of special module/non module distinctions. # * fix error unwinds and return values on initialization # -------------------------------------------- # diff -Nru a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c --- a/drivers/net/skfp/skfddi.c Thu Dec 4 16:36:03 2003 +++ b/drivers/net/skfp/skfddi.c Thu Dec 4 16:36:03 2003 @@ -58,6 +58,7 @@ * 07-May-00 DM 64 bit fixes, new dma interface * 31-Jul-03 DB Audit copy_*_user in skfp_ioctl * Daniele Bellucci + * 03-Dec-03 SH Convert to PCI device model * * Compilation options (-Dxxx): * DRIVERDEBUG print lots of messages to log file @@ -70,7 +71,7 @@ /* Version information string - should be updated prior to */ /* each new release!!! */ -#define VERSION "2.06" +#define VERSION "2.07" static const char *boot_msg = "SysKonnect FDDI PCI Adapter driver v" VERSION " for\n" @@ -80,15 +81,11 @@ #include #include -#include -#include #include #include #include #include #include -#include -#include // isdigit #include #include #include @@ -107,11 +104,6 @@ // Define module-wide (static) routines -static struct net_device *alloc_device(struct net_device *dev, u_long iobase); -static struct net_device *insert_device(struct net_device *dev); -static int fddi_dev_index(unsigned char *s); -static void init_dev(struct net_device *dev, u_long iobase); -static void link_modules(struct net_device *dev, struct net_device *tmp); static int skfp_driver_init(struct net_device *dev); static int skfp_open(struct net_device *dev); static int skfp_close(struct net_device *dev); @@ -188,15 +180,6 @@ // Define module-wide (static) variables static int num_boards; /* total number of adapters configured */ -static int num_fddi; -static int autoprobed; - -#ifdef MODULE -static struct net_device *unlink_modules(struct net_device *p); -static int loading_module = 1; -#else -static int loading_module; -#endif // MODULE #ifdef DRIVERDEBUG #define PRINTK(s, args...) printk(s, ## args) @@ -207,9 +190,9 @@ #define PRIV(dev) (&(((struct s_smc *)dev->priv)->os)) /* - * ============== - * = skfp_probe = - * ============== + * ================= + * = skfp_init_one = + * ================= * * Overview: * Probes for supported FDDI PCI controllers @@ -218,30 +201,11 @@ * Condition code * * Arguments: - * dev - pointer to device information + * pdev - pointer to PCI device information * * Functional Description: - * This routine is called by the OS for each FDDI device name (fddi0, - * fddi1,...,fddi6, fddi7) specified in drivers/net/Space.c. - * If loaded as a module, it will detect and initialize all - * adapters the first time it is called. - * - * Let's say that skfp_probe() is getting called to initialize fddi0. - * Furthermore, let's say there are three supported controllers in the - * system. Before skfp_probe() leaves, devices fddi0, fddi1, and fddi2 - * will be initialized and a global flag will be set to indicate that - * skfp_probe() has already been called. - * - * However...the OS doesn't know that we've already initialized - * devices fddi1 and fddi2 so skfp_probe() gets called again and again - * until it reaches the end of the device list for FDDI (presently, - * fddi7). It's important that the driver "pretend" to probe for - * devices fddi1 and fddi2 and return success. Devices fddi3 - * through fddi7 will return failure since they weren't initialized. - * - * This algorithm seems to work for the time being. As other FDDI - * drivers are written for Linux, a more generic approach (perhaps - * similar to the Ethernet card approach) may need to be implemented. + * This is now called by PCI driver registration process + * for each board found. * * Return Codes: * 0 - This device (fddi0, fddi1, etc) configured successfully @@ -254,370 +218,166 @@ * initialized and the board resources are read and stored in * the device structure. */ -static int skfp_probe(struct net_device *dev) +static __init int skfp_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent) { - int i; /* used in for loops */ - struct pci_dev *pdev = NULL; /* PCI device structure */ -#ifndef MEM_MAPPED_IO - u16 port; /* temporary I/O (port) address */ - int port_len; /* length of port address range (in bytes) */ -#else - unsigned long port; -#endif - u16 command; /* PCI Configuration space Command register val */ + struct net_device *dev; struct s_smc *smc; /* board pointer */ - struct net_device *tmp = dev; - u8 first_dev_used = 0; - u16 SubSysId; + u32 port, len; + int err; PRINTK(KERN_INFO "entering skfp_probe\n"); - /* - * Verify whether we're going through skfp_probe() again - * - * If so, see if we're going through for a subsequent fddi device that - * we've already initialized. If we are, return success (0). If not, - * return failure (-ENODEV). - */ + if (num_boards == 0) + printk("%s\n", boot_msg); - if (autoprobed) { - PRINTK(KERN_INFO "Already entered skfp_probe\n"); - if (dev != NULL) { - if ((strncmp(dev->name, "fddi", 4) == 0) && - (dev->base_addr != 0)) { - return (0); - } - return (-ENODEV); - } + err = pci_enable_device(pdev); + if (err) + goto err_out1; + + +#ifdef MEM_MAPPED_IO + if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { + printk(KERN_ERR "skfp: region is not an MMIO resource\n"); + err = -EIO; + goto err_out1; + } + port = pci_resource_start(pdev, 0); + len = pci_resource_len(pdev, 0); + + if (len < 0x4000) { + printk(KERN_ERR "skfp: Invalid PCI region size: %d\n", len); + err = -EIO; + goto err_out1; } - autoprobed = 1; /* set global flag */ - - printk("%s\n", boot_msg); - - /* Scan for Syskonnect FDDI PCI controllers */ - for (i = 0; i < SKFP_MAX_NUM_BOARDS; i++) { // scan for PCI cards - PRINTK(KERN_INFO "Check device %d\n", i); - if ((pdev=pci_find_device(PCI_VENDOR_ID_SK, PCI_DEVICE_ID_SK_FP, - pdev)) == 0) { - break; - } - if (pci_enable_device(pdev)) - continue; - -#ifndef MEM_MAPPED_IO - /* Verify that I/O enable bit is set (PCI slot is enabled) */ - pci_read_config_word(pdev, PCI_COMMAND, &command); - if ((command & PCI_COMMAND_IO) == 0) { - PRINTK("I/O enable bit not set!"); - PRINTK(" Verify that slot is enabled\n"); - continue; - } - - /* Turn off memory mapped space and enable mastering */ - - PRINTK(KERN_INFO "Command Reg: %04x\n", command); - command |= PCI_COMMAND_MASTER; - command &= ~PCI_COMMAND_MEMORY; - pci_write_config_word(pdev, PCI_COMMAND, command); - - /* Read I/O base address from PCI Configuration Space */ - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_1, &port); - port &= PCI_BASE_ADDRESS_IO_MASK; // clear I/O bit (bit 0) - - /* Verify port address range is not already being used */ - - port_len = FP_IO_LEN; - if (check_region(port, port_len) != 0) { - printk("I/O range allocated to adapter"); - printk(" (0x%X-0x%X) is already being used!\n", port, - (port + port_len - 1)); - continue; - } #else - /* Verify that MEM enable bit is set (PCI slot is enabled) */ - pci_read_config_word(pdev, PCI_COMMAND, &command); - if ((command & PCI_COMMAND_MEMORY) == 0) { - PRINTK("MEMORY-I/O enable bit not set!"); - PRINTK(" Verify that slot is enabled\n"); - continue; - } - - /* Turn off IO mapped space and enable mastering */ - - PRINTK(KERN_INFO "Command Reg: %04x\n", command); - command |= PCI_COMMAND_MASTER; - command &= ~PCI_COMMAND_IO; - pci_write_config_word(pdev, PCI_COMMAND, command); - - port = pci_resource_start(pdev, 0); - - port = (unsigned long)ioremap(port, 0x4000); - if (!port){ - printk("skfp: Unable to map MEMORY register, " - "FDDI adapter will be disabled.\n"); - break; - } -#endif - - if ((!loading_module) || first_dev_used) { - /* Allocate a device structure for this adapter */ - tmp = alloc_device(dev, port); - } - first_dev_used = 1; // only significant first time - - pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &SubSysId); - - if (tmp != NULL) { - if (loading_module) - link_modules(dev, tmp); - dev = tmp; - init_dev(dev, port); - dev->irq = pdev->irq; - - /* Initialize board structure with bus-specific info */ - - smc = (struct s_smc *) dev->priv; - smc->os.dev = dev; - smc->os.bus_type = SK_BUS_TYPE_PCI; - smc->os.pdev = *pdev; - smc->os.QueueSkb = MAX_TX_QUEUE_LEN; - smc->os.MaxFrameSize = MAX_FRAME_SIZE; - smc->os.dev = dev; - smc->hw.slot = -1; - smc->os.ResetRequested = FALSE; - skb_queue_head_init(&smc->os.SendSkbQueue); - - if (skfp_driver_init(dev) == 0) { - int SubSysId = pdev->subsystem_device; - // only increment global board - // count on success - num_boards++; - if ((SubSysId & 0xff00) == 0x5500 || - (SubSysId & 0xff00) == 0x5800) { - printk("%s: SysKonnect FDDI PCI adapter" - " found (SK-%04X)\n", dev->name, - SubSysId); - } else { - printk("%s: FDDI PCI adapter found\n", - dev->name); - } - } else { - kfree(dev); - i = SKFP_MAX_NUM_BOARDS; // stop search - } - } // if (dev != NULL) - } // for SKFP_MAX_NUM_BOARDS - - /* - * If we're at this point we're going through skfp_probe() for the - * first time. Return success (0) if we've initialized 1 or more - * boards. Otherwise, return failure (-ENODEV). - */ - - if (num_boards > 0) - return (0); - else { - release_region (dev->base_addr, FP_IO_LEN); - printk("no SysKonnect FDDI adapter found\n"); - return (-ENODEV); + if (!(pci_resource_flags(pdev, 1) & IO_RESOURCE_IO)) { + printk(KERN_ERR "skfp: region is not PIO resource\n"); + err = -EIO; + goto err_out1; } -} // skfp_probe - - -/************************ - * - * Search the entire 'fddi' device list for a fixed probe. If a match isn't - * found then check for an autoprobe or unused device location. If they - * are not available then insert a new device structure at the end of - * the current list. - * - ************************/ -static struct net_device *alloc_device(struct net_device *dev, u_long iobase) -{ - struct net_device *adev = NULL; - int fixed = 0, new_dev = 0; - PRINTK(KERN_INFO "entering alloc_device\n"); - if (!dev) - return dev; - - num_fddi = fddi_dev_index(dev->name); - if (loading_module) { - num_fddi++; - dev = insert_device(dev); - return dev; + port = pci_resource_start(pdev, 1); + len = pci_resource_len(pdev, 1); + if (len < FP_IO_LEN) { + printk(KERN_ERR "skfp: Invalid PCI region size: %d\n", + io_len); + err = -EIO; + goto err_out1; } - while (1) { - if (((dev->base_addr == NO_ADDRESS) || - (dev->base_addr == 0)) && !adev) { - adev = dev; - } else if ((dev->priv == NULL) && (dev->base_addr == iobase)) { - fixed = 1; - } else { - if (dev->next == NULL) { - new_dev = 1; - } else if (strncmp(dev->next->name, "fddi", 4) != 0) { - new_dev = 1; - } - } - if ((dev->next == NULL) || new_dev || fixed) - break; - dev = dev->next; - num_fddi++; - } // while (1) - - if (adev && !fixed) { - dev = adev; - num_fddi = fddi_dev_index(dev->name); - new_dev = 0; - } - if (((dev->next == NULL) && ((dev->base_addr != NO_ADDRESS) && - (dev->base_addr != 0)) && !fixed) || - new_dev) { - num_fddi++; /* New device */ - dev = insert_device(dev); - } - if (dev) { - if (!dev->priv) { - /* Allocate space for private board structure */ - dev->priv = (void *) kmalloc(sizeof(struct s_smc), - GFP_KERNEL); - if (dev->priv == NULL) { - printk("%s: Could not allocate memory for", - dev->name); - printk(" private board structure!\n"); - return (NULL); - } - /* clear structure */ - memset(dev->priv, 0, sizeof(struct s_smc)); - } +#endif + err = pci_request_regions(pdev, "skfddi"); + if (err) + goto err_out1; + + pci_set_master(pdev); + + dev = alloc_fddidev(sizeof(struct s_smc)); + if (!dev) { + printk(KERN_ERR "skfp: Unable to allocate fddi device, " + "FDDI adapter will be disabled.\n"); + err = -ENOMEM; + goto err_out2; + } + +#ifdef MEM_MAPPED_IO + dev->base_addr = (unsigned long) ioremap(port, len); + if (!dev->base_addr) { + printk(KERN_ERR "skfp: Unable to map MEMORY register, " + "FDDI adapter will be disabled.\n"); + err = -EIO; + goto err_out3; } - return dev; -} // alloc_device - - - -/************************ - * - * Initialize device structure - * - ************************/ -static void init_dev(struct net_device *dev, u_long iobase) -{ - /* Initialize new device structure */ - - dev->mem_end = 0; /* shared memory isn't used */ - dev->mem_start = 0; /* shared memory isn't used */ - dev->base_addr = iobase; /* save port (I/O) base address */ - dev->if_port = 0; /* not applicable to FDDI adapters */ - dev->dma = 0; /* Bus Master DMA doesn't require channel */ - dev->irq = 0; - - netif_start_queue(dev); +#else + dev->base_addr = port; +#endif + dev->irq = pdev->irq; dev->get_stats = &skfp_ctl_get_stats; dev->open = &skfp_open; dev->stop = &skfp_close; + dev->init = &skfp_driver_init; dev->hard_start_xmit = &skfp_send_pkt; - dev->hard_header = NULL; /* set in fddi_setup() */ - dev->rebuild_header = NULL; /* set in fddi_setup() */ dev->set_multicast_list = &skfp_ctl_set_multicast_list; dev->set_mac_address = &skfp_ctl_set_mac_address; dev->do_ioctl = &skfp_ioctl; - dev->set_config = NULL; /* not supported for now &&& */ dev->header_cache_update = NULL; /* not supported */ - dev->change_mtu = NULL; /* set in fddi_setup() */ SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); - /* Initialize remaining device structure information */ - fddi_setup(dev); -} // init_device + /* Initialize board structure with bus-specific info */ + smc = (struct s_smc *) dev->priv; + smc->os.dev = dev; + smc->os.bus_type = SK_BUS_TYPE_PCI; + smc->os.pdev = *pdev; + smc->os.QueueSkb = MAX_TX_QUEUE_LEN; + smc->os.MaxFrameSize = MAX_FRAME_SIZE; + smc->os.dev = dev; + smc->hw.slot = -1; + smc->os.ResetRequested = FALSE; + skb_queue_head_init(&smc->os.SendSkbQueue); + + err = register_netdev(dev); + if (err) + goto err_out4; + + ++num_boards; + pci_set_drvdata(pdev, dev); + + if ((pdev->subsystem_device & 0xff00) == 0x5500 || + (pdev->subsystem_device & 0xff00) == 0x5800) + printk("%s: SysKonnect FDDI PCI adapter" + " found (SK-%04X)\n", dev->name, + pdev->subsystem_device); + else + printk("%s: FDDI PCI adapter found\n", dev->name); + return 0; +err_out4: +#ifdef MEM_MAPPED_IO + iounmap((void *) dev->base_addr); +#endif +err_out3: + free_netdev(dev); +err_out2: + pci_release_regions(pdev); +err_out1: + return err; +} -/************************ - * - * If at end of fddi device list and can't use current entry, malloc - * one up. If memory could not be allocated, print an error message. - * -************************/ -static struct net_device *insert_device(struct net_device *dev) +/* + * Called for each adapter board from pci_unregister_driver + */ +static void __devexit skfp_remove_one(struct pci_dev *pdev) { - struct net_device *new; - int len; + struct net_device *p = pci_get_drvdata(pdev); + struct s_smc *lp = p->priv; - PRINTK(KERN_INFO "entering insert_device\n"); - len = sizeof(struct net_device) + sizeof(struct s_smc); - new = (struct net_device *) kmalloc(len, GFP_KERNEL); - if (new == NULL) { - printk("fddi%d: Device not initialised, insufficient memory\n", - num_fddi); - return NULL; - } else { - memset((char *) new, 0, len); - new->priv = (struct s_smc *) (new + 1); - new->init = skfp_probe; - if (!loading_module) { - new->next = dev->next; - dev->next = new; - } - /* create new device name */ - if (num_fddi > 999) { - sprintf(new->name, "fddi????"); - } else { - sprintf(new->name, "fddi%d", num_fddi); - } - } - return new; -} // insert_device - - -/************************ - * - * Get the number of a "fddiX" string - * - ************************/ -static int fddi_dev_index(unsigned char *s) -{ - int i = 0, j = 0; + unregister_netdev(p); - for (; *s; s++) { - if (isdigit(*s)) { - j = 1; - i = (i * 10) + (*s - '0'); - } else if (j) - break; + if (lp->os.SharedMemAddr) { + pci_free_consistent(&lp->os.pdev, + lp->os.SharedMemSize, + lp->os.SharedMemAddr, + lp->os.SharedMemDMA); + lp->os.SharedMemAddr = NULL; + } + if (lp->os.LocalRxBuffer) { + pci_free_consistent(&lp->os.pdev, + MAX_FRAME_SIZE, + lp->os.LocalRxBuffer, + lp->os.LocalRxBufferDMA); + lp->os.LocalRxBuffer = NULL; } - return i; -} // fddi_dev_index - - -/************************ - * - * Used if loaded as module only. Link the device structures - * together. Needed to release them all at unload. - * -************************/ -static void link_modules(struct net_device *dev, struct net_device *tmp) -{ - struct net_device *p = dev; - - if (p) { - while (((struct s_smc *) (p->priv))->os.next_module) { - p = ((struct s_smc *) (p->priv))->os.next_module; - } - - if (dev != tmp) { - ((struct s_smc *) (p->priv))->os.next_module = tmp; - } else { - ((struct s_smc *) (p->priv))->os.next_module = NULL; - } - } - return; -} // link_modules - +#ifdef MEM_MAPPED_IO + iounmap((void *) p->base_addr); +#endif + pci_release_regions(pdev); + free_netdev(p); + pci_set_drvdata(pdev, NULL); +} /* * ==================== @@ -644,11 +404,12 @@ * 0 - initialization succeeded * -1 - initialization failed */ -static int skfp_driver_init(struct net_device *dev) +static __init int skfp_driver_init(struct net_device *dev) { struct s_smc *smc = (struct s_smc *) dev->priv; skfddi_priv *bp = PRIV(dev); u8 val; /* used for I/O read/writes */ + int err = -EIO; PRINTK(KERN_INFO "entering skfp_driver_init\n"); @@ -729,7 +490,7 @@ bp->LocalRxBuffer, bp->LocalRxBufferDMA); bp->LocalRxBuffer = NULL; } - return (-1); + return err; } // skfp_driver_init @@ -757,14 +518,15 @@ static int skfp_open(struct net_device *dev) { struct s_smc *smc = (struct s_smc *) dev->priv; + int err; PRINTK(KERN_INFO "entering skfp_open\n"); /* Register IRQ - support shared interrupts by passing device ptr */ - if (request_irq(dev->irq, (void *) skfp_interrupt, SA_SHIRQ, - dev->name, dev)) { - printk("%s: Requested IRQ %d is busy\n", dev->name, dev->irq); - return (-EAGAIN); - } + err = request_irq(dev->irq, (void *) skfp_interrupt, SA_SHIRQ, + dev->name, dev); + if (err) + return err; + /* * Set current address to factory MAC address * @@ -788,6 +550,7 @@ /* Disable promiscuous filter settings */ mac_drv_rx_mode(smc, RX_DISABLE_PROMISC); + netif_start_queue(dev); return (0); } // skfp_open @@ -822,7 +585,6 @@ static int skfp_close(struct net_device *dev) { struct s_smc *smc = (struct s_smc *) dev->priv; - struct sk_buff *skb; skfddi_priv *bp = PRIV(dev); CLI_FBI(); @@ -835,13 +597,7 @@ /* Deregister (free) IRQ */ free_irq(dev->irq, dev); - for (;;) { - skb = skb_dequeue(&bp->SendSkbQueue); - if (skb == NULL) - break; - bp->QueueSkb++; - dev_kfree_skb(skb); - } + skb_queue_purge(&bp->SendSkbQueue); return (0); } // skfp_close @@ -1276,6 +1032,8 @@ break; default: printk("ioctl for %s: unknow cmd: %04x\n", dev->name, ioc.cmd); + status = -EOPNOTSUPP; + } // switch return status; @@ -2529,63 +2287,21 @@ } // drv_reset_indication - -static struct net_device *mdev; +static struct pci_driver skfddi_pci_driver = { + .name = "skfddi", + .id_table = skfddi_pci_tbl, + .probe = skfp_init_one, + .remove = __devexit_p(skfp_remove_one), +}; static int __init skfd_init(void) { - struct net_device *p; - - if ((mdev = insert_device(NULL)) == NULL) - return -ENOMEM; - - for (p = mdev; p != NULL; p = ((struct s_smc *)p->priv)->os.next_module) { - if (register_netdev(p) != 0) { - printk("skfddi init_module failed\n"); - return -EIO; - } - } - - return 0; + return pci_module_init(&skfddi_pci_driver); } -static struct net_device *unlink_modules(struct net_device *p) -{ - struct net_device *next = NULL; - - if (p->priv) { /* Private areas allocated? */ - struct s_smc *lp = (struct s_smc *) p->priv; - - next = lp->os.next_module; - - if (lp->os.SharedMemAddr) { - pci_free_consistent(&lp->os.pdev, - lp->os.SharedMemSize, - lp->os.SharedMemAddr, - lp->os.SharedMemDMA); - lp->os.SharedMemAddr = NULL; - } - if (lp->os.LocalRxBuffer) { - pci_free_consistent(&lp->os.pdev, - MAX_FRAME_SIZE, - lp->os.LocalRxBuffer, - lp->os.LocalRxBufferDMA); - lp->os.LocalRxBuffer = NULL; - } - release_region(p->base_addr, - (lp->os.bus_type == SK_BUS_TYPE_PCI ? FP_IO_LEN : 0)); - } - unregister_netdev(p); - printk("%s: unloaded\n", p->name); - free_netdev(p); /* Free the device structure */ - - return next; -} // unlink_modules - static void __exit skfd_exit(void) { - while (mdev) - mdev = unlink_modules(mdev); + pci_unregister_driver(&skfddi_pci_driver); } module_init(skfd_init); From aviro@redhat.com Thu Dec 4 16:59:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 16:59:53 -0800 (PST) Received: from devserv.devel.redhat.com (pix-525-pool.redhat.com [66.187.233.200]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB50xeTa022324 for ; Thu, 4 Dec 2003 16:59:40 -0800 Received: from devserv.devel.redhat.com (localhost.localdomain [127.0.0.1]) by devserv.devel.redhat.com (8.12.10/8.12.10) with ESMTP id hB50xGDl005522; Thu, 4 Dec 2003 19:59:16 -0500 Received: (from aviro@localhost) by devserv.devel.redhat.com (8.12.10/8.12.10/Submit) id hB50xGP7005520; Thu, 4 Dec 2003 19:59:16 -0500 Date: Thu, 4 Dec 2003 19:59:16 -0500 From: Alexander Viro To: Stephen Hemminger Cc: Jeff Garzik , netdev@oss.sgi.com, Alexander Viro Subject: Re: [PATCH] skfddi - convert to new pci model. Message-ID: <20031205005915.GD31510@devserv.devel.redhat.com> References: <20031204163928.0f34d5d1.shemminger@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031204163928.0f34d5d1.shemminger@osdl.org> User-Agent: Mutt/1.4.1i X-archive-position: 1882 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: aviro@redhat.com Precedence: bulk X-list: netdev On Thu, Dec 04, 2003 at 04:39:28PM -0800, Stephen Hemminger wrote: > + dev->irq = pdev->irq; > dev->get_stats = &skfp_ctl_get_stats; > dev->open = &skfp_open; > dev->stop = &skfp_close; > + dev->init = &skfp_driver_init; Ehh... Don't do that, please. net_device ->init() means trouble, since getting failure from register_netdev() gives you no clue whether it had failed before, during or after ->init(). Makes for an interesting cleanup... You can do that if required cleanup can be deduced from the state of *dev after register_netdev() failure (e.g. if no cleanup is ever needed), but generally it's less PITA to just call the damn function directly before register_netdev() and leave ->init NULL. From garzik@gtf.org Thu Dec 4 22:38:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 22:39:19 -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 hB56cnTa000304 for ; Thu, 4 Dec 2003 22:38:51 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id 1AFE06659; Fri, 5 Dec 2003 01:38:43 -0500 (EST) Date: Fri, 5 Dec 2003 01:38:43 -0500 From: Jeff Garzik To: netdev@oss.sgi.com Subject: [RFR] new e100 driver Message-ID: <20031205063842.GA23843@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 1883 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 e100 3.0.9_dev just got checked into net-drivers-2.5-exp queue. As I do occasionally (especially for smaller drivers), I post them for review and comment. Patches welcome in addition to comments. One thing I am tempted to request is use of the new module_param()... Jeff /******************************************************************************* Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The full GNU General Public License is included in this distribution in the file called LICENSE. Contact Information: Linux NICS Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *******************************************************************************/ /* * e100.c: Intel(R) PRO/100 ethernet driver * * (Re)written 2003 by scott.feldman@intel.com. Based loosely on * original e100 driver, but better described as a munging of * e100, e1000, eepro100, tg3, 8139cp, and other drivers. * * References: * Intel 8255x 10/100 Mbps Ethernet Controller Family, * Open Source Software Developers Manual, * http://sourceforge.net/projects/e1000 * * * Theory of Operation * * I. General * * The driver supports Intel(R) 10/100 Mbps PCI Fast Ethernet * controller family, which includes the 82557, 82558, 82559, 82550, * 82551, and 82562 devices. 82558 and greater controllers * integrate the Intel 82555 PHY. The controllers are used in * server and client network interface cards, as well as in * LAN-On-Motherboard (LOM), CardBus, MiniPCI, and ICHx * configurations. 8255x supports a 32-bit linear addressing * mode and operates at 33Mhz PCI clock rate. * * II. Driver Operation * * Memory-mapped mode is used exclusively to access the device's * shared-memory structure, the Control/Status Registers (CSR). All * setup, configuration, and control of the device, including queuing * of Tx, Rx, and configuration commands is through the CSR. * cmd_lock serializes accesses to the CSR command register. cb_lock * protects the shared Command Block List (CBL). * * 8255x is highly MII-compliant and all access to the PHY go * through the Management Data Interface (MDI). Consequently, the * driver leverages the mii.c library shared with other MII-compliant * devices. * * Big- and Little-Endian byte order as well as 32- and 64-bit * archs are supported. Weak-ordered memory and non-cache-coherent * archs are supported. * * III. Transmit * * A Tx skb is mapped and hangs off of a TCB. TCBs are linked * together in a fixed-size ring (CBL) thus forming the flexible mode * memory structure. A TCB marked with the suspend-bit indicates * the end of the ring. The last TCB processed suspends the * controller, and the controller can be restarted by issue a CU * resume command to continue from the suspend point, or a CU start * command to start at a given position in the ring. * * Non-Tx commands (config, multicast setup, etc) are linked * into the CBL ring along with Tx commands. The common structure * used for both Tx and non-Tx commands is the Command Block (CB). * * cb_to_use is the next CB to use for queuing a command; cb_to_clean * is the next CB to check for completion; cb_to_send is the first * CB to start on in case of a previous failure to resume. CB clean * up happens in interrupt context in response to a CU interrupt, or * in dev->poll in the case where NAPI is enabled. cbs_avail keeps * track of number of free CB resources available. * * Hardware padding of short packets to minimum packet size is * enabled. 82557 pads with 7Eh, while the later controllers pad * with 00h. * * IV. Recieve * * The Receive Frame Area (RFA) comprises a ring of Receive Frame * Descriptors (RFD) + data buffer, thus forming the simplified mode * memory structure. Rx skbs are allocated to contain both the RFD * and the data buffer, but the RFD is pulled off before the skb is * indicated. The data buffer is aligned such that encapsulated * protocol headers are u32-aligned. Since the RFD is part of the * mapped shared memory, and completion status is contained within * the RFD, the RFD must be dma_sync'ed to maintain a consistent * view from software and hardware. * * Under typical operation, the receive unit (RU) is start once, * and the controller happily fills RFDs as frames arrive. If * replacement RFDs cannot be allocated, or the RU goes non-active, * the RU must be restarted. Frame arrival generates an interrupt, * and Rx indication and re-allocation happen in the same context, * therefore no locking is required. If NAPI is enabled, this work * happens in dev->poll. A software-generated interrupt is gen- * erated from the watchdog to recover from a failed allocation * senario where all Rx resources have been indicated and none re- * placed. * * V. Miscellaneous * * VLAN offload support of tagging, stripping and filtering is not * supported, but driver will accommodate the extra 4-byte VLAN tag * for processing by upper layers. Tx/Rx Checksum offloading is not * supported. Tx Scatter/Gather is not supported. Jumbo Frames is * not supported. * * NAPI support is enabled with CONFIG_E100_NAPI. * * MagicPacket(tm) WoL support is enabled/disabled via ethtool. * * Thanks to JC (jchapman@katalix.com) for helping with * testing/troubleshooting the development driver. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define DRV_NAME "e100" #define DRV_VERSION "3.0.9_dev" #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 1999-2003 Intel Corporation" #define PFX DRV_NAME ": " #define E100_WATCHDOG_PERIOD 2 * HZ #define E100_NAPI_WEIGHT 16 MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); static int debug = 3; MODULE_PARM(debug, "i"); MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); #define DPRINTK(nlevel, klevel, fmt, args...) \ (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \ printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \ __FUNCTION__ , ## args)) #define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ PCI_CLASS_NETWORK_ETHERNET << 8, 0xFFFF00, ich } static struct pci_device_id e100_id_table[] = { INTEL_8255X_ETHERNET_DEVICE(0x1029, 0), INTEL_8255X_ETHERNET_DEVICE(0x1030, 0), INTEL_8255X_ETHERNET_DEVICE(0x1031, 3), INTEL_8255X_ETHERNET_DEVICE(0x1032, 3), INTEL_8255X_ETHERNET_DEVICE(0x1033, 3), INTEL_8255X_ETHERNET_DEVICE(0x1034, 3), INTEL_8255X_ETHERNET_DEVICE(0x1038, 3), INTEL_8255X_ETHERNET_DEVICE(0x1039, 4), INTEL_8255X_ETHERNET_DEVICE(0x103A, 4), INTEL_8255X_ETHERNET_DEVICE(0x103B, 4), INTEL_8255X_ETHERNET_DEVICE(0x103C, 4), INTEL_8255X_ETHERNET_DEVICE(0x103D, 4), INTEL_8255X_ETHERNET_DEVICE(0x103E, 4), INTEL_8255X_ETHERNET_DEVICE(0x1050, 5), INTEL_8255X_ETHERNET_DEVICE(0x1051, 5), INTEL_8255X_ETHERNET_DEVICE(0x1052, 5), INTEL_8255X_ETHERNET_DEVICE(0x1053, 5), INTEL_8255X_ETHERNET_DEVICE(0x1054, 5), INTEL_8255X_ETHERNET_DEVICE(0x1055, 5), INTEL_8255X_ETHERNET_DEVICE(0x1059, 0), INTEL_8255X_ETHERNET_DEVICE(0x1209, 0), INTEL_8255X_ETHERNET_DEVICE(0x1229, 0), INTEL_8255X_ETHERNET_DEVICE(0x2449, 2), INTEL_8255X_ETHERNET_DEVICE(0x2459, 2), INTEL_8255X_ETHERNET_DEVICE(0x245D, 2), { 0, } }; MODULE_DEVICE_TABLE(pci, e100_id_table); enum mac { mac_82557_D100_A = 0, mac_82557_D100_B = 1, mac_82557_D100_C = 2, mac_82558_D101_A4 = 4, mac_82558_D101_B0 = 5, mac_82559_D101M = 8, mac_82559_D101S = 9, mac_82550_D102 = 12, mac_82550_D102_C = 13, mac_82550_D102_E = 15, mac_unknown = 0xFF, }; enum phy { phy_100a = 0x000003E0, phy_100c = 0x035002A8, phy_82555_tx = 0x015002A8, phy_nsc_tx = 0x5C002000, phy_82562_et = 0x033002A8, phy_82562_em = 0x032002A8, phy_82562_eh = 0x017002A8, phy_unknown = 0xFFFFFFFF, }; /* CSR (Control/Status Registers) */ struct csr { struct { u8 status; u8 stat_ack; u8 cmd_lo; u8 cmd_hi; u32 gen_ptr; } scb; u32 port; u16 flash_ctrl; u8 eeprom_ctrl_lo; u8 eeprom_ctrl_hi; u32 mdi_ctrl; u32 rx_dma_count; }; enum scb_status { rus_idle = 0x00, rus_suspended = 0x04, rus_no_resources = 0x08, rus_ready = 0x10, rus_mask = 0x3C, cus_idle = 0x00, cus_suspended = 0x40, cus_active = 0x80, cus_mask = 0xC0, }; enum scb_stat_ack { stat_ack_sw_gen = 0x04, stat_ack_rnr = 0x10, stat_ack_cu_idle = 0x20, stat_ack_frame_rx = 0x40, stat_ack_cu_cmd_done = 0x80, stat_ack_rx = (stat_ack_sw_gen | stat_ack_rnr | stat_ack_frame_rx), stat_ack_tx = (stat_ack_cu_idle | stat_ack_cu_cmd_done), }; enum scb_cmd_hi { irq_mask_none = 0x00, irq_mask_all = 0x01, irq_sw_gen = 0x02, }; enum scb_cmd_lo { ruc_start = 0x01, ruc_load_base = 0x06, cuc_start = 0x10, cuc_resume = 0x20, cuc_dump_addr = 0x40, cuc_dump_stats = 0x50, cuc_load_base = 0x60, cuc_dump_reset = 0x70, }; enum port { software_reset = 0x0000, selftest = 0x0001, selective_reset = 0x0002, }; enum eeprom_ctrl_lo { eesk = 0x01, eecs = 0x02, eedi = 0x04, eedo = 0x08, }; enum mdi_ctrl { mdi_write = 0x04000000, mdi_read = 0x08000000, mdi_ready = 0x10000000, }; enum eeprom_op { op_write = 0x05, op_read = 0x06, op_ewds = 0x10, op_ewen = 0x13, }; enum eeprom_offsets { eeprom_id = 0x0A, eeprom_config_asf = 0x0D, eeprom_smbus_addr = 0x90, }; enum eeprom_id { eeprom_id_wol = 0x0020, }; enum eeprom_config_asf { eeprom_asf = 0x8000, eeprom_gcl = 0x4000, }; enum cb_status { cb_complete = 0x8000, cb_ok = 0x2000, }; enum cb_command { cb_iaaddr = 0x0001, cb_config = 0x0002, cb_multi = 0x0003, cb_tx = 0x0004, cb_dump = 0x0006, cb_tx_sf = 0x0008, cb_cid = 0x1f00, cb_i = 0x2000, cb_s = 0x4000, cb_el = 0x8000, }; struct rfd { u16 status; u16 command; u32 link; u32 rbd; u16 actual_size; u16 size; }; struct rx_list { struct list_head list; struct sk_buff *skb; dma_addr_t dma_addr; unsigned int length; }; #if defined(__BIG_ENDIAN_BITFIELD) #define X(a,b) b,a #else #define X(a,b) a,b #endif struct config { /*0*/ u8 X(byte_count:6, pad0:2); /*1*/ u8 X(X(rx_fifo_limit:4, tx_fifo_limit:3), pad1:1); /*2*/ u8 adaptive_ifs; /*3*/ u8 X(X(X(X(mwi_enable:1, type_enable:1), read_align_enable:1), term_write_cache_line:1), pad3:4); /*4*/ u8 X(rx_dma_max_count:7, pad4:1); /*5*/ u8 X(tx_dma_max_count:7, dma_max_count_enable:1); /*6*/ u8 X(X(X(X(X(X(X(late_scb_update:1, direct_rx_dma:1), tno_intr:1), cna_intr:1), standard_tcb:1), standard_stat_counter:1), rx_discard_overruns:1), rx_save_bad_frames:1); /*7*/ u8 X(X(X(X(X(rx_discard_short_frames:1, tx_underrun_retry:2), pad7:2), rx_extended_rfd:1), tx_two_frames_in_fifo:1), tx_dynamic_tbd:1); /*8*/ u8 X(X(mii_mode:1, pad8:6), csma_disabled:1); /*9*/ u8 X(X(X(X(X(rx_tcpudp_checksum:1, pad9:3), vlan_arp_tco:1), link_status_wake:1), arp_wake:1), mcmatch_wake:1); /*10*/ u8 X(X(X(pad10:3, no_source_addr_insertion:1), preamble_length:2), loopback:2); /*11*/ u8 X(linear_priority:3, pad11:5); /*12*/ u8 X(X(linear_priority_mode:1, pad12:3), ifs:4); /*13*/ u8 ip_addr_lo; /*14*/ u8 ip_addr_hi; /*15*/ u8 X(X(X(X(X(X(X(promiscuous_mode:1, broadcast_disabled:1), wait_after_win:1), pad15_1:1), ignore_ul_bit:1), crc_16_bit:1), pad15_2:1), crs_or_cdt:1); /*16*/ u8 fc_delay_lo; /*17*/ u8 fc_delay_hi; /*18*/ u8 X(X(X(X(X(rx_stripping:1, tx_padding:1), rx_crc_transfer:1), rx_long_ok:1), fc_priority_threshold:3), pad18:1); /*19*/ u8 X(X(X(X(X(X(X(addr_wake:1, magic_packet_disable:1), fc_disable:1), fc_restop:1), fc_restart:1), fc_reject:1), full_duplex_force:1), full_duplex_pin:1); /*20*/ u8 X(X(X(pad20_1:5, fc_priority_location:1), multi_ia:1), pad20_2:1); /*21*/ u8 X(X(pad21_1:3, multicast_all:1), pad21_2:4); /*22*/ u8 X(X(rx_d102_mode:1, rx_vlan_drop:1), pad22:6); u8 pad_d102[9]; }; #define E100_MAX_MULTICAST_ADDRS 64 struct multi { u16 count; u8 addr[E100_MAX_MULTICAST_ADDRS * ETH_ALEN + 2/*pad*/]; }; /* Important: keep total struct u32-aligned */ struct cb { u16 status; u16 command; u32 link; union { u8 iaaddr[ETH_ALEN]; struct config config; struct multi multi; struct { u32 tbd_array; u16 tcb_byte_count; u8 threshold; u8 tbd_count; struct { u32 buf_addr; u16 size; u16 eol; } tbd; } tcb; u32 dump_buffer_addr; } u; struct cb *next, *prev; dma_addr_t dma_addr; struct sk_buff *skb; }; enum loopback { lb_none = 0, lb_mac = 1, lb_phy = 3, }; struct stats { u32 tx_good_frames, tx_max_collisions, tx_late_collisions, tx_underruns, tx_lost_crs, tx_deferred, tx_single_collisions, tx_multiple_collisions, tx_total_collisions; u32 rx_good_frames, rx_crc_errors, rx_alignment_errors, rx_resource_errors, rx_overrun_errors, rx_cdt_errors, rx_short_frame_errors; u32 fc_xmt_pause, fc_rcv_pause, fc_rcv_unsupported; u16 xmt_tco_frames, rcv_tco_frames; u32 complete; }; struct mem { struct { u32 signature; u32 result; } selftest; struct stats stats; u8 dump_buf[596]; }; struct param_range { u32 min; u32 max; u32 count; }; struct params { struct param_range rfds; struct param_range cbs; }; struct nic { /* Begin: frequently used values: keep adjacent for cache effect */ u32 msg_enable ____cacheline_aligned; struct net_device *netdev; struct pci_dev *pdev; struct list_head rx_list_head ____cacheline_aligned; struct rx_list *rx_list; struct rfd blank_rfd; spinlock_t cb_lock ____cacheline_aligned; spinlock_t cmd_lock; struct csr *csr; enum scb_cmd_lo cuc_cmd; unsigned int cbs_avail; struct cb *cbs; struct cb *cb_to_use; struct cb *cb_to_send; struct cb *cb_to_clean; u16 tx_command; /* End: frequently used values: keep adjacent for cache effect */ enum { ich = (1 << 0), promiscuous = (1 << 1), multicast_all = (1 << 2), wol_magic = (1 << 3), } flags ____cacheline_aligned; enum mac mac; enum phy phy; struct params params; struct net_device_stats net_stats; struct timer_list watchdog; struct timer_list blink_timer; struct mii_if_info mii; enum loopback loopback; struct mem *mem; dma_addr_t dma_addr; dma_addr_t cbs_dma_addr; u8 adaptive_ifs; u8 tx_threshold; u32 tx_frames; u32 tx_collisions; u32 tx_deferred; u32 tx_single_collisions; u32 tx_multiple_collisions; u32 tx_fc_pause; u32 tx_tco_frames; u32 rx_fc_pause; u32 rx_fc_unsupported; u32 rx_tco_frames; u8 rev_id; u16 leds; u16 eeprom_wc; u16 eeprom[256]; u32 pm_state[16]; }; static void e100_get_defaults(struct nic *nic) { struct param_range rfds = { .min = 64, .max = 256, .count = 64 }; struct param_range cbs = { .min = 64, .max = 256, .count = 64 }; pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->rev_id; if(nic->mac == mac_unknown) nic->mac = mac_82557_D100_A; nic->params.rfds = rfds; nic->params.cbs = cbs; /* Quadwords to DMA into FIFO before starting frame transmit */ nic->tx_threshold = 0xE0; nic->tx_command = cpu_to_le16(cb_tx | cb_i | cb_tx_sf | ((nic->mac >= mac_82558_D101_A4) ? cb_cid : 0)); /* Template for a freshly allocated RFD */ nic->blank_rfd.status = 0; nic->blank_rfd.command = cpu_to_le16(cb_el); nic->blank_rfd.link = 0; nic->blank_rfd.rbd = 0xFFFFFFFF; nic->blank_rfd.actual_size = 0; nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); } static inline void e100_write_flush(struct nic *nic) { /* Flush previous PCI writes through intermediate bridges * by doing a benign read */ (void)readb(&nic->csr->scb.status); } static inline void e100_enable_irq(struct nic *nic) { writeb(irq_mask_none, &nic->csr->scb.cmd_hi); e100_write_flush(nic); } static inline void e100_disable_irq(struct nic *nic) { writeb(irq_mask_all, &nic->csr->scb.cmd_hi); e100_write_flush(nic); } static void e100_hw_reset(struct nic *nic) { /* Put CU and RU into idle with a selective reset to get * device off of PCI bus */ writel(selective_reset, &nic->csr->port); e100_write_flush(nic); udelay(20); /* Now fully reset device */ writel(software_reset, &nic->csr->port); e100_write_flush(nic); udelay(20); /* TCO workaround - 82559 and greater */ if(nic->mac >= mac_82559_D101M) { /* Issue a redundant CU load base without setting * general pointer, and without waiting for scb to * clear. This gets us into post-driver. Finally, * wait 20 msec for reset to take effect. */ writeb(cuc_load_base, &nic->csr->scb.cmd_lo); mdelay(20); } /* Mask off our interrupt line - it's unmasked after reset */ e100_disable_irq(nic); } static int e100_self_test(struct nic *nic) { u32 dma_addr = nic->dma_addr + offsetof(struct mem, selftest); /* Passing the self-test is a pretty good indication * that the device can DMA to/from host memory */ nic->mem->selftest.signature = 0; nic->mem->selftest.result = 0xFFFFFFFF; writel(selftest | dma_addr, &nic->csr->port); e100_write_flush(nic); /* Wait 10 msec for self-test to complete */ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 100 + 1); /* Interrupts are enabled after self-test */ e100_disable_irq(nic); /* Check results of self-test */ if(nic->mem->selftest.result != 0) { DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", nic->mem->selftest.result); return -ETIMEDOUT; } if(nic->mem->selftest.signature == 0) { DPRINTK(HW, ERR, "Self-test failed: timed out\n"); return -ETIMEDOUT; } return 0; } static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data) { u32 cmd_addr_data[3]; u8 ctrl; int i, j; /* Three cmds: write/erase enable, write data, write/erase disable */ cmd_addr_data[0] = op_ewen << (addr_len - 2); cmd_addr_data[1] = (((op_write << addr_len) | addr) << 16) | data; cmd_addr_data[2] = op_ewds << (addr_len - 2); /* Bit-bang cmds to write word to eeprom */ for(j = 0; j < 3; j++) { /* Chip select */ writeb(eecs | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); for(i = 31; i >= 0; i--) { ctrl = (cmd_addr_data[j] & (1 << i)) ? eecs | eedi : eecs; writeb(ctrl, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); } /* Wait 10 msec for cmd to complete */ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 100 + 1); /* Chip deselect */ writeb(0, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); } }; /* General technique stolen from the eepro100 driver - very clever */ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr) { u32 cmd_addr_data; u16 data = 0; u8 ctrl; int i; cmd_addr_data = ((op_read << *addr_len) | addr) << 16; /* Chip select */ writeb(eecs | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); /* Bit-bang to read word from eeprom */ for(i = 31; i >= 0; i--) { ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs; writeb(ctrl, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); /* Eeprom drives a dummy zero to EEDO after receiving * complete address. Use this to adjust addr_len. */ ctrl = readb(&nic->csr->eeprom_ctrl_lo); if(!(ctrl & eedo) && i > 16) { *addr_len -= (i - 16); i = 17; } data = (data << 1) | (ctrl & eedo ? 1 : 0); } /* Chip deselect */ writeb(0, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); return data; }; /* Load entire EEPROM image into driver cache and validate checksum */ static int e100_eeprom_load(struct nic *nic) { u16 addr, addr_len = 8, checksum = 0; /* Try reading with an 8-bit addr len to discover actual addr len */ e100_eeprom_read(nic, &addr_len, 0); nic->eeprom_wc = 1 << addr_len; for(addr = 0; addr < nic->eeprom_wc; addr++) { nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr); if(addr < nic->eeprom_wc - 1) checksum += nic->eeprom[addr]; } /* The checksum, stored in the last word, is calculated such that * the sum of words should be 0xBABA */ checksum = 0xBABA - checksum; if(checksum != nic->eeprom[nic->eeprom_wc - 1]) { DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); return -EAGAIN; } return 0; } /* Save (portion of) driver EEPROM cache to device and update checksum */ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count) { u16 addr, addr_len = 8, checksum = 0; /* Try reading with an 8-bit addr len to discover actual addr len */ e100_eeprom_read(nic, &addr_len, 0); nic->eeprom_wc = 1 << addr_len; if(start + count >= nic->eeprom_wc) return -EINVAL; for(addr = start; addr < start + count; addr++) e100_eeprom_write(nic, addr_len, addr, nic->eeprom[addr]); /* The checksum, stored in the last word, is calculated such that * the sum of words should be 0xBABA */ for(addr = 0; addr < nic->eeprom_wc - 1; addr++) checksum += nic->eeprom[addr]; nic->eeprom[nic->eeprom_wc - 1] = 0xBABA - checksum; e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1, 0xBABA - checksum); return 0; } #define E100_WAIT_SCB_TIMEOUT 40 static inline int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr) { unsigned long flags; unsigned int i; int err = 0; spin_lock_irqsave(&nic->cmd_lock, flags); /* Previous command is accepted when SCB clears */ for(i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) { if(likely(!readb(&nic->csr->scb.cmd_lo))) break; cpu_relax(); if(unlikely(i > (E100_WAIT_SCB_TIMEOUT >> 1))) udelay(5); } if(unlikely(i == E100_WAIT_SCB_TIMEOUT)) { err = -EAGAIN; goto err_unlock; } if(unlikely(cmd != cuc_resume)) writel(dma_addr, &nic->csr->scb.gen_ptr); writeb(cmd, &nic->csr->scb.cmd_lo); err_unlock: spin_unlock_irqrestore(&nic->cmd_lock, flags); return err; } static inline int e100_exec_cb(struct nic *nic, struct sk_buff *skb, void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) { struct cb *cb; unsigned long flags; int err = 0; spin_lock_irqsave(&nic->cb_lock, flags); if(unlikely(!nic->cbs_avail)) { err = -ENOMEM; goto err_unlock; } cb = nic->cb_to_use; nic->cb_to_use = cb->next; nic->cbs_avail--; cb->skb = skb; if(unlikely(!nic->cbs_avail)) err = -ENOSPC; cb_prepare(nic, cb, skb); /* Order is important otherwise we'll be in a race with h/w: * set S-bit in current first, then clear S-bit in previous. */ cb->command |= cpu_to_le16(cb_s); cb->prev->command &= cpu_to_le16(~cb_s); while(nic->cb_to_send != nic->cb_to_use) { if(unlikely((err = e100_exec_cmd(nic, nic->cuc_cmd, nic->cb_to_send->dma_addr)))) { /* Ok, here's where things get sticky. It's * possible that we can't schedule the command * because the controller is too busy, so * let's just queue the command and try again * when another command is scheduled. */ break; } else { nic->cuc_cmd = cuc_resume; nic->cb_to_send = nic->cb_to_send->next; } } err_unlock: spin_unlock_irqrestore(&nic->cb_lock, flags); return err; } static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) { u32 data_out = 0; unsigned int i; writel((reg << 16) | (addr << 21) | dir | data, &nic->csr->mdi_ctrl); for(i = 0; i < 100; i++) { udelay(20); if((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready) break; } DPRINTK(HW, DEBUG, "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n", dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); return (u16)data_out; } static int mdio_read(struct net_device *netdev, int addr, int reg) { return mdio_ctrl(netdev->priv, addr, mdi_read, reg, 0); } static void mdio_write(struct net_device *netdev, int addr, int reg, int data) { mdio_ctrl(netdev->priv, addr, mdi_write, reg, data); } static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct config *config = &cb->u.config; u8 *c = (u8 *)config; cb->command = cpu_to_le16(cb_config); memset(config, 0, sizeof(struct config)); config->byte_count = 0x16; /* bytes in this struct */ config->rx_fifo_limit = 0x8; /* bytes in FIFO before DMA */ config->direct_rx_dma = 0x1; /* reserved */ config->standard_tcb = 0x1; /* 1=standard, 0=extended */ config->standard_stat_counter = 0x1; /* 1=standard, 0=extended */ config->rx_discard_short_frames = 0x1; /* 1=discard, 0=pass */ config->tx_underrun_retry = 0x3; /* # of underrun retries */ config->mii_mode = 0x1; /* 1=MII mode, 0=503 mode */ config->pad10 = 0x6; config->no_source_addr_insertion = 0x1; /* 1=no, 0=yes */ config->preamble_length = 0x2; /* 0=1, 1=3, 2=7, 3=15 bytes */ config->ifs = 0x6; /* x16 = inter frame spacing */ config->ip_addr_hi = 0xF2; /* ARP IP filter - not used */ config->pad15_1 = 0x1; config->pad15_2 = 0x1; config->crs_or_cdt = 0x0; /* 0=CRS only, 1=CRS or CDT */ config->fc_delay_hi = 0x40; /* time delay for fc frame */ config->tx_padding = 0x1; /* 1=pad short frames */ config->fc_priority_threshold = 0x7; /* 7=priority fc disabled */ config->pad18 = 0x1; config->full_duplex_pin = 0x1; /* 1=examine FDX# pin */ config->pad20_1 = 0x1F; config->fc_priority_location = 0x1; /* 1=byte#31, 0=byte#19 */ config->pad21_1 = 0x5; config->adaptive_ifs = nic->adaptive_ifs; config->loopback = nic->loopback; if(nic->mii.force_media && nic->mii.full_duplex) config->full_duplex_force = 0x1; /* 1=force, 0=auto */ if(nic->flags & promiscuous || nic->loopback) { config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */ config->promiscuous_mode = 0x1; /* 1=on, 0=off */ } if(nic->flags & multicast_all) config->multicast_all = 0x1; /* 1=accept, 0=no */ if(!(nic->flags & wol_magic)) config->magic_packet_disable = 0x1; /* 1=off, 0=on */ if(nic->mac >= mac_82558_D101_A4) { config->fc_disable = 0x1; /* 1=Tx fc off, 0=Tx fc on */ config->mwi_enable = 0x1; /* 1=enable, 0=disable */ config->standard_tcb = 0x0; /* 1=standard, 0=extended */ config->rx_long_ok = 0x1; /* 1=VLANs ok, 0=standard */ if(nic->mac >= mac_82559_D101M) config->tno_intr = 0x1; /* TCO stats enable */ else config->standard_stat_counter = 0x0; } DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); DPRINTK(HW, DEBUG, "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); DPRINTK(HW, DEBUG, "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); } static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, struct sk_buff *skb) { u8 *dev_addr = nic->netdev->dev_addr; DPRINTK(HW, DEBUG, "dev_addr=%02X:%02X:%02X:%02X:%02X:%02X\n", dev_addr[0], dev_addr[1], dev_addr[2], dev_addr[3], dev_addr[4], dev_addr[5]); cb->command = cpu_to_le16(cb_iaaddr); memcpy(cb->u.iaaddr, dev_addr, ETH_ALEN); } static void e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) { cb->command = cpu_to_le16(cb_dump); cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + offsetof(struct mem, dump_buf)); } #define NCONFIG_AUTO_SWITCH 0x0080 #define MII_NSC_CONG MII_RESV1 #define NSC_CONG_ENABLE 0x0100 #define NSC_CONG_TXREADY 0x0400 #define ADVERTISE_FC_SUPPORTED 0x0400 static int e100_phy_init(struct nic *nic) { struct net_device *netdev = nic->netdev; u32 addr; u16 bmcr, stat, id_lo, id_hi, cong; nic->mii.phy_id = 0; nic->mii.advertising = 0; nic->mii.phy_id_mask = 0x1F; nic->mii.reg_num_mask = 0x1F; nic->mii.dev = netdev; nic->mii.full_duplex = 0; nic->mii.force_media = 0; nic->mii.mdio_read = mdio_read; nic->mii.mdio_write = mdio_write; /* Discover phy addr by searching addrs in order {1,0,2,..., 31} */ for(addr = 0; addr < 32; addr++) { nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr; bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR); stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); if(!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0)))) break; } DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id); if(addr == 32) return -EAGAIN; /* Selected the phy and isolate the rest */ for(addr = 0; addr < 32; addr++) { if(addr != nic->mii.phy_id) { mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE); } else { bmcr = mdio_read(netdev, addr, MII_BMCR); mdio_write(netdev, addr, MII_BMCR, bmcr & ~BMCR_ISOLATE); } } /* Get phy ID */ id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1); id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2); nic->phy = (u32)id_hi << 16 | (u32)id_lo; DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy); /* Handle National tx phy */ if(nic->phy == phy_nsc_tx) { /* Disable congestion control */ cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG); cong |= NSC_CONG_TXREADY; cong &= ~NSC_CONG_ENABLE; mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong); } /* enable MDI/MDI-X auto-switching */ if(nic->mac >= mac_82550_D102) mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, NCONFIG_AUTO_SWITCH); return 0; } static int e100_hw_init(struct nic *nic) { int err; e100_hw_reset(nic); DPRINTK(HW, ERR, "e100_hw_init\n"); if(!in_interrupt() && (err = e100_self_test(nic))) return err; if((err = e100_phy_init(nic))) return err; if((err = e100_exec_cmd(nic, cuc_load_base, 0))) return err; if((err = e100_exec_cmd(nic, ruc_load_base, 0))) return err; if((err = e100_exec_cb(nic, NULL, e100_configure))) return err; if((err = e100_exec_cb(nic, NULL, e100_setup_iaaddr))) return err; if((err = e100_exec_cmd(nic, cuc_dump_addr, nic->dma_addr + offsetof(struct mem, stats)))) return err; if((err = e100_exec_cmd(nic, cuc_dump_reset, 0))) return err; e100_disable_irq(nic); return 0; } static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct net_device *netdev = nic->netdev; struct dev_mc_list *list = netdev->mc_list; u16 i, count = min(netdev->mc_count, E100_MAX_MULTICAST_ADDRS); cb->command = cpu_to_le16(cb_multi); cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); for(i = 0; list && i < count; i++, list = list->next) memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr, ETH_ALEN); } static void e100_set_multicast_list(struct net_device *netdev) { struct nic *nic = netdev->priv; DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n", netdev->mc_count, netdev->flags); if(netdev->flags & IFF_PROMISC) nic->flags |= promiscuous; else nic->flags &= ~promiscuous; if(netdev->flags & IFF_ALLMULTI || netdev->mc_count > E100_MAX_MULTICAST_ADDRS) nic->flags |= multicast_all; else nic->flags &= ~multicast_all; e100_exec_cb(nic, NULL, e100_configure); e100_exec_cb(nic, NULL, e100_multi); } static void e100_update_stats(struct nic *nic) { struct net_device_stats *ns = &nic->net_stats; struct stats *s = &nic->mem->stats; u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause : (nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames : &s->complete; /* Device's stats reporting may take several microseconds to * complete, so where always waiting for results of the * previous command. */ if(*complete == le32_to_cpu(0x0000A007)) { *complete = 0; nic->tx_frames = le32_to_cpu(s->tx_good_frames); nic->tx_collisions = le32_to_cpu(s->tx_total_collisions); ns->tx_aborted_errors += le32_to_cpu(s->tx_max_collisions); ns->tx_window_errors += le32_to_cpu(s->tx_late_collisions); ns->tx_carrier_errors += le32_to_cpu(s->tx_lost_crs); ns->tx_fifo_errors += le32_to_cpu(s->tx_underruns); ns->collisions += nic->tx_collisions; ns->tx_errors += le32_to_cpu(s->tx_max_collisions) + le32_to_cpu(s->tx_lost_crs); ns->rx_dropped += le32_to_cpu(s->rx_resource_errors); ns->rx_length_errors += le32_to_cpu(s->rx_short_frame_errors); ns->rx_over_errors += le32_to_cpu(s->rx_resource_errors); ns->rx_crc_errors += le32_to_cpu(s->rx_crc_errors); ns->rx_frame_errors += le32_to_cpu(s->rx_alignment_errors); ns->rx_fifo_errors += le32_to_cpu(s->rx_overrun_errors); ns->rx_errors += le32_to_cpu(s->rx_crc_errors) + le32_to_cpu(s->rx_alignment_errors) + le32_to_cpu(s->rx_short_frame_errors) + le32_to_cpu(s->rx_cdt_errors); nic->tx_deferred += le32_to_cpu(s->tx_deferred); nic->tx_single_collisions += le32_to_cpu(s->tx_single_collisions); nic->tx_multiple_collisions += le32_to_cpu(s->tx_multiple_collisions); if(nic->mac >= mac_82558_D101_A4) { nic->tx_fc_pause += le32_to_cpu(s->fc_xmt_pause); nic->rx_fc_pause += le32_to_cpu(s->fc_rcv_pause); nic->rx_fc_unsupported += le32_to_cpu(s->fc_rcv_unsupported); if(nic->mac >= mac_82559_D101M) { nic->tx_tco_frames += le16_to_cpu(s->xmt_tco_frames); nic->rx_tco_frames += le16_to_cpu(s->rcv_tco_frames); } } } e100_exec_cmd(nic, cuc_dump_reset, 0); } static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex) { /* Adjust inter-frame-spacing (IFS) between two transmits if * we're getting collisions on a half-duplex connection. */ if(duplex == DUPLEX_HALF) { u32 prev = nic->adaptive_ifs; u32 min_frames = (speed == SPEED_100) ? 1000 : 100; if((nic->tx_frames / 32 < nic->tx_collisions) && (nic->tx_frames > min_frames)) { if(nic->adaptive_ifs < 60) nic->adaptive_ifs += 5; } else if (nic->tx_frames < min_frames) { if(nic->adaptive_ifs >= 5) nic->adaptive_ifs -= 5; } if(nic->adaptive_ifs != prev) e100_exec_cb(nic, NULL, e100_configure); } } static void e100_watchdog(unsigned long data) { struct nic *nic = (struct nic *)data; struct ethtool_cmd cmd; DPRINTK(TIMER, DEBUG, "right now = %ld\n", jiffies); /* mii library handles link maintenance tasks */ mii_ethtool_gset(&nic->mii, &cmd); if(mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { DPRINTK(LINK, INFO, "link up, %sMbps, %s-duplex\n", cmd.speed == SPEED_100 ? "100" : "10", cmd.duplex == DUPLEX_FULL ? "full" : "half"); } else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { DPRINTK(LINK, INFO, "link down\n"); } mii_check_link(&nic->mii); /* Software generated interrupt to recover from (rare) Rx * allocation failure */ writeb(irq_sw_gen, &nic->csr->scb.cmd_hi); e100_write_flush(nic); e100_update_stats(nic); e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex); if(nic->mac <= mac_82557_D100_C) /* Issue a multicast command to workaround a 557 lock up */ e100_set_multicast_list(nic->netdev); mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD); } static inline void e100_xmit_prepare(struct nic *nic, struct cb *cb, struct sk_buff *skb) { cb->command = nic->tx_command; cb->u.tcb.tbd_array = cb->dma_addr + offsetof(struct cb, u.tcb.tbd); cb->u.tcb.tcb_byte_count = 0; cb->u.tcb.threshold = nic->tx_threshold; cb->u.tcb.tbd_count = 1; cb->u.tcb.tbd.buf_addr = cpu_to_le32(pci_map_single(nic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE)); cb->u.tcb.tbd.size = cpu_to_le16(skb->len); } static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev) { struct nic *nic = netdev->priv; int err = e100_exec_cb(nic, skb, e100_xmit_prepare); switch(err) { case -ENOSPC: /* We queued the skb, but now we're out of space, so * stop the queue before we completely run out. */ netif_stop_queue(netdev); break; case -ENOMEM: /* This is a hard error - log it. */ DPRINTK(TX_ERR, DEBUG, "Out of Tx resources, returning skb\n"); netif_stop_queue(netdev); return 1; } netdev->trans_start = jiffies; return 0; } static inline int e100_tx_clean(struct nic *nic) { struct cb *cb; int tx_cleaned = 0; spin_lock(&nic->cb_lock); DPRINTK(TX_DONE, DEBUG, "cb->status = 0x%04X\n", nic->cb_to_clean->status); /* Clean CBs marked complete */ for(cb = nic->cb_to_clean; cb->status & cpu_to_le16(cb_complete); cb = nic->cb_to_clean = cb->next) { if(likely(cb->skb != NULL)) { nic->net_stats.tx_packets++; nic->net_stats.tx_bytes += cb->skb->len; pci_unmap_single(nic->pdev, le32_to_cpu(cb->u.tcb.tbd.buf_addr), le16_to_cpu(cb->u.tcb.tbd.size), PCI_DMA_TODEVICE); dev_kfree_skb_any(cb->skb); tx_cleaned = 1; } cb->status = 0; nic->cbs_avail++; } spin_unlock(&nic->cb_lock); /* Recover from running out of Tx resources in xmit_frame */ if(unlikely(tx_cleaned && netif_queue_stopped(nic->netdev))) netif_wake_queue(nic->netdev); return tx_cleaned; } static void e100_clean_cbs(struct nic *nic, int free_mem) { if(nic->cbs) { while(nic->cb_to_clean != nic->cb_to_use) { struct cb *cb = nic->cb_to_clean; if(cb->skb) { pci_unmap_single(nic->pdev, le32_to_cpu(cb->u.tcb.tbd.buf_addr), le16_to_cpu(cb->u.tcb.tbd.size), PCI_DMA_TODEVICE); dev_kfree_skb(cb->skb); } nic->cb_to_clean = nic->cb_to_clean->next; } nic->cbs_avail = nic->params.cbs.count; if(free_mem) { pci_free_consistent(nic->pdev, sizeof(struct cb) * nic->params.cbs.count, nic->cbs, nic->cbs_dma_addr); nic->cbs = NULL; nic->cbs_avail = 0; } } nic->cuc_cmd = cuc_start; nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; } static int e100_alloc_cbs(struct nic *nic) { struct cb *cb; unsigned int i, count = nic->params.cbs.count; nic->cuc_cmd = cuc_start; nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; nic->cbs_avail = 0; nic->cbs = pci_alloc_consistent(nic->pdev, sizeof(struct cb) * count, &nic->cbs_dma_addr); if(!nic->cbs) return -ENOMEM; for(cb = nic->cbs, i = 0; i < count; cb++, i++) { cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; cb->prev = (i == 0) ? nic->cbs + count - 1 : cb - 1; cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); cb->link = cpu_to_le32(nic->cbs_dma_addr + ((i+1) % count) * sizeof(struct cb)); } nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; nic->cbs_avail = count; return 0; } static inline void e100_start_receiver(struct nic *nic) { /* (Re)start RU if suspended or idle and RFA is fully allocated */ struct rx_list *curr = list_entry(nic->rx_list_head.next, struct rx_list, list); if(curr->skb) { u8 status = readb(&nic->csr->scb.status); if(unlikely((status & rus_mask) != rus_ready)) e100_exec_cmd(nic, ruc_start, curr->dma_addr); } } static inline int e100_rx_alloc_skb(struct nic *nic, struct rx_list *curr) { unsigned int rx_offset = 2; /* u32 align protocol headers */ curr->dma_addr = 0; curr->length = sizeof(struct rfd) + VLAN_ETH_FRAME_LEN; if(!(curr->skb = dev_alloc_skb(curr->length + rx_offset))) return -ENOMEM; skb_reserve(curr->skb, rx_offset); curr->skb->dev = nic->netdev; curr->dma_addr = pci_map_single(nic->pdev, curr->skb->data, curr->length, PCI_DMA_FROMDEVICE); return 0; } static inline void e100_rx_rfa_add_tail(struct nic *nic, struct rx_list *curr) { struct rfd *rfd = (struct rfd *)curr->skb->data; *rfd = nic->blank_rfd; pci_dma_sync_single(nic->pdev, curr->dma_addr, sizeof(struct rfd), PCI_DMA_TODEVICE); if(likely(curr->list.prev != &nic->rx_list_head)) { struct rx_list *prev = (struct rx_list *)curr->list.prev; if(likely(prev->skb != NULL)) { struct rfd *prev_rfd = (struct rfd *)prev->skb->data; put_unaligned(cpu_to_le32(curr->dma_addr), (u32 *)&prev_rfd->link); prev_rfd->command = 0; pci_dma_sync_single(nic->pdev, prev->dma_addr, sizeof(struct rfd), PCI_DMA_TODEVICE); } } } static inline int e100_rx_indicate(struct nic *nic, struct rx_list *curr, unsigned int *work_done, unsigned int work_to_do) { struct sk_buff *skb = curr->skb; struct rfd *rfd = (struct rfd *)skb->data; u16 rfd_status, actual_size; if(unlikely(work_done && *work_done >= work_to_do)) return -EAGAIN; /* Need to sync before taking a peek at cb_complete bit */ pci_dma_sync_single(nic->pdev, curr->dma_addr, sizeof(struct rfd), PCI_DMA_FROMDEVICE); rfd_status = le16_to_cpu(rfd->status); DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status); /* If data isn't ready, nothing to indicate */ if(unlikely(!(rfd_status & cb_complete))) return -EAGAIN; /* Get actual data size */ actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF; if(unlikely(actual_size > curr->length - sizeof(struct rfd))) actual_size = curr->length - sizeof(struct rfd); /* Get data */ pci_dma_sync_single(nic->pdev, curr->dma_addr, sizeof(struct rfd) + actual_size, PCI_DMA_FROMDEVICE); pci_unmap_single(nic->pdev, curr->dma_addr, curr->length, PCI_DMA_FROMDEVICE); /* Pull off the RFD and put the actual data (minus eth hdr) */ skb_reserve(skb, sizeof(struct rfd)); skb_put(skb, actual_size); skb->protocol = eth_type_trans(skb, nic->netdev); if(unlikely(!(rfd_status & cb_ok)) || actual_size > nic->netdev->mtu + VLAN_ETH_HLEN) { /* Don't indicate if errors */ dev_kfree_skb_any(skb); } else { nic->net_stats.rx_packets++; nic->net_stats.rx_bytes += actual_size; nic->netdev->last_rx = jiffies; #ifdef CONFIG_E100_NAPI netif_receive_skb(skb); #else netif_rx(skb); #endif if(work_done) (*work_done)++; } curr->length = 0; curr->dma_addr = 0; curr->skb = NULL; return 0; } static inline void e100_rx_clean(struct nic *nic, unsigned int *work_done, unsigned int work_to_do) { struct list_head *list, *tmp; struct rx_list *curr; /* Indicate newly arrived packets */ list_for_each(list, &nic->rx_list_head) { curr = list_entry(list, struct rx_list, list); if(likely(curr->skb != NULL)) if(e100_rx_indicate(nic, curr, work_done, work_to_do)) break; } /* Alloc new skbs to refill list */ list_for_each_safe(list, tmp, &nic->rx_list_head) { curr = list_entry(list, struct rx_list, list); if(unlikely(curr->skb != NULL)) break; /* List is full, done */ if(unlikely(e100_rx_alloc_skb(nic, curr))) break; /* Better luck next time (see watchdog) */ list_del(&curr->list); list_add_tail(&curr->list, &nic->rx_list_head); e100_rx_rfa_add_tail(nic, curr); } e100_start_receiver(nic); } static void e100_rx_clean_list(struct nic *nic) { struct list_head *list; if(!nic->rx_list) return; list_for_each(list, &nic->rx_list_head) { struct rx_list *curr = list_entry(list, struct rx_list, list); if(curr->skb) { pci_unmap_single(nic->pdev, curr->dma_addr, curr->length, PCI_DMA_FROMDEVICE); dev_kfree_skb(curr->skb); } } kfree(nic->rx_list); nic->rx_list = NULL; } static int e100_rx_alloc_list(struct nic *nic) { struct rx_list *curr; unsigned int i, count = nic->params.rfds.count; INIT_LIST_HEAD(&nic->rx_list_head); if(!(nic->rx_list = kmalloc(sizeof(struct rx_list)*count, GFP_ATOMIC))) return -ENOMEM; for(curr = nic->rx_list, i = 0; i < count; curr++, i++) { if(e100_rx_alloc_skb(nic, curr)) { e100_rx_clean_list(nic); return -ENOMEM; } list_add_tail(&curr->list, &nic->rx_list_head); e100_rx_rfa_add_tail(nic, curr); } return 0; } static irqreturn_t e100_intr(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *netdev = dev_id; struct nic *nic = netdev->priv; u8 stat_ack = readb(&nic->csr->scb.stat_ack); DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack); if(stat_ack == 0x00 || /* Not our interurpt */ stat_ack == 0xFF) /* Hardware is ejected (cardbus, hotswap) */ return IRQ_NONE; /* Ack interrupts */ writeb(stat_ack, &nic->csr->scb.stat_ack); e100_write_flush(nic); #ifdef CONFIG_E100_NAPI e100_disable_irq(nic); netif_rx_schedule(netdev); #else if(stat_ack & stat_ack_rx) e100_rx_clean(nic, NULL, 0); if(stat_ack & stat_ack_tx) e100_tx_clean(nic); #endif return IRQ_HANDLED; } #ifdef CONFIG_E100_NAPI static int e100_poll(struct net_device *netdev, int *budget) { struct nic *nic = netdev->priv; unsigned int work_to_do = min(netdev->quota, *budget); unsigned int work_done = 0; int tx_cleaned; e100_rx_clean(nic, &work_done, work_to_do); tx_cleaned = e100_tx_clean(nic); /* If no Rx and Tx cleanup work was done, exit polling mode. */ if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { netif_rx_complete(netdev); e100_enable_irq(nic); return 0; } *budget -= work_done; netdev->quota -= work_done; return 1; } #endif static struct net_device_stats *e100_get_stats(struct net_device *netdev) { struct nic *nic = netdev->priv; return &nic->net_stats; } static int e100_set_mac_address(struct net_device *netdev, void *p) { struct nic *nic = netdev->priv; struct sockaddr *addr = p; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); e100_exec_cb(nic, NULL, e100_setup_iaaddr); return 0; } static int e100_change_mtu(struct net_device *netdev, int new_mtu) { if(new_mtu < ETH_ZLEN || new_mtu > ETH_DATA_LEN) return -EINVAL; netdev->mtu = new_mtu; return 0; } static int e100_asf(struct nic *nic) { /* ASF can be enabled from eeprom */ return((nic->pdev->device >= 0x1050) && (nic->pdev->device <= 0x1055) && (nic->eeprom[eeprom_config_asf] & eeprom_asf) && !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE)); } static int e100_up(struct nic *nic) { int err; if((err = e100_rx_alloc_list(nic))) return err; if((err = e100_alloc_cbs(nic))) goto err_rx_clean_list; if((err = e100_hw_init(nic))) goto err_clean_cbs; e100_set_multicast_list(nic->netdev); e100_start_receiver(nic); netif_start_queue(nic->netdev); mod_timer(&nic->watchdog, jiffies); if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, nic->netdev->name, nic->netdev))) goto err_no_irq; e100_enable_irq(nic); return 0; err_no_irq: del_timer_sync(&nic->watchdog); netif_stop_queue(nic->netdev); err_clean_cbs: e100_clean_cbs(nic, 1); err_rx_clean_list: e100_rx_clean_list(nic); return err; } static void e100_down(struct nic *nic) { e100_disable_irq(nic); free_irq(nic->pdev->irq, nic->netdev); del_timer_sync(&nic->watchdog); netif_carrier_off(nic->netdev); netif_stop_queue(nic->netdev); e100_clean_cbs(nic, 1); e100_rx_clean_list(nic); } static void e100_tx_timeout(struct net_device *netdev) { struct nic *nic = netdev->priv; DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n", readb(&nic->csr->scb.status)); e100_down(netdev->priv); e100_up(netdev->priv); } static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) { int err; struct sk_buff *skb; struct rx_list *rx; /* Use driver resources to perform internal MAC or PHY * loopback test. A single packet is prepared and transmitted * in loopback mode, and the test passes if the received * packet compares byte-for-byte to the transmitted packet. */ if((err = e100_rx_alloc_list(nic))) return err; if((err = e100_alloc_cbs(nic))) goto err_clean_rx; /* ICH PHY loopback is broken so do MAC loopback instead */ if(nic->flags & ich && loopback_mode == lb_phy) loopback_mode = lb_mac; nic->loopback = loopback_mode; if((err = e100_hw_init(nic))) goto err_loopback_none; if(loopback_mode == lb_phy) mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, BMCR_LOOPBACK); e100_start_receiver(nic); if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { err = -ENOMEM; goto err_loopback_none; } skb_put(skb, ETH_DATA_LEN); memset(skb->data, 0xFF, ETH_DATA_LEN); e100_xmit_frame(skb, nic->netdev); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 100 + 1); rx = list_entry(nic->rx_list_head.next, struct rx_list, list); if(memcmp(rx->skb->data + sizeof(struct rfd), skb->data, ETH_DATA_LEN)) err = -EAGAIN; err_loopback_none: mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, 0); nic->loopback = lb_none; e100_hw_init(nic); e100_clean_cbs(nic, 1); err_clean_rx: e100_rx_clean_list(nic); return err; } #define MII_LED_CONTROL 0x1B static void e100_blink_led(unsigned long data) { struct nic *nic = (struct nic *)data; enum led_state { led_on = 0x01, led_off = 0x04, led_on_559 = 0x05, led_on_557 = 0x07, }; nic->leds = (nic->leds & led_on) ? led_off : (nic->mac < mac_82559_D101M) ? led_on_557 : led_on_559; mdio_write(nic->netdev, nic->mii.phy_id, MII_LED_CONTROL, nic->leds); mod_timer(&nic->blink_timer, jiffies + HZ / 4); } static int e100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) { struct nic *nic = netdev->priv; return mii_ethtool_gset(&nic->mii, cmd); } static int e100_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd) { struct nic *nic = netdev->priv; return mii_ethtool_sset(&nic->mii, cmd); } static void e100_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info) { struct nic *nic = netdev->priv; strcpy(info->driver, DRV_NAME); strcpy(info->version, DRV_VERSION); strcpy(info->fw_version, "N/A"); strcpy(info->bus_info, pci_name(nic->pdev)); } static int e100_get_regs_len(struct net_device *netdev) { struct nic *nic = netdev->priv; #define E100_PHY_REGS 0x1C #define E100_REGS_LEN 1 + E100_PHY_REGS + \ sizeof(nic->mem->dump_buf) / sizeof(u32) return E100_REGS_LEN * sizeof(u32); } static void e100_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) { struct nic *nic = netdev->priv; u32 *buff = p; int i; regs->version = (1 << 24) | nic->rev_id; buff[0] = readb(&nic->csr->scb.cmd_hi) << 24 | readb(&nic->csr->scb.cmd_lo) << 16 | readw(&nic->csr->scb.status); for(i = E100_PHY_REGS; i >= 0; i--) buff[1 + E100_PHY_REGS - i] = mdio_read(netdev, nic->mii.phy_id, i); memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); e100_exec_cb(nic, NULL, e100_dump); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 100 + 1); memcpy(&buff[2 + E100_PHY_REGS], nic->mem->dump_buf, sizeof(nic->mem->dump_buf)); } static void e100_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct nic *nic = netdev->priv; wol->supported = (nic->mac >= mac_82558_D101_A4) ? WAKE_MAGIC : 0; wol->wolopts = (nic->flags & wol_magic) ? WAKE_MAGIC : 0; } static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct nic *nic = netdev->priv; if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) return -EOPNOTSUPP; if(wol->wolopts) nic->flags |= wol_magic; else nic->flags &= ~wol_magic; pci_enable_wake(nic->pdev, 0, nic->flags & (wol_magic | e100_asf(nic))); e100_exec_cb(nic, NULL, e100_configure); return 0; } static u32 e100_get_msglevel(struct net_device *netdev) { struct nic *nic = netdev->priv; return nic->msg_enable; } static void e100_set_msglevel(struct net_device *netdev, u32 value) { struct nic *nic = netdev->priv; nic->msg_enable = value; } static int e100_nway_reset(struct net_device *netdev) { struct nic *nic = netdev->priv; return mii_nway_restart(&nic->mii); } static u32 e100_get_link(struct net_device *netdev) { struct nic *nic = netdev->priv; return mii_link_ok(&nic->mii); } static int e100_get_eeprom_len(struct net_device *netdev) { struct nic *nic = netdev->priv; return nic->eeprom_wc << 1; } #define E100_EEPROM_MAGIC 0x1234 static int e100_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, u8 *bytes) { struct nic *nic = netdev->priv; eeprom->magic = E100_EEPROM_MAGIC; memcpy(bytes, &((u8 *)nic->eeprom)[eeprom->offset], eeprom->len); return 0; } static int e100_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, u8 *bytes) { struct nic *nic = netdev->priv; if(eeprom->magic != E100_EEPROM_MAGIC) return -EINVAL; memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len); return e100_eeprom_save(nic, eeprom->offset >> 1, (eeprom->len >> 1) + 1); } static void e100_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct nic *nic = netdev->priv; struct param_range *rfds = &nic->params.rfds; struct param_range *cbs = &nic->params.cbs; ring->rx_max_pending = rfds->max; ring->tx_max_pending = cbs->max; ring->rx_mini_max_pending = 0; ring->rx_jumbo_max_pending = 0; ring->rx_pending = rfds->count; ring->tx_pending = cbs->count; ring->rx_mini_pending = 0; ring->rx_jumbo_pending = 0; } static int e100_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct nic *nic = netdev->priv; struct param_range *rfds = &nic->params.rfds; struct param_range *cbs = &nic->params.cbs; if(netif_running(netdev)) e100_down(nic); rfds->count = max(ring->rx_pending, rfds->min); rfds->count = min(rfds->count, rfds->max); cbs->count = max(ring->tx_pending, cbs->min); cbs->count = min(cbs->count, cbs->max); if(netif_running(netdev)) e100_up(nic); return 0; } static char e100_gstrings_test[][ETH_GSTRING_LEN] = { "Link test (on/offline)", "Eeprom test (on/offline)", "Self test (offline)", "Mac loopback (offline)", "Phy loopback (offline)", }; #define E100_TEST_LEN sizeof(e100_gstrings_test) / ETH_GSTRING_LEN static int e100_diag_test_count(struct net_device *netdev) { return E100_TEST_LEN; } static void e100_diag_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) { struct nic *nic = netdev->priv; int i; memset(data, 0, E100_TEST_LEN * sizeof(u64)); data[0] = !mii_link_ok(&nic->mii); data[1] = e100_eeprom_load(nic); if(test->flags & ETH_TEST_FL_OFFLINE) { if(netif_running(netdev)) e100_down(nic); data[2] = e100_self_test(nic); data[3] = e100_loopback_test(nic, lb_mac); data[4] = e100_loopback_test(nic, lb_phy); if(netif_running(netdev)) e100_up(nic); } for(i = 0; i < E100_TEST_LEN; i++) test->flags |= data[i] ? ETH_TEST_FL_FAILED : 0; } static int e100_phys_id(struct net_device *netdev, u32 data) { struct nic *nic = netdev->priv; if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); mod_timer(&nic->blink_timer, jiffies); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(data * HZ); del_timer_sync(&nic->blink_timer); mdio_write(netdev, nic->mii.phy_id, MII_LED_CONTROL, 0); return 0; } static char e100_gstrings_stats[][ETH_GSTRING_LEN] = { "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", "rx_length_errors", "rx_over_errors", "rx_crc_errors", "rx_frame_errors", "rx_fifo_errors", "rx_missed_errors", "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors", "tx_heartbeat_errors", "tx_window_errors", /* device-specific stats */ "tx_deferred", "tx_single_collisions", "tx_multi_collisions", "tx_flow_control_pause", "rx_flow_control_pause", "rx_flow_control_unsupported", "tx_tco_packets", "rx_tco_packets", }; #define E100_NET_STATS_LEN 21 #define E100_STATS_LEN sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN static int e100_get_stats_count(struct net_device *netdev) { return E100_STATS_LEN; } static void e100_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct nic *nic = netdev->priv; int i; for(i = 0; i < E100_NET_STATS_LEN; i++) data[i] = ((unsigned long *)&nic->net_stats)[i]; data[i++] = nic->tx_deferred; data[i++] = nic->tx_single_collisions; data[i++] = nic->tx_multiple_collisions; data[i++] = nic->tx_fc_pause; data[i++] = nic->rx_fc_pause; data[i++] = nic->rx_fc_unsupported; data[i++] = nic->tx_tco_frames; data[i++] = nic->rx_tco_frames; } static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data) { switch(stringset) { case ETH_SS_TEST: memcpy(data, *e100_gstrings_test, sizeof(e100_gstrings_test)); break; case ETH_SS_STATS: memcpy(data, *e100_gstrings_stats, sizeof(e100_gstrings_stats)); break; } } static struct ethtool_ops e100_ethtool_ops = { .get_settings = e100_get_settings, .set_settings = e100_set_settings, .get_drvinfo = e100_get_drvinfo, .get_regs_len = e100_get_regs_len, .get_regs = e100_get_regs, .get_wol = e100_get_wol, .set_wol = e100_set_wol, .get_msglevel = e100_get_msglevel, .set_msglevel = e100_set_msglevel, .nway_reset = e100_nway_reset, .get_link = e100_get_link, .get_eeprom_len = e100_get_eeprom_len, .get_eeprom = e100_get_eeprom, .set_eeprom = e100_set_eeprom, .get_ringparam = e100_get_ringparam, .set_ringparam = e100_set_ringparam, .self_test_count = e100_diag_test_count, .self_test = e100_diag_test, .get_strings = e100_get_strings, .phys_id = e100_phys_id, .get_stats_count = e100_get_stats_count, .get_ethtool_stats = e100_get_ethtool_stats, }; static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct nic *nic = netdev->priv; struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr->ifr_data; return generic_mii_ioctl(&nic->mii, mii, cmd, NULL); } static int e100_alloc(struct nic *nic) { nic->mem = pci_alloc_consistent(nic->pdev, sizeof(struct mem), &nic->dma_addr); return nic->mem ? 0 : -ENOMEM; } static void e100_free(struct nic *nic) { if(nic->mem) { pci_free_consistent(nic->pdev, sizeof(struct mem), nic->mem, nic->dma_addr); nic->mem = NULL; } } static int e100_open(struct net_device *netdev) { struct nic *nic = netdev->priv; int err = 0; netif_carrier_off(netdev); if((err = e100_up(nic))) DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n"); return err; } static int e100_close(struct net_device *netdev) { e100_down(netdev->priv); return 0; } static int __devinit e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct net_device *netdev; struct nic *nic; int err; if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { if(((1 << debug) - 1) & NETIF_MSG_PROBE) printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); return -ENOMEM; } netdev->open = e100_open; netdev->stop = e100_close; netdev->hard_start_xmit = e100_xmit_frame; netdev->get_stats = e100_get_stats; netdev->set_multicast_list = e100_set_multicast_list; netdev->set_mac_address = e100_set_mac_address; netdev->change_mtu = e100_change_mtu; netdev->do_ioctl = e100_do_ioctl; SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); netdev->tx_timeout = e100_tx_timeout; netdev->watchdog_timeo = E100_WATCHDOG_PERIOD; #ifdef CONFIG_E100_NAPI netdev->poll = e100_poll; netdev->weight = E100_NAPI_WEIGHT; #endif nic = netdev->priv; nic->netdev = netdev; nic->pdev = pdev; nic->msg_enable = (1 << debug) - 1; pci_set_drvdata(pdev, netdev); if((err = pci_enable_device(pdev))) { DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n"); goto err_out_free_dev; } if(!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { DPRINTK(PROBE, ERR, "Cannot find proper PCI device " "base address, aborting.\n"); err = -ENODEV; goto err_out_disable_pdev; } if((err = pci_request_regions(pdev, DRV_NAME))) { DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n"); goto err_out_disable_pdev; } pci_set_master(pdev); if((err = pci_set_dma_mask(pdev, 0xFFFFFFFFULL))) { DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); goto err_out_free_res; } SET_MODULE_OWNER(netdev); SET_NETDEV_DEV(netdev, &pdev->dev); nic->csr = ioremap(pci_resource_start(pdev, 0), sizeof(struct csr)); if(!nic->csr) { DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n"); err = -ENOMEM; goto err_out_free_res; } if(ent->driver_data) nic->flags |= ich; else nic->flags &= ~ich; spin_lock_init(&nic->cb_lock); spin_lock_init(&nic->cmd_lock); init_timer(&nic->watchdog); nic->watchdog.function = e100_watchdog; nic->watchdog.data = (unsigned long)nic; init_timer(&nic->blink_timer); nic->blink_timer.function = e100_blink_led; nic->blink_timer.data = (unsigned long)nic; if((err = e100_alloc(nic))) { DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n"); goto err_out_iounmap; } e100_get_defaults(nic); e100_hw_reset(nic); e100_phy_init(nic); if((err = e100_eeprom_load(nic))) goto err_out_free; ((u16 *)nic->netdev->dev_addr)[0] = le16_to_cpu(nic->eeprom[0]); ((u16 *)nic->netdev->dev_addr)[1] = le16_to_cpu(nic->eeprom[1]); ((u16 *)nic->netdev->dev_addr)[2] = le16_to_cpu(nic->eeprom[2]); if(!is_valid_ether_addr(nic->netdev->dev_addr)) { DPRINTK(PROBE, ERR, "Invalid MAC address from " "EEPROM, aborting.\n"); err = -EAGAIN; goto err_out_free; } /* Wol magic packet can be enabled from eeprom */ if((nic->mac >= mac_82558_D101_A4) && (nic->eeprom[eeprom_id] & eeprom_id_wol)) nic->flags |= wol_magic; pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic))); if((err = register_netdev(netdev))) { DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); goto err_out_free; } return 0; err_out_free: e100_free(nic); err_out_iounmap: iounmap(nic->csr); err_out_free_res: pci_release_regions(pdev); err_out_disable_pdev: pci_disable_device(pdev); err_out_free_dev: pci_set_drvdata(pdev, NULL); free_netdev(netdev); return err; } static void __devexit e100_remove(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); if(netdev) { struct nic *nic = netdev->priv; unregister_netdev(netdev); e100_free(nic); iounmap(nic->csr); free_netdev(netdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); } } #ifdef CONFIG_PM static int e100_suspend(struct pci_dev *pdev, u32 state) { struct net_device *netdev = pci_get_drvdata(pdev); struct nic *nic = netdev->priv; if(netif_running(netdev)) e100_down(nic); e100_hw_reset(nic); netif_device_detach(netdev); pci_save_state(pdev, nic->pm_state); pci_enable_wake(pdev, state, nic->flags & (wol_magic | e100_asf(nic))); pci_disable_device(pdev); pci_set_power_state(pdev, state); return 0; } static int e100_resume(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); struct nic *nic = netdev->priv; pci_set_power_state(pdev, 0); pci_restore_state(pdev, nic->pm_state); e100_hw_init(nic); netif_device_attach(netdev); if(netif_running(netdev)) e100_up(nic); return 0; } #endif static struct pci_driver e100_driver = { .name = DRV_NAME, .id_table = e100_id_table, .probe = e100_probe, .remove = __devexit_p(e100_remove), #ifdef CONFIG_PM .suspend = e100_suspend, .resume = e100_resume, #endif }; static int __init e100_init_module(void) { if(((1 << debug) - 1) & NETIF_MSG_DRV) { printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); } return pci_module_init(&e100_driver); } static void __exit e100_cleanup_module(void) { pci_unregister_driver(&e100_driver); } module_init(e100_init_module); module_exit(e100_cleanup_module); From jgarzik@pobox.com Thu Dec 4 22:40:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 22:40:54 -0800 (PST) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB56eeTa000669 for ; Thu, 4 Dec 2003 22:40:41 -0800 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:39574 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 1AS9dl-0001In-BQ; Fri, 05 Dec 2003 06:40:37 +0000 Message-ID: <3FD02853.2070804@pobox.com> Date: Fri, 05 Dec 2003 01:40:19 -0500 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: prasanna@in.ibm.com CC: mpm@selenic.com, suparna@in.ibm.com, netdev@oss.sgi.com Subject: Re: [2/4] pollcontroller patch for 2.6.0-test10-bk25-netdrvr-exp1 References: <20031203135728.GA13585@in.ibm.com> In-Reply-To: <20031203135728.GA13585@in.ibm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1884 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 I'm applying smc-ultra and tlan patches, but holding off on e100 and e1000. For both, as Scott mentioned, they don't look tested under NAPI. For e100 specifically, there is a spiffy new e100 that would need to be re-diffed and tested against. Jeff From jgarzik@pobox.com Thu Dec 4 23:47:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Dec 2003 23:47:55 -0800 (PST) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB57ldTa001984 for ; Thu, 4 Dec 2003 23:47:40 -0800 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:39603 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 1ASAga-0001pT-TO; Fri, 05 Dec 2003 07:47:37 +0000 Message-ID: <3FD03807.6040207@pobox.com> Date: Fri, 05 Dec 2003 02:47:19 -0500 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Dillow CC: Netdev Subject: Re: [BK RESEND Typhoon (3CR990) updates for 2.5 References: <1070487775.5062.8.camel@dillow.idleaire.com> In-Reply-To: <1070487775.5062.8.camel@dillow.idleaire.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1885 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 thanks, applied to 2.4 and 2.5 bugfix stream From rask@sygehus.dk Fri Dec 5 07:43:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 07:44:07 -0800 (PST) Received: from 0x50a172bb.albnxx15.adsl-dhcp.tele.dk (0x50a172bb.albnxx15.adsl-dhcp.tele.dk [80.161.114.187]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB5FhqTa031005 for ; Fri, 5 Dec 2003 07:43:53 -0800 Received: by 0x50a1446d.albnxx15.adsl-dhcp.tele.dk (Postfix, from userid 500) id 037A120BB6; Fri, 5 Dec 2003 16:43:48 +0100 (CET) Date: Fri, 5 Dec 2003 16:43:47 +0100 From: Rask Ingemann Lambertsen To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: Re: [RFR] new e100 driver Message-ID: <20031205164347.B1291@sygehus.dk> References: <20031205063842.GA23843@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20031205063842.GA23843@gtf.org>; from jgarzik@pobox.com on Fri, Dec 05, 2003 at 01:38:43AM -0500 X-archive-position: 1886 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rask@sygehus.dk Precedence: bulk X-list: netdev On Fri, Dec 05, 2003 at 01:38:43AM -0500, Jeff Garzik wrote: > > e100 3.0.9_dev just got checked into net-drivers-2.5-exp queue. As I do > occasionally (especially for smaller drivers), I post them for review > and comment. How would I build it? A patch for the Makefile is missing. > Patches welcome in addition to comments. > > One thing I am tempted to request is use of the new module_param()... Does anybody have a macro that turns module_parm() into MODULE_PARM() for 2.4 compatibility? > * References: > * Intel 8255x 10/100 Mbps Ethernet Controller Family, > * Open Source Software Developers Manual, > * http://sourceforge.net/projects/e1000 [cut] > * Hardware padding of short packets to minimum packet size is > * enabled. 82557 pads with 7Eh, while the later controllers pad > * with 00h. I would be nice if the documentation said so. A few days ago I spent half an hour or so trying to figure out why frames sent by an 82558 were padded with 0x00 rather than the documented 0x7e (with no sign of skb_padto(), memset() or anything similiar in the driver). > enum mac { > mac_82557_D100_A = 0, > mac_82557_D100_B = 1, > mac_82557_D100_C = 2, > mac_82558_D101_A4 = 4, > mac_82558_D101_B0 = 5, > mac_82559_D101M = 8, > mac_82559_D101S = 9, > mac_82550_D102 = 12, > mac_82550_D102_C = 13, > mac_82550_D102_E = 15, > mac_unknown = 0xFF, > }; Nice for matching the D10* names with chip numbers. -- Regards, Rask Ingemann Lambertsen From jleu@mindspring.com Fri Dec 5 09:37:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 09:37:49 -0800 (PST) Received: from localhost.localdomain (jleu-laptop.dyn.internetnoc.com [209.249.160.113]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB5HbaTa005093 for ; Fri, 5 Dec 2003 09:37:36 -0800 Received: from localhost.localdomain (jleu-laptop [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id hB5HZWkB003362; Fri, 5 Dec 2003 11:35:32 -0600 Received: (from jleu@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id hB5HZWgZ003360; Fri, 5 Dec 2003 11:35:32 -0600 X-Authentication-Warning: localhost.localdomain: jleu set sender to jleu@mindspring.com using -f Date: Fri, 5 Dec 2003 11:35:32 -0600 From: "James R. Leu" To: "David S. Miller" Cc: Ramon Casellas , netdev@oss.sgi.com Subject: Re: Request: Allocate a Netlink Family Number for MPLS Message-ID: <20031205173507.GB2241@mindspring.com> Reply-To: jleu@mindspring.com References: <20031201124532.3f6b6a65.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031201124532.3f6b6a65.davem@redhat.com> User-Agent: Mutt/1.4.1i X-archive-position: 1887 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jleu@mindspring.com Precedence: bulk X-list: netdev On Mon, Dec 01, 2003 at 12:45:32PM -0800, David S. Miller wrote: > On Mon, 1 Dec 2003 15:36:26 +0100 (MET) > Ramon Casellas wrote: > > > We're working in porting mpls for linux to 2.6 and one of the planned > > features is to move from an IOCTL based approach to a Netlink based one > > for updating/querying the MPLS FTN/ILM/Label Mapping/... tables from > > userspace. Since netlink families are public, I would > > like to know if it is possible to reserve a family for MPLS, even though > > the MPLS patch is not part of the official kernel. > > You don't need a whole new netlink family. Just create a dummy > address family for MPLS (ie. AF_MPLS) and then just use > NETLINK_ROUTE. Agreed. One could also use AF_MPLS for applications to register for data associated with the router alert label. I suppose one could also go completly nuts and allow an application to open stream connection that talks and listens on a specific label, but I think that is a bit overboard. -- James R. Leu jleu@mindspring.com From jgarzik@pobox.com Fri Dec 5 10:34:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 10:34:47 -0800 (PST) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB5IYVTa006797 for ; Fri, 5 Dec 2003 10:34:32 -0800 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:39769 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 1ASKGm-0002Hr-Pw; Fri, 05 Dec 2003 18:01:36 +0000 Message-ID: <3FD0C7EF.40305@pobox.com> Date: Fri, 05 Dec 2003 13:01:19 -0500 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rask Ingemann Lambertsen CC: netdev@oss.sgi.com Subject: Re: [RFR] new e100 driver References: <20031205063842.GA23843@gtf.org> <20031205164347.B1291@sygehus.dk> In-Reply-To: <20031205164347.B1291@sygehus.dk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 1888 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 Rask Ingemann Lambertsen wrote: > On Fri, Dec 05, 2003 at 01:38:43AM -0500, Jeff Garzik wrote: > >>e100 3.0.9_dev just got checked into net-drivers-2.5-exp queue. As I do >>occasionally (especially for smaller drivers), I post them for review >>and comment. > > > How would I build it? A patch for the Makefile is missing. Download the net-drivers-2.5-exp patch I am about to post :) >>Patches welcome in addition to comments. >> >>One thing I am tempted to request is use of the new module_param()... > > > Does anybody have a macro that turns module_parm() into MODULE_PARM() for > 2.4 compatibility? Due to semantics of MODULE_PARM(), that's impossible AFAIK. >> * References: >> * Intel 8255x 10/100 Mbps Ethernet Controller Family, >> * Open Source Software Developers Manual, >> * http://sourceforge.net/projects/e1000 > > [cut] > >> * Hardware padding of short packets to minimum packet size is >> * enabled. 82557 pads with 7Eh, while the later controllers pad >> * with 00h. > > > I would be nice if the documentation said so. A few days ago I spent half an > hour or so trying to figure out why frames sent by an 82558 were padded with > 0x00 rather than the documented 0x7e (with no sign of skb_padto(), memset() > or anything similiar in the driver). Do you mean the PDF documentation? I dunno how much control Scott Feldman and his team have over that. Jeff From garzik@gtf.org Fri Dec 5 11:28:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 11:28:50 -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 hB5JSYTa009128 for ; Fri, 5 Dec 2003 11:28:35 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id E92476641; Fri, 5 Dec 2003 14:28:28 -0500 (EST) Date: Fri, 5 Dec 2003 14:28:28 -0500 From: Jeff Garzik To: netdev@oss.sgi.com Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org Subject: [BK PATCHES] 2.6.x experimental net driver queue Message-ID: <20031205192828.GA15907@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 1889 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 This is the latest installment of "stuff I think should go into 2.6.1" ;-) or IOW, my patch queue. The changelog was getting quite long, so I'm now omitting all but the new changes. The full changelog is in BK, and also will be posted on kernel.org in the same directory as its respective patch. The new and interesting thing in today's patch is the e100 rewrite. A bit of history. I have been really impressed with what Intel has done with the e100 driver. If anyone saw it in the days when e100 only reared its head in vendor kernels, it was pretty grotty, and had license problems to boot. The current guys working on e100 listened to feedback from the community, and over time improved e100's code and license to the point where it was acceptable for merging into the mainline kernel. Well, even after all that work, it was a pretty darn big driver. It supported all the whiz bang hw-offload features. But as hardware does, you find out about various limits and errata that have crept into the field over time. Particularly, some of the hwaccel features don't work on some chips. So we come full circle, with e100 version 3. I've received a lot of "this works where e100 and eepro100 don't" reports, so I'm anxious to see how it does in wide testing. To quote from the driver, * VLAN offload support of tagging, stripping and filtering is not * supported, but driver will accommodate the extra 4-byte VLAN tag * for processing by upper layers. Tx/Rx Checksum offloading is not * supported. Tx Scatter/Gather is not supported. Jumbo Frames is * not supported. * * NAPI support is enabled with CONFIG_E100_NAPI. * * MagicPacket(tm) WoL support is enabled/disabled via ethtool. In other words, the scales tip back in the direction of letting the net stack do a bit more of the work. And guess what? The newer, more simple driver not only seems a bit more stable, but sometimes faster, because it now scales upward with the performance of your system CPU. If I may risk a tangent, this is another reason why I feel interest in TOE may be more trouble than it's worth. Forget security issues. Forget userland interface issues. The plain and simple fact is that CPUs keep getting faster, while that TOE card you bought last month does not. Getting back on topic, I like the new e100. Yes, it's a rewrite from scratch. But darn, it's clean, and early reports seem to indicate it's more stable and faster, too. So why not? Jeff BK users: bk pull bk://gkernel.bkbits.net/net-drivers-2.5-exp Patch: ftp://ftp.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.6/2.6.0-test11-netdrvr-exp2.patch.bz2 This will update the following files: Documentation/networking/8139too.txt | 438 --- drivers/net/68360enet.c | 951 ------ drivers/net/e100/LICENSE | 339 -- drivers/net/e100/Makefile | 8 drivers/net/e100/e100.h | 999 ------- drivers/net/e100/e100_config.c | 639 ---- drivers/net/e100/e100_config.h | 168 - drivers/net/e100/e100_eeprom.c | 565 ---- drivers/net/e100/e100_main.c | 4358 -------------------------------- drivers/net/e100/e100_phy.c | 1163 -------- drivers/net/e100/e100_phy.h | 158 - drivers/net/e100/e100_test.c | 500 --- drivers/net/e100/e100_ucode.h | 365 -- Documentation/SubmittingPatches | 4 Documentation/networking/netconsole.txt | 57 drivers/char/synclink.c | 43 drivers/net/3c501.c | 116 drivers/net/3c501.h | 1 drivers/net/3c503.c | 117 drivers/net/3c505.c | 128 drivers/net/3c507.c | 120 drivers/net/3c515.c | 328 +- drivers/net/3c523.c | 108 drivers/net/3c527.c | 682 ++--- drivers/net/3c527.h | 6 drivers/net/3c59x.c | 17 drivers/net/8139too.c | 405 +- drivers/net/82596.c | 83 drivers/net/Kconfig | 34 drivers/net/Makefile | 4 drivers/net/Space.c | 587 ++-- drivers/net/a2065.c | 21 drivers/net/ac3200.c | 91 drivers/net/amd8111e.c | 14 drivers/net/apne.c | 81 drivers/net/appletalk/ipddp.c | 62 drivers/net/appletalk/ltpc.c | 2 drivers/net/arcnet/arc-rimi.c | 131 drivers/net/arcnet/arcnet.c | 6 drivers/net/arcnet/com20020-isa.c | 84 drivers/net/arcnet/com20020-pci.c | 54 drivers/net/arcnet/com20020.c | 16 drivers/net/arcnet/com90io.c | 126 drivers/net/arcnet/com90xx.c | 238 - drivers/net/ariadne.c | 10 drivers/net/arm/am79c961a.c | 2 drivers/net/arm/ether00.c | 4 drivers/net/arm/ether1.c | 2 drivers/net/arm/ether3.c | 2 drivers/net/arm/etherh.c | 2 drivers/net/at1700.c | 166 - drivers/net/atari_bionet.c | 62 drivers/net/atari_pamsnet.c | 67 drivers/net/atarilance.c | 58 drivers/net/atp.c | 40 drivers/net/au1000_eth.c | 61 drivers/net/bagetlance.c | 77 drivers/net/cs89x0.c | 132 drivers/net/de600.c | 59 drivers/net/de600.h | 1 drivers/net/de620.c | 63 drivers/net/declance.c | 17 drivers/net/defxx.c | 2 drivers/net/depca.c | 20 drivers/net/dummy.c | 2 drivers/net/e100.c | 2299 ++++++++++++++++ drivers/net/e100/e100_config.c | 8 drivers/net/e100/e100_main.c | 41 drivers/net/e100/e100_phy.c | 14 drivers/net/e1000/e1000.h | 10 drivers/net/e1000/e1000_ethtool.c | 94 drivers/net/e1000/e1000_hw.c | 65 drivers/net/e1000/e1000_hw.h | 9 drivers/net/e1000/e1000_main.c | 143 - drivers/net/e1000/e1000_param.c | 45 drivers/net/e2100.c | 88 drivers/net/eepro.c | 256 - drivers/net/eepro100.c | 21 drivers/net/eexpress.c | 91 drivers/net/eql.c | 2 drivers/net/es3210.c | 87 drivers/net/eth16i.c | 119 drivers/net/ethertap.c | 3 drivers/net/ewrk3.c | 684 ++--- drivers/net/fc/iph5526.c | 3 drivers/net/fc/iph5526_scsi.h | 2 drivers/net/fmv18x.c | 111 drivers/net/gt96100eth.c | 49 drivers/net/hamradio/baycom_epp.c | 2 drivers/net/hamradio/bpqether.c | 2 drivers/net/hamradio/hdlcdrv.c | 2 drivers/net/hamradio/yam.c | 2 drivers/net/hp-plus.c | 84 drivers/net/hp.c | 84 drivers/net/hp100.c | 743 ++--- drivers/net/hplance.c | 85 drivers/net/hydra.c | 19 drivers/net/jazzsonic.c | 88 drivers/net/lance.c | 129 drivers/net/lasi_82596.c | 17 drivers/net/lne390.c | 88 drivers/net/mac8390.c | 103 drivers/net/mac89x0.c | 77 drivers/net/mace.c | 50 drivers/net/macmace.c | 30 drivers/net/macsonic.c | 103 drivers/net/meth.c | 83 drivers/net/mvme147.c | 64 drivers/net/natsemi.c | 39 drivers/net/ne.c | 83 drivers/net/ne2.c | 82 drivers/net/ne2k-pci.c | 3 drivers/net/ne2k_cbus.c | 107 drivers/net/ne2k_cbus.h | 2 drivers/net/ne3210.c | 18 drivers/net/netconsole.c | 120 drivers/net/ni5010.c | 184 - drivers/net/ni52.c | 118 drivers/net/ni65.c | 101 drivers/net/ns83820.c | 2 drivers/net/oaknet.c | 61 drivers/net/pci-skeleton.c | 2 drivers/net/pcmcia/3c574_cs.c | 25 drivers/net/pcmcia/3c589_cs.c | 24 drivers/net/pcmcia/axnet_cs.c | 17 drivers/net/pcmcia/com20020_cs.c | 47 drivers/net/pcmcia/fmvj18x_cs.c | 28 drivers/net/pcmcia/ibmtr_cs.c | 15 drivers/net/pcmcia/nmclan_cs.c | 24 drivers/net/pcmcia/pcnet_cs.c | 17 drivers/net/pcmcia/smc91c92_cs.c | 24 drivers/net/pcmcia/xirc2ps_cs.c | 7 drivers/net/pcnet32.c | 11 drivers/net/plip.c | 18 drivers/net/ppp_generic.c | 67 drivers/net/r8169.c | 448 ++- drivers/net/saa9730.c | 63 drivers/net/sb1250-mac.c | 49 drivers/net/seeq8005.c | 97 drivers/net/sgiseeq.c | 29 drivers/net/shaper.c | 11 drivers/net/sk_g16.c | 182 - drivers/net/sk_mca.c | 119 drivers/net/sk_mca.h | 3 drivers/net/skfp/skfddi.c | 32 drivers/net/smc-ultra.c | 107 drivers/net/smc-ultra32.c | 85 drivers/net/smc9194.c | 110 drivers/net/stnic.c | 42 drivers/net/sun3_82586.c | 81 drivers/net/sun3lance.c | 85 drivers/net/tc35815.c | 194 - drivers/net/tg3.c | 16 drivers/net/tlan.c | 11 drivers/net/tokenring/3c359.c | 4 drivers/net/tokenring/abyss.c | 2 drivers/net/tokenring/madgemc.c | 6 drivers/net/tokenring/proteon.c | 184 - drivers/net/tokenring/skisa.c | 182 - drivers/net/tokenring/smctr.c | 194 - drivers/net/tokenring/tmspci.c | 2 drivers/net/tulip/Kconfig | 20 drivers/net/tulip/de2104x.c | 2 drivers/net/tulip/dmfe.c | 2 drivers/net/tulip/interrupt.c | 417 ++- drivers/net/tulip/tulip.h | 18 drivers/net/tulip/tulip_core.c | 78 drivers/net/tulip/winbond-840.c | 2 drivers/net/tulip/xircom_tulip_cb.c | 3 drivers/net/tun.c | 18 drivers/net/wan/cosa.c | 37 drivers/net/wan/lmc/lmc_main.c | 375 -- drivers/net/wan/lmc/lmc_var.h | 15 drivers/net/wan/x25_asy.c | 2 drivers/net/wd.c | 89 drivers/net/wireless/arlan-main.c | 283 -- drivers/net/wireless/arlan.h | 6 drivers/net/wireless/atmel.c | 2 drivers/net/wireless/ray_cs.c | 17 drivers/net/wireless/strip.c | 2 drivers/net/wireless/wavelan.c | 251 - drivers/net/wireless/wavelan.p.h | 58 drivers/net/wireless/wavelan_cs.c | 113 drivers/net/wireless/wavelan_cs.p.h | 49 drivers/net/znet.c | 36 drivers/net/zorro8390.c | 19 drivers/s390/net/qeth.c | 18 drivers/usb/gadget/ether.c | 2 include/linux/arcdevice.h | 1 include/linux/com20020.h | 1 include/linux/netdevice.h | 18 include/linux/netpoll.h | 38 include/linux/pci_ids.h | 2 net/Kconfig | 20 net/core/Makefile | 1 net/core/dev.c | 39 net/core/netpoll.c | 646 ++++ net/wanrouter/wanmain.c | 2 198 files changed, 10465 insertions(+), 17186 deletions(-) through these ChangeSets: (03/12/05 1.1505) [netdrvr tlan] netpoll support Hi Jeff, Below is the pollcontroller patch for tlan network device driver. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch (03/12/05 1.1504) [netdrvr smc-ultra] netpoll support Hi Jeff, Below is the pollcontroller patch for smc ultra net driver. This patch can be applied over 2.6.0-test9-bk25-netdrvr-exp1.patch (03/12/05 1.1503) [netdrvr e100] complete rewrite of e100 driver [... snip changes from previous net-drivers-2.5-exp patchkits ...] From garzik@gtf.org Fri Dec 5 11:47:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 11:48:05 -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 hB5JloTa015570 for ; Fri, 5 Dec 2003 11:47:51 -0800 Received: by havoc.gtf.org (Postfix, from userid 500) id 3EACC6641; Fri, 5 Dec 2003 14:47:14 -0500 (EST) Date: Fri, 5 Dec 2003 14:47:13 -0500 From: Jeff Garzik To: netdev@oss.sgi.com Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org Subject: new e100 (was Re: [BK PATCHES] 2.6.x experimental net driver queue) Message-ID: <20031205194713.GA19321@gtf.org> References: <20031205192828.GA15907@gtf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031205192828.GA15907@gtf.org> User-Agent: Mutt/1.3.28i X-archive-position: 1890 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 Oh, since it wasn't very clear, this is largely the work of Scott Feldman at Intel. In addition to have been in public testing for a while, Scott says Intel Q/A beat up e100 v3 for a while, too. Kudos Scott, Jeff From jkenisto@us.ibm.com Fri Dec 5 11:56:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 11:56:30 -0800 (PST) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.104]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB5JuGTa016041 for ; Fri, 5 Dec 2003 11:56:16 -0800 Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150]) by e4.ny.us.ibm.com (8.12.10/8.12.2) with ESMTP id hB5Ju1h3176714; Fri, 5 Dec 2003 14:56:01 -0500 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay02.pok.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id hB5JtxIt170414; Fri, 5 Dec 2003 14:55:59 -0500 Message-ID: <3FD0E1FE.1D5B1883@us.ibm.com> Date: Fri, 05 Dec 2003 11:52:30 -0800 From: Jim Keniston X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: LKML , netdev , Jeff Garzik , Andrew Morton CC: "Feldman, Scott" , Larry Kessler Subject: [PATCH 2.6.0-test11] Net device error logging Content-Type: multipart/mixed; boundary="------------A4FE9473AFB3835D185F2625" X-archive-position: 1891 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jkenisto@us.ibm.com Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --------------A4FE9473AFB3835D185F2625 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit The enclosed patch implements the netdev_* error-logging macros for network drivers. These macros have been discussed at length on the linux-kernel and linux-netdev lists. With the v2.6.0-test6 version of these macros, we addressed all the issues that reviewers had raised. This is just an update for v2.6.0-test11. As previously discussed, these macros are in demand now (e.g., for the e1000 driver) and have essentially no impact on drivers that don't use them. RECAP (from previous posts): Calls to the netdev_* macros (netdev_printk and wrappers such as netdev_err) are intended to replace calls to printk in network device drivers. These macros have the following characteristics: - Same format + args as the corresponding printk call. - Approximately the same amount of text as the corresponding printk call. - The first arg is a pointer to the net_device struct. - The second arg, which is a NETIF_MSG_* message level, can be used to implement verbosity control. - Standard message prefixes: verbose (interface name, driver name, bus ID) during probe, or just the interface name once the device is registered. - The current implementation just calls printk. However, the netdev_* interface (and availability of the net_device pointer) opens the door for logging additional information (via printk, via evlog/netlink, etc.) as desired, with no change to driver code. Examples: netdev_err(netdev, RX_ERR, "No mem: dropped packet\n"); logs a message such as the following if the NETIF_MSG_RX_ERR bit is set in netdev->msg_enable. eth2: No mem: dropped packet netdev_fatal(netdev, PROBE, "The EEPROM Checksum Is Not Valid\n"); or netdev_err(netdev, ALL, "The EEPROM Checksum Is Not Valid\n"); unconditionally logs a message such as: eth%d (e1000 0000:00:03.0): The EEPROM Checksum Is Not Valid The message's prefix includes the driver name and bus ID because the message is logged at probe time, before netdev is registered. SAMPLE DRIVERS As examples of how the netdev_* macros could be used, patches for the v2.6.0-test11 e100, e1000, and tg3 drivers are available on request. LINUX v2.4 SUPPORT Since there is no v2.6-style struct device underlying the net_device, a v2.4.23-compatible version of netdev_printk would always log the interface name as the message prefix: #define netdev_printk(sevlevel, netdev, msglevel, format, arg...) \ do { \ if (NETIF_MSG_##msglevel == NETIF_MSG_ALL \ || (netdev->msg_enable & NETIF_MSG_##msglevel)) { \ printk(sevlevel "%s: " format , netdev->name , ## arg); \ } \ } while (0) Jim Keniston IBM Linux Technology Center --------------A4FE9473AFB3835D185F2625 Content-Type: text/plain; charset=us-ascii; name="netdev-2.6.0-test11.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="netdev-2.6.0-test11.patch" diff -Naur linux.org/include/linux/netdevice.h linux.netdev.patched/include/linux/netdevice.h --- linux.org/include/linux/netdevice.h Fri Dec 5 10:36:55 2003 +++ linux.netdev.patched/include/linux/netdevice.h Fri Dec 5 10:36:56 2003 @@ -467,6 +467,9 @@ struct divert_blk *divert; #endif /* CONFIG_NET_DIVERT */ + /* NETIF_MSG_* flags to control the types of events we log */ + int msg_enable; + /* class/net/name entry */ struct class_device class_dev; struct net_device_stats* (*last_stats)(struct net_device *); @@ -749,6 +752,7 @@ NETIF_MSG_PKTDATA = 0x1000, NETIF_MSG_HW = 0x2000, NETIF_MSG_WOL = 0x4000, + NETIF_MSG_ALL = -1, /* always log message */ }; #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV) @@ -910,6 +914,41 @@ #ifdef CONFIG_SYSCTL extern char *net_sysctl_strdup(const char *s); #endif + +/* debugging and troubleshooting/diagnostic helpers. */ +/** + * netdev_printk() - Log message with interface name, gated by message level + * @sevlevel: severity level -- e.g., KERN_INFO + * @netdev: net_device pointer + * @msglevel: a standard message-level flag with the NETIF_MSG_ prefix removed. + * Unless msglevel is ALL, log the message only if that flag is set in + * netdev->msg_enable. + * @format: as with printk + * @args: as with printk + */ +extern int __netdev_printk(const char *sevlevel, + const struct net_device *netdev, int msglevel, const char *format, ...); +#define netdev_printk(sevlevel, netdev, msglevel, format, arg...) \ + __netdev_printk(sevlevel , netdev , NETIF_MSG_##msglevel , \ + format , ## arg) + +#ifdef DEBUG +#define netdev_dbg(netdev, msglevel, format, arg...) \ + netdev_printk(KERN_DEBUG , netdev , msglevel , format , ## arg) +#else +#define netdev_dbg(netdev, msglevel, format, arg...) do {} while (0) +#endif + +#define netdev_err(netdev, msglevel, format, arg...) \ + netdev_printk(KERN_ERR , netdev , msglevel , format , ## arg) +#define netdev_info(netdev, msglevel, format, arg...) \ + netdev_printk(KERN_INFO , netdev , msglevel , format , ## arg) +#define netdev_warn(netdev, msglevel, format, arg...) \ + netdev_printk(KERN_WARNING , netdev , msglevel , format , ## arg) + +/* report fatal error unconditionally; msglevel ignored for now */ +#define netdev_fatal(netdev, msglevel, format, arg...) \ + netdev_printk(KERN_ERR , netdev , ALL , format , ## arg) #endif /* __KERNEL__ */ diff -Naur linux.org/net/core/dev.c linux.netdev.patched/net/core/dev.c --- linux.org/net/core/dev.c Fri Dec 5 10:36:56 2003 +++ linux.netdev.patched/net/core/dev.c Fri Dec 5 10:36:56 2003 @@ -3049,6 +3049,79 @@ subsys_initcall(net_dev_init); +static spinlock_t netdev_printk_lock = SPIN_LOCK_UNLOCKED; +/** + * __netdev_printk() - Log message with interface name, gated by message level + * @sevlevel: severity level -- e.g., KERN_INFO + * @netdev: net_device pointer + * @msglevel: a standard message-level flag such as NETIF_MSG_PROBE. + * Unless msglevel is NETIF_MSG_ALL, log the message only if + * that flag is set in netdev->msg_enable. + * @format: as with printk + * @args: as with printk + * + * Does the work for the netdev_printk macro. + * For a lot of network drivers, the probe function looks like + * ... + * netdev = alloc_netdev(...); // or alloc_etherdev(...) + * SET_NETDEV_DEV(netdev, dev); + * ... + * register_netdev(netdev); + * ... + * netdev_printk and its wrappers (e.g., netdev_err) can be used as + * soon as you have a valid net_device pointer -- e.g., from alloc_netdev, + * alloc_etherdev, or init_etherdev. (Before that, use dev_printk and + * its wrappers to report device errors.) It's common for an interface to + * have a name like "eth%d" until the device is successfully configured, + * and the call to register_netdev changes it to a "real" name like "eth0". + * + * If the interface's reg_state is NETREG_REGISTERED, we assume that it has + * been successfully set up in sysfs, and we prepend only the interface name + * to the message -- e.g., "eth0: NIC Link is Down". The interface + * name can be used to find eth0's driver, bus ID, etc. in sysfs. + * + * For any other value of reg_state, we prepend the driver name and bus ID + * as well as the (possibly incomplete) interface name -- e.g., + * "eth%d (e100 0000:00:03.0): Failed to map PCI address..." + * + * Probe functions that alloc and register in one step (via init_etherdev), + * or otherwise register the device before the probe completes successfully, + * may need to take other steps to ensure that the failing device is clearly + * identified. + */ +int __netdev_printk(const char *sevlevel, const struct net_device *netdev, + int msglevel, const char *format, ...) +{ + if (!netdev || !format) { + return -EINVAL; + } + if (msglevel == NETIF_MSG_ALL || (netdev->msg_enable & msglevel)) { + static char msg[512]; /* protected by netdev_printk_lock */ + unsigned long flags; + va_list args; + struct device *dev = netdev->class_dev.dev; + + spin_lock_irqsave(&netdev_printk_lock, flags); + va_start(args, format); + vsnprintf(msg, 512, format, args); + va_end(args); + + if (!sevlevel) { + sevlevel = ""; + } + + if (netdev->reg_state == NETREG_REGISTERED || !dev) { + printk("%s%s: %s", sevlevel, netdev->name, msg); + } else { + printk("%s%s (%s %s): %s", sevlevel, netdev->name, + dev->driver->name, dev->bus_id, msg); + } + spin_unlock_irqrestore(&netdev_printk_lock, flags); + } + return 0; +} + +EXPORT_SYMBOL(__netdev_printk); EXPORT_SYMBOL(__dev_get); EXPORT_SYMBOL(__dev_get_by_flags); EXPORT_SYMBOL(__dev_get_by_index); --------------A4FE9473AFB3835D185F2625-- From mashirle@us.ibm.com Fri Dec 5 12:15:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 12:15:24 -0800 (PST) Received: from linux2.suntekindustrial.com (wbar1.sjo1-4-4-004-065.sjo1.dsl-verizon.net [4.4.4.65]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id hB5KF9Ta016629 for ; Fri, 5 Dec 2003 12:15:09 -0800 Received: from ibm-mxl (bi01p1.co.us.ibm.com [32.97.110.142]) (authenticated bits=0) by linux2.suntekindustrial.com (8.12.8/8.12.8) with ESMTP id hB5LQKbO022422; Fri, 5 Dec 2003 13:26:26 -0800 From: Shirley Ma Organization: IBM Linux To: kuznet@ms2.inr.ac.ru Subject: [PATCH]snmp6 64-bit counter support in proc.c Date: Fri, 5 Dec 2003 12:14:47 -0800 User-Agent: KMail/1.4.3 Cc: netdev@oss.sgi.com, xma@us.ibm.com References: <200312021240.PAA01536@yakov.inr.ac.ru> In-Reply-To: <200312021240.PAA01536@yakov.inr.ac.ru> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_NWUFQ050M8TIMNC8CGFE" Message-Id: <200312051214.48076.mashirle@us.ibm.com> X-archive-position: 1892 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mashirle@us.ibm.com Precedence: bulk X-list: netdev --------------Boundary-00=_NWUFQ050M8TIMNC8CGFE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I add this because there are some 64-bit counters in the new IPv6 MIBs.=20 This patch has been tested agaist linux-2.6.0-test9, and cleanly applied = to=20 linux-2.6.0-test11. Thanks Shirley Ma IBM Linux Technology Center --------------Boundary-00=_NWUFQ050M8TIMNC8CGFE Content-Type: text/x-diff; charset="iso-8859-1"; name="linux-2.6.0-test11-ipv6mib2-64.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux-2.6.0-test11-ipv6mib2-64.patch" diff -urN linux-2.6.0-test11/net/ipv6/proc.c linux-2.6.0-test11-ipv6mib2-64/net/ipv6/proc.c --- linux-2.6.0-test11/net/ipv6/proc.c 2003-11-26 12:43:38.000000000 -0800 +++ linux-2.6.0-test11-ipv6mib2-64/net/ipv6/proc.c 2003-12-05 12:04:19.000000000 -0800 @@ -60,13 +60,14 @@ struct snmp6_item { char *name; + int size; int offset; }; -#define SNMP6_SENTINEL { .name = NULL, .offset = 0 } +#define SNMP6_SENTINEL { .name = NULL, .size = 0, .offset = 0 } static struct snmp6_item snmp6_ipv6_list[] = { /* ipv6 mib according to RFC 2465 */ -#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct ipv6_mib, x) } +#define SNMP6_GEN(x) { .name = #x , .size = sizeof(((struct ipv6_mib *)0)->x), .offset = offsetof(struct ipv6_mib, x) } SNMP6_GEN(Ip6InReceives), SNMP6_GEN(Ip6InHdrErrors), SNMP6_GEN(Ip6InTooBigErrors), @@ -104,7 +105,7 @@ OutRouterAdvertisements too. OutGroupMembQueries too. */ -#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct icmpv6_mib, x) } +#define SNMP6_GEN(x) { .name = #x , .size = sizeof(((struct icmpv6_mib *)0)->x), .offset = offsetof(struct icmpv6_mib, x) } SNMP6_GEN(Icmp6InMsgs), SNMP6_GEN(Icmp6InErrors), SNMP6_GEN(Icmp6InDestUnreachs), @@ -138,7 +139,7 @@ }; static struct snmp6_item snmp6_udp6_list[] = { -#define SNMP6_GEN(x) { .name = "Udp6" #x , .offset = offsetof(struct udp_mib, Udp##x) } +#define SNMP6_GEN(x) { .name = "Udp6" #x , .size = sizeof(((struct udp_mib *)0)->Udp##x), .offset = offsetof(struct udp_mib, Udp##x) } SNMP6_GEN(InDatagrams), SNMP6_GEN(NoPorts), SNMP6_GEN(InErrors), @@ -147,22 +148,27 @@ SNMP6_SENTINEL }; -static unsigned long -fold_field(void *mib[], int offt) +static unsigned long long +fold_field(void *mib[], int size, int offt) { - unsigned long res = 0; + unsigned long long res = 0; int i; for (i = 0; i < NR_CPUS; i++) { if (!cpu_possible(i)) continue; - res += - *((unsigned long *) (((void *)per_cpu_ptr(mib[0], i)) + - offt)); - res += - *((unsigned long *) (((void *)per_cpu_ptr(mib[1], i)) + - offt)); - } + if (size == 4) { + res += *((unsigned long *) + (((void *)per_cpu_ptr(mib[0], i)) + offt)); + res += *((unsigned long *) + (((void *)per_cpu_ptr(mib[1], i)) + offt)); + } else if (size == 8) { + res += *((unsigned long long *) + (((void *)per_cpu_ptr(mib[0], i)) + offt)); + res += *((unsigned long long *) + (((void *)per_cpu_ptr(mib[1], i)) + offt)); + } + } return res; } @@ -170,9 +176,9 @@ snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp6_item *itemlist) { int i; - for (i=0; itemlist[i].name; i++) - seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, - fold_field(mib, itemlist[i].offset)); + for (i=0; itemlist[i].name; i++) + seq_printf(seq, "%-32s\t%llu\n", itemlist[i].name, + fold_field(mib, itemlist[i].size, itemlist[i].offset)); } static int snmp6_seq_show(struct seq_file *seq, void *v) --------------Boundary-00=_NWUFQ050M8TIMNC8CGFE-- From davem@pizda.ninka.net Fri Dec 5 12:33:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Dec 2003 12:33:44 -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 hB5KXNTa019910 for ; Fri, 5 Dec 2003 12:33:23 -0800 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA06420; Fri, 5 Dec 2003 12:31:33 -0800 Date: Fri, 5 Dec 2003 12:31:33 -0800 From: "David S. Miller" To: Shirley Ma Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, xma@us.ibm.com Subject: Re: [PATCH]snmp6 64-bit counter support in proc.c Message-Id: <20031205123133.3743fe39.davem@redhat.com> In-Reply-To: <200312051214.48076.mashirle@us.ibm.com> References: <200312021240.PAA01536@yakov.inr.ac.ru> <200312051214.48076.mashirle@us.ibm.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: 1893 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 Fri, 5 Dec 2003 12:14:47 -0800 Shirley Ma wrote: > I add this because there are some 64-bit counters in the new IPv6 MIBs. > This patch has been tested agaist linux-2.6.0-test9, and cleanly applied to > linux-2.6.0-test11. "sizeof(unsigned long)" evaluates to 8 on 64-bit systems, yet you assume it always evaluated to 4 as on 32-bit systems. Maybe it would be wiser to explicitl