From romieu@fr.zoreil.com Mon Sep 1 00:18:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 00:19:03 -0700 (PDT) Received: from fr.zoreil.com (electric-eye.fr.zoreil.com [213.41.134.224]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h817ILWZ011163 for ; Mon, 1 Sep 2003 00:18:22 -0700 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 h817DMxA004060; Mon, 1 Sep 2003 09:13:22 +0200 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id h817DLBr004059; Mon, 1 Sep 2003 09:13:21 +0200 Date: Mon, 1 Sep 2003 09:13:21 +0200 From: Francois Romieu To: Maillist netdev Cc: Jeff Garzik Subject: Re: So you thought sis190 was evil... Message-ID: <20030901091321.A4000@electric-eye.fr.zoreil.com> References: <3F529E71.20402@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <3F529E71.20402@pobox.com>; from jgarzik@pobox.com on Sun, Aug 31, 2003 at 09:18:41PM -0400 X-archive-position: 5452 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 Jeff Garzik : > It looks like the objectionable sis190 code was copied almost wholesale > from r8169... virt_to_bus, static descriptors, lack of cpu_to_leXX, > and all. Are you asking for a copy from sis190 to r8169 ? -- Ueimor From vnuorval@tcs.hut.fi Mon Sep 1 01:18:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:19:14 -0700 (PDT) Received: from smtp-2.hut.fi (root@smtp-2.hut.fi [130.233.228.92]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818IcWZ028152 for ; Mon, 1 Sep 2003 01:18:39 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-2.hut.fi (8.12.9/8.12.9) with ESMTP id h818IV5t020009; Mon, 1 Sep 2003 11:18:32 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 194358001BF; Mon, 1 Sep 2003 11:18:31 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h818IU9s028101; Mon, 1 Sep 2003 11:18:31 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h818IUxD028097; Mon, 1 Sep 2003 11:18:30 +0300 Date: Mon, 1 Sep 2003 11:18:30 +0300 (EEST) From: Ville Nuorvala To: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= Cc: davem@redhat.com, , Subject: Re: [PATCH] IPv6: (5/5) Allow IPv6 tunnels without own IPv6 address In-Reply-To: <20030901.112409.61391981.yoshfuji@linux-ipv6.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-15 X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-2.hut.fi) X-DCC-HUTCC-Metrics: smtp-2.hut.fi 1165; Body=5 Fuz1=5 Fuz2=5 X-archive-position: 5453 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 On Mon, 1 Sep 2003, YOSHIFUJI Hideaki / [iso-2022-jp] $B5HF#1QL@(B wrote: > In article (at Mon, 1 Sep 2003 03:11:58 +0300 (EEST)), Ville Nuorvala says: > > > unless (link-local) protocols like DHCPv6 or MLD are run over the virtual > > link formed by IPv6 tunnels, the net_devices representing the tunnels > > don't necessarily need to have an IPv6 address configured specifically to > > them. > > Wrong. All interfaces have a link-local address. (RFC2462) Unfortunately the IPv6 tunneling spec (RFC2473) is broken on this point :( I should probably raise this issue on the IETF ipv6 WG mailing list. The first problem is, that the way to generate the interface-identifier isn't currently specified in the tunnel spec. The IPv6 over PPP spec (RFC2472) section 4.1 has some ideas: 1) if available, reuse any IEEE EUI-48 or EUI-64 identifiers on the node 2) use link-layer addresses, machine serial numbers, et cetera 3) if none of these can be found, use random bits The second problem is, that this method alone doesn't yet guarantee unique identifiers to the two tunnel endpoints. In RFC2472 the IPv6 Control Protocol negotiates the identifiers between the two peers beforehand, but unfortunately we don't have a similar protocol in RFC2473. Like the other tunnels (ipip, ip_gre, sit) ip6_tunnel is fundamentally a IFF_NOARP device so you can't even use DAD to detect a duplicate address on the virtual link. (Besides, the link doesn't even exist before both devices have been brought up on the two separate nodes.) This is something for the ipv6 WG to think about, I guess. In the mean time, do we accept the in theory 1/2^64 (in practice of course bigger) chance of duplicate addresses occurring on the link? If yes, then I could (probably still later today) send a patch where the interface-identifiers for the IPv6 tunnels are generated like in the IPv6 over PPP case above. Regards, Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From davem@pizda.ninka.net Mon Sep 1 01:18:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:19:32 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818IxWZ028182 for ; Mon, 1 Sep 2003 01:18:59 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA07751; Mon, 1 Sep 2003 01:09:45 -0700 Date: Mon, 1 Sep 2003 01:09:45 -0700 From: "David S. Miller" To: Christoph Hellwig Cc: netdev@oss.sgi.com Subject: Re: [PATCH] convert icmpv6_socket to per-cpu data Message-Id: <20030901010945.42f4c01e.davem@redhat.com> In-Reply-To: <20030831100521.GB18663@lst.de> References: <20030831100521.GB18663@lst.de> X-Mailer: Sylpheed version 0.9.2 (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: 5454 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, 31 Aug 2003 12:05:21 +0200 Christoph Hellwig wrote: > per-cpu data works in modules for a while now. Also bring over a > comment from the IPv4 version and consolidate the error handling. Applied, thanks Christoph. From davem@pizda.ninka.net Mon Sep 1 01:39:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:40:04 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818dQWZ000557 for ; Mon, 1 Sep 2003 01:39:27 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA07847; Mon, 1 Sep 2003 01:30:20 -0700 Date: Mon, 1 Sep 2003 01:30:20 -0700 From: "David S. Miller" To: "David S. Miller" Cc: dwmw2@redhat.com, netdev@oss.sgi.com Subject: Re: Missing routes cause BUG() in icmpv6_xmit_lock(). Message-Id: <20030901013020.189fe564.davem@redhat.com> In-Reply-To: <20030831224454.349a6a53.davem@redhat.com> References: <1062341789.2785.11.camel@imladris.demon.co.uk> <20030831224454.349a6a53.davem@redhat.com> X-Mailer: Sylpheed version 0.9.2 (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: 5455 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, 31 Aug 2003 22:44:54 -0700 "David S. Miller" wrote: > I'll see what I can do about this one. Ok, here is the fix I'm going to use. I actually inadvertantly added this problem when I converted net/ipv6/icmp.c over to per-cpu sockets. There is nothing we could do with such ICMP destination unreachable packets anyways, so dropping them is the right thing to do. # 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.1614 -> 1.1615 # net/ipv6/icmp.c 1.26 -> 1.27 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1615 # [IPV6]: Do not BUG() on icmp6 socket contention, just drop. # -------------------------------------------- # diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c --- a/net/ipv6/icmp.c Mon Sep 1 01:36:39 2003 +++ b/net/ipv6/icmp.c Mon Sep 1 01:36:39 2003 @@ -95,8 +95,15 @@ static void icmpv6_xmit_lock(void) { local_bh_disable(); - if (unlikely(!spin_trylock(&icmpv6_socket->sk->lock.slock))) - BUG(); + if (unlikely(!spin_trylock(&icmpv6_socket->sk->lock.slock))) { + /* This can happen if the output path (f.e. SIT or + * ip6ip6 tunnel) signals dst_link_failure() for an + * outgoing ICMP6 packet. + */ + local_bh_enable(); + return 1; + } + return 0; } static void icmpv6_xmit_unlock(void) @@ -340,7 +347,8 @@ fl.fl_icmp_type = type; fl.fl_icmp_code = code; - icmpv6_xmit_lock(); + if (icmpv6_xmit_lock()) + return; if (!icmpv6_xrlim_allow(sk, type, &fl)) goto out; @@ -423,7 +431,8 @@ fl.oif = skb->dev->ifindex; fl.fl_icmp_type = ICMPV6_ECHO_REPLY; - icmpv6_xmit_lock(); + if (icmpv6_xmit_lock()) + return; if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) fl.oif = np->mcast_oif; From davem@pizda.ninka.net Mon Sep 1 01:51:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:51:44 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818p9WZ005785 for ; Mon, 1 Sep 2003 01:51:10 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA07940; Mon, 1 Sep 2003 01:41:01 -0700 Date: Mon, 1 Sep 2003 01:41:01 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (1/5) Fix bugs in ip6_tunnel.c ICMP error handler Message-Id: <20030901014101.15ff54a6.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5456 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 Sep 2003 02:34:55 +0300 (EEST) Ville Nuorvala wrote: > this patch fixes two byte order bugs in ip6ip6_err(). Please apply! Applied, thanks Ville. From davem@pizda.ninka.net Mon Sep 1 01:55:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:56:25 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818toWZ008456 for ; Mon, 1 Sep 2003 01:55:51 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA07971; Mon, 1 Sep 2003 01:45:44 -0700 Date: Mon, 1 Sep 2003 01:45:44 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (2/5) Use free_netdev() as destructor in ip6_tunnel.c Message-Id: <20030901014544.3acd384d.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5457 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 Sep 2003 02:46:45 +0300 (EEST) Ville Nuorvala wrote: > Oops, > forgot to attach the patch in the original mail... > > Sorry about that, That's ok :-) Applied, thanks Ville. From davem@pizda.ninka.net Mon Sep 1 01:57:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:58:04 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818vTWZ009352 for ; Mon, 1 Sep 2003 01:57:29 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA07998; Mon, 1 Sep 2003 01:47:23 -0700 Date: Mon, 1 Sep 2003 01:47:22 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (3/5) Set dev->dev_addr and dev->broadcast in ip6_tnls Message-Id: <20030901014722.4f2d27bd.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5458 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 Sep 2003 02:48:55 +0300 (EEST) Ville Nuorvala wrote: > I just only recently noticed MAX_ADDR_LEN had beed increased to 32. This > means the IPv6 addresses can now be copied into the dev->dev_addr and > dev->broadcast fields, just like the IPv4 addresses are for the other > tunnel drivers. Please apply! Applied, thanks Ville. From davem@pizda.ninka.net Mon Sep 1 01:58:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 01:59:03 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h818wqWZ010069 for ; Mon, 1 Sep 2003 01:58:52 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA08025; Mon, 1 Sep 2003 01:48:46 -0700 Date: Mon, 1 Sep 2003 01:48:45 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (4/5) Remove sockets from ip6_tunnel.c Message-Id: <20030901014845.660a9471.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5459 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 Sep 2003 02:57:03 +0300 (EEST) Ville Nuorvala wrote: > this patch removes all sockets from ip6_tunnel.c. It also allows nested > IPv6 encapsulations through different devices in the IPv6 tunnel > entry-point node, since the old restrictions caused by the sockets don't > apply any more. Please apply the patch! Thank you very much for finishing this work. Applied, thanks. From davem@pizda.ninka.net Mon Sep 1 02:01:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 02:01:48 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8191AWZ011379 for ; Mon, 1 Sep 2003 02:01:10 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA08042; Mon, 1 Sep 2003 01:52:01 -0700 Date: Mon, 1 Sep 2003 01:52:01 -0700 From: "David S. Miller" To: "YOSHIFUJI Hideaki / _$B5HF#1QL@" Cc: vnuorval@tcs.hut.fi, usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (5/5) Allow IPv6 tunnels without own IPv6 address Message-Id: <20030901015201.4d673fd7.davem@redhat.com> In-Reply-To: <20030901.112409.61391981.yoshfuji@linux-ipv6.org> References: <20030901.112409.61391981.yoshfuji@linux-ipv6.org> X-Mailer: Sylpheed version 0.9.2 (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: 5460 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, 01 Sep 2003 11:24:09 +0900 (JST) YOSHIFUJI Hideaki / _$B5HF#1QL@ wrote: > In article (at Mon, 1 Sep 2003 03:11:58 +0300 (EEST)), Ville Nuorvala says: > > > unless (link-local) protocols like DHCPv6 or MLD are run over the virtual > > link formed by IPv6 tunnels, the net_devices representing the tunnels > > don't necessarily need to have an IPv6 address configured specifically to > > them. > > Wrong. All interfaces have a link-local address. (RFC2462) Are you sure there isn't an exception in the ip6ip6 tunnel RFC? From davem@pizda.ninka.net Mon Sep 1 02:13:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 02:14:25 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h819DoWZ018517 for ; Mon, 1 Sep 2003 02:13:51 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA08086; Mon, 1 Sep 2003 02:03:40 -0700 Date: Mon, 1 Sep 2003 02:03:40 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: yoshfuji@linux-ipv6.org, usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (5/5) Allow IPv6 tunnels without own IPv6 address Message-Id: <20030901020340.5a128836.davem@redhat.com> In-Reply-To: References: <20030901.112409.61391981.yoshfuji@linux-ipv6.org> X-Mailer: Sylpheed version 0.9.2 (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: 5461 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 Sep 2003 11:18:30 +0300 (EEST) Ville Nuorvala wrote: > Unfortunately the IPv6 tunneling spec (RFC2473) is broken on this point :( > I should probably raise this issue on the IETF ipv6 WG mailing list. ... > The first problem is, that the way to generate the interface-identifier > isn't currently specified in the tunnel spec. ... > The second problem is, that this method alone doesn't yet guarantee > unique identifiers to the two tunnel endpoints. This is exactly what I was thinking. I really don't think link- local addresses make any sense on a software device such as the ipip6 tunnels. From hch@lst.de Mon Sep 1 02:21:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 02:22:00 -0700 (PDT) Received: from mail.lst.de ([212.34.189.10]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h819LMWZ024275 for ; Mon, 1 Sep 2003 02:21:23 -0700 Received: from verein.lst.de (localhost [127.0.0.1]) by mail.lst.de (8.12.3/8.12.3/Debian-6.4) with ESMTP id h819L0Z4031148 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 1 Sep 2003 11:21:00 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.3) id h819L0xH031146 for netdev@oss.sgi.com; Mon, 1 Sep 2003 11:21:00 +0200 Date: Mon, 1 Sep 2003 11:21:00 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] CONFIG_IA64_SGI_SN1 is gone Message-ID: <20030901092100.GA31136@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Score: -1.8 () PATCH_UNIFIED_DIFF,UPPERCASE_25_50,USER_AGENT_MUTT X-Scanned-By: MIMEDefang 2.33 (www . roaringpenguin . com / mimedefang) X-archive-position: 5462 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hch@lst.de Precedence: bulk X-list: netdev and the IOC3 driver would only work with SN0/Mips anyway. --- 1.40/drivers/net/Kconfig Mon Aug 18 23:59:59 2003 +++ edited/drivers/net/Kconfig Mon Sep 1 10:05:48 2003 @@ -502,7 +502,7 @@ config SGI_IOC3_ETH bool "SGI IOC3 Ethernet" - depends on NET_ETHERNET && (IA64_SGI_SN1 || SGI_IP27) + depends on NET_ETHERNET && SGI_IP27 help If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from From davem@pizda.ninka.net Mon Sep 1 02:44:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 02:45:22 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h819ilWZ004435 for ; Mon, 1 Sep 2003 02:44:49 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA08225; Mon, 1 Sep 2003 02:35:38 -0700 Date: Mon, 1 Sep 2003 02:35:38 -0700 From: "David S. Miller" To: Christoph Hellwig Cc: netdev@oss.sgi.com Subject: Re: [PATCH] CONFIG_IA64_SGI_SN1 is gone Message-Id: <20030901023538.1512536a.davem@redhat.com> In-Reply-To: <20030901092100.GA31136@lst.de> References: <20030901092100.GA31136@lst.de> X-Mailer: Sylpheed version 0.9.2 (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: 5463 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 Sep 2003 11:21:00 +0200 Christoph Hellwig wrote: > and the IOC3 driver would only work with SN0/Mips anyway. Applied, thanks Christoph. From dwmw2@redhat.com Mon Sep 1 02:58:33 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 02:59:06 -0700 (PDT) Received: from executor.cambridge.redhat.com (pub237.cambridge.redhat.com [213.86.99.237] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h819wVWZ010891 for ; Mon, 1 Sep 2003 02:58:32 -0700 Received: from hades.cambridge.redhat.com (hades.cambridge.redhat.com [172.16.18.64]) by executor.cambridge.redhat.com (Postfix) with ESMTP id 860FF63D63; Mon, 1 Sep 2003 10:58:25 +0100 (BST) Received: from hades.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by hades.cambridge.redhat.com (8.12.9/8.11.0) with ESMTP id h819wN54009915; Mon, 1 Sep 2003 10:58:23 +0100 Received: (from dwmw2@localhost) by hades.cambridge.redhat.com (8.12.9/8.12.9/Submit) id h819wMn5009913; Mon, 1 Sep 2003 10:58:22 +0100 X-Authentication-Warning: hades.cambridge.redhat.com: dwmw2 set sender to dwmw2@redhat.com using -f Subject: Re: Missing routes cause BUG() in icmpv6_xmit_lock(). From: David Woodhouse To: "David S. Miller" Cc: netdev@oss.sgi.com In-Reply-To: <20030901013020.189fe564.davem@redhat.com> References: <1062341789.2785.11.camel@imladris.demon.co.uk> <20030831224454.349a6a53.davem@redhat.com> <20030901013020.189fe564.davem@redhat.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Red Hat UK Ltd. Message-Id: <1062410301.9518.19.camel@hades.cambridge.redhat.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 (1.4.4-4.dwmw2.1) Date: Mon, 01 Sep 2003 10:58:22 +0100 X-archive-position: 5464 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: dwmw2@redhat.com Precedence: bulk X-list: netdev On Mon, 2003-09-01 at 01:30 -0700, David S. Miller wrote: > On Sun, 31 Aug 2003 22:44:54 -0700 > "David S. Miller" wrote: > > > I'll see what I can do about this one. > > Ok, here is the fix I'm going to use. I actually inadvertantly > added this problem when I converted net/ipv6/icmp.c over to > per-cpu sockets. In the meantime, since there's nothing to prevent anyone from faking ICMP6 echo packets from an 'internal' machine and sending them to a victim over the IPv4 encap, it might be prudent for everyone doing 6to4 to add an unreachable route to their 2002:XXXX:YYYY::/48 subnet, which seems to avoid the problem. -- dwmw2 From pekkas@netcore.fi Mon Sep 1 03:51:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 03:51:45 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81Ap9WZ031832 for ; Mon, 1 Sep 2003 03:51:10 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h81Amjl19249; Mon, 1 Sep 2003 13:48:45 +0300 Date: Mon, 1 Sep 2003 13:48:44 +0300 (EEST) From: Pekka Savola To: "David S. Miller" cc: Ville Nuorvala , , , Subject: Re: [PATCH] IPv6: (5/5) Allow IPv6 tunnels without own IPv6 address In-Reply-To: <20030901020340.5a128836.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5465 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pekkas@netcore.fi Precedence: bulk X-list: netdev On Mon, 1 Sep 2003, David S. Miller wrote: > On Mon, 1 Sep 2003 11:18:30 +0300 (EEST) > Ville Nuorvala wrote: > > > Unfortunately the IPv6 tunneling spec (RFC2473) is broken on this point :( > > I should probably raise this issue on the IETF ipv6 WG mailing list. > ... > > The first problem is, that the way to generate the interface-identifier > > isn't currently specified in the tunnel spec. > ... > > The second problem is, that this method alone doesn't yet guarantee > > unique identifiers to the two tunnel endpoints. > > This is exactly what I was thinking. I really don't think link- > local addresses make any sense on a software device such as the > ipip6 tunnels. Well, link-local addresses are used e.g. by routing protocols and such, so having one is probably rather important.. FWIW, on FreeBSD platform they take the link-local address of the first physical interface, and give the exact same link-local address on all of the tunnels, disambiuating them with the scope identifier. Seems like an OK appaorach too, and guarantees (to the degree of unique MAC addresses) that the addresses of the endpoints do not clash. -- Pekka Savola "You each name yourselves king, yet the Netcore Oy kingdom bleeds." Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings From davem@pizda.ninka.net Mon Sep 1 04:00:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 04:01:17 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81B0hWZ004428 for ; Mon, 1 Sep 2003 04:00:44 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id DAA08489; Mon, 1 Sep 2003 03:51:34 -0700 Date: Mon, 1 Sep 2003 03:51:34 -0700 From: "David S. Miller" To: Pekka Savola Cc: vnuorval@tcs.hut.fi, yoshfuji@linux-ipv6.org, usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (5/5) Allow IPv6 tunnels without own IPv6 address Message-Id: <20030901035134.2585aa79.davem@redhat.com> In-Reply-To: References: <20030901020340.5a128836.davem@redhat.com> X-Mailer: Sylpheed version 0.9.2 (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: 5466 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 Sep 2003 13:48:44 +0300 (EEST) Pekka Savola wrote: > Well, link-local addresses are used e.g. by routing protocols and such, so > having one is probably rather important.. Ok. > FWIW, on FreeBSD platform they take the link-local address of the first > physical interface, and give the exact same link-local address on all of > the tunnels, disambiuating them with the scope identifier. Seems like an > OK appaorach too, and guarantees (to the degree of unique MAC addresses) > that the addresses of the endpoints do not clash. Interesting approach... I'm not particularly picky about how this uniqueness issue is solved. From jgarzik@pobox.com Mon Sep 1 06:10:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 06:10:44 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81DA6WZ009171 for ; Mon, 1 Sep 2003 06:10:09 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:33493 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19tSCn-0000Gm-Cl; Sun, 31 Aug 2003 14:25:21 +0100 Message-ID: <3F51F738.5040607@pobox.com> Date: Sun, 31 Aug 2003 09:25:12 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Yusuf Wilajati Purna CC: netdev@oss.sgi.com Subject: Re: [PATCH] fix skb binding time in some network drivers due to skb_padto conversion References: <3F515DD0.9000409@jcom.home.ne.jp> In-Reply-To: <3F515DD0.9000409@jcom.home.ne.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5467 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 Yusuf Wilajati Purna wrote: > Hi Jeff, > > It seems that skb_padto security fixes in 2.4 and 2.5 trying > to fix "CAN-2003-0001:Multiple ethernet NID device drivers > do not pad frames with null bytes", do not put the skb_padto > blocks in proper places in the 3c527, eth16i, fmv18x, seeq8005, > yellowfin device drivers. > > In case a driver calls skb_padto(), it is possible > that the space available in the original skb buffer tailroom is less > than the space to pad. In this case, in short, the skb_padto() > will create a new skb buffer, copy data from the original > skb buffer to a new skb buffer, free the original buffer, > and finally return the new buffer. > > If this happens to the aforementioned device drivers, they come to > point to wrong data. And, for 3c527 and yellowfin, the drivers can > unexpectedly double free the original skb buffers since they still > point to the original skb buffers. The attached patch against > 2.4.23pre1 fixes these issues. > > If the patch looks okay, please consider including it in > 2.4 and 2.5/6. Yes, this looks needed. Thanks! Jeff From vinay-rc@naturesoft.net Mon Sep 1 06:59:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 07:00:22 -0700 (PDT) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81DxkWZ021399 for ; Mon, 1 Sep 2003 06:59:47 -0700 Received: from trial.naturesoft.com ([192.168.0.15] helo=lima.royalchallenge.com) by naturesoft.net with esmtp (Exim 3.35 #1) id 19tp6i-00031b-00; Mon, 01 Sep 2003 19:22:36 +0530 Subject: Re: [PATCH 2.4.22-pre1][NET] timer cleanups From: Vinay K Nallamothu To: "David S. Miller" Cc: netdev@oss.sgi.com, LKML In-Reply-To: <20030830203311.0b8c0807.davem@redhat.com> References: <1062258097.8532.26.camel@lima.royalchallenge.com> <20030830203311.0b8c0807.davem@redhat.com> Content-Type: text/plain Organization: NatureSoft Private Limited Message-Id: <1062424850.4414.40.camel@lima.royalchallenge.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Mon, 01 Sep 2003 19:30:51 +0530 Content-Transfer-Encoding: 7bit X-archive-position: 5469 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: vinay-rc@naturesoft.net Precedence: bulk X-list: netdev Content-Length: 4015 Lines: 135 Hi Dave, On Sun, 2003-08-31 at 09:03, David S. Miller wrote: > On Sat, 30 Aug 2003 21:11:37 +0530 > Vinay K Nallamothu wrote: > > > This patch does the following timer code cleanup: > > > > 1. Change del_timer/add_timer to mod_timer > > 2. Use static timer initialisation wherever applicable > > I'm not accepting this. In particular, the ip6_flowlabel.c > change is a bad idea because the code remains racey. > Someone > submitted a similar move to mod_timer() for ip6_flowlabel That too was submitted by me. Unfortunately I never got to see your mail. No excuses though. > > Just blindly doing these kinds of conversions to mod_timer() > is foolhardy. You need to apply some brains to it to make > sure you really are getting rid of whatever potential races > exist in the code. You are correct. While I tried to make sure that new bugs are not introduced, I haven't paid attention to the existing ones. > And in the ip6_flowlabel.c case things are > as buggy as they were before. Please find the updated patch below and let me know if it's ok. Thanks Vinay ip6_flowlabel.c: 1. Use static timer initializer 2. Use timer macros to handle jiffie wrap in comparisions 3. Convert del_timer/add_timer to mod_timer ip6_flowlabel.c | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff -urN linux-2.4.22/net/ipv6/ip6_flowlabel.c linux-2.4.22-nvk/net/ipv6/ip6_flowlabel.c --- linux-2.4.22/net/ipv6/ip6_flowlabel.c 2003-06-14 10:03:12.000000000 +0530 +++ linux-2.4.22-nvk/net/ipv6/ip6_flowlabel.c 2003-09-01 16:47:03.000000000 +0530 @@ -48,7 +48,8 @@ static atomic_t fl_size = ATOMIC_INIT(0); static struct ip6_flowlabel *fl_ht[FL_HASH_MASK+1]; -static struct timer_list ip6_fl_gc_timer; +static void ip6_fl_gc(unsigned long dummy); +static struct timer_list ip6_fl_gc_timer = TIMER_INITIALIZER(ip6_fl_gc, 0, 0); /* FL hash table lock: it protects only of GC */ @@ -92,10 +93,12 @@ static void fl_release(struct ip6_flowlabel *fl) { + write_lock_bh(&ip6_fl_lock); + fl->lastuse = jiffies; if (atomic_dec_and_test(&fl->users)) { unsigned long ttd = fl->lastuse + fl->linger; - if ((long)(ttd - fl->expires) > 0) + if (time_after(ttd, fl->expires)) fl->expires = ttd; ttd = fl->expires; if (fl->opt && fl->share == IPV6_FL_S_EXCL) { @@ -103,11 +106,12 @@ fl->opt = NULL; kfree(opt); } - if (!del_timer(&ip6_fl_gc_timer) || - (long)(ip6_fl_gc_timer.expires - ttd) > 0) - ip6_fl_gc_timer.expires = ttd; - add_timer(&ip6_fl_gc_timer); + if (!timer_pending(&ip6_fl_gc_timer) || + time_after(ip6_fl_gc_timer.expires, ttd)) + mod_timer(&ip6_fl_gc_timer, ttd); } + + write_unlock_bh(&ip6_fl_lock); } static void ip6_fl_gc(unsigned long dummy) @@ -124,16 +128,16 @@ while ((fl=*flp) != NULL) { if (atomic_read(&fl->users) == 0) { unsigned long ttd = fl->lastuse + fl->linger; - if ((long)(ttd - fl->expires) > 0) + if (time_after(ttd, fl->expires)) fl->expires = ttd; ttd = fl->expires; - if ((long)(now - ttd) >= 0) { + if (time_after_eq(now, ttd)) { *flp = fl->next; fl_free(fl); atomic_dec(&fl_size); continue; } - if (!sched || (long)(ttd - sched) < 0) + if (!sched || time_before(ttd, sched)) sched = ttd; } flp = &fl->next; @@ -262,11 +266,11 @@ if (!expires) return -EPERM; fl->lastuse = jiffies; - if (fl->linger < linger) + if (time_before(fl->linger, linger)) fl->linger = linger; - if (expires < fl->linger) + if (time_before(expires, fl->linger)) expires = fl->linger; - if ((long)(fl->expires - (fl->lastuse+expires)) < 0) + if (time_before(fl->expires, fl->lastuse + expires)) fl->expires = fl->lastuse + expires; return 0; } @@ -609,8 +613,6 @@ void ip6_flowlabel_init() { - init_timer(&ip6_fl_gc_timer); - ip6_fl_gc_timer.function = ip6_fl_gc; #ifdef CONFIG_PROC_FS create_proc_read_entry("net/ip6_flowlabel", 0, 0, ip6_fl_read_proc, NULL); #endif From davem@pizda.ninka.net Mon Sep 1 07:20:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 07:21:13 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81EKdWZ027901 for ; Mon, 1 Sep 2003 07:20:39 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id HAA09130; Mon, 1 Sep 2003 07:11:26 -0700 Date: Mon, 1 Sep 2003 07:11:26 -0700 From: "David S. Miller" To: Vinay K Nallamothu Cc: netdev@oss.sgi.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2.4.22-pre1][NET] timer cleanups Message-Id: <20030901071126.60b0dc78.davem@redhat.com> In-Reply-To: <1062424850.4414.40.camel@lima.royalchallenge.com> References: <1062258097.8532.26.camel@lima.royalchallenge.com> <20030830203311.0b8c0807.davem@redhat.com> <1062424850.4414.40.camel@lima.royalchallenge.com> X-Mailer: Sylpheed version 0.9.2 (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: 5470 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 Content-Length: 268 Lines: 9 On Mon, 01 Sep 2003 19:30:51 +0530 Vinay K Nallamothu wrote: > > And in the ip6_flowlabel.c case things are > > as buggy as they were before. > > Please find the updated patch below and let me know if it's ok. Looks great, patch applied. From vnuorval@tcs.hut.fi Mon Sep 1 07:24:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 07:25:26 -0700 (PDT) Received: from smtp-4.hut.fi (root@smtp-4.hut.fi [130.233.228.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81EOqWZ028430 for ; Mon, 1 Sep 2003 07:24:53 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-4.hut.fi (8.12.9/8.12.9) with ESMTP id h81EOhgL031249; Mon, 1 Sep 2003 17:24:44 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id C7B80800188; Mon, 1 Sep 2003 17:24:43 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h81EOh9s029286; Mon, 1 Sep 2003 17:24:43 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h81EOgSn029282; Mon, 1 Sep 2003 17:24:42 +0300 Date: Mon, 1 Sep 2003 17:24:42 +0300 (EEST) From: Ville Nuorvala To: "David S. Miller" Cc: Pekka Savola , , , Subject: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: <20030901035134.2585aa79.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-377318441-1773213307-1062426282=:29198" X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-4.hut.fi) X-DCC-HUTCC-Metrics: smtp-4.hut.fi 1165; Body=6 Fuz1=6 Fuz2=6 X-archive-position: 5471 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 Content-Length: 4825 Lines: 96 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. ---377318441-1773213307-1062426282=:29198 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 1 Sep 2003, David S. Miller wrote: > On Mon, 1 Sep 2003 13:48:44 +0300 (EEST) > Pekka Savola wrote: > > > Well, link-local addresses are used e.g. by routing protocols and such, so > > having one is probably rather important.. > > Ok. > > > FWIW, on FreeBSD platform they take the link-local address of the first > > physical interface, and give the exact same link-local address on all of > > the tunnels, disambiuating them with the scope identifier. Seems like an > > OK appaorach too, and guarantees (to the degree of unique MAC addresses) > > that the addresses of the endpoints do not clash. > > Interesting approach... I'm not particularly picky about how this > uniqueness issue is solved. Ok, this incremental patch to my previous addrconf.c patch generates a link-local address to the IPv6 tunnel device. It first tries to inherit the EUI64 identifier of some other device and if this fails, uses a random interface id. Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 ---377318441-1773213307-1062426282=:29198 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ip6_tnl_autoconf.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="ip6_tnl_autoconf.patch" IyBUaGlzIGlzIGEgQml0S2VlcGVyIGdlbmVyYXRlZCBwYXRjaCBmb3IgdGhl IGZvbGxvd2luZyBwcm9qZWN0Og0KIyBQcm9qZWN0IE5hbWU6IExpbnV4IGtl cm5lbCB0cmVlDQojIFRoaXMgcGF0Y2ggZm9ybWF0IGlzIGludGVuZGVkIGZv ciBHTlUgcGF0Y2ggY29tbWFuZCB2ZXJzaW9uIDIuNSBvciBoaWdoZXIuDQoj IFRoaXMgcGF0Y2ggaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBkZWx0YXM6DQoj CSAgICAgICAgICAgQ2hhbmdlU2V0CTEuMTI5MSAgLT4gMS4xMjkyIA0KIwkg bmV0L2lwdjYvYWRkcmNvbmYuYwkxLjY0ICAgIC0+IDEuNjUgICANCiMNCiMg VGhlIGZvbGxvd2luZyBpcyB0aGUgQml0S2VlcGVyIENoYW5nZVNldCBMb2cN CiMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0NCiMgMDMvMDkvMDEJdm51b3J2YWxAYW1iZXIuaHV0Lm1lZGlhcG9saS5j b20JMS4xMjkyDQojIEF1dG9jb25maWd1cmUgYSBsaW5rLWxvY2FsIGFkZHJl c3MgdG8gYWxsIElQdjYgdHVubmVsIGRldmljZXMNCiMgLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiMNCmRpZmYgLU5y dSBhL25ldC9pcHY2L2FkZHJjb25mLmMgYi9uZXQvaXB2Ni9hZGRyY29uZi5j DQotLS0gYS9uZXQvaXB2Ni9hZGRyY29uZi5jCU1vbiBTZXAgIDEgMTY6NTY6 MzkgMjAwMw0KKysrIGIvbmV0L2lwdjYvYWRkcmNvbmYuYwlNb24gU2VwICAx IDE2OjU2OjM5IDIwMDMNCkBAIC0xODIwLDYgKzE4MjAsMzkgQEANCiANCiAN CiAjaWYgZGVmaW5lZChDT05GSUdfSVBWNl9UVU5ORUwpIHx8IGRlZmluZWQo Q09ORklHX0lQVjZfVFVOTkVMX01PRFVMRSkNCisNCisvKiANCisgKiBBdXRv Y29uZmlndXJlIHR1bm5lbCB3aXRoIGEgbGluay1sb2NhbCBhZGRyZXNzIHNv IHJvdXRpbmcgcHJvdG9jb2xzLA0KKyAqIERIQ1B2NiwgTUxEIGV0Yy4gY2Fu IGJlIHJ1biBvdmVyIHRoZSB2aXJ0dWFsIGxpbmsgDQorICovDQorDQorc3Rh dGljIHZvaWQgaXA2X3RubF9hZGRfbGlua2xvY2FsKHN0cnVjdCBpbmV0Nl9k ZXYgKmlkZXYpDQorew0KKwlzdHJ1Y3QgaW42X2FkZHIgYWRkcjsNCisJc3Ry dWN0IG5ldF9kZXZpY2UgKmRldjsgDQorCUFTU0VSVF9SVE5MKCk7DQorDQor CW1lbXNldCgmYWRkciwgMCwgc2l6ZW9mKHN0cnVjdCBpbjZfYWRkcikpOw0K KwlhZGRyLnM2X2FkZHIzMlswXSA9IGh0b25sKDB4RkU4MDAwMDApOw0KKw0K KwkvKiB0cnkgdG8gaW5oZXJpdCBFVUk2NCBmcm9tIGFub3RoZXIgZGV2aWNl ICovDQorCWZvciAoZGV2ID0gZGV2X2Jhc2U7IGRldjsgZGV2ID0gZGV2LT5u ZXh0KSB7DQorCQlpZiAoIWlwdjZfZ2VuZXJhdGVfZXVpNjQoYWRkci5zNl9h ZGRyICsgOCwgZGV2KSkgew0KKwkJCWFkZHJjb25mX2FkZF9saW5rbG9jYWwo aWRldiwgJmFkZHIpOw0KKwkJCXJldHVybjsNCisJCX0NCisJfQ0KKyNpZmRl ZiBDT05GSUdfSVBWNl9QUklWQUNZDQorCS8qIGVsc2UgdHJ5IHRvIGdlbmVy YXRlIGEgcmFuZG9tIGlkZW50aWZpZXIgKi8NCisJaWYgKCFfX2lwdjZfcmVn ZW5fcm5kaWQoaWRldikpIHsNCisJCW1lbWNweShhZGRyLnM2X2FkZHIgKyA4 LCBpZGV2LT5ybmRpZCwgOCk7DQorCQlhZGRyY29uZl9hZGRfbGlua2xvY2Fs KGlkZXYsICZhZGRyKTsNCisJCXJldHVybjsNCisJfQ0KKyNlbmRpZg0KKwlw cmludGsoS0VSTl9ERUJVRyAiaW5pdCBpcDYtaXA2OiBhZGRfbGlua2xvY2Fs IGZhaWxlZFxuIik7DQorfQ0KKw0KIHN0YXRpYyB2b2lkIGFkZHJjb25mX2lw Nl90bmxfY29uZmlnKHN0cnVjdCBuZXRfZGV2aWNlICpkZXYpDQogew0KIAlz dHJ1Y3QgaW5ldDZfZGV2ICppZGV2Ow0KQEAgLTE4MzAsNiArMTg2Myw4IEBA DQogCQlwcmludGsoS0VSTl9ERUJVRyAiaW5pdCBpcDYtaXA2OiBmaW5kX2Rl diBmYWlsZWRcbiIpOw0KIAkJcmV0dXJuOw0KIAl9DQorCWlwNl90bmxfYWRk X2xpbmtsb2NhbChpZGV2KTsNCisJYWRkcmNvbmZfYWRkX21yb3V0ZShkZXYp Ow0KIH0NCiAjZW5kaWYNCiANCkBAIC0yMTM1LDYgKzIxNzAsNyBAQA0KIA0K IAlpZiAoaWZwLT5pZGV2LT5jbmYuZm9yd2FyZGluZyA9PSAwICYmDQogCSAg ICAoZGV2LT5mbGFncyZJRkZfTE9PUEJBQ0spID09IDAgJiYNCisJICAgIGRl di0+dHlwZSAhPSBBUlBIUkRfVFVOTkVMNiAmJg0KIAkgICAgKGlwdjZfYWRk cl90eXBlKCZpZnAtPmFkZHIpICYgSVBWNl9BRERSX0xJTktMT0NBTCkpIHsN CiAJCXN0cnVjdCBpbjZfYWRkciBhbGxfcm91dGVyczsNCiANCg== ---377318441-1773213307-1062426282=:29198-- From jgarzik@pobox.com Mon Sep 1 07:29:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 07:30:06 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81ETUWZ029013 for ; Mon, 1 Sep 2003 07:29:31 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:34035 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19tpgO-00007b-Va; Mon, 01 Sep 2003 15:29:29 +0100 Message-ID: <3F5357BE.4060902@pobox.com> Date: Mon, 01 Sep 2003 10:29:18 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Francois Romieu CC: Maillist netdev Subject: Re: So you thought sis190 was evil... References: <3F529E71.20402@pobox.com> <20030901091321.A4000@electric-eye.fr.zoreil.com> In-Reply-To: <20030901091321.A4000@electric-eye.fr.zoreil.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5472 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 Content-Length: 478 Lines: 22 Francois Romieu wrote: > Jeff Garzik : > >>It looks like the objectionable sis190 code was copied almost wholesale >>from r8169... virt_to_bus, static descriptors, lack of cpu_to_leXX, >>and all. > > > Are you asking for a copy from sis190 to r8169 ? hehe :) Actually, no. I have docs and test hardware for RTL-8169, and it's basically the same as RTL-8139C+ (8139cp). So, for r8169 I'm coming to copy over my RX and TX handling code. Jeff From jgarzik@pobox.com Mon Sep 1 07:59:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 07:59:55 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81ExLWZ008236 for ; Mon, 1 Sep 2003 07:59:22 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:34044 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19tq9I-0000NL-JV for netdev@oss.sgi.com; Mon, 01 Sep 2003 15:59:20 +0100 Message-ID: <3F535EBD.6090401@pobox.com> Date: Mon, 01 Sep 2003 10:59:09 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Maillist netdev Subject: The recent free_netdev() conversion... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5473 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 Content-Length: 318 Lines: 27 Note that a lot of error paths were not caught. In the typical driver you have: ->probe() dev = alloc_etherdev() blah_probe() if blah_probe() fails goto err_out register_netdev() return 0; err_out: kfree(dev); ->remove() free_netdev(dev); The "kfree" needs to be a free_netdev() too. Jeff From davem@pizda.ninka.net Mon Sep 1 08:02:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 08:03:28 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81F2sWZ009952 for ; Mon, 1 Sep 2003 08:02:55 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id HAA09231; Mon, 1 Sep 2003 07:53:45 -0700 Date: Mon, 1 Sep 2003 07:53:45 -0700 From: "David S. Miller" To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: Re: The recent free_netdev() conversion... Message-Id: <20030901075345.4c35e3e6.davem@redhat.com> In-Reply-To: <3F535EBD.6090401@pobox.com> References: <3F535EBD.6090401@pobox.com> X-Mailer: Sylpheed version 0.9.2 (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: 5474 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 Content-Length: 318 Lines: 11 On Mon, 01 Sep 2003 10:59:09 -0400 Jeff Garzik wrote: > err_out: > kfree(dev); ... > The "kfree" needs to be a free_netdev() too. If the 'dev' hasn't been given to register_netdev() it really doesn't need to be free_netdev(). It's just memory until it has been given to the device layer. From davem@pizda.ninka.net Mon Sep 1 09:07:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 09:07:58 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81G7OWZ019911 for ; Mon, 1 Sep 2003 09:07:24 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id IAA09396; Mon, 1 Sep 2003 08:58:14 -0700 Date: Mon, 1 Sep 2003 08:58:14 -0700 From: "David S. Miller" To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: Re: The recent free_netdev() conversion... Message-Id: <20030901085814.5a333518.davem@redhat.com> In-Reply-To: <3F536CB7.6060404@pobox.com> References: <3F535EBD.6090401@pobox.com> <20030901075345.4c35e3e6.davem@redhat.com> <3F536CB7.6060404@pobox.com> X-Mailer: Sylpheed version 0.9.2 (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: 5475 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 Content-Length: 404 Lines: 10 On Mon, 01 Sep 2003 11:58:47 -0400 Jeff Garzik wrote: > True, but for long term, it's best to use free_netdev(). Besides > naturally pairing with alloc_foodev(), if we ever decide to have > alloc_netdev() perform more than one allocation, free_netdev() will > already be in place to handle the multiple de-allocations. Okie dokie, I'll take patches that fix any of these cases. From garzik@gtf.org Mon Sep 1 09:22:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 09:23:26 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81GMfWZ021043 for ; Mon, 1 Sep 2003 09:22:42 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 588986659; Mon, 1 Sep 2003 11:49:45 -0400 (EDT) Date: Mon, 1 Sep 2003 11:49:45 -0400 From: Jeff Garzik To: marcelo@parcelfarce.linux.theplanet.co.uk Cc: marcelo@conectiva.com.br, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: [bk patches] 2.4.x net driver updates Message-ID: <20030901154945.GA22275@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: 5476 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 Content-Length: 1348 Lines: 41 Marcelo, please do a bk pull bk://kernel.bkbits.net/jgarzik/net-drivers-2.4 This will update the following files: drivers/net/8139cp.c | 35 ++++++++----------------- drivers/net/8139too.c | 68 ++++++++++++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 59 deletions(-) through these ChangeSets: (03/08/31 1.1119) [netdrvr 8139cp] PCI MWI cleanup; remove unneeded workaround * The PCI layer now handles incorrect cacheline size settings, as it should. Remove our own workarounds. * Move pci_set_mwi up much earlier in the probe process, and check its return value. * Call pci_clear_mwi() in ->probe error handling * Call pci_clear_mwi() in ->remove (03/08/31 1.1117) [netdrvr 8139too] don't start thread when it's not needed The thread for was unneeded on chips other than CH_8139_K/8129. So, this patch doesn't create the thread on chips other than CH_8139_K/8129. (03/08/31 1.1116) [netdrvr 8139too] remove driver-based poisoning of net_device Harmless in 2.4, but causes oopses on rmmod in 2.6. slab poisoning can take care of this for us, anyway. (03/08/31 1.1115) [netdrvr 8139cp] must call NAPI-specific vlan hook From da-x@gmx.net Mon Sep 1 09:46:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 09:47:10 -0700 (PDT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81GkaWZ024256 for ; Mon, 1 Sep 2003 09:46:37 -0700 Received: (qmail 10929 invoked by uid 65534); 1 Sep 2003 16:46:28 -0000 Received: from bzq-234-149.red.bezeqint.net (HELO callisto.yi.org) (212.179.234.149) by mail.gmx.net (mp025) with SMTP; 01 Sep 2003 18:46:28 +0200 Date: Mon, 1 Sep 2003 19:46:24 +0300 From: Dan Aloni To: netdev@oss.sgi.com Cc: "David S. Miller" Subject: [BK PATCH 2.6] repost, fix sysctl breakage during network device renaming, for ipv4 Message-ID: <20030901164624.GA26886@callisto.yi.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i X-archive-position: 5477 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: da-x@gmx.net Precedence: bulk X-list: netdev Content-Length: 5419 Lines: 171 Can you please take a look and comment? You can import this changeset into BK by piping this whole message to: '| bk receive [path to repository]' or apply the patch as usual. =================================================================== ChangeSet@1.1292, 2003-08-26 18:30:17+03:00, da-x@gmx.net Sysctl assumes its ctl_table.procname field is const, but the networking points ctl_table.procname to dev->name. When renaming a network device using SIOCSIFNAME, dev->name is modified and sysctl's assumption breaks, causing this behaviour, at least: 1. sysctl wouldn't be able to remove the proc entry when the device requests to be unregistered, because it would be using the new name instead of the old one. 2. proc entries for devices remain with the old name after rename. This change includes allocating the current device name to a new copy upon registering with sysctl, plus re-registering with sysctl when the device is renamed. This only fixes IPv4. Fixes for ax25, core/neighbour.c, decnet, and ipv6 are also planned. devinet.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 40 insertions(+), 5 deletions(-) diff -Nru a/net/ipv4/devinet.c b/net/ipv4/devinet.c --- a/net/ipv4/devinet.c Tue Aug 26 18:31:08 2003 +++ b/net/ipv4/devinet.c Tue Aug 26 18:31:08 2003 @@ -904,6 +904,11 @@ * not interesting to applications using netlink. */ inetdev_changename(dev, in_dev); + +#ifdef CONFIG_SYSCTL + devinet_sysctl_unregister(&in_dev->cnf); + devinet_sysctl_register(in_dev, &in_dev->cnf); +#endif break; } out: @@ -1295,12 +1300,21 @@ }, }; +static char *strdup(char *s) +{ + char *rv = kmalloc(strlen(s)+1, GFP_KERNEL); + if (rv) + strcpy(rv, s); + return rv; +} + static void devinet_sysctl_register(struct in_device *in_dev, struct ipv4_devconf *p) { int i; struct net_device *dev = in_dev ? in_dev->dev : NULL; struct devinet_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL); + char *dev_name = NULL; if (!t) return; @@ -1309,13 +1323,25 @@ t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; t->devinet_vars[i].de = NULL; } + if (dev) { - t->devinet_dev[0].procname = dev->name; + dev_name = dev->name; t->devinet_dev[0].ctl_name = dev->ifindex; } else { - t->devinet_dev[0].procname = "default"; + dev_name = "default"; t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; } + + /* + * Make a copy of dev_name, because '.procname' is regarded as const + * by sysctl and we wouldn't want anyone to change it under our feet + * (see SIOCSIFNAME). + */ + dev_name = strdup(dev_name); + if (!dev_name) + goto free; + + t->devinet_dev[0].procname = dev_name; t->devinet_dev[0].child = t->devinet_vars; t->devinet_dev[0].de = NULL; t->devinet_conf_dir[0].child = t->devinet_dev; @@ -1327,9 +1353,17 @@ t->sysctl_header = register_sysctl_table(t->devinet_root_dir, 0); if (!t->sysctl_header) - kfree(t); - else - p->sysctl = t; + goto free_procname; + + p->sysctl = t; + return; + + /* error path */ + free_procname: + kfree(dev_name); + free: + kfree(t); + return; } static void devinet_sysctl_unregister(struct ipv4_devconf *p) @@ -1338,6 +1372,7 @@ struct devinet_sysctl_table *t = p->sysctl; p->sysctl = NULL; unregister_sysctl_table(t->sysctl_header); + kfree(t->devinet_dev[0].procname); kfree(t); } } =================================================================== This BitKeeper patch contains the following changesets: + ## Wrapped with gzip_uu ## M'XL( #Q]2S\ [56^V_;-A#^V?PK;@VP/&K+>EB*;,-!NC3IC*9)D+08AK8P M:(FV5ECQ8I--FR1O#M^W]WIHP[@G6*RUXAIZY$N;;OX\9U3S_:#K1/8G=-MY,2.0SL.BVVW$P8=LDHXW;1D M=,ZISB138J(-C_?5+A^?1O3LT/4S;3!I.B_3 \\=:-GD%_AO25R0"!XV*M(I4*6R!5.0: 4X'FDZ M3IFUE"+B=,%@DK TA@37!%>Z">-,@YXQP (SU0FX5-8BH1_W5\+B-FJ=68& M%OPV8QPDPX'QPABTBF*LDHA!ILS*P_#VXF%X=?/BS65SYV]@+$2<(*88*(]- M )6S.%0%CZ5.!(>Q9'2NFA#1(IJ>H>.8S>@J$9EL M60,HI-B/[X!2Q(&0?6 M(DMC?JC1' P1@U^RA5BQG+6A!8QKN8&UH5)F(K]* I+]D3&%R4!/#))QR::) MTDRR&+/'#"8DHHN=C$7E7V%EF)(U%'PQY8S&(";YO$ 'P9F5>[C6#DV"]9L( M64)0!C%-.*P3/:L=\X!T@D#J'?-"E.'PYZU)4Y1W$NXLC6..HTAP$Y9I9@"VOC"HB[E+;;E+HDJH ML554+$+K!]GQ$D,.[5<4CDPGZZ/K8 $*R-F?)=#;&PEN1Z:4(&ZZ9 M=T^R7 5 )68E50)Q4<[+'5Z#[W>['7*W$Q+2^I<7(3:UR=EW'EP$TT8.'5.G,PG=;CQ^(A+?B&*D)W!\S[:[6S?PPDXN MC5_:?E\C?Q0E^42Y)21=L>@\P$"6FG\;JX._G< _W7;PQL]ETG4^%TF[^U61 M[-C0\O\7E;S?=>I^'_]3CYH.O4,Y0G'+GX?RZ#B]N9J^&KT\/O#Q=MKTFB4L4<%I]%. MJXY^3O@HU]V(3X[[7YK6AH5=$SYS.& <=9H,\: [A9 HC1(2&7&1<**TC+/E M43DX)G^21G$O5S" ^2*7G".T2AD_4L?/G2:\NKH;O;Z\O[F\-F"2"1S)U3&B M0J-HN<%!$Y19D0S/9$SPJD_^0MI#Q[,]<*KXB&^45V$ -^^NK_MFW7%P_0-Y MB7?&>&SS#)-$OULR)T"(Z)W6B? &G ";RA<[;7 M%)7C[E@XK,_-PZ*AIE3&YJPKC]\BS'A3-:%1L37;'5IKBM),^08/":/*E99K M/(5B[%_40)@PU#(3Y4@QMG_.'EMFNMT@^X3*4E4S5?)_JB?0!Z^IP-TFDK&^ MH:M;9U6WX/][^^/N;0"O0"99'FN2=;3:*/*+P^[;)V5M >@ZUKW MRP0S*5'VE_C<(PGRU+U'&G,SL<\CMZ@7]/%>0$2#>F)*6RY^DP]ZU2^AT8Q% 5; Mon, 1 Sep 2003 09:50:38 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id JAA09505; Mon, 1 Sep 2003 09:41:27 -0700 Date: Mon, 1 Sep 2003 09:41:27 -0700 From: "David S. Miller" To: Dan Aloni Cc: netdev@oss.sgi.com Subject: Re: [BK PATCH 2.6] repost, fix sysctl breakage during network device renaming, for ipv4 Message-Id: <20030901094127.6a0f6878.davem@redhat.com> In-Reply-To: <20030901164624.GA26886@callisto.yi.org> References: <20030901164624.GA26886@callisto.yi.org> X-Mailer: Sylpheed version 0.9.2 (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: 5478 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 Content-Length: 257 Lines: 8 On Mon, 1 Sep 2003 19:46:24 +0300 Dan Aloni wrote: > Can you please take a look and comment? I commented already and I said "putting a private copy of a generic function like strdup() in the middle of the networking code is inappropriate." From da-x@gmx.net Mon Sep 1 09:56:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 09:56:46 -0700 (PDT) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81GuCWZ028189 for ; Mon, 1 Sep 2003 09:56:13 -0700 Received: (qmail 12374 invoked by uid 65534); 1 Sep 2003 16:56:04 -0000 Received: from bzq-234-149.red.bezeqint.net (HELO callisto.yi.org) (212.179.234.149) by mail.gmx.net (mp016) with SMTP; 01 Sep 2003 18:56:04 +0200 Date: Mon, 1 Sep 2003 19:55:59 +0300 From: Dan Aloni To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [BK PATCH 2.6] repost, fix sysctl breakage during network device renaming, for ipv4 Message-ID: <20030901165559.GA27099@callisto.yi.org> References: <20030901164624.GA26886@callisto.yi.org> <20030901094127.6a0f6878.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030901094127.6a0f6878.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 5479 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: da-x@gmx.net Precedence: bulk X-list: netdev Content-Length: 592 Lines: 19 On Mon, Sep 01, 2003 at 09:41:27AM -0700, David S. Miller wrote: > On Mon, 1 Sep 2003 19:46:24 +0300 > Dan Aloni wrote: > > > Can you please take a look and comment? > > I commented already and I said "putting a private copy > of a generic function like strdup() in the middle of > the networking code is inappropriate." For some unknown reason I didn't get that response. The private copy of strdup() is something that I'd also wouldn't want, but I don't have much choice. Please read a recent thread in lkml regarding strdup() consolidation. -- Dan Aloni da-x@gmx.net From garzik@gtf.org Mon Sep 1 10:57:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 10:57:38 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81Hv2WZ031657 for ; Mon, 1 Sep 2003 10:57:03 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 8B8E9665E; Mon, 1 Sep 2003 13:56:57 -0400 (EDT) Date: Mon, 1 Sep 2003 13:56:57 -0400 From: Jeff Garzik To: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: [patch 2/2][fyi] alloc_ei_netdev() example: ne2k-pci Message-ID: <20030901175657.GA31874@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: 5481 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 Content-Length: 2091 Lines: 72 # 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.1120 -> 1.1121 # drivers/net/ne2k-pci.c 1.9 -> 1.10 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 jgarzik@redhat.com 1.1121 # [netdrvr ne2k-pci] allocate netdev+8390 struct using new alloc_ei_netdev() # # Also, call pci_disable_device() in PCI ->remove handler, # to match pci_enable_device() in PCI ->probe handler. # -------------------------------------------- # diff -Nru a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c --- a/drivers/net/ne2k-pci.c Mon Sep 1 13:48:30 2003 +++ b/drivers/net/ne2k-pci.c Mon Sep 1 13:48:30 2003 @@ -259,7 +259,8 @@ } } - dev = alloc_etherdev(0); + /* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */ + dev = alloc_ei_netdev(); if (!dev) { printk (KERN_ERR PFX "cannot allocate ethernet device\n"); goto err_out_free_res; @@ -330,13 +331,6 @@ dev->base_addr = ioaddr; pci_set_drvdata(pdev, dev); - /* Allocate dev->priv and fill in 8390 specific dev fields. */ - if (ethdev_init(dev)) { - printk (KERN_ERR "ne2kpci(%s): unable to get memory for dev->priv.\n", - pdev->slot_name); - goto err_out_free_netdev; - } - ei_status.name = pci_clone_list[chip_idx].name; ei_status.tx_start_page = start_page; ei_status.stop_page = stop_page; @@ -365,7 +359,7 @@ i = register_netdev(dev); if (i) - goto err_out_free_8390; + goto err_out_free_netdev; printk("%s: %s found at %#lx, IRQ %d, ", dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq); @@ -376,8 +370,6 @@ return 0; -err_out_free_8390: - kfree(dev->priv); err_out_free_netdev: kfree (dev); err_out_free_res: @@ -634,7 +626,7 @@ unregister_netdev(dev); release_region(dev->base_addr, NE_IO_EXTENT); - kfree(dev->priv); + pci_disable_device(pdev); kfree(dev); pci_set_drvdata(pdev, NULL); } From garzik@gtf.org Mon Sep 1 10:56:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 10:57:02 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81HuQWZ031592 for ; Mon, 1 Sep 2003 10:56:27 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 21E8B665E; Mon, 1 Sep 2003 13:56:21 -0400 (EDT) Date: Mon, 1 Sep 2003 13:56:21 -0400 From: Jeff Garzik To: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: [patch 1/2][fyi] alloc_ei_netdev() function for 8390 devices Message-ID: <20030901175621.GA31452@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: 5480 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 Content-Length: 3381 Lines: 131 I've just checked this into my 2.4 and 2.5 net-driver queues. Most 8390-based (ne2000) drivers use a helper lib, drivers/net/8390.c. This lib has been taking care of the chore of allocating and managing dev->priv, which is a common struct ei_device shared across all 8390 drivers. For such drivers, I've created alloc_ei_netdev(), which is intended to replace dev = alloc_etherdev(...); if (!dev) ... ... if (ethdev_init(dev)) /* 8390-specific */ ... ... with dev = alloc_ei_netdev(); if (!dev) ... ... The patch below is the API change I checked in. The patch that follows in the next email is an example conversion -- drivers/net/ne2k-pci.c. Jeff # 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.1119 -> 1.1120 # drivers/net/8390.c 1.8 -> 1.9 # drivers/net/8390.h 1.6 -> 1.7 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 jgarzik@redhat.com 1.1120 # [netdrvr 8390] new function alloc_ei_netdev() # # (preferred over alloc_etherdev + 8390-specific ethdev_init) # -------------------------------------------- # diff -Nru a/drivers/net/8390.c b/drivers/net/8390.c --- a/drivers/net/8390.c Mon Sep 1 13:48:26 2003 +++ b/drivers/net/8390.c Mon Sep 1 13:48:26 2003 @@ -1000,6 +1000,11 @@ spin_unlock_irqrestore(&ei_local->page_lock, flags); } +static inline void ei_device_init(struct ei_device *ei_local) +{ + spin_lock_init(&ei_local->page_lock); +} + /** * ethdev_init - init rest of 8390 device struct * @dev: network device structure to init @@ -1015,14 +1020,11 @@ if (dev->priv == NULL) { - struct ei_device *ei_local; - dev->priv = kmalloc(sizeof(struct ei_device), GFP_KERNEL); if (dev->priv == NULL) return -ENOMEM; memset(dev->priv, 0, sizeof(struct ei_device)); - ei_local = (struct ei_device *)dev->priv; - spin_lock_init(&ei_local->page_lock); + ei_device_init(dev->priv); } dev->hard_start_xmit = &ei_start_xmit; @@ -1033,6 +1035,29 @@ return 0; } + +/* wrapper to make alloc_netdev happy; probably should just cast... */ +static void __ethdev_init(struct net_device *dev) +{ + ethdev_init(dev); +} + +/** + * alloc_ei_netdev - alloc_etherdev counterpart for 8390 + * + * Allocate 8390-specific net_device. + */ +struct net_device *alloc_ei_netdev(void) +{ + struct net_device *dev; + + dev = alloc_netdev(sizeof(struct ei_device), "eth%d", __ethdev_init); + if (dev) + ei_device_init(dev->priv); + + return dev; +} + @@ -1136,6 +1161,7 @@ EXPORT_SYMBOL(ei_tx_timeout); EXPORT_SYMBOL(ethdev_init); EXPORT_SYMBOL(NS8390_init); +EXPORT_SYMBOL(alloc_ei_netdev); #if defined(MODULE) diff -Nru a/drivers/net/8390.h b/drivers/net/8390.h --- a/drivers/net/8390.h Mon Sep 1 13:48:26 2003 +++ b/drivers/net/8390.h Mon Sep 1 13:48:26 2003 @@ -50,6 +50,7 @@ extern int ei_open(struct net_device *dev); extern int ei_close(struct net_device *dev); extern void ei_interrupt(int irq, void *dev_id, struct pt_regs *regs); +extern struct net_device *alloc_ei_netdev(void); /* Most of these entries should be in 'struct net_device' (or most of the things in there should be here!) */ From jgarzik@pobox.com Mon Sep 1 11:27:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 11:28:09 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81IRYWZ002005 for ; Mon, 1 Sep 2003 11:27:35 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:34058 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19tr50-0000s0-CA; Mon, 01 Sep 2003 16:58:58 +0100 Message-ID: <3F536CB7.6060404@pobox.com> Date: Mon, 01 Sep 2003 11:58:47 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: "David S. Miller" CC: netdev@oss.sgi.com Subject: Re: The recent free_netdev() conversion... References: <3F535EBD.6090401@pobox.com> <20030901075345.4c35e3e6.davem@redhat.com> In-Reply-To: <20030901075345.4c35e3e6.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5483 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 Content-Length: 641 Lines: 26 David S. Miller wrote: > On Mon, 01 Sep 2003 10:59:09 -0400 > Jeff Garzik wrote: > > >> err_out: >> kfree(dev); > > ... > >>The "kfree" needs to be a free_netdev() too. > > > If the 'dev' hasn't been given to register_netdev() it > really doesn't need to be free_netdev(). It's just memory > until it has been given to the device layer. True, but for long term, it's best to use free_netdev(). Besides naturally pairing with alloc_foodev(), if we ever decide to have alloc_netdev() perform more than one allocation, free_netdev() will already be in place to handle the multiple de-allocations. Jeff From garzik@gtf.org Mon Sep 1 11:27:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 11:27:48 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81IRDWZ001980 for ; Mon, 1 Sep 2003 11:27:14 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 37D44666F; Mon, 1 Sep 2003 14:27:08 -0400 (EDT) Date: Mon, 1 Sep 2003 14:27:08 -0400 From: Jeff Garzik To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] move tg3 netif_* to netdevice.h Message-ID: <20030901182708.GA2084@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: 5482 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 Content-Length: 3247 Lines: 115 Ok for me to commit, and send to 2.4+2.6 upstream? I have it queued locally, but it touches stuff you've been touching lately... ===== drivers/net/tg3.c 1.82 vs edited ===== --- 1.82/drivers/net/tg3.c Tue Aug 19 23:53:17 2003 +++ edited/drivers/net/tg3.c Mon Sep 1 14:19:58 2003 @@ -237,38 +237,6 @@ tg3_cond_int(tp); } -/* these netif_xxx funcs should be moved into generic net layer */ -static void netif_poll_disable(struct net_device *dev) -{ - while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } -} - -static inline void netif_poll_enable(struct net_device *dev) -{ - clear_bit(__LINK_STATE_RX_SCHED, &dev->state); -} - -/* same as netif_rx_complete, except that local_irq_save(flags) - * has already been issued - */ -static inline void __netif_rx_complete(struct net_device *dev) -{ - if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG(); - list_del(&dev->poll_list); - smp_mb__before_clear_bit(); - clear_bit(__LINK_STATE_RX_SCHED, &dev->state); -} - -static inline void netif_tx_disable(struct net_device *dev) -{ - spin_lock_bh(&dev->xmit_lock); - netif_stop_queue(dev); - spin_unlock_bh(&dev->xmit_lock); -} - static inline void tg3_netif_stop(struct tg3 *tp) { netif_poll_disable(tp->dev); ===== include/linux/netdevice.h 1.52 vs edited ===== --- 1.52/include/linux/netdevice.h Wed Aug 20 00:01:19 2003 +++ edited/include/linux/netdevice.h Mon Sep 1 14:23:06 2003 @@ -832,6 +832,38 @@ local_irq_restore(flags); } +static inline void netif_poll_disable(struct net_device *dev) +{ + while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) { + /* No hurry. */ + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } +} + +static inline void netif_poll_enable(struct net_device *dev) +{ + clear_bit(__LINK_STATE_RX_SCHED, &dev->state); +} + +/* same as netif_rx_complete, except that local_irq_save(flags) + * has already been issued + */ +static inline void __netif_rx_complete(struct net_device *dev) +{ + if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG(); + list_del(&dev->poll_list); + smp_mb__before_clear_bit(); + clear_bit(__LINK_STATE_RX_SCHED, &dev->state); +} + +static inline void netif_tx_disable(struct net_device *dev) +{ + spin_lock_bh(&dev->xmit_lock); + netif_stop_queue(dev); + spin_unlock_bh(&dev->xmit_lock); +} + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct net_device *dev); ===== net/core/dev.c 1.95 vs edited ===== --- 1.95/net/core/dev.c Wed Aug 20 00:04:26 2003 +++ edited/net/core/dev.c Mon Sep 1 14:23:40 2003 @@ -845,11 +845,7 @@ * engine, but this requires more changes in devices. */ smp_mb__after_clear_bit(); /* Commit netif_running(). */ - while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) { - /* No hurry. */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } + netif_poll_disable(dev); /* * Call the device specific close. This cannot fail. @@ -1657,7 +1653,7 @@ list_del(&backlog_dev->poll_list); smp_mb__before_clear_bit(); - clear_bit(__LINK_STATE_RX_SCHED, &backlog_dev->state); + netif_poll_enable(backlog_dev); if (queue->throttle) { queue->throttle = 0; From davem@pizda.ninka.net Mon Sep 1 11:38:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 11:39:24 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81IcnWZ003258 for ; Mon, 1 Sep 2003 11:38:50 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA09767; Mon, 1 Sep 2003 11:29:39 -0700 Date: Mon, 1 Sep 2003 11:29:39 -0700 From: "David S. Miller" To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: Re: [PATCH] move tg3 netif_* to netdevice.h Message-Id: <20030901112939.02af4ddc.davem@redhat.com> In-Reply-To: <20030901182708.GA2084@gtf.org> References: <20030901182708.GA2084@gtf.org> X-Mailer: Sylpheed version 0.9.2 (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: 5484 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 Content-Length: 316 Lines: 12 On Mon, 1 Sep 2003 14:27:08 -0400 Jeff Garzik wrote: > Ok for me to commit, and send to 2.4+2.6 upstream? > > I have it queued locally, but it touches stuff you've been touching > lately... Linus and Marcelo have my current work, so you should have no conflicts. Feel free to push it around. From davem@pizda.ninka.net Mon Sep 1 11:40:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 11:41:30 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81IeuWZ003688 for ; Mon, 1 Sep 2003 11:40:57 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA09781; Mon, 1 Sep 2003 11:31:43 -0700 Date: Mon, 1 Sep 2003 11:31:43 -0700 From: "David S. Miller" To: Dan Aloni Cc: netdev@oss.sgi.com Subject: Re: [BK PATCH 2.6] repost, fix sysctl breakage during network device renaming, for ipv4 Message-Id: <20030901113143.1ba34464.davem@redhat.com> In-Reply-To: <20030901165559.GA27099@callisto.yi.org> References: <20030901164624.GA26886@callisto.yi.org> <20030901094127.6a0f6878.davem@redhat.com> <20030901165559.GA27099@callisto.yi.org> X-Mailer: Sylpheed version 0.9.2 (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: 5485 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 Content-Length: 516 Lines: 14 On Mon, 1 Sep 2003 19:55:59 +0300 Dan Aloni wrote: > The private copy of strdup() is something that I'd also wouldn't > want, but I don't have much choice. Please read a recent > thread in lkml regarding strdup() consolidation. Ugh, I'm afraid to look... I guess the controversy is over the allocation function, what GFP_* flags it should use etc.? For now just call the thing in your patch netdev_name_dup() or something like that. I can't handle having something named "strdup()" in there :-) From da-x@gmx.net Mon Sep 1 11:55:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 11:56:17 -0700 (PDT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81IthWZ004863 for ; Mon, 1 Sep 2003 11:55:43 -0700 Received: (qmail 4923 invoked by uid 65534); 1 Sep 2003 18:55:35 -0000 Received: from bzq-234-149.red.bezeqint.net (HELO callisto.yi.org) (212.179.234.149) by mail.gmx.net (mp022) with SMTP; 01 Sep 2003 20:55:35 +0200 Date: Mon, 1 Sep 2003 21:55:32 +0300 From: Dan Aloni To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [BK PATCH 2.6] repost, fix sysctl breakage during network device renaming, for ipv4 Message-ID: <20030901185532.GA28941@callisto.yi.org> References: <20030901164624.GA26886@callisto.yi.org> <20030901094127.6a0f6878.davem@redhat.com> <20030901165559.GA27099@callisto.yi.org> <20030901113143.1ba34464.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030901113143.1ba34464.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 5486 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: da-x@gmx.net Precedence: bulk X-list: netdev Content-Length: 900 Lines: 26 On Mon, Sep 01, 2003 at 11:31:43AM -0700, David S. Miller wrote: > On Mon, 1 Sep 2003 19:55:59 +0300 > Dan Aloni wrote: > > > The private copy of strdup() is something that I'd also wouldn't > > want, but I don't have much choice. Please read a recent > > thread in lkml regarding strdup() consolidation. > > Ugh, I'm afraid to look... I guess the controversy is > over the allocation function, what GFP_* flags it should > use etc.? Yes, this is the one reason against consolidation, though I don't know why anyone would want to call strdup() from a context other than GPF_KERNEL. Copying strings around in the kernel is done as a result of userspace interaction. > For now just call the thing in your patch netdev_name_dup() or > something like that. I can't handle having something named > "strdup()" in there :-) Sure, I'll do it and resend. -- Dan Aloni da-x@gmx.net From garzik@gtf.org Mon Sep 1 12:34:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 12:34:58 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h81JYNWZ007891 for ; Mon, 1 Sep 2003 12:34:23 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id D42DF6643; Mon, 1 Sep 2003 15:34:17 -0400 (EDT) Date: Mon, 1 Sep 2003 15:34:17 -0400 From: Jeff Garzik To: netdev@oss.sgi.com, davem@redhat.com Subject: [patch 2.4][fyi] s/blog_dev/backlog_dev/ in process_backlog Message-ID: <20030901193417.GA7519@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: 5488 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 Content-Length: 1735 Lines: 58 Since I was patching this area anyway... Queued locally. Patch only for 2.4.x. See BK description for more. # 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.1126 -> 1.1127 # net/core/dev.c 1.39 -> 1.40 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 jgarzik@redhat.com 1.1127 # [NET] s/blog_dev/backlog_dev/ in process_backlog, net/core/dev.c # # This 100% cosmetic change reduces the diff between 2.4 and 2.5. # -------------------------------------------- # diff -Nru a/net/core/dev.c b/net/core/dev.c --- a/net/core/dev.c Mon Sep 1 15:32:25 2003 +++ b/net/core/dev.c Mon Sep 1 15:32:25 2003 @@ -1535,10 +1535,10 @@ return ret; } -static int process_backlog(struct net_device *blog_dev, int *budget) +static int process_backlog(struct net_device *backlog_dev, int *budget) { int work = 0; - int quota = min(blog_dev->quota, *budget); + int quota = min(backlog_dev->quota, *budget); int this_cpu = smp_processor_id(); struct softnet_data *queue = &softnet_data[this_cpu]; unsigned long start_time = jiffies; @@ -1575,17 +1575,17 @@ #endif } - blog_dev->quota -= work; + backlog_dev->quota -= work; *budget -= work; return -1; job_done: - blog_dev->quota -= work; + backlog_dev->quota -= work; *budget -= work; - list_del(&blog_dev->poll_list); + list_del(&backlog_dev->poll_list); smp_mb__before_clear_bit(); - netif_poll_enable(blog_dev); + netif_poll_enable(backlog_dev); if (queue->throttle) { queue->throttle = 0; From garzik@gtf.org Mon Sep 1 17:33:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Sep 2003 17:34:20 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h820XiWZ001128 for ; Mon, 1 Sep 2003 17:33:45 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 3C6086645; Mon, 1 Sep 2003 20:33:39 -0400 (EDT) Date: Mon, 1 Sep 2003 20:33:39 -0400 From: Jeff Garzik To: netdev@oss.sgi.com, davem@redhat.com Subject: [patch][fyi] move ethtool_op_tx_csum Message-ID: <20030902003339.GA29156@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: 5489 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 Queued here for both 2.4 and 2.5. # 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.1129 -> 1.1130 # net/core/ethtool.c 1.3 -> 1.4 # include/linux/ethtool.h 1.16 -> 1.17 # net/netsyms.c 1.41 -> 1.42 # drivers/net/8139cp.c 1.43 -> 1.44 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 jgarzik@redhat.com 1.1130 # [NET] move ethtool_op_set_tx_csum from 8139cp drvr to net/core/ethtool.c, # where it belongs. # -------------------------------------------- # diff -Nru a/drivers/net/8139cp.c b/drivers/net/8139cp.c --- a/drivers/net/8139cp.c Mon Sep 1 20:32:14 2003 +++ b/drivers/net/8139cp.c Mon Sep 1 20:32:14 2003 @@ -1405,17 +1405,6 @@ return 0; } -/* move this to net/core/ethtool.c */ -static int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) -{ - if (data) - dev->features |= NETIF_F_IP_CSUM; - else - dev->features &= ~NETIF_F_IP_CSUM; - - return 0; -} - static void cp_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { diff -Nru a/include/linux/ethtool.h b/include/linux/ethtool.h --- a/include/linux/ethtool.h Mon Sep 1 20:32:14 2003 +++ b/include/linux/ethtool.h Mon Sep 1 20:32:14 2003 @@ -255,6 +255,7 @@ /* Some generic methods drivers may use in their ethtool_ops */ u32 ethtool_op_get_link(struct net_device *dev); u32 ethtool_op_get_tx_csum(struct net_device *dev); +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); u32 ethtool_op_get_sg(struct net_device *dev); int ethtool_op_set_sg(struct net_device *dev, u32 data); diff -Nru a/net/core/ethtool.c b/net/core/ethtool.c --- a/net/core/ethtool.c Mon Sep 1 20:32:14 2003 +++ b/net/core/ethtool.c Mon Sep 1 20:32:14 2003 @@ -31,6 +31,16 @@ return (dev->features & NETIF_F_IP_CSUM) != 0; } +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_IP_CSUM; + else + dev->features &= ~NETIF_F_IP_CSUM; + + return 0; +} + u32 ethtool_op_get_sg(struct net_device *dev) { return (dev->features & NETIF_F_SG) != 0; diff -Nru a/net/netsyms.c b/net/netsyms.c --- a/net/netsyms.c Mon Sep 1 20:32:14 2003 +++ b/net/netsyms.c Mon Sep 1 20:32:14 2003 @@ -617,6 +617,7 @@ /* ethtool.c */ EXPORT_SYMBOL(ethtool_op_get_link); EXPORT_SYMBOL(ethtool_op_get_tx_csum); +EXPORT_SYMBOL(ethtool_op_set_tx_csum); EXPORT_SYMBOL(ethtool_op_get_sg); EXPORT_SYMBOL(ethtool_op_set_sg); From mitch@sfgoth.com Tue Sep 2 01:08:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 01:09:14 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8288wWZ011068 for ; Tue, 2 Sep 2003 01:08:59 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h828GQkV052388; Tue, 2 Sep 2003 01:16:26 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h828GPjv052387; Tue, 2 Sep 2003 01:16:25 -0700 (PDT) (envelope-from mitch) Date: Tue, 2 Sep 2003 01:16:25 -0700 From: Mitchell Blank Jr To: netdev@oss.sgi.com Cc: "David S. Miller" Subject: [PATCH] small skbuff.[ch] tweaks Message-ID: <20030902081625.GA52298@gaz.sfgoth.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-archive-position: 5490 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev This patch: o Makes a couple inline functions in take const arguments as appropriate o Obvious unlikely()/likely()/BUG_ON() conversions Patch is versus 2.6.0-test4. -Mitch --- linux-2.6.0-test4-VIRGIN/include/linux/skbuff.h 2003-08-10 05:28:41.000000000 -0700 +++ linux-2.6.0-test4mnb1/include/linux/skbuff.h 2003-09-01 14:08:54.000000000 -0700 @@ -306,7 +306,7 @@ * * Returns true if the queue is empty, false otherwise. */ -static inline int skb_queue_empty(struct sk_buff_head *list) +static inline int skb_queue_empty(const struct sk_buff_head *list) { return list->next == (struct sk_buff *)list; } @@ -475,7 +475,7 @@ * * Return the length of an &sk_buff queue. */ -static inline __u32 skb_queue_len(struct sk_buff_head *list_) +static inline __u32 skb_queue_len(const struct sk_buff_head *list_) { return list_->qlen; } @@ -1050,7 +1050,7 @@ int gfp_mask) { struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); - if (skb) + if (likely(skb)) skb_reserve(skb, 16); return skb; } --- linux-2.6.0-test4-VIRGIN/net/core/skbuff.c 2003-08-22 13:47:28.000000000 -0700 +++ linux-2.6.0-test4mnb1/net/core/skbuff.c 2003-09-01 14:00:37.000000000 -0700 @@ -129,14 +129,17 @@ /* Get the HEAD */ skb = kmem_cache_alloc(skbuff_head_cache, gfp_mask & ~__GFP_DMA); - if (!skb) + if (unlikely(!skb)) goto out; /* Get the DATA. Size must match skb_add_mtu(). */ size = SKB_DATA_ALIGN(size); data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); - if (!data) - goto nodata; + if (unlikely(!data)) { + kmem_cache_free(skbuff_head_cache, skb); + skb = NULL; + goto out; + } memset(skb, 0, offsetof(struct sk_buff, truesize)); skb->truesize = size + sizeof(struct sk_buff); @@ -153,10 +156,6 @@ skb_shinfo(skb)->frag_list = NULL; out: return skb; -nodata: - kmem_cache_free(skbuff_head_cache, skb); - skb = NULL; - goto out; } @@ -218,7 +217,7 @@ void __kfree_skb(struct sk_buff *skb) { - if (skb->list) { + if (unlikely(skb->list)) { printk(KERN_WARNING "Warning: kfree_skb passed an skb still " "on a list (from %p).\n", NET_CALLER(skb)); BUG(); @@ -229,7 +228,7 @@ secpath_put(skb->sp); #endif if(skb->destructor) { - if (in_irq()) + if (unlikely(in_irq())) printk(KERN_WARNING "Warning: kfree_skb on " "hard IRQ %p\n", NET_CALLER(skb)); skb->destructor(skb); @@ -261,7 +260,7 @@ { struct sk_buff *n = kmem_cache_alloc(skbuff_head_cache, gfp_mask); - if (!n) + if (unlikely(!n)) return NULL; #define C(x) n->x = skb->x @@ -395,7 +394,7 @@ */ struct sk_buff *n = alloc_skb(skb->end - skb->head + skb->data_len, gfp_mask); - if (!n) + if (unlikely(!n)) return NULL; /* Set the data pointer */ @@ -405,7 +404,7 @@ n->csum = skb->csum; n->ip_summed = skb->ip_summed; - if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len)) + if (unlikely(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))) BUG(); copy_skb_header(n, skb); @@ -433,7 +432,7 @@ */ struct sk_buff *n = alloc_skb(skb->end - skb->head, gfp_mask); - if (!n) + if (unlikely(!n)) goto out; /* Set the data pointer */ @@ -493,14 +492,13 @@ int size = nhead + (skb->end - skb->head) + ntail; long off; - if (skb_shared(skb)) - BUG(); + BUG_ON(skb_shared(skb)); size = SKB_DATA_ALIGN(size); data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); - if (!data) - goto nodata; + if (unlikely(!data)) + return -ENOMEM; /* Copy only real data... and, alas, header. This should be * optimized for the cases when header is void. */ @@ -527,9 +525,6 @@ skb->cloned = 0; atomic_set(&skb_shinfo(skb)->dataref, 1); return 0; - -nodata: - return -ENOMEM; } /* Make private copy of skb with writable head and some headroom */ @@ -543,8 +538,8 @@ skb2 = pskb_copy(skb, GFP_ATOMIC); else { skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0, - GFP_ATOMIC)) { + if (unlikely(skb2 && pskb_expand_head(skb2, + SKB_DATA_ALIGN(delta), 0, GFP_ATOMIC))) { kfree_skb(skb2); skb2 = NULL; } @@ -582,7 +577,7 @@ */ struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom, gfp_mask); - if (!n) + if (unlikely(!n)) return NULL; skb_reserve(n, newheadroom); @@ -591,7 +586,7 @@ skb_put(n, skb->len); /* Copy the data only. */ - if (skb_copy_bits(skb, 0, n->data, skb->len)) + if (unlikely(skb_copy_bits(skb, 0, n->data, skb->len))) BUG(); copy_skb_header(n, skb); @@ -625,7 +620,7 @@ nskb = skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb) + pad, GFP_ATOMIC); kfree_skb(skb); - if (nskb) + if (likely(nskb)) memset(nskb->data+nskb->len, 0, pad); return nskb; } @@ -645,9 +640,8 @@ int end = offset + skb_shinfo(skb)->frags[i].size; if (end > len) { if (skb_cloned(skb)) { - if (!realloc) - BUG(); - if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) + BUG_ON(!realloc); + if (unlikely(pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) return -ENOMEM; } if (len <= offset) { @@ -713,12 +707,12 @@ int i, k, eat = (skb->tail + delta) - skb->end; if (eat > 0 || skb_cloned(skb)) { - if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, - GFP_ATOMIC)) + if (unlikely(pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, + GFP_ATOMIC))) return NULL; } - if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta)) + if (unlikely(skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta))) BUG(); /* Optimization: no fragments, no reasons to preestimate @@ -748,8 +742,7 @@ struct sk_buff *insp = NULL; do { - if (!list) - BUG(); + BUG_ON(!list); if (list->len <= eat) { /* Eaten as whole. */ @@ -762,7 +755,7 @@ if (skb_shared(list)) { /* Sucks! We need to fork list. :-( */ clone = skb_clone(list, GFP_ATOMIC); - if (!clone) + if (unlikely(!clone)) return NULL; insp = list->next; list = clone; @@ -771,7 +764,7 @@ * problems. */ insp = list; } - if (!pskb_pull(list, eat)) { + if (unlikely(!pskb_pull(list, eat))) { if (clone) kfree_skb(clone); return NULL; @@ -825,7 +818,7 @@ int i, copy; int start = skb_headlen(skb); - if (offset > (int)skb->len - len) + if (unlikely(offset > (int)skb->len - len)) goto fault; /* Copy header. */ @@ -877,8 +870,8 @@ if ((copy = end - offset) > 0) { if (copy > len) copy = len; - if (skb_copy_bits(list, offset - start, - to, copy)) + if (unlikely(skb_copy_bits(list, offset - start, + to, copy))) goto fault; if ((len -= copy) == 0) return 0; @@ -888,7 +881,7 @@ start = end; } } - if (!len) + if (likely(!len)) return 0; fault: @@ -965,8 +958,7 @@ start = end; } } - if (len) - BUG(); + BUG_ON(len); return csum; } @@ -1048,8 +1040,7 @@ start = end; } } - if (len) - BUG(); + BUG_ON(len); return csum; } @@ -1063,8 +1054,7 @@ else csstart = skb_headlen(skb); - if (csstart > skb_headlen(skb)) - BUG(); + BUG_ON(csstart > skb_headlen(skb)); memcpy(to, skb->data, csstart); From mitch@sfgoth.com Tue Sep 2 02:03:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 02:03:35 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8293UWZ028334 for ; Tue, 2 Sep 2003 02:03:30 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h829B0kV053662; Tue, 2 Sep 2003 02:11:00 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h829AxCV053661; Tue, 2 Sep 2003 02:10:59 -0700 (PDT) (envelope-from mitch) Date: Tue, 2 Sep 2003 02:10:59 -0700 From: Mitchell Blank Jr To: Andi Kleen Cc: netdev@oss.sgi.com Subject: Re: [PATCH] small skbuff.[ch] tweaks Message-ID: <20030902091059.GA53570@gaz.sfgoth.com> References: <20030902081625.GA52298@gaz.sfgoth.com> <20030902105833.04778449.ak@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030902105833.04778449.ak@suse.de> User-Agent: Mutt/1.4.1i X-archive-position: 5491 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev Andi Kleen wrote: > Both unlikely(!ptr) and likely(ptr) are not needed because gcc assumes this > by default Is there any disadvantage to stating it explicitly? -Mitch From ak@suse.de Tue Sep 2 02:04:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 02:05:03 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [195.135.220.2]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8294TWZ028639 for ; Tue, 2 Sep 2003 02:04:29 -0700 Received: from Hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 095F91599B95; Tue, 2 Sep 2003 11:04:24 +0200 (CEST) Date: Tue, 2 Sep 2003 11:04:23 +0200 From: Andi Kleen To: Mitchell Blank Jr Cc: Andi Kleen , netdev@oss.sgi.com Subject: Re: [PATCH] small skbuff.[ch] tweaks Message-ID: <20030902090423.GD3889@wotan.suse.de> References: <20030902081625.GA52298@gaz.sfgoth.com> <20030902105833.04778449.ak@suse.de> <20030902091059.GA53570@gaz.sfgoth.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030902091059.GA53570@gaz.sfgoth.com> X-archive-position: 5492 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@suse.de Precedence: bulk X-list: netdev On Tue, Sep 02, 2003 at 02:10:59AM -0700, Mitchell Blank Jr wrote: > Andi Kleen wrote: > > Both unlikely(!ptr) and likely(ptr) are not needed because gcc assumes this > > by default > > Is there any disadvantage to stating it explicitly? It makes the code much uglier. -Andi From ak@suse.de Tue Sep 2 02:20:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 02:20:57 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [195.135.220.2]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h829KdWZ000733 for ; Tue, 2 Sep 2003 02:20:40 -0700 Received: from Hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id BC0E51599AF6; Tue, 2 Sep 2003 10:58:35 +0200 (CEST) Date: Tue, 2 Sep 2003 10:58:33 +0200 From: Andi Kleen To: Mitchell Blank Jr Cc: netdev@oss.sgi.com, davem@redhat.com Subject: Re: [PATCH] small skbuff.[ch] tweaks Message-Id: <20030902105833.04778449.ak@suse.de> In-Reply-To: <20030902081625.GA52298@gaz.sfgoth.com> References: <20030902081625.GA52298@gaz.sfgoth.com> X-Mailer: Sylpheed version 0.8.9 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5493 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@suse.de Precedence: bulk X-list: netdev On Tue, 2 Sep 2003 01:16:25 -0700 Mitchell Blank Jr wrote: > --- linux-2.6.0-test4-VIRGIN/net/core/skbuff.c 2003-08-22 13:47:28.000000000 -0700 > +++ linux-2.6.0-test4mnb1/net/core/skbuff.c 2003-09-01 14:00:37.000000000 -0700 > @@ -129,14 +129,17 @@ > /* Get the HEAD */ > skb = kmem_cache_alloc(skbuff_head_cache, > gfp_mask & ~__GFP_DMA); > - if (!skb) > + if (unlikely(!skb)) > goto out; > > /* Get the DATA. Size must match skb_add_mtu(). */ > size = SKB_DATA_ALIGN(size); > data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); > - if (!data) > - goto nodata; > + if (unlikely(!data)) { Both unlikely(!ptr) and likely(ptr) are not needed because gcc assumes this by default -Andi From mitch@sfgoth.com Tue Sep 2 02:42:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 02:42:16 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h829gCWZ006225 for ; Tue, 2 Sep 2003 02:42:12 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h829ngkV054427; Tue, 2 Sep 2003 02:49:42 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h829ngjb054426; Tue, 2 Sep 2003 02:49:42 -0700 (PDT) (envelope-from mitch) Date: Tue, 2 Sep 2003 02:49:42 -0700 From: Mitchell Blank Jr To: Andi Kleen Cc: netdev@oss.sgi.com Subject: Re: [PATCH] small skbuff.[ch] tweaks Message-ID: <20030902094942.GB53570@gaz.sfgoth.com> References: <20030902081625.GA52298@gaz.sfgoth.com> <20030902105833.04778449.ak@suse.de> <20030902091059.GA53570@gaz.sfgoth.com> <20030902090423.GD3889@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030902090423.GD3889@wotan.suse.de> User-Agent: Mutt/1.4.1i X-archive-position: 5494 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev Andi Kleen wrote: > > > Both unlikely(!ptr) and likely(ptr) are not needed because gcc assumes this > > > by default > > > > Is there any disadvantage to stating it explicitly? > > It makes the code much uglier. Well I guess it's a matter of taste then. Personally I like unlikely()/ likely() a lot, even from just a readability standpoint. I think it provides a nice hint to the structure of code while reading it ("ok, we're just handling an error case here, the meat of the code is below") If anything they help comment the code. I certainly think they're preferable to "this is an unlikely error condition but we shouldn't mark it as such because of some gcc trivia lets us save a few characters of typing" However if the consensus is that those unlikely()'s should be removed I'll be happy to spin a new patch with those removed. -Mitch From Ronnie_vaisman@radwin.com Tue Sep 2 03:24:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 03:24:36 -0700 (PDT) Received: from mx100.qos.net.il (mx100.qos.net.il [80.74.96.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82AO0WZ010082 for ; Tue, 2 Sep 2003 03:24:01 -0700 Received: from check_mail.radwin.ltd.com (access.radwin.com [80.74.102.194]) by mx100.qos.net.il (8.11.6/8.11.6) with ESMTP id h82AHiG24153 for ; Tue, 2 Sep 2003 13:17:44 +0300 Received: by check_mail.radwin.ltd.com with XWall v3.27 ; Tue, 2 Sep 2003 13:25:58 +0200 From: Ronnie Vaisman To: "netdev@oss.sgi.com" Subject: GUI linux kerne/driver modulel debugger. Date: Tue, 2 Sep 2003 13:21:20 +0200 X-Assembled-By: XWall v3.27 X-Mailer: Internet Mail Service (5.5.2653.19) Message-ID: <116CA223EAAED2119F050090272E3D7F063F88BC@EXCHANGE> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h82AO0WZ010082 X-archive-position: 5495 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Ronnie_vaisman@radwin.com Precedence: bulk X-list: netdev Hi all, I am starting to work with Linux. I would like to debug some device driver module of linux. My questions are Which free GUI debuggers may be used? Can I use DDD for debug module in linux? Is only remote debug mode should be used? I will happy to get any aditional information about this issues. Thanks in advance. Regards, Ronnie Vaisman Regards, Ronnie Vaisman RadWin LTD. 34 Habarzel st., Tel Aviv 69710 Israel +972-3-645-5403 (Direct) +972-3-765-7535(Fax) email Ronnie_Vaisman@radwin.com web ************************************************************************************************** Privacy Notice: The information contained in this transmittal, including any attachments hereto, are confidential and privileged, and intended solely for the specified addressee(s). If you are not the intended addressee, or if you receive this message by error, please notify the sender and delete this information from your computer. Moreover, the recipient(s) may not disclose, forward, or copy this e-mail or attachments, or any portion thereof, or permit the use of this information, by anyone not entitled to it, or in a way that may be damaging to the sender. ************************************************************************************************** From davem@pizda.ninka.net Tue Sep 2 04:46:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 04:46:33 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82Bk0WZ020197 for ; Tue, 2 Sep 2003 04:46:00 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id EAA11860; Tue, 2 Sep 2003 04:35:34 -0700 Date: Tue, 2 Sep 2003 04:35:34 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: pekkas@netcore.fi, yoshfuji@linux-ipv6.org, usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels Message-Id: <20030902043534.05fc6586.davem@redhat.com> In-Reply-To: References: <20030901035134.2585aa79.davem@redhat.com> X-Mailer: Sylpheed version 0.9.2 (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: 5496 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 Sep 2003 17:24:42 +0300 (EEST) Ville Nuorvala wrote: > Ok, this incremental patch to my previous addrconf.c patch generates a > link-local address to the IPv6 tunnel device. It first tries to inherit > the EUI64 identifier of some other device and if this fails, uses a > random interface id. Yoshfuji, do you mind if I apply his patch 5 and "5/5+1"? From acme@conectiva.com.br Tue Sep 2 07:31:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 07:31:41 -0700 (PDT) Received: from orion.netbank.com.br (orion.netbank.com.br [200.203.199.90]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82EV6WZ001244 for ; Tue, 2 Sep 2003 07:31:07 -0700 Received: from [200.181.138.124] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19uCJA-00019P-00; Tue, 02 Sep 2003 11:39:01 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id D469AE723; Tue, 2 Sep 2003 14:30:51 +0000 (UTC) Date: Tue, 2 Sep 2003 11:30:50 -0300 From: Arnaldo Carvalho de Melo To: netfilter-devel@lists.netfilter.org Cc: Linux Networking Development Mailing List Subject: ipt_physdev.c alignment problems on parisc64 Message-ID: <20030902143050.GC3398@conectiva.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 5497 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: acme@conectiva.com.br Precedence: bulk X-list: netdev The 1.786.1.54 changeset (i.e. the initial ipt_physdev.c one 8) created this alignment problems on parisc64: tmp.stdout.allegro.31506.s: Assembler messages: tmp.stdout.allegro.31506.s:97: Error: Field not properly aligned [8] (18). tmp.stdout.allegro.31506.s:97: Error: Invalid operands tmp.stdout.allegro.31506.s:125: Error: Field not properly aligned [8] (34). tmp.stdout.allegro.31506.s:125: Error: Invalid operands tmp.stdout.allegro.31506.s:129: Error: Field not properly aligned [8] (50). tmp.stdout.allegro.31506.s:129: Error: Invalid operands I got this nailed to the match function, on these lines: for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { ret |= (((const unsigned long *)indev)[i] ^ ((const unsigned long *)info->physindev)[i]) & ((const unsigned long *)info->in_mask)[i]; } and for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { ret |= (((const unsigned long *)outdev)[i] ^ ((const unsigned long *)info->physoutdev)[i]) & ((const unsigned long *)info->out_mask)[i]; } Reading specs from /opt/palinux/lib/gcc-lib/hppa64-linux/3.0.4/specs Configured with: ../../gcc-3.0-3.0.4ds3/src/configure --host=hppa-linux --build=hppa-linux --target=hppa64-linux --disable-shared --disable-nls --enable-languages=c --prefix=/opt/palinux Thread model: single gcc version 3.0.4 acme@allegro:~/bk/scsi-2.6$ - Arnaldo From pekkas@netcore.fi Tue Sep 2 07:42:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 07:43:14 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82EgbWZ003386 for ; Tue, 2 Sep 2003 07:42:39 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h82EeGb04301; Tue, 2 Sep 2003 17:40:16 +0300 Date: Tue, 2 Sep 2003 17:40:15 +0300 (EEST) From: Pekka Savola To: Ville Nuorvala cc: "David S. Miller" , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5498 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pekkas@netcore.fi Precedence: bulk X-list: netdev On Mon, 1 Sep 2003, Ville Nuorvala wrote: > On Mon, 1 Sep 2003, David S. Miller wrote: > > On Mon, 1 Sep 2003 13:48:44 +0300 (EEST) > > Pekka Savola wrote: > > > > > Well, link-local addresses are used e.g. by routing protocols and such, so > > > having one is probably rather important.. > > > > Ok. > > > > > FWIW, on FreeBSD platform they take the link-local address of the first > > > physical interface, and give the exact same link-local address on all of > > > the tunnels, disambiuating them with the scope identifier. Seems like an > > > OK appaorach too, and guarantees (to the degree of unique MAC addresses) > > > that the addresses of the endpoints do not clash. > > > > Interesting approach... I'm not particularly picky about how this > > uniqueness issue is solved. > > Ok, this incremental patch to my previous addrconf.c patch generates a > link-local address to the IPv6 tunnel device. It first tries to inherit > the EUI64 identifier of some other device and if this fails, uses a > random interface id. Two comments: + /* try to inherit EUI64 from another device */ + for (dev = dev_base; dev; dev = dev->next) { + if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) { + addrconf_add_linklocal(idev, &addr); + return; + ==> does this really inherit _EUI64_, *or* MAC address (or something like it) to derive an EUI64? Note that there is a significant difference when you've configured manually e.g. 3ffe:ffff:f00:ba::1 on a device, and the case when you've auto-configured the interface identifier from the MAC address of the device. The latter is probably always unique. The former is not necessarily sufficiently unique (but better than nothing, of course). +#ifdef CONFIG_IPV6_PRIVACY + /* else try to generate a random identifier */ + if (!__ipv6_regen_rndid(idev)) { + memcpy(addr.s6_addr + 8, idev->rndid, 8); + addrconf_add_linklocal(idev, &addr); + return; + ==> my question is: as the former method to steal an EUI64 should succeed pretty much always, is it useful to add basically dead code which never gets executed here? I certainly can't think of any scenario where you'd have no interface to steal the MAC address/EUI64 from and you'd have to fall back to random identifiers? -- Pekka Savola "You each name yourselves king, yet the Netcore Oy kingdom bleeds." Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings From shemminger@osdl.org Tue Sep 2 08:28:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 08:29:12 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82FSaWZ008584 for ; Tue, 2 Sep 2003 08:28:38 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h82FSJo24319; Tue, 2 Sep 2003 08:28:19 -0700 Date: Tue, 2 Sep 2003 08:28:07 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: Bart De Schuymer , greearb@candelatech.com, netdev@oss.sgi.com Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device Message-Id: <20030902082807.0e18fe76.shemminger@osdl.org> In-Reply-To: <20030830203043.0eb1a660.davem@redhat.com> References: <200308301504.03241.bdschuym@pandora.be> <20030830203043.0eb1a660.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5499 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, 30 Aug 2003 20:30:43 -0700 "David S. Miller" wrote: > On Sat, 30 Aug 2003 15:04:03 +0200 > Bart De Schuymer wrote: > > > The patch below disables making vlan devices on top of bridge > > devices, f.e. br0.12 would be impossible. > > I don't think disallowing this merely for the sake of > implementation convenience is such a good idea. And > from other people's comments, such setups might even > be useful. Bridge of a VLAN makes sense and is done. VLAN of a bridge might be done by someone for redundancy or testing. Don't apply the patch, can't see the harm in allowing either case. From akpm@osdl.org Tue Sep 2 09:54:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 09:54:58 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82GsPWZ014728 for ; Tue, 2 Sep 2003 09:54:26 -0700 Received: from dhcp-140-192.pao.digeo.com (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h82GsJo08121; Tue, 2 Sep 2003 09:54:19 -0700 Date: Tue, 2 Sep 2003 09:37:42 -0700 From: Andrew Morton To: netdev@oss.sgi.com Cc: mcousin@sigma.fr Subject: Fw: [Bugme-new] [Bug 1176] New: icmp redirect shuts connexions Message-Id: <20030902093742.20ea5d2d.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5500 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Begin forwarded message: Date: Tue, 2 Sep 2003 08:49:47 -0700 From: bugme-daemon@osdl.org To: bugme-new@lists.osdl.org Subject: [Bugme-new] [Bug 1176] New: icmp redirect shuts connexions http://bugme.osdl.org/show_bug.cgi?id=1176 Summary: icmp redirect shuts connexions Kernel Version: 2.6.0-test4 Status: NEW Severity: normal Owner: bugme-janitors@lists.osdl.org Submitter: mcousin@sigma.fr Distribution: Gentoo Hardware Environment: PIV 1.7 GHz - 1Gb ns83820 network adapter Software Environment: 2.6.0-test4. gcc version 3.3.1 (Gentoo Linux 3.3.1, propolice). glibc 2.3.2. Problem Description: Connection are dropped every time I get an icmp_redirect Steps to reproduce: Log into a server using the wrong router as your default route. You get an icmp redirect, and manage to connect. At the next icmp_redirect you receive, connexions are lost. I've tested this with having an IRC connexion to the 'mercure' machine . After about 10 minutes, I see a new ICMP redirect arriving (the route cache has expired ?) 64 bytes from mercure.sigma.fr (192.168.1.232): icmp_seq=501 ttl=252 time=0.565 ms 64 bytes from mercure.sigma.fr (192.168.1.232): icmp_seq=503 ttl=252 time=0.575 ms >From 89.133.2.200: icmp_seq=504 Redirect Host(New nexthop: fwsigma.sigma.fr (89.133.2.1)) 64 bytes from mercure.sigma.fr (192.168.1.232): icmp_seq=504 ttl=252 time=1.61 ms 64 bytes from mercure.sigma.fr (192.168.1.232): icmp_seq=505 ttl=252 time=0.596 ms from route -C : before the redirect : marc root # route -C | grep mercure marc mercure.sigma.f fwsigma.sigma.f 0 0 5 eth0 mercure.sigma.f marc marc l 0 0 4 lo marc mercure.sigma.f fwsigma.sigma.f 0 0 470 eth0 marc mercure.sigma.f fwsigma.sigma.f 0 2 5 eth0 mercure.sigma.f marc marc l 0 0 525 lo after the redirect: marc root # route -C | grep mercure mercure.sigma.f marc marc l 0 0 18 lo marc mercure.sigma.f fwsigma.sigma.f 0 0 6 eth0 marc mercure.sigma.f fwsigma.sigma.f 0 1 4 eth0 my routing table: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 89.0.0.0 * 255.0.0.0 U 0 0 0 eth0 loopback localhost 255.0.0.0 UG 0 0 0 lo default 89.133.2.200 0.0.0.0 UG 1 0 0 eth0 My 'usual' route is via 89.133.2.200. To get to mercure, I have to get through 'fwsigma' (89.133.2.1). As soon as I get the ICMP_REDIRECT packet, the connexion to the IRC server is lost. When I add a static route to mercure via fwsigma, the problem disappears... ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. From vnuorval@tcs.hut.fi Tue Sep 2 09:59:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 09:59:24 -0700 (PDT) Received: from smtp-1.hut.fi (root@smtp-1.hut.fi [130.233.228.91]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82GxHWZ015395 for ; Tue, 2 Sep 2003 09:59:18 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-1.hut.fi (8.12.9/8.12.9) with ESMTP id h82Gx8Qe022368; Tue, 2 Sep 2003 19:59:09 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 58C788001B8; Tue, 2 Sep 2003 19:59:08 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h82Gx89s001958; Tue, 2 Sep 2003 19:59:08 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h82Gx7RM001954; Tue, 2 Sep 2003 19:59:07 +0300 Date: Tue, 2 Sep 2003 19:59:07 +0300 (EEST) From: Ville Nuorvala To: Pekka Savola Cc: "David S. Miller" , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-1.hut.fi) X-DCC-HUTCC-Metrics: smtp-1.hut.fi 1165; Body=6 Fuz1=6 Fuz2=6 X-archive-position: 5501 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 On Tue, 2 Sep 2003, Pekka Savola wrote: > Two comments: > > + /* try to inherit EUI64 from another device */ > + for (dev = dev_base; dev; dev = dev->next) { > + if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) { > + addrconf_add_linklocal(idev, &addr); > + return; > + > > ==> does this really inherit _EUI64_, *or* MAC address (or something like > it) to derive an EUI64? Note that there is a significant difference when > you've configured manually e.g. 3ffe:ffff:f00:ba::1 on a device, and the > case when you've auto-configured the interface identifier from the MAC > address of the device. ipv6_generate_eui64() derives the interface identifier from the MAC address on ARPHRD_{ETHER,FDDI,IEEE802_TR,ARCNET} interfaces, but doesn't do anything for other types of devices > ==> my question is: as the former method to steal an EUI64 should succeed > pretty much always, is it useful to add basically dead code which never > gets executed here? I certainly can't think of any scenario where you'd > have no interface to steal the MAC address/EUI64 from and you'd have to > fall back to random identifiers? If the node doesn't have an Ethernet (etc.) NIC it won't get a valid identifier from ipv6_generate_eui64() and has to resort to something else, for example generating a random address. An alternative would be to use ipv6_inherit_eui64(), which just copies the 64-bit suffix from the first link-local address it can find. This includes both manually and auto-configured addresses, which means the risk of duplicate addresses might be (I assume) greater than in the random address case. Regards, Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From shemminger@osdl.org Tue Sep 2 10:43:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 10:44:15 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82HheWZ018933 for ; Tue, 2 Sep 2003 10:43:41 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h82HhKo17095; Tue, 2 Sep 2003 10:43:21 -0700 Date: Tue, 2 Sep 2003 10:43:08 -0700 From: Stephen Hemminger To: chas williams Cc: netdev@oss.sgi.com Subject: [RFT] covert br2684 to seq_file Message-Id: <20030902104308.08ce3fa4.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5502 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 Convert the /proc/net/atm/br2684 to seq_file interface. It builds and runs, but without any real atm hardware the table is empty... Patch is against 2.6-test4 bk latest. diff -Nru a/net/atm/br2684.c b/net/atm/br2684.c --- a/net/atm/br2684.c Tue Sep 2 10:37:52 2003 +++ b/net/atm/br2684.c Tue Sep 2 10:37:52 2003 @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -666,31 +667,57 @@ return -ENOIOCTLCMD; } -/* Never put more than 256 bytes in at once */ -static int br2684_proc_engine(loff_t pos, char *buf) +#ifdef CONFIG_PROC_FS +static void *br2684_seq_start(struct seq_file *seq, loff_t *pos) { - struct list_head *lhd, *lhc; - struct net_device *net_dev; - struct br2684_dev *brdev; - struct br2684_vcc *brvcc; - list_for_each(lhd, &br2684_devs) { - net_dev = list_entry_brdev(lhd); - brdev = BRPRIV(net_dev); - if (pos-- == 0) - return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:" - "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, - brdev->number, - net_dev->dev_addr[0], - net_dev->dev_addr[1], - net_dev->dev_addr[2], - net_dev->dev_addr[3], - net_dev->dev_addr[4], - net_dev->dev_addr[5], - brdev->mac_was_set ? "set" : "auto"); - list_for_each(lhc, &brdev->brvccs) { - brvcc = list_entry_brvcc(lhc); - if (pos-- == 0) - return sprintf(buf, " vcc %d.%d.%d: encaps=%s" + loff_t offs = 0; + struct br2684_dev *brd; + + read_lock(&devs_lock); + + list_for_each_entry(brd, &br2684_devs, br2684_devs) { + if (offs == *pos) + return brd; + ++offs; + } + return NULL; +} + +static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct br2684_dev *brd = v; + + ++*pos; + + brd = list_entry(brd->br2684_devs.next, + struct br2684_dev, br2684_devs); + return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; +} + +static void br2684_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&devs_lock); +} + +static int br2684_seq_show(struct seq_file *seq, void *v) +{ + const struct br2684_dev *brdev = v; + const struct net_device *net_dev = brdev->net_dev; + const struct br2684_vcc *brvcc; + + seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:" + "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, + brdev->number, + net_dev->dev_addr[0], + net_dev->dev_addr[1], + net_dev->dev_addr[2], + net_dev->dev_addr[3], + net_dev->dev_addr[4], + net_dev->dev_addr[5], + brdev->mac_was_set ? "set" : "auto"); + + list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { + seq_printf(seq, " vcc %d.%d.%d: encaps=%s" #ifndef FASTER_VERSION ", failed copies %u/%u" #endif /* FASTER_VERSION */ @@ -711,63 +738,41 @@ #undef bs #undef b1 #endif /* CONFIG_ATM_BR2684_IPFILTER */ - } } return 0; } -static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count, - loff_t *pos) +static struct seq_operations br2684_seq_ops = { + .start = br2684_seq_start, + .next = br2684_seq_next, + .stop = br2684_seq_stop, + .show = br2684_seq_show, +}; + +static int br2684_proc_open(struct inode *inode, struct file *file) { - unsigned long page; - int len = 0, x, left; - page = get_zeroed_page(GFP_KERNEL); - if (!page) - return -ENOMEM; - left = PAGE_SIZE - 256; - if (count < left) - left = count; - read_lock(&devs_lock); - for (;;) { - x = br2684_proc_engine(*pos, &((char *) page)[len]); - if (x == 0) - break; - if (x > left) - /* - * This should only happen if the user passed in - * a "count" too small for even one line - */ - x = -EINVAL; - if (x < 0) { - len = x; - break; - } - len += x; - left -= x; - (*pos)++; - if (left < 256) - break; - } - read_unlock(&devs_lock); - if (len > 0 && copy_to_user(buf, (char *) page, len)) - len = -EFAULT; - free_page(page); - return len; + return seq_open(file, &br2684_seq_ops); } static struct file_operations br2684_proc_operations = { .owner = THIS_MODULE, - .read = br2684_proc_read, + .open = br2684_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ +#endif static int __init br2684_init(void) { +#ifdef CONFIG_PROC_FS struct proc_dir_entry *p; if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL) return -ENOMEM; p->proc_fops = &br2684_proc_operations; +#endif br2684_ioctl_set(br2684_ioctl); return 0; } From bdschuym@pandora.be Tue Sep 2 11:05:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 11:05:47 -0700 (PDT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82I50WZ020297 for ; Tue, 2 Sep 2003 11:05:01 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id 9AC3F38551; Tue, 2 Sep 2003 19:32:45 +0200 (MEST) Received: from 192.168.123.138 (D5763FDE.kabel.telenet.be [213.118.63.222]) by adicia.telenet-ops.be (Postfix) with ESMTP id 5C0C4380F4; Tue, 2 Sep 2003 19:32:37 +0200 (MEST) From: Bart De Schuymer To: Stephen Hemminger , "David S. Miller" Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device Date: Tue, 2 Sep 2003 19:32:37 +0200 User-Agent: KMail/1.5 Cc: greearb@candelatech.com, netdev@oss.sgi.com References: <200308301504.03241.bdschuym@pandora.be> <20030830203043.0eb1a660.davem@redhat.com> <20030902082807.0e18fe76.shemminger@osdl.org> In-Reply-To: <20030902082807.0e18fe76.shemminger@osdl.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309021932.37224.bdschuym@pandora.be> X-archive-position: 5503 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 On Tuesday 02 September 2003 17:28, Stephen Hemminger wrote: > Bridge of a VLAN makes sense and is done. > VLAN of a bridge might be done by someone for redundancy or testing. > > Don't apply the patch, can't see the harm in allowing either case. OK. But isn't br0.15 supposed to work like this: all vlan tagged traffic with tag different from 15 is discarded, all non-tagged traffic is given to br0. This is how it works with a vlan on top of physical devices like eth0 if I read the code correctly, but it doesn't currently work like that for vlan on top of a logical bridge device. The vlan code only sees tagged packets if the packets are destined for the bridge box itself, so bridged traffic is unaffected. This is why I think a vlan device on top of br0 in Linux is currently useless. cheers, Bart From davem@pizda.ninka.net Tue Sep 2 11:25:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 11:25:13 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82IP5WZ021757 for ; Tue, 2 Sep 2003 11:25:05 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA13023; Tue, 2 Sep 2003 11:15:43 -0700 Date: Tue, 2 Sep 2003 11:15:43 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: chas@cmf.nrl.navy.mil, netdev@oss.sgi.com Subject: Re: [RFT] covert br2684 to seq_file Message-Id: <20030902111543.559452dd.davem@redhat.com> In-Reply-To: <20030902104308.08ce3fa4.shemminger@osdl.org> References: <20030902104308.08ce3fa4.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5504 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 Sep 2003 10:43:08 -0700 Stephen Hemminger wrote: > Convert the /proc/net/atm/br2684 to seq_file interface. > It builds and runs, but without any real atm hardware the table > is empty... Looks fine to me, Chas? From shemminger@osdl.org Tue Sep 2 11:58:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 11:58:59 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82IwPWZ030873 for ; Tue, 2 Sep 2003 11:58:25 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h82IwDo03791; Tue, 2 Sep 2003 11:58:13 -0700 Date: Tue, 2 Sep 2003 11:58:00 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] af_netlink - convert to seq_file Message-Id: <20030902115800.23ebdaeb.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5505 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 Convert af_netlink to use seq_file interface. Tested on 2.6.0-test4 bk latest. diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c --- a/net/netlink/af_netlink.c Tue Sep 2 11:56:11 2003 +++ b/net/netlink/af_netlink.c Tue Sep 2 11:56:11 2003 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -964,62 +965,108 @@ #endif - #ifdef CONFIG_PROC_FS -static int netlink_read_proc(char *buffer, char **start, off_t offset, - int length, int *eof, void *data) +static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) { - off_t pos=0; - off_t begin=0; - int len=0; int i; struct sock *s; struct hlist_node *node; - - len+= sprintf(buffer,"sk Eth Pid Groups " - "Rmem Wmem Dump Locks\n"); - + loff_t off = 0; + for (i=0; iprivate = (void *) i; + return s; + } + ++off; + } + } + return NULL; +} - len+=sprintf(buffer+len,"%p %-3d %-6d %08x %-8d %-8d %p %d", - s, - s->sk_protocol, - nlk->pid, - nlk->groups, - atomic_read(&s->sk_rmem_alloc), - atomic_read(&s->sk_wmem_alloc), - nlk->cb, - atomic_read(&s->sk_refcnt) - ); +static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) +{ + read_lock(&nl_table_lock); + return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : (void *) 1; +} + +static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct sock *s; + + ++*pos; - buffer[len++]='\n'; + if (v == (void *) 1) + return netlink_seq_socket_idx(seq, 0); - pos=begin+len; - if(posoffset+length) { - read_unlock(&nl_table_lock); - goto done; + s = sk_next(v); + if (!s) { + int i = (int) seq->private; + + while (++i < MAX_LINKS) { + s = sk_head(&nl_table[i]); + if (s) { + seq->private = (void *) i; + break; } } - read_unlock(&nl_table_lock); } - *eof = 1; + return s; +} -done: - *start=buffer+(offset-begin); - len-=(offset-begin); - if(len>length) - len=length; - if(len<0) - len=0; - return len; +static void netlink_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&nl_table_lock); +} + + +static int netlink_seq_show(struct seq_file *seq, void *v) +{ + if (v == (void *)1) + seq_puts(seq, + "sk Eth Pid Groups " + "Rmem Wmem Dump Locks\n"); + else { + struct sock *s = v; + struct netlink_opt *nlk = nlk_sk(s); + + seq_printf(seq, "%p %-3d %-6d %08x %-8d %-8d %p %d\n", + s, + s->sk_protocol, + nlk->pid, + nlk->groups, + atomic_read(&s->sk_rmem_alloc), + atomic_read(&s->sk_wmem_alloc), + nlk->cb, + atomic_read(&s->sk_refcnt) + ); + + } + return 0; } + +struct seq_operations netlink_seq_ops = { + .start = netlink_seq_start, + .next = netlink_seq_next, + .stop = netlink_seq_stop, + .show = netlink_seq_show, +}; + + +static int netlink_seq_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &netlink_seq_ops); +} + +static struct file_operations netlink_seq_fops = { + .owner = THIS_MODULE, + .open = netlink_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + #endif int netlink_register_notifier(struct notifier_block *nb) @@ -1069,7 +1116,7 @@ } sock_register(&netlink_family_ops); #ifdef CONFIG_PROC_FS - create_proc_read_entry("net/netlink", 0, 0, netlink_read_proc, NULL); + proc_net_fops_create("netlink", 0, &netlink_seq_fops); #endif /* The netlink device handler may be needed early. */ rtnetlink_init(); @@ -1079,7 +1126,7 @@ static void __exit netlink_proto_exit(void) { sock_unregister(PF_NETLINK); - remove_proc_entry("net/netlink", NULL); + proc_net_remove("netlink"); } core_initcall(netlink_proto_init); From davem@pizda.ninka.net Tue Sep 2 12:07:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:07:11 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82J78WZ032050 for ; Tue, 2 Sep 2003 12:07:08 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA13138; Tue, 2 Sep 2003 11:57:19 -0700 Date: Tue, 2 Sep 2003 11:57:18 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: netdev@oss.sgi.com Subject: Re: [PATCH] af_netlink - convert to seq_file Message-Id: <20030902115718.4f42da2b.davem@redhat.com> In-Reply-To: <20030902115800.23ebdaeb.shemminger@osdl.org> References: <20030902115800.23ebdaeb.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5506 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 Sep 2003 11:58:00 -0700 Stephen Hemminger wrote: > Convert af_netlink to use seq_file interface. > Tested on 2.6.0-test4 bk latest. Applied, thanks Stephen. From mitch@sfgoth.com Tue Sep 2 12:07:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:08:02 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82J7dWZ032225 for ; Tue, 2 Sep 2003 12:07:59 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h82JEYkV069289; Tue, 2 Sep 2003 12:14:34 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h82JEXcS069288; Tue, 2 Sep 2003 12:14:33 -0700 (PDT) (envelope-from mitch) Date: Tue, 2 Sep 2003 12:14:33 -0700 From: Mitchell Blank Jr To: Stephen Hemminger Cc: chas williams , netdev@oss.sgi.com, Francois Romieu Subject: Re: [RFT] covert br2684 to seq_file Message-ID: <20030902191433.GB67783@gaz.sfgoth.com> References: <20030902104308.08ce3fa4.shemminger@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030902104308.08ce3fa4.shemminger@osdl.org> User-Agent: Mutt/1.4.1i X-archive-position: 5507 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev Stephen Hemminger wrote: > Convert the /proc/net/atm/br2684 to seq_file interface. > It builds and runs, but without any real atm hardware the table > is empty... FYI - Francios Romieu has patch for converting much of net/atm/*.c to seq_file which will probably integrated soon (I think they're still working out some nits w/ Chas; not sure what the status is currently) You probably should coordinate any seq_file work in the ATM code with them to avoid any duplicated effort. -Mitch From shemminger@osdl.org Tue Sep 2 12:11:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:12:13 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82JBcWZ000849 for ; Tue, 2 Sep 2003 12:11:39 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h82JBRo06749; Tue, 2 Sep 2003 12:11:27 -0700 Date: Tue, 2 Sep 2003 12:11:14 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] ethertap update Message-Id: <20030902121114.4f489216.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5508 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 Updates to ethertap includes these changes from viro * switched ethertap to dynamic allocation * ethertap: embedded ->priv * ethertap: fixed resource leaks on failure exits and from me * get it out of the static device list completely. * add dependency on NETLINK_DEV * not really obsolete yet * configurable number of interfaces Patch against 2.6.0-test4 diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig --- a/drivers/net/Kconfig Tue Sep 2 12:07:05 2003 +++ b/drivers/net/Kconfig Tue Sep 2 12:07:05 2003 @@ -132,8 +132,8 @@ If you don't know what to use this for, you don't need it. config ETHERTAP - tristate "Ethertap network tap (OBSOLETE)" - depends on NETDEVICES && EXPERIMENTAL + tristate "Ethertap network tap" + depends on NETDEVICES && EXPERIMENTAL && NETLINK_DEV ---help--- If you say Y here (and have said Y to "Kernel/User network link driver", above) and create a character special file /dev/tap0 with diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c --- a/drivers/net/Space.c Tue Sep 2 12:07:05 2003 +++ b/drivers/net/Space.c Tue Sep 2 12:07:05 2003 @@ -89,7 +89,6 @@ extern int bionet_probe(struct net_device *); extern int pamsnet_probe(struct net_device *); extern int cs89x0_probe(struct net_device *dev); -extern int ethertap_probe(struct net_device *dev); extern int hplance_probe(struct net_device *dev); extern int bagetlance_probe(struct net_device *); extern int mvme147lance_probe(struct net_device *dev); @@ -386,17 +385,6 @@ return 0; return -ENODEV; } - -#ifdef CONFIG_ETHERTAP -static struct net_device tap0_dev = { - .name = "tap0", - .base_addr = NETLINK_TAPBASE, - .next = NEXT_DEV, - .init = ethertap_probe, -}; -#undef NEXT_DEV -#define NEXT_DEV (&tap0_dev) -#endif #ifdef CONFIG_SDLA extern int sdla_init(struct net_device *); diff -Nru a/drivers/net/ethertap.c b/drivers/net/ethertap.c --- a/drivers/net/ethertap.c Tue Sep 2 12:07:05 2003 +++ b/drivers/net/ethertap.c Tue Sep 2 12:07:05 2003 @@ -33,7 +33,6 @@ * Index to functions. */ -int ethertap_probe(struct net_device *dev); static int ethertap_open(struct net_device *dev); static int ethertap_start_xmit(struct sk_buff *skb, struct net_device *dev); static int ethertap_close(struct net_device *dev); @@ -45,7 +44,11 @@ static int ethertap_debug; -static struct net_device *tap_map[32]; /* Returns the tap device for a given netlink */ +static int max_taps = 1; +MODULE_PARM(max_taps, "i"); +MODULE_PARM_DESC(max_taps,"Max number of ethernet tap devices"); + +static struct net_device **tap_map; /* Returns the tap device for a given netlink */ /* * Board-specific info in dev->priv. @@ -64,25 +67,29 @@ * To call this a probe is a bit misleading, however for real * hardware it would have to check what was present. */ - -int __init ethertap_probe(struct net_device *dev) +static int __init ethertap_probe(int unit) { + struct net_device *dev; + int err = -ENOMEM; + + dev = alloc_netdev(sizeof(struct net_local), "tap%d", + ether_setup); + + if (!dev) + goto out; + SET_MODULE_OWNER(dev); + sprintf(dev->name, "tap%d", unit); + dev->base_addr = unit + NETLINK_TAPBASE; + + netdev_boot_setup_check(dev); + memcpy(dev->dev_addr, "\xFE\xFD\x00\x00\x00\x00", 6); if (dev->mem_start & 0xf) ethertap_debug = dev->mem_start & 0x7; /* - * Initialize the device structure. - */ - - dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); - if (dev->priv == NULL) - return -ENOMEM; - memset(dev->priv, 0, sizeof(struct net_local)); - - /* * The tap specific entries in the device structure. */ @@ -94,17 +101,19 @@ dev->set_multicast_list = set_multicast_list; #endif - /* - * Setup the generic properties - */ - - ether_setup(dev); - dev->tx_queue_len = 0; dev->flags|=IFF_NOARP; - tap_map[dev->base_addr]=dev; + err = register_netdev(dev); + if (err) + goto out1; + + tap_map[unit]=dev; return 0; +out1: + kfree(dev); +out: + return err; } /* @@ -116,11 +125,12 @@ struct net_local *lp = (struct net_local*)dev->priv; if (ethertap_debug > 2) - printk("%s: Doing ethertap_open()...", dev->name); + printk(KERN_DEBUG "%s: Doing ethertap_open()...", dev->name); lp->nl = netlink_kernel_create(dev->base_addr, ethertap_rx); if (lp->nl == NULL) return -ENOBUFS; + netif_start_queue(dev); return 0; } @@ -302,7 +312,7 @@ } if (ethertap_debug > 3) - printk("%s: ethertap_rx()\n", dev->name); + printk(KERN_DEBUG "%s: ethertap_rx()\n", dev->name); while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) ethertap_rx_skb(skb, dev); @@ -314,7 +324,7 @@ struct sock *sk = lp->nl; if (ethertap_debug > 2) - printk("%s: Shutting down.\n", dev->name); + printk(KERN_DEBUG "%s: Shutting down.\n", dev->name); netif_stop_queue(dev); @@ -332,45 +342,49 @@ return &lp->stats; } -#ifdef MODULE - -static int unit; -MODULE_PARM(unit,"i"); -MODULE_PARM_DESC(unit,"Ethertap device number"); -static struct net_device dev_ethertap = +int __init ethertap_init(void) { - .name = " ", - .init = ethertap_probe -}; + int i, err = 0; -int init_module(void) -{ - dev_ethertap.base_addr=unit+NETLINK_TAPBASE; - sprintf(dev_ethertap.name,"tap%d",unit); - if (dev_get(dev_ethertap.name)) - { - printk(KERN_INFO "%s already loaded.\n", dev_ethertap.name); - return -EBUSY; - } - if (register_netdev(&dev_ethertap) != 0) - return -EIO; - return 0; -} - -void cleanup_module(void) -{ - tap_map[dev_ethertap.base_addr]=NULL; - unregister_netdev(&dev_ethertap); + /* netlink can only hande 16 entries unless modified */ + if (max_taps > MAX_LINKS - NETLINK_TAPBASE) + return -E2BIG; - /* - * Free up the private structure. - */ + tap_map = kmalloc(sizeof(struct net_device *)*max_taps, GFP_KERNEL); + if (!tap_map) + return -ENOMEM; - kfree(dev_ethertap.priv); - dev_ethertap.priv = NULL; /* gets re-allocated by ethertap_probe */ + for (i = 0; i < max_taps; i++) { + err = ethertap_probe(i); + if (err) { + while (--i > 0) { + unregister_netdev(tap_map[i]); + free_netdev(tap_map[i]); + } + break; + } + } + if (err) + kfree(tap_map); + return err; +} +module_init(ethertap_init); + +void __exit ethertap_cleanup(void) +{ + int i; + + for (i = 0; i < max_taps; i++) { + struct net_device *dev = tap_map[i]; + if (dev) { + tap_map[i] = NULL; + unregister_netdev(dev); + free_netdev(dev); + } + } + kfree(tap_map); } +module_exit(ethertap_cleanup); -#endif /* MODULE */ MODULE_LICENSE("GPL"); - From khc@pm.waw.pl Tue Sep 2 12:17:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:17:59 -0700 (PDT) Received: from hq.pm.waw.pl (hq.pm.waw.pl [195.116.170.10]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82JHOWZ001535 for ; Tue, 2 Sep 2003 12:17:26 -0700 Received: by hq.pm.waw.pl (Postfix, from userid 10) id ADD3D3184; Tue, 2 Sep 2003 21:17:21 +0200 (CEST) Received: by defiant.pm.waw.pl (Postfix, from userid 500) id ABF3F3C815; Tue, 2 Sep 2003 20:24:35 +0200 (CEST) To: Bart De Schuymer Cc: Stephen Hemminger , "David S. Miller" , greearb@candelatech.com, netdev@oss.sgi.com Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device References: <200308301504.03241.bdschuym@pandora.be> <20030830203043.0eb1a660.davem@redhat.com> <20030902082807.0e18fe76.shemminger@osdl.org> <200309021932.37224.bdschuym@pandora.be> From: Krzysztof Halasa Date: 02 Sep 2003 20:24:35 +0200 In-Reply-To: <200309021932.37224.bdschuym@pandora.be> Message-ID: Lines: 19 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 5509 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 Bart De Schuymer writes: > OK. But isn't br0.15 supposed to work like this: all vlan tagged traffic > with > tag different from 15 is discarded, all non-tagged traffic is given to br0. Actually I think non-VLAN15 traffic shouldn't make it to br0.15 in the first place, the same with physical ethernet and anything like that. > The vlan code only sees tagged packets if the > packets are destined for the bridge box itself, so bridged traffic is > unaffected. Sure. Do you mean packets received from ethernet interface (br0 port)? They go to br0, of course. I don't see anything special here. I understand you don't need VLAN support for trunk bridging. You need it for locally accessing VLANs (trunk members) only. -- Krzysztof Halasa, B*FH From davem@pizda.ninka.net Tue Sep 2 12:22:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:22:47 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82JMiWZ002122 for ; Tue, 2 Sep 2003 12:22:45 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA13215; Tue, 2 Sep 2003 12:13:24 -0700 Date: Tue, 2 Sep 2003 12:13:24 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: netdev@oss.sgi.com Subject: Re: [PATCH] ethertap update Message-Id: <20030902121324.2d4c05f7.davem@redhat.com> In-Reply-To: <20030902121114.4f489216.shemminger@osdl.org> References: <20030902121114.4f489216.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5510 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 Sep 2003 12:11:14 -0700 Stephen Hemminger wrote: > Updates to ethertap Looks good, applied. Thanks Stephen. From bdschuym@pandora.be Tue Sep 2 12:45:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:45:36 -0700 (PDT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82JipWZ003573 for ; Tue, 2 Sep 2003 12:44:52 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id B0943385AB; Tue, 2 Sep 2003 21:16:42 +0200 (MEST) Received: from 192.168.123.138 (D5763FDE.kabel.telenet.be [213.118.63.222]) by adicia.telenet-ops.be (Postfix) with ESMTP id 7E01A38375; Tue, 2 Sep 2003 21:16:41 +0200 (MEST) From: Bart De Schuymer To: Arnaldo Carvalho de Melo , netfilter-devel@lists.netfilter.org Subject: Re: ipt_physdev.c alignment problems on parisc64 Date: Tue, 2 Sep 2003 21:16:41 +0200 User-Agent: KMail/1.5 Cc: Linux Networking Development Mailing List References: <20030902143050.GC3398@conectiva.com.br> In-Reply-To: <20030902143050.GC3398@conectiva.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309022116.41697.bdschuym@pandora.be> X-archive-position: 5511 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 On Tuesday 02 September 2003 16:30, Arnaldo Carvalho de Melo wrote: > The 1.786.1.54 changeset (i.e. the initial ipt_physdev.c one 8) created Does this fix it? cheers, Bart --- linux-2.6.0-test4/include/linux/netfilter_ipv4/ipt_physdev.h.old 2003-09-02 21:11:12.000000000 +0200 +++ linux-2.6.0-test4/include/linux/netfilter_ipv4/ipt_physdev.h 2003-09-02 21:12:30.000000000 +0200 @@ -15,7 +15,7 @@ struct ipt_physdev_info { u_int8_t invert; u_int8_t bitmask; - char physindev[IFNAMSIZ]; + char physindev[IFNAMSIZ] __attribute__ ((aligned (__alignof__(unsigned long)))); char in_mask[IFNAMSIZ]; char physoutdev[IFNAMSIZ]; char out_mask[IFNAMSIZ]; From romieu@fr.zoreil.com Tue Sep 2 12:58:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 12:59:05 -0700 (PDT) Received: from fr.zoreil.com (electric-eye.fr.zoreil.com [213.41.134.224]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82JwUWZ004607 for ; Tue, 2 Sep 2003 12:58:31 -0700 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 h82JqwxA028287; Tue, 2 Sep 2003 21:52:59 +0200 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id h82Jqwbh028286; Tue, 2 Sep 2003 21:52:58 +0200 Date: Tue, 2 Sep 2003 21:52:58 +0200 From: Francois Romieu To: Mitchell Blank Jr Cc: Stephen Hemminger , chas williams , netdev@oss.sgi.com Subject: Re: [RFT] covert br2684 to seq_file Message-ID: <20030902215258.A26380@electric-eye.fr.zoreil.com> References: <20030902104308.08ce3fa4.shemminger@osdl.org> <20030902191433.GB67783@gaz.sfgoth.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030902191433.GB67783@gaz.sfgoth.com>; from mitch@sfgoth.com on Tue, Sep 02, 2003 at 12:14:33PM -0700 X-archive-position: 5512 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 Mitchell Blank Jr : [...] > FYI - Francios Romieu has patch for converting much of net/atm/*.c to seq_file > which will probably integrated soon (I think they're still working out > some nits w/ Chas; not sure what the status is currently) You probably should > coordinate any seq_file work in the ATM code with them to avoid any duplicated > effort. I have sent Chas a set of patches against 2.6.0-test4 (supposedly) integrating its comments this sunday. If it isn't merged for 2.6.0-test5, I'll send an update to remind people that testing would help. The patches address only net/atm/proc.c. I have no plan for others modifications in the atm area right now as my atm TODO is probably quite outdated. -- Ueimor From bdschuym@pandora.be Tue Sep 2 13:02:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 13:03:27 -0700 (PDT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82K2rWZ005650 for ; Tue, 2 Sep 2003 13:02:54 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id DB71A37FB4; Tue, 2 Sep 2003 22:02:52 +0200 (MEST) Received: from 192.168.123.138 (D5763FDE.kabel.telenet.be [213.118.63.222]) by adicia.telenet-ops.be (Postfix) with ESMTP id 961D338074; Tue, 2 Sep 2003 22:02:51 +0200 (MEST) From: Bart De Schuymer To: Krzysztof Halasa Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device Date: Tue, 2 Sep 2003 22:02:52 +0200 User-Agent: KMail/1.5 Cc: Stephen Hemminger , "David S. Miller" , greearb@candelatech.com, netdev@oss.sgi.com References: <200308301504.03241.bdschuym@pandora.be> <200309021932.37224.bdschuym@pandora.be> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309022202.52044.bdschuym@pandora.be> X-archive-position: 5513 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 On Tuesday 02 September 2003 20:24, Krzysztof Halasa wrote: > Actually I think non-VLAN15 traffic shouldn't make it to br0.15 in the > first place, the same with physical ethernet and anything like that. Obviously. The point is, vlan traffic with tag differing from 15 would be dropped if br0 were a physical device and not a logical bridge device. > > The vlan code only sees tagged packets if the > > packets are destined for the bridge box itself, so bridged traffic is > > unaffected. > > Sure. Do you mean packets received from ethernet interface (br0 port)? > They go to br0, of course. I don't see anything special here. > I understand you don't need VLAN support for trunk bridging. You need > it for locally accessing VLANs (trunk members) only. Umm, I probably should stop wasting people's time. Let me compare eth1.15 with br0.15, eth0 is a port of br0, eth1 is not, eth0.xx doesn't exist. Vlan tagged packet arrives on eth1: the vlan code gets to deal with the packet thanks to dev_add_pack(&vlan_packet_type). If the vlan tag differs from 15, the packet is dropped. To outsiders, the indev is eth0.15. Vlan tagged packet arrives on eth0: the bridge code gets to deal with the packet. So, to (most) outsiders the indev is br0. The bridge code happily forwards the packet, no matter what the vlan tag might be. I would find it logical if the indev would be br0.15 for vlan traffic over a bridge br0 when br0.15 exists, and that only vlan15 traffic gets forwarded. So, basically, I'd expect br0.15 to act like a bridge, since br0 is a bridge. cheers, Bart From acme@conectiva.com.br Tue Sep 2 13:03:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 13:04:14 -0700 (PDT) Received: from orion.netbank.com.br (orion.netbank.com.br [200.203.199.90]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82K3eWZ005800 for ; Tue, 2 Sep 2003 13:03:41 -0700 Received: from [200.181.138.124] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19uHV9-0001wM-00; Tue, 02 Sep 2003 17:11:43 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 154ABE723; Tue, 2 Sep 2003 20:03:36 +0000 (UTC) Date: Tue, 2 Sep 2003 17:03:36 -0300 From: Arnaldo Carvalho de Melo To: Bart De Schuymer Cc: netfilter-devel@lists.netfilter.org, Linux Networking Development Mailing List Subject: Re: ipt_physdev.c alignment problems on parisc64 Message-ID: <20030902200336.GQ3398@conectiva.com.br> References: <20030902143050.GC3398@conectiva.com.br> <200309022116.41697.bdschuym@pandora.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200309022116.41697.bdschuym@pandora.be> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 5514 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: acme@conectiva.com.br Precedence: bulk X-list: netdev Em Tue, Sep 02, 2003 at 09:16:41PM +0200, Bart De Schuymer escreveu: > On Tuesday 02 September 2003 16:30, Arnaldo Carvalho de Melo wrote: > > The 1.786.1.54 changeset (i.e. the initial ipt_physdev.c one 8) created > > Does this fix it? Thanks, I'll test it later, now I have most of my machines turned off while cleaning up this messy machine room. - Arnaldo From romieu@fr.zoreil.com Tue Sep 2 13:28:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 13:28:42 -0700 (PDT) Received: from fr.zoreil.com (electric-eye.fr.zoreil.com [213.41.134.224]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82KSNWZ007691 for ; Tue, 2 Sep 2003 13:28:24 -0700 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 h82KJPxA028656; Tue, 2 Sep 2003 22:19:25 +0200 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id h82KJPec028655; Tue, 2 Sep 2003 22:19:25 +0200 Date: Tue, 2 Sep 2003 22:19:25 +0200 From: Francois Romieu To: "David S. Miller" Cc: Stephen Hemminger , netdev@oss.sgi.com Subject: Re: [PATCH] ethertap update Message-ID: <20030902221925.B26380@electric-eye.fr.zoreil.com> References: <20030902121114.4f489216.shemminger@osdl.org> <20030902121324.2d4c05f7.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030902121324.2d4c05f7.davem@redhat.com>; from davem@redhat.com on Tue, Sep 02, 2003 at 12:13:24PM -0700 X-archive-position: 5515 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 [ethertap update] Apply on top of Stephen's patch. Balance alloc_netdev() with free_netdev(). drivers/net/ethertap.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -puN drivers/net/ethertap.c~ethertap-free_netdev drivers/net/ethertap.c --- linux-2.6.0-test4/drivers/net/ethertap.c~ethertap-free_netdev Tue Sep 2 22:13:55 2003 +++ linux-2.6.0-test4-fr/drivers/net/ethertap.c Tue Sep 2 22:14:49 2003 @@ -106,12 +106,12 @@ static int __init ethertap_probe(int un err = register_netdev(dev); if (err) - goto out1; + goto out_free; tap_map[unit]=dev; return 0; -out1: - kfree(dev); +out_free: + free_netdev(dev); out: return err; } _ From davem@pizda.ninka.net Tue Sep 2 13:31:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 13:31:16 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82KVBWZ008158 for ; Tue, 2 Sep 2003 13:31:11 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id NAA13444; Tue, 2 Sep 2003 13:21:45 -0700 Date: Tue, 2 Sep 2003 13:21:45 -0700 From: "David S. Miller" To: Francois Romieu Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] ethertap update Message-Id: <20030902132145.7fcaa9a7.davem@redhat.com> In-Reply-To: <20030902221925.B26380@electric-eye.fr.zoreil.com> References: <20030902121114.4f489216.shemminger@osdl.org> <20030902121324.2d4c05f7.davem@redhat.com> <20030902221925.B26380@electric-eye.fr.zoreil.com> X-Mailer: Sylpheed version 0.9.2 (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: 5516 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 Sep 2003 22:19:25 +0200 Francois Romieu wrote: > [ethertap update] > > Apply on top of Stephen's patch. > > Balance alloc_netdev() with free_netdev(). Applied, thank you. From sathissh_k@yahoo.co.in Tue Sep 2 13:57:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 13:58:19 -0700 (PDT) Received: from web8206.mail.in.yahoo.com (web8206.mail.in.yahoo.com [203.199.70.75]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82KviWZ009877 for ; Tue, 2 Sep 2003 13:57:45 -0700 Message-ID: <20030902205737.25903.qmail@web8206.mail.in.yahoo.com> Received: from [216.236.121.30] by web8206.mail.in.yahoo.com via HTTP; Tue, 02 Sep 2003 21:57:37 BST Date: Tue, 2 Sep 2003 21:57:37 +0100 (BST) From: =?iso-8859-1?q?sathish=20kumar?= Subject: Kernel programming - Hooking in TCP/IP To: netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 5517 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sathissh_k@yahoo.co.in Precedence: bulk X-list: netdev Hello, Iam interested in Linux Kernel Programming especially in TCP/IP stack implementation technique and redesigning. I have seen the TCP/IP stack implementation details in /net/ipv4/ . I would like to alter it for my needs. Like I would like to change the algorithm 'slowstart' to 'suddenstart'. To change this I just opened the tcp.c file from the directory that I mentioned above .But Iam confued to see that code. My problem is, from where to I have to change? And which is the entry point to do these kind of things. How to design TCP/IP stack in Linux?For this how to get/transmit frames from Datalink layer? And how to do Kernel Hooking in TCP/IP layer? Please kindly give some idea about this.And give some links for this kind of programming. Awaiting for Your Informative mail. regards, sathish. ________________________________________________________________________ Yahoo! India Promos: Win TVs, Bikes, DVD players & more! Go to http://in.promos.yahoo.com From yoshfuji@linux-ipv6.org Tue Sep 2 14:36:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 14:37:10 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82LaZWZ012362 for ; Tue, 2 Sep 2003 14:36:36 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h82Lb51M024770; Wed, 3 Sep 2003 06:37:06 +0900 Date: Wed, 03 Sep 2003 06:37:05 +0900 (JST) Message-Id: <20030903.063705.89449634.yoshfuji@linux-ipv6.org> To: davem@redhat.com Cc: vnuorval@tcs.hut.fi, pekkas@netcore.fi, usagi-core@linux-ipv6.org, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030902043534.05fc6586.davem@redhat.com> References: <20030901035134.2585aa79.davem@redhat.com> <20030902043534.05fc6586.davem@redhat.com> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5518 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev In article <20030902043534.05fc6586.davem@redhat.com> (at Tue, 2 Sep 2003 04:35:34 -0700), "David S. Miller" says: > On Mon, 1 Sep 2003 17:24:42 +0300 (EEST) > Ville Nuorvala wrote: > > > Ok, this incremental patch to my previous addrconf.c patch generates a > > link-local address to the IPv6 tunnel device. It first tries to inherit > > the EUI64 identifier of some other device and if this fails, uses a > > random interface id. > > Yoshfuji, do you mind if I apply his patch 5 and "5/5+1"? Well, I have a question and a comment. if (ifp->idev->cnf.forwarding == 0 && (dev->flags&IFF_LOOPBACK) == 0 && + dev->type != ARPHRD_TUNNEL6 && (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { struct in6_addr all_routers; Why? Comment: this strategy is the "default." We can (or even should) do this stretegy whenever we failed to ipv6_generate_eui64() in addrconf_dev_config(). -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From khc@pm.waw.pl Tue Sep 2 14:44:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 14:45:01 -0700 (PDT) Received: from hq.pm.waw.pl (hq.pm.waw.pl [195.116.170.10]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82LiPWZ013069 for ; Tue, 2 Sep 2003 14:44:27 -0700 Received: by hq.pm.waw.pl (Postfix, from userid 10) id 19C13322F; Tue, 2 Sep 2003 23:44:22 +0200 (CEST) Received: by defiant.pm.waw.pl (Postfix, from userid 500) id 9587A3C815; Tue, 2 Sep 2003 23:43:44 +0200 (CEST) To: Bart De Schuymer Cc: Stephen Hemminger , "David S. Miller" , greearb@candelatech.com, netdev@oss.sgi.com Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device References: <200308301504.03241.bdschuym@pandora.be> <200309021932.37224.bdschuym@pandora.be> <200309022202.52044.bdschuym@pandora.be> From: Krzysztof Halasa Date: 02 Sep 2003 23:43:44 +0200 In-Reply-To: <200309022202.52044.bdschuym@pandora.be> Message-ID: Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 5519 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 Bart De Schuymer writes: > Let me compare eth1.15 with br0.15, eth0 is a port of br0, eth1 is not, > eth0.xx doesn't exist. > > Vlan tagged packet arrives on eth1: the vlan code gets to deal with the > packet > thanks to dev_add_pack(&vlan_packet_type). If the vlan tag differs from 15, > the packet is dropped. To outsiders, the indev is eth0.15. Right. > Vlan tagged packet arrives on eth0: the bridge code gets to deal with the > packet. So, to (most) outsiders the indev is br0. The bridge code happily > forwards the packet, no matter what the vlan tag might be. Right. The bridge just bridges the packet based on dest MAC. > I would find it logical if the indev would be br0.15 for vlan traffic over a > bridge br0 when br0.15 exists, and that only vlan15 traffic gets forwarded. > So, basically, I'd expect br0.15 to act like a bridge, since br0 is a bridge. I would rather expect that br0 bridges all ethernet frames. br0.15 should behave like a "static VLAN" port on VLAN-aware switch. This is basically what VLAN-aware switches do with trunk and single VLAN ports (let alone VLAN filtering which isn't implemented here). If you have just one trunk port, don't add it (eth0) to the bridge. Add eth0.15 to the bridge instead. -- Krzysztof Halasa, B*FH From emann@mrv.com Tue Sep 2 15:00:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 15:01:25 -0700 (PDT) Received: from apollo.nbase.co.il (apollo.nbase.co.il [194.90.137.2]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82M0oWZ014202 for ; Tue, 2 Sep 2003 15:00:51 -0700 Received: from mrv.com ([194.90.137.91]) by apollo.nbase.co.il (Post.Office MTA v3.1.2 release (PO205-101c) ID# 0-44418U200L2S100) with ESMTP id AAA686; Wed, 3 Sep 2003 01:04:56 +0200 Message-ID: <3F552256.7000008@mrv.com> Date: Wed, 03 Sep 2003 01:05:58 +0200 From: Eran Mann User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: emann@opticalaccess.com CC: netdev@oss.sgi.com Subject: Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device References: <200308301504.03241.bdschuym@pandora.be> <20030830203043.0eb1a660.davem@redhat.com> <20030902082807.0e18fe76.shemminger@osdl.org> <200309021932.37224.bdschuym@pandora.be> In-Reply-To: <200309021932.37224.bdschuym@pandora.be> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5520 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: emann@mrv.com Precedence: bulk X-list: netdev Bart De Schuymer wrote: > > OK. But isn't br0.15 supposed to work like this: all vlan tagged traffic with > tag different from 15 is discarded, all non-tagged traffic is given to br0. > This is how it works with a vlan on top of physical devices like eth0 if I > read the code correctly, but it doesn't currently work like that for vlan on > top of a logical bridge device. The vlan code only sees tagged packets if the > packets are destined for the bridge box itself, so bridged traffic is > unaffected. > This is why I think a vlan device on top of br0 in Linux is currently useless. > > cheers, > Bart > Actually this behavior (bridge all VLANs for non-local traffic, allow incoming traffic only from configured VLANs) is exactly what you typicaly want in a bridged VLAN-aware LAN. Assume for instance that an enterprise has N departments and a VLAN (or a few) for each dept. You want only guys from the MIS or IT department to be able to manage the bridges, not all the departments. being able to configure br0.x in such a setup would save you a lot of configuration. Otherwise you'd have to - configure all the N VLANs on all the physical ports. - define ebtable rules on each non MIS VLAN, on each physical port, to block access to the bridge management. - define bridging between all the devices. Also if you want to run spanning-tree than you have a slight problem, since the STP code is not VLAN aware, and would send BPDUs on the VLAN devices as if they were normal ports, so you need to setup a br Regards, Eran. From andi@averellmail.firstfloor.org Tue Sep 2 16:01:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 16:01:39 -0700 (PDT) Received: from zero.aec.at (Marley.Wottel@zero.aec.at [193.170.194.10]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82N12WZ018289 for ; Tue, 2 Sep 2003 16:01:04 -0700 Received: from fred.muc.de (Eugene.Debs@localhost.localdomain [127.0.0.1]) by zero.aec.at (8.11.6/8.11.2) with ESMTP id h82N0qS10092 for ; Wed, 3 Sep 2003 01:00:53 +0200 Received: by fred.muc.de (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 2D13B5BBEE; Wed, 3 Sep 2003 01:00:57 +0200 (CEST) Date: Wed, 3 Sep 2003 01:00:57 +0200 From: Andi Kleen To: netdev@oss.sgi.com Subject: [PATCH] Remove X86_TSC dependency in net profile code Message-ID: <20030902230057.GA5424@averell> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 5521 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@muc.de Precedence: bulk X-list: netdev This removes one of the remaining users of CONFIG_X86_TSC Replace it with a runtime test instead. In some configurations it will be still properly optimized because cpu_has_tsc will expand to a constant then. This also makes it handle x86-64. I did not actually compile test this because net profile is commented out since a long time and doesn't compile. An alternative if noone comes up to fix it would be just to remove it completely. -Andi --- linux-2.6.0test4/include/net/profile.h-o 2003-05-27 03:00:21.000000000 +0200 +++ linux-2.6.0test4/include/net/profile.h 2003-08-29 19:48:11.000000000 +0200 @@ -29,11 +29,14 @@ extern struct timeval net_profile_adjust; extern void net_profile_irq_adjust(struct timeval *entered, struct timeval* leaved); -#ifdef CONFIG_X86_TSC +#ifdef CONFIG_X86 static inline void net_profile_stamp(struct timeval *pstamp) { - rdtsc(pstamp->tv_usec, pstamp->tv_sec); + if (cpu_has_tsc) + rdtsc(pstamp->tv_usec, pstamp->tv_sec); + else + do_gettimeofday(pstamp); } static inline void net_profile_accumulate(struct timeval *entered, From davem@pizda.ninka.net Tue Sep 2 16:07:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 16:07:53 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h82N7nWZ018964 for ; Tue, 2 Sep 2003 16:07:50 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id PAA14004; Tue, 2 Sep 2003 15:57:50 -0700 Date: Tue, 2 Sep 2003 15:57:50 -0700 From: "David S. Miller" To: Andi Kleen Cc: netdev@oss.sgi.com, kuznet@ms2.inr.ac.ru Subject: Re: [PATCH] Remove X86_TSC dependency in net profile code Message-Id: <20030902155750.31390a6e.davem@redhat.com> In-Reply-To: <20030902230057.GA5424@averell> References: <20030902230057.GA5424@averell> X-Mailer: Sylpheed version 0.9.2 (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: 5522 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 Sep 2003 01:00:57 +0200 Andi Kleen wrote: > I did not actually compile test this because net profile is commented > out since a long time and doesn't compile. An alternative if noone comes > up to fix it would be just to remove it completely. Alexey, time to remove the net profile stuff? From pekkas@netcore.fi Tue Sep 2 23:13:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 02 Sep 2003 23:13:34 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h836CwWZ012999 for ; Tue, 2 Sep 2003 23:12:59 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h836AYr14831; Wed, 3 Sep 2003 09:10:34 +0300 Date: Wed, 3 Sep 2003 09:10:34 +0300 (EEST) From: Pekka Savola To: Ville Nuorvala cc: "David S. Miller" , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5523 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pekkas@netcore.fi Precedence: bulk X-list: netdev On Tue, 2 Sep 2003, Ville Nuorvala wrote: > On Tue, 2 Sep 2003, Pekka Savola wrote: > > > Two comments: > > > > + /* try to inherit EUI64 from another device */ > > + for (dev = dev_base; dev; dev = dev->next) { > > + if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) { > > + addrconf_add_linklocal(idev, &addr); > > + return; > > + > > > > ==> does this really inherit _EUI64_, *or* MAC address (or something like > > it) to derive an EUI64? Note that there is a significant difference when > > you've configured manually e.g. 3ffe:ffff:f00:ba::1 on a device, and the > > case when you've auto-configured the interface identifier from the MAC > > address of the device. > > ipv6_generate_eui64() derives the interface identifier from the MAC > address on ARPHRD_{ETHER,FDDI,IEEE802_TR,ARCNET} interfaces, but doesn't > do anything for other types of devices Ok, but then the command should be: /* try to inherit MAC address from another device, to build an EUI64 */ > > ==> my question is: as the former method to steal an EUI64 should succeed > > pretty much always, is it useful to add basically dead code which never > > gets executed here? I certainly can't think of any scenario where you'd > > have no interface to steal the MAC address/EUI64 from and you'd have to > > fall back to random identifiers? > > If the node doesn't have an Ethernet (etc.) NIC it won't get a valid > identifier from ipv6_generate_eui64() and has to resort to something > else, for example generating a random address. And exactly how often does this happen? Eth (all variants), FDDI, TR, ARCnet.. what's missing? Does IPv6 even work with any other physical interfaces? :-) > An alternative would be to use ipv6_inherit_eui64(), which just copies the > 64-bit suffix from the first link-local address it can find. This includes > both manually and auto-configured addresses, which means the risk of > duplicate addresses might be (I assume) greater than in the random address > case. A possible twist here could be to copy only those whose universal/local bits indicate that that address was NOT manually configured, i.e..: 2001:708:10:40:207:e9ff:fe7b:259 ^ this one .. but as stated, I'm not sure this is really necessary anyway either. Note: it is desirable to have link-local addresses reasonably stable. Randomizing them may not be the right choice. -- Pekka Savola "You each name yourselves king, yet the Netcore Oy kingdom bleeds." Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings From yoshfuji@linux-ipv6.org Wed Sep 3 00:07:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 00:07:49 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8377DWZ029824 for ; Wed, 3 Sep 2003 00:07:14 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h8377Y1M028633; Wed, 3 Sep 2003 16:07:35 +0900 Date: Wed, 03 Sep 2003 16:07:33 +0900 (JST) Message-Id: <20030903.160733.06230402.yoshfuji@linux-ipv6.org> To: Ricky Beam , jfbeam@bluetronic.net Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org, davem@redhat.com Subject: Re: /proc/net/* read drops data From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5524 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev Hello. In article (at Wed, 27 Aug 2003 19:58:17 -0400 (EDT)), Ricky Beam says: > On Wed, 27 Aug 2003, Ricky Beam wrote: > >This smells like a simple "off by one" bug, but I've been too busy to go > >look at the code. > > Ah hah! it's a block size problem... netstat reads 1024 at a time. > > Using dd... > > [root:pts/5{9}]gir:~/[7:55pm]:dd if=/proc/net/udp bs=1024 | wc > 2+1 records in > 2+1 records out > 18 216 2304 > [root:pts/5{9}]gir:~/[7:56pm]:dd if=/proc/net/udp bs=2048 | wc > 1+1 records in > 1+1 records out > 19 228 2432 : Please try this patch. D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data Index: linux-2.6/net/ipv4/udp.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/udp.c,v retrieving revision 1.38 diff -u -r1.38 udp.c --- linux-2.6/net/ipv4/udp.c 14 Aug 2003 06:00:04 -0000 1.38 +++ linux-2.6/net/ipv4/udp.c 3 Sep 2003 05:30:52 -0000 @@ -1349,64 +1349,65 @@ /* ------------------------------------------------------------------------ */ #ifdef CONFIG_PROC_FS -static __inline__ struct sock *udp_get_bucket(struct seq_file *seq, loff_t *pos) +static struct sock *udp_get_first(struct seq_file *seq) { - int i; struct sock *sk; - struct hlist_node *node; - loff_t l = *pos; struct udp_iter_state *state = seq->private; - for (; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { - i = 0; + for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { + struct hlist_node *node; sk_for_each(sk, node, &udp_hash[state->bucket]) { - if (sk->sk_family != state->family) { - ++i; - continue; - } - if (l--) { - ++i; - continue; - } - *pos = i; - goto out; + if (sk->sk_family == state->family) + goto found; } } sk = NULL; -out: +found: return sk; } +static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) +{ + struct udp_iter_state *state = seq->private; + + do { + sk = sk_next(sk); +try_again: + ; + } while (sk && sk->sk_family != state->family); + + if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { + sk = sk_head(&udp_hash[state->bucket]); + goto try_again; + } + return sk; +} + +static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) +{ + struct sock *sk = udp_get_first(seq); + + if (sk) + while(pos && (sk = udp_get_next(seq, sk)) != NULL) + --pos; + return pos ? NULL : sk; +} + static void *udp_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&udp_hash_lock); - return *pos ? udp_get_bucket(seq, pos) : (void *)1; + return *pos ? udp_get_idx(seq, *pos-1) : (void *)1; } static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct sock *sk; - struct hlist_node *node; - struct udp_iter_state *state; - - if (v == (void *)1) { - sk = udp_get_bucket(seq, pos); - goto out; - } - state = seq->private; + if (v == (void *)1) + sk = udp_get_idx(seq, 0); + else + sk = udp_get_next(seq, v); - sk = v; - sk_for_each_continue(sk, node) - if (sk->sk_family == state->family) - goto out; - - if (++state->bucket >= UDP_HTABLE_SIZE) - goto out; - - *pos = 0; - sk = udp_get_bucket(seq, pos); -out: ++*pos; return sk; } -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From max@mail.sternwelten.at Wed Sep 3 01:22:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 01:23:25 -0700 (PDT) Received: from stallburg.dyndns.org (M929P025.adsl.highway.telekom.at [62.47.148.25]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h838MbWZ027953 for ; Wed, 3 Sep 2003 01:22:39 -0700 Received: from max by stallburg.dyndns.org with local id 19uStu-00086m-00; Wed, 03 Sep 2003 10:22:02 +0200 Date: Wed, 3 Sep 2003 10:22:02 +0200 From: maximilian attems To: kj Cc: netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com, marcel@holtmann.org Subject: [PATCH] list_for_each net/ Message-ID: <20030903082202.GB13662@mail.sternwelten.at> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lEGEL1/lMxI0MVQ2" Content-Disposition: inline X-archive-position: 5525 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: janitor@sternwelten.at Precedence: bulk X-list: netdev --lEGEL1/lMxI0MVQ2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable again pure cosmetical changes!! i checked the FOR_WALKERS and it seems to work. - for (list =3D ymf_devs.next; list !=3D &ymf_devs; list =3D list->next) { + list_for_each(list, &ymf_devs) { tested, please apply a++ maks bluetooth/rfcomm/core.c | 2 +- core/netfilter.c | 4 ++-- ipv4/netfilter/ip_conntrack_standalone.c | 5 ++--- ipv4/netfilter/ip_nat_standalone.c | 2 +- ipv6/ip6_fib.c | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) --- linux-2.6.0-test4/net/core/netfilter.c Sat Aug 23 01:55:34 2003 +++ linux/net/core/netfilter.c Wed Sep 3 09:55:25 2003 @@ -101,7 +101,7 @@ if (down_interruptible(&nf_sockopt_mutex) !=3D 0) return -EINTR; =20 - for (i =3D nf_sockopts.next; i !=3D &nf_sockopts; i =3D i->next) { + list_for_each(i, &nf_sockopts) { struct nf_sockopt_ops *ops =3D (struct nf_sockopt_ops *)i; if (ops->pf =3D=3D reg->pf && (overlap(ops->set_optmin, ops->set_optmax,=20 @@ -296,7 +296,7 @@ if (down_interruptible(&nf_sockopt_mutex) !=3D 0) return -EINTR; =20 - for (i =3D nf_sockopts.next; i !=3D &nf_sockopts; i =3D i->next) { + list_for_each(i, &nf_sockopts) { ops =3D (struct nf_sockopt_ops *)i; if (ops->pf =3D=3D pf) { if (get) { --- linux-2.6.0-test4/net/ipv4/netfilter/ip_conntrack_standalone.c Sat Aug = 23 01:55:11 2003 +++ linux/net/ipv4/netfilter/ip_conntrack_standalone.c Wed Sep 3 09:56:47 = 2003 @@ -151,8 +151,7 @@ } =20 /* Now iterate through expecteds. */ - for (e =3D ip_conntrack_expect_list.next;=20 - e !=3D &ip_conntrack_expect_list; e =3D e->next) { + list_for_each(e, &ip_conntrack_expect_list) { unsigned int last_len; struct ip_conntrack_expect *expect =3D (struct ip_conntrack_expect *)e; @@ -320,7 +319,7 @@ struct list_head *i; =20 WRITE_LOCK(&ip_conntrack_lock); - for (i =3D protocol_list.next; i !=3D &protocol_list; i =3D i->next) { + list_for_each(i, &protocol_list) { if (((struct ip_conntrack_protocol *)i)->proto =3D=3D proto->proto) { ret =3D -EBUSY; --- linux-2.6.0-test4/net/ipv4/netfilter/ip_nat_standalone.c Sat Aug 23 01:= 58:40 2003 +++ linux/net/ipv4/netfilter/ip_nat_standalone.c Wed Sep 3 09:57:27 2003 @@ -272,7 +272,7 @@ struct list_head *i; =20 WRITE_LOCK(&ip_nat_lock); - for (i =3D protos.next; i !=3D &protos; i =3D i->next) { + list_for_each(i, &protos) { if (((struct ip_nat_protocol *)i)->protonum =3D=3D proto->protonum) { ret =3D -EBUSY; --- linux-2.6.0-test4/net/bluetooth/rfcomm/core.c Sat Aug 23 01:50:53 2003 +++ linux/net/bluetooth/rfcomm/core.c Wed Sep 3 09:58:11 2003 @@ -1794,7 +1794,7 @@ if (p->next !=3D &s->dlcs) return p->next; =20 - for (p =3D s->list.next; p !=3D &session_list; p =3D p->next) { + list_for_each(p, &session_list) { s =3D list_entry(p, struct rfcomm_session, list); __list_for_each(pp, &s->dlcs) { seq->private =3D s; --- linux-2.6.0-test4/net/ipv6/ip6_fib.c Sat Aug 23 01:58:45 2003 +++ linux/net/ipv6/ip6_fib.c Wed Sep 3 10:00:51 2003 @@ -99,7 +99,7 @@ .next =3D &fib6_walker_list,=20 }; =20 -#define FOR_WALKERS(w) for ((w)=3Dfib6_walker_list.next; (w) !=3D &fib6_wa= lker_list; (w)=3D(w)->next) +#define FOR_WALKERS(w) list_for_each((w), &fib6_walker_list) =20 static __inline__ u32 fib6_new_sernum(void) { --lEGEL1/lMxI0MVQ2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD4DBQE/VaSq6//kSTNjoX0RAkY4AJiPGbnGTe4Xp+PFuPeQz9MRrw/gAJ4hZG0K isrpztY9UWxY8oz1k3cXPQ== =c0TI -----END PGP SIGNATURE----- --lEGEL1/lMxI0MVQ2-- From srompf@isg.de Wed Sep 3 02:48:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 02:49:27 -0700 (PDT) Received: from mail.isg.de (rzfoobar.is-asp.com [217.11.194.155]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h839mgWZ001921 for ; Wed, 3 Sep 2003 02:48:43 -0700 Received: from barkeeper.frankfurter-softwarefabrik.de (barkeeper.frankfurter-softwarefabrik.de [192.168.6.182]) by mail.isg.de (Postfix) with ESMTP id B6884143D219; Wed, 3 Sep 2003 10:42:55 +0200 (CEST) From: Stefan Rompf To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [ANNOUNCE] netplug, a daemon that handles network cables getting plugged in and out Date: Wed, 3 Sep 2003 10:42:35 +0200 User-Agent: KMail/1.5.9 References: <1062105712.12285.78.camel@serpentine.internal.keyresearch.com> <3F4E8373.1040204@pobox.com> <20030828224553.GC23528@werewolf.able.es> In-Reply-To: <20030828224553.GC23528@werewolf.able.es> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200309031042.54413.srompf@isg.de> X-archive-position: 5526 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: srompf@isg.de Precedence: bulk X-list: netdev Hi, > That would be very nice, but there is still a problem. > Does netlink solve the fact that there are cards (at least in 2.4) > that do not support any detection method: even in 2.6 not all cards support link state via netlink, it requires some updates to the driver. Maintainers should take this as a hint to add netif_carrier_on()/_off() or mii_check_link()/mii_check_media()-calls ;-). This does not hurt for 2.4 as these functions are already available there, but do not create notifications in the stock kernel. Stefan -- "doesn't work" is not a magic word to explain everything. From vnuorval@tcs.hut.fi Wed Sep 3 03:18:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 03:18:20 -0700 (PDT) Received: from smtp-3.hut.fi (root@smtp-3.hut.fi [130.233.228.93]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83AI9WZ011978 for ; Wed, 3 Sep 2003 03:18:11 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-3.hut.fi (8.12.9/8.12.9) with ESMTP id h83AHwAF001622; Wed, 3 Sep 2003 13:17:59 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 4EB2B8001C2; Wed, 3 Sep 2003 13:17:58 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83AHw9s005288; Wed, 3 Sep 2003 13:17:58 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83AHuAc005284; Wed, 3 Sep 2003 13:17:57 +0300 Date: Wed, 3 Sep 2003 13:17:56 +0300 (EEST) From: Ville Nuorvala To: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= Cc: davem@redhat.com, , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: <20030903.063705.89449634.yoshfuji@linux-ipv6.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-15 X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-3.hut.fi) X-DCC-HUTCC-Metrics: smtp-3.hut.fi 1165; Body=6 Fuz1=6 Fuz2=6 X-archive-position: 5527 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 On Wed, 3 Sep 2003, YOSHIFUJI Hideaki / [iso-2022-jp] $B5HF#1QL@(B wrote: > In article <20030902043534.05fc6586.davem@redhat.com> (at Tue, 2 Sep 2003 04:35:34 -0700), "David S. Miller" says: > > > On Mon, 1 Sep 2003 17:24:42 +0300 (EEST) > > Ville Nuorvala wrote: > > > > > Ok, this incremental patch to my previous addrconf.c patch generates a > > > link-local address to the IPv6 tunnel device. It first tries to inherit > > > the EUI64 identifier of some other device and if this fails, uses a > > > random interface id. > > > > Yoshfuji, do you mind if I apply his patch 5 and "5/5+1"? > > Well, I have a question and a comment. > > if (ifp->idev->cnf.forwarding == 0 && > (dev->flags&IFF_LOOPBACK) == 0 && > + dev->type != ARPHRD_TUNNEL6 && > (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { > struct in6_addr all_routers; > > Why? The other end of the tunnel might not yet be set up to receive the packet, which causes an ICMP error message to be sent back to the sender. Besides, RS and RA over a ipv6-in-ipv6 tunnel is a _bad_ idea. A default route through a tunnel without more advanced (policy/flow/srcaddr/? based) routing schemes can lead to local routing loops. Come to think of it a more elegant solution might be: if (ifp->idev->cnf.forwarding == 0 && (dev->flags&IFF_LOOPBACK) == 0 && + ifp->idev->cnf.rtr_solicits > 0 && (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { struct in6_addr all_routers; and set both idev->cnf.rtr_solicits = 0 and idev->cnf.accept_ra = 0 for ARPHRD_TUNNEL6 devices > Comment: this strategy is the "default." > We can (or even should) do this stretegy whenever we failed to > ipv6_generate_eui64() in addrconf_dev_config(). Should I send a separate patch to enable the random interface ids in addrconf_dev_config()? Regards, Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From yoshfuji@linux-ipv6.org Wed Sep 3 03:21:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 03:22:32 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83ALtWZ014738 for ; Wed, 3 Sep 2003 03:21:57 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h83AMQ1M030711; Wed, 3 Sep 2003 19:22:26 +0900 Date: Wed, 03 Sep 2003 19:22:26 +0900 (JST) Message-Id: <20030903.192226.122933464.yoshfuji@linux-ipv6.org> To: vnuorval@tcs.hut.fi Cc: davem@redhat.com, pekkas@netcore.fi, usagi-core@linux-ipv6.org, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: <20030903.063705.89449634.yoshfuji@linux-ipv6.org> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5528 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev In article (at Wed, 3 Sep 2003 13:17:56 +0300 (EEST)), Ville Nuorvala says: > Come to think of it a more elegant solution might be: > > if (ifp->idev->cnf.forwarding == 0 && > (dev->flags&IFF_LOOPBACK) == 0 && > + ifp->idev->cnf.rtr_solicits > 0 && > (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { > struct in6_addr all_routers; > > and set both idev->cnf.rtr_solicits = 0 and idev->cnf.accept_ra = 0 for > ARPHRD_TUNNEL6 devices Yes, something like that. > > Comment: this strategy is the "default." > > We can (or even should) do this stretegy whenever we failed to > > ipv6_generate_eui64() in addrconf_dev_config(). > > Should I send a separate patch to enable the random interface ids in > addrconf_dev_config()? No, just move them to addrconf_dev_config(). --yoshfuji From ahu@outpost.ds9a.nl Wed Sep 3 03:28:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 03:28:39 -0700 (PDT) Received: from outpost.ds9a.nl (postfix@outpost.ds9a.nl [213.244.168.210]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83AS5WZ017390 for ; Wed, 3 Sep 2003 03:28:05 -0700 Received: by outpost.ds9a.nl (Postfix, from userid 1000) id 603854415; Wed, 3 Sep 2003 12:28:03 +0200 (CEST) Date: Wed, 3 Sep 2003 12:28:03 +0200 From: bert hubert To: devik@cdi.cz Cc: netdev@oss.sgi.com Subject: 2.6.0-test4, 2.5.47, child qdiscs, parent not filled out? Message-ID: <20030903102803.GA11876@outpost.ds9a.nl> Mail-Followup-To: bert hubert , devik@cdi.cz, netdev@oss.sgi.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 5529 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ahu@ds9a.nl Precedence: bulk X-list: netdev Devik (I hope we can be friends again :-)), others, I'm currently working on the wondershaper 2.0 which is going to be much more a massmarket product (still GPL, no worries), and I'm wondering why the parent field of child qdiscs isn't filled out? If I create a cbq with several classes, and attach a qdisc to those classes, a later netlink dump (RTM_GETQDISCS) returns parent as 0:0 for that qdisc, is this right? Same holds for HTB and child qdiscs. Basically, I can't find a way to figure out where qdiscs are actually attached. Or should I look for that in xstats? Thanks. -- http://www.PowerDNS.com Open source, database driven DNS Software http://lartc.org Linux Advanced Routing & Traffic Control HOWTO From pekkas@netcore.fi Wed Sep 3 04:50:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 04:50:44 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83BoOWZ012606 for ; Wed, 3 Sep 2003 04:50:25 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h83Bm5A18164; Wed, 3 Sep 2003 14:48:05 +0300 Date: Wed, 3 Sep 2003 14:48:04 +0300 (EEST) From: Pekka Savola To: Ville Nuorvala cc: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 5530 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pekkas@netcore.fi Precedence: bulk X-list: netdev On Wed, 3 Sep 2003, Ville Nuorvala wrote: > On Wed, 3 Sep 2003, YOSHIFUJI Hideaki / [iso-2022-jp] $B5HF#1QL@(B wrote: > > In article <20030902043534.05fc6586.davem@redhat.com> (at Tue, 2 Sep 2003 04:35:34 -0700), "David S. Miller" says: > > > > > On Mon, 1 Sep 2003 17:24:42 +0300 (EEST) > > > Ville Nuorvala wrote: > > > > > > > Ok, this incremental patch to my previous addrconf.c patch generates a > > > > link-local address to the IPv6 tunnel device. It first tries to inherit > > > > the EUI64 identifier of some other device and if this fails, uses a > > > > random interface id. > > > > > > Yoshfuji, do you mind if I apply his patch 5 and "5/5+1"? > > > > Well, I have a question and a comment. > > > > if (ifp->idev->cnf.forwarding == 0 && > > (dev->flags&IFF_LOOPBACK) == 0 && > > + dev->type != ARPHRD_TUNNEL6 && > > (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { > > struct in6_addr all_routers; > > > > Why? > > The other end of the tunnel might not yet be set up to receive the packet, > which causes an ICMP error message to be sent back to the sender. > > Besides, RS and RA over a ipv6-in-ipv6 tunnel is a _bad_ idea. A default > route through a tunnel without more advanced (policy/flow/srcaddr/? based) > routing schemes can lead to local routing loops. Who are you to say it's a bad idea? Users may have a lot of ideas, which some may think are bad but are OK. There is nothing wrong with RS/RA over an IPv6-over-IPv6 tunnel. I'd probably be concerned myself if it wasn't possible. _However_, that doesn't make sense unless you have a more specific route to the destination IPv6 tunnel endpoint. At the moment, I don't know who'd like to get a default IPv6 route over an IPv6 tunnel, though.. IPv6 VPN users? MIPv6 users who restrict themselves to bidirectional tunneling through the home agent, maybe? just my 2 cents. -- Pekka Savola "You each name yourselves king, yet the Netcore Oy kingdom bleeds." Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings From vnuorval@tcs.hut.fi Wed Sep 3 05:15:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 05:15:53 -0700 (PDT) Received: from smtp-1.hut.fi (root@smtp-1.hut.fi [130.233.228.91]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83CFjWZ020334 for ; Wed, 3 Sep 2003 05:15:46 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-1.hut.fi (8.12.9/8.12.9) with ESMTP id h83CFYQe015583; Wed, 3 Sep 2003 15:15:35 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 95DFA8001B5; Wed, 3 Sep 2003 15:15:34 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83CFY9s005778; Wed, 3 Sep 2003 15:15:34 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83CFXRM005774; Wed, 3 Sep 2003 15:15:33 +0300 Date: Wed, 3 Sep 2003 15:15:33 +0300 (EEST) From: Ville Nuorvala To: Pekka Savola Cc: "David S. Miller" , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-1.hut.fi) X-DCC-HUTCC-Metrics: smtp-1.hut.fi 1165; Body=6 Fuz1=6 Fuz2=6 X-archive-position: 5531 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 On Wed, 3 Sep 2003, Pekka Savola wrote: > On Tue, 2 Sep 2003, Ville Nuorvala wrote: > > > > ipv6_generate_eui64() derives the interface identifier from the MAC > > address on ARPHRD_{ETHER,FDDI,IEEE802_TR,ARCNET} interfaces, but doesn't > > do anything for other types of devices > > Ok, but then the command should be: > > /* try to inherit MAC address from another device, to build an EUI64 */ Ok, I'll update the comment :) > > If the node doesn't have an Ethernet (etc.) NIC it won't get a valid > > identifier from ipv6_generate_eui64() and has to resort to something > > else, for example generating a random address. > > And exactly how often does this happen? Eth (all variants), FDDI, TR, > ARCnet.. what's missing? Does IPv6 even work with any other physical > interfaces? :-) Not perhaps physical, but PPP for example. Can we assume _all_ devices have an Eth, FDDI, TR or ARCnet NIC? I would say no. > Note: it is desirable to have link-local addresses reasonably stable. > Randomizing them may not be the right choice. They will of course be configured only once when the interface is brought up :) -Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From xose@wanadoo.es Wed Sep 3 05:32:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 05:33:22 -0700 (PDT) Received: from smtp13.eresmas.com (smtp13.eresmas.com [62.81.235.113]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83CWkWZ021606 for ; Wed, 3 Sep 2003 05:32:48 -0700 Received: from [192.168.108.55] (helo=mx05.in.mad.eresmas.com) by smtp13.eresmas.com with esmtp (Exim 4.10) id 19uWoS-0007qr-00; Wed, 03 Sep 2003 14:32:40 +0200 Received: from [80.102.81.94] (helo=wanadoo.es) by mx05.in.mad.eresmas.com with esmtp (Exim 4.20) id 19uWoR-0007Pk-S2; Wed, 03 Sep 2003 14:32:40 +0200 Message-ID: <3F55DF1B.4000105@wanadoo.es> Date: Wed, 03 Sep 2003 14:31:23 +0200 From: Xose Vazquez Perez User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: gl, es, en MIME-Version: 1.0 To: netdev@oss.sgi.com, jgarzik Subject: [PATCH] 3c59x.c pci.ids X-Enigmail-Version: 0.63.3.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------070505010203050702040707" X-Spam-Score: 0.6 X-archive-position: 5532 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: xose@wanadoo.es Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --------------070505010203050702040707 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit hi, In 2.4.23-pre2 two pci.ids are missing and there is one duplicate. 2.6.0-preX driver is ok. -thanks- -- Que trabajen los romanos, que tienen el pecho de lata. --------------070505010203050702040707 Content-Type: text/plain; name="3c59x.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="3c59x.diff" --- linux/drivers/net/3c59x.c 2003-08-30 19:04:12.000000000 +0200 +++ linux.new/drivers/net/3c59x.c 2003-09-02 03:25:44.000000000 +0200 @@ -429,7 +429,6 @@ CH_3C905B_2, CH_3C905B_FX, CH_3C905C, - CH_3C905C2, CH_3C980, CH_3C9805, @@ -450,6 +449,9 @@ CH_3C920, CH_3C982A, CH_3C982B, + + CH_905BT4, + CH_920B_EMB_WNM, }; @@ -503,8 +505,6 @@ PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, }, {"3c905C Tornado", PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, }, - {"3c905C Tornado 2", - PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, }, {"3c980 Cyclone", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, }, {"3c980C Python-T", @@ -550,6 +550,11 @@ {"3c982 Hydra Dual Port B", PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, }, + {"3c905B-T4", + PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, }, + {"3c920B-EMB-WNM Tornado", + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, }, + {0,}, /* 0 terminated list. */ }; @@ -576,7 +581,6 @@ { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, { 0x10B7, 0x905A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_FX }, { 0x10B7, 0x9200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905C }, - { 0x10B7, 0x9201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905C2 }, { 0x10B7, 0x9800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C980 }, { 0x10B7, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C9805 }, @@ -597,6 +601,10 @@ { 0x10B7, 0x9201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C920 }, { 0x10B7, 0x1201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C982A }, { 0x10B7, 0x1202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C982B }, + + { 0x10B7, 0x9056, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_905BT4 }, + { 0x10B7, 0x9210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_920B_EMB_WNM }, + {0,} /* 0 terminated list. */ }; MODULE_DEVICE_TABLE(pci, vortex_pci_tbl); --------------070505010203050702040707-- From felipewd@terra.com.br Wed Sep 3 07:02:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 07:03:25 -0700 (PDT) Received: from ivoti.terra.com.br (ivoti.terra.com.br [200.176.3.20]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83E2oWZ016140 for ; Wed, 3 Sep 2003 07:02:51 -0700 Received: from barra.terra.com.br (barra.terra.com.br [200.176.3.52]) by ivoti.terra.com.br (Postfix) with ESMTP id 8286879C2BD; Wed, 3 Sep 2003 11:02:48 -0300 (BRT) Received: from terra.com.br (200-163-191-105.paemt7004.dsl.brasiltelecom.net.br [200.163.191.105]) (authenticated user felipewd) by barra.terra.com.br (Postfix) with ESMTP id 4371623409A; Wed, 3 Sep 2003 11:02:43 -0300 (BRT) Message-ID: <3F55F4DD.9070301@terra.com.br> Date: Wed, 03 Sep 2003 11:04:13 -0300 From: Felipe W Damasio User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9 MIME-Version: 1.0 To: pekkas@netcore.fi, davem@redhat.com, yoshfuji@linux-ipv6.org Cc: Linux Kernel Mailing List , netdev@oss.sgi.com Subject: [PATCH] Kill unneeded linux/version.h include in net/ipv6 Content-Type: multipart/mixed; boundary="------------020308040205020607070106" X-archive-position: 5533 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: felipewd@terra.com.br Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --------------020308040205020607070106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, Patch against 2.6-test4. Removes an unneeded linux/version.h include from af_inet6.. Please consider applying. Cheers, Felipe --------------020308040205020607070106 Content-Type: text/plain; name="ipv6-checkversion.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ipv6-checkversion.patch" --- linux-2.6.0-test4/net/ipv6/af_inet6.c Fri Aug 22 20:56:34 2003 +++ linux-2.6.0-test4-fwd/net/ipv6/af_inet6.c Wed Sep 3 10:58:48 2003 @@ -40,7 +40,6 @@ #include #include #include -#include #include #include --------------020308040205020607070106-- From rddunlap@osdl.org Wed Sep 3 08:35:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 08:35:57 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83FZNWZ004445 for ; Wed, 3 Sep 2003 08:35:24 -0700 Received: from dragon.pdx.osdl.net (dragon.pdx.osdl.net [172.20.1.27]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h83FZHo09510; Wed, 3 Sep 2003 08:35:17 -0700 Date: Wed, 3 Sep 2003 08:29:58 -0700 From: "Randy.Dunlap" To: netdev@oss.sgi.com Cc: felipewd@terra.com.br Subject: Fw: [PATCH] Kill unneeded version.h in net/wanrouter Message-Id: <20030903082958.582cc0c5.rddunlap@osdl.org> Organization: OSDL X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: +5V?h'hZQPB9kW Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Wed__3_Sep_2003_08:29:58_-0700_09464040" X-archive-position: 5534 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rddunlap@osdl.org Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --Multipart_Wed__3_Sep_2003_08:29:58_-0700_09464040 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit net/ patches should go to netdev@oss.sgi.com ............ ~Randy Begin forwarded message: Date: Wed, 03 Sep 2003 11:26:47 -0300 From: Felipe W Damasio To: Linux Kernel Mailing List Subject: [PATCH] Kill unneeded version.h in net/wanrouter Hi, Patch against linux-2.6.0-test4. Please apply. Thanks, Felipe --Multipart_Wed__3_Sep_2003_08:29:58_-0700_09464040 Content-Type: text/plain; name="wanrouter-checkversion.patch" Content-Disposition: attachment; filename="wanrouter-checkversion.patch" Content-Transfer-Encoding: 7bit diff -u -X ./dontdiff linux-2.6.0-test4/net/wanrouter/af_wanpipe.c linux-2.6.0-test4-fwd/net/wanrouter/af_wanpipe.c --- linux-2.6.0-test4/net/wanrouter/af_wanpipe.c Fri Aug 22 21:01:48 2003 +++ linux-2.6.0-test4-fwd/net/wanrouter/af_wanpipe.c Wed Sep 3 11:05:45 2003 @@ -32,7 +32,6 @@ * ******************************************************************************/ -#include #include #include #include diff -u -X ./dontdiff linux-2.6.0-test4/net/wanrouter/wanmain.c linux-2.6.0-test4-fwd/net/wanrouter/wanmain.c --- linux-2.6.0-test4/net/wanrouter/wanmain.c Fri Aug 22 20:57:53 2003 +++ linux-2.6.0-test4-fwd/net/wanrouter/wanmain.c Wed Sep 3 11:05:33 2003 @@ -42,7 +42,6 @@ * Jun 02, 1999 Gideon Hack Updates for Linux 2.0.X and 2.2.X kernels. *****************************************************************************/ -#include #include #include /* offsetof(), etc. */ #include /* return codes */ --Multipart_Wed__3_Sep_2003_08:29:58_-0700_09464040-- From rddunlap@osdl.org Wed Sep 3 08:35:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 08:36:02 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83FZTWZ004460 for ; Wed, 3 Sep 2003 08:35:29 -0700 Received: from dragon.pdx.osdl.net (dragon.pdx.osdl.net [172.20.1.27]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h83FZOo09515; Wed, 3 Sep 2003 08:35:24 -0700 Date: Wed, 3 Sep 2003 08:30:05 -0700 From: "Randy.Dunlap" To: netdev@oss.sgi.com Cc: felipewd@terra.com.br Subject: Fw: [PATCH] Kill unneeded version.h from net/sched Message-Id: <20030903083005.5a35c59f.rddunlap@osdl.org> Organization: OSDL X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: +5V?h'hZQPB9kW Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Wed__3_Sep_2003_08:30:05_-0700_09378280" X-archive-position: 5535 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rddunlap@osdl.org Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --Multipart_Wed__3_Sep_2003_08:30:05_-0700_09378280 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Another net/ patch. ~Randy Begin forwarded message: Date: Wed, 03 Sep 2003 11:29:44 -0300 From: Felipe W Damasio To: Linux Kernel Mailing List Subject: [PATCH] Kill unneeded version.h from net/sched Hi, Last patch, removing all references that checkversion gave me on net/ Against 2.6-test4, please apply. Cheers Felipe --Multipart_Wed__3_Sep_2003_08:30:05_-0700_09378280 Content-Type: text/plain; name="net_sched-checkversion.patch" Content-Disposition: attachment; filename="net_sched-checkversion.patch" Content-Transfer-Encoding: 7bit --- linux-2.6.0-test4/net/sched/sch_htb.c Fri Aug 22 20:57:14 2003 +++ linux-2.6.0-test4-fwd/net/sched/sch_htb.c Wed Sep 3 11:27:06 2003 @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include --Multipart_Wed__3_Sep_2003_08:30:05_-0700_09378280-- From chas@cmf.nrl.navy.mil Wed Sep 3 09:28:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 09:28:38 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83GS2WZ014972 for ; Wed, 3 Sep 2003 09:28:03 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h83GPFl5022616; Wed, 3 Sep 2003 12:25:15 -0400 (EDT) Message-Id: <200309031625.h83GPFl5022616@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com Subject: [PATCH][ATM] atm_getaddr() isn't safe Reply-To: chas3@users.sourceforge.net Date: Wed, 03 Sep 2003 12:25:16 -0400 From: chas williams X-Spam-Score: () hits=0.5 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5537 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev this patch also preserves the old behavior of atm_getaddr() in that it does partially fill in the passed buffer. please apply to 2.6 and 2.4. # 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.1414 -> 1.1415 # net/atm/addr.c 1.3 -> 1.4 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/03 chas@relax.cmf.nrl.navy.mil 1.1415 # addr.c: # copy_to_user() shouldn't be called while blocking interrupts # -------------------------------------------- # diff -Nru a/net/atm/addr.c b/net/atm/addr.c --- a/net/atm/addr.c Wed Sep 3 05:33:30 2003 +++ b/net/atm/addr.c Wed Sep 3 05:33:30 2003 @@ -118,23 +118,24 @@ { unsigned long flags; struct atm_dev_addr *walk; - int total; + int total = 0, error; + struct sockaddr_atmsvc *tmp_buf, *tmp_bufp; + spin_lock_irqsave(&dev->lock, flags); - total = 0; - for (walk = dev->local; walk; walk = walk->next) { + for (walk = dev->local; walk; walk = walk->next) total += sizeof(struct sockaddr_atmsvc); - if (total > size) { - spin_unlock_irqrestore(&dev->lock, flags); - return -E2BIG; - } - if (copy_to_user(u_buf,&walk->addr, - sizeof(struct sockaddr_atmsvc))) { - spin_unlock_irqrestore(&dev->lock, flags); - return -EFAULT; - } - u_buf++; + tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC); + if (!tmp_buf) { + spin_unlock_irqrestore(&dev->lock, flags); + return -ENOMEM; } + for (walk = dev->local; walk; walk = walk->next) + memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc)); spin_unlock_irqrestore(&dev->lock, flags); - return total; + error = total > size ? -E2BIG : total; + if (copy_to_user(u_buf, tmp_buf, total < size ? total : size)) + error = -EFAULT; + kfree(tmp_buf); + return error; } From ams@wiw.org Wed Sep 3 10:05:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 10:06:17 -0700 (PDT) Received: from miranda.org (IDENT:qmailr@miranda.org [209.58.150.153]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83H5eWZ018120 for ; Wed, 3 Sep 2003 10:05:43 -0700 Received: (qmail 21646 invoked from network); 3 Sep 2003 17:05:36 -0000 Received: from miranda.org (HELO lustre.dyn.wiw.org) (ams@209.58.150.153) by miranda.org with SMTP; 3 Sep 2003 17:05:36 -0000 Received: from ams by lustre.dyn.wiw.org with local (Exim 4.20) id 19ub4Y-00025X-5S for netdev@oss.sgi.com; Wed, 03 Sep 2003 22:35:34 +0530 Date: Wed, 3 Sep 2003 22:35:34 +0530 From: Abhijit Menon-Sen To: netdev@oss.sgi.com Subject: how is recv(..., MSG_PEEK) racy? Message-ID: <20030903223534.A7806@lustre.dyn.wiw.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-archive-position: 5539 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ams@wiw.org Precedence: bulk X-list: netdev I'm trying to understand a fetchmail problem that causes large downloads from IMAP servers to fail randomly. For some reason, fetchmail uses the following bizarre code inside a loop to read data from the server: if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0) return (-1); if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; if ((n = read(sock, bp, n)) == -1) return (-1); The problem occurs (at an unpredictable time, but very often, and with a greater probability with a larger attachment) when the recv() returns 0, although tcpdump doesn't show the server closing the connection, or any other unusual behaviour. Are there any circumstances other than the connection being closed where recv(..., MSG_PEEK) can return 0? (Stevens/SUSv3 don't mention any.) I found the following (paraphrased) comment in net/ipv4/tcp.c: if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) { printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n", current->comm, current->pid); While fetchmail doesn't seem to be triggering that printk(), I'm curious about what the race condition is. Google found a post by DaveM saying it has something to do with URG data, but without any further details. I'd appreciate any explanation of the problem(s). Thank you. -- ams From cfriesen@nortelnetworks.com Wed Sep 3 10:17:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 10:18:10 -0700 (PDT) Received: from zcars04f.nortelnetworks.com (zcars04f.nortelnetworks.com [47.129.242.57]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83HHYWZ019166 for ; Wed, 3 Sep 2003 10:17:35 -0700 Received: from zcard307.ca.nortel.com (americasm03.nt.com [47.129.242.67]) by zcars04f.nortelnetworks.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id h83HHQ806865; Wed, 3 Sep 2003 13:17:26 -0400 (EDT) Received: from zcard0k6.ca.nortel.com ([47.129.242.158]) by zcard307.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id RZHNPTPK; Wed, 3 Sep 2003 13:17:26 -0400 Received: from pcard0ks.ca.nortel.com ([47.129.117.131]) by zcard0k6.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id Q8C6J05C; Wed, 3 Sep 2003 13:17:26 -0400 Received: from nortelnetworks.com (localhost.localdomain [127.0.0.1]) by pcard0ks.ca.nortel.com (Postfix) with ESMTP id ED2182E112; Wed, 3 Sep 2003 13:17:25 -0400 (EDT) Message-ID: <3F562225.4010609@nortelnetworks.com> Date: Wed, 03 Sep 2003 13:17:25 -0400 X-Sybari-Space: 00000000 00000000 00000000 00000000 From: Chris Friesen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: Linux Kernel Mailing List , netdev@oss.sgi.com Subject: given a struct sock, how to find pid of process that owns it? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5540 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: cfriesen@nortelnetworks.com Precedence: bulk X-list: netdev I'm working on a small app similar to netstat that only cares about unix sockets. I can easily walk /proc/net/unix, but to find the owner of the socket I need to scan /proc, which gets expensive. Accordingly, I'd like to extend /proc/net/unix to also dump out the pid of the process that owns the socket. The only thing is, I can't seem to figure out how to find the pid of the socket owner given a pointer to the socket struct. Any tips? Is it even there? Thanks, Chris -- Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com From chas@cmf.nrl.navy.mil Wed Sep 3 10:24:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 10:24:39 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83HO5WZ019706 for ; Wed, 3 Sep 2003 10:24:06 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h83HNql5024404; Wed, 3 Sep 2003 13:23:53 -0400 (EDT) Message-Id: <200309031723.h83HNql5024404@ginger.cmf.nrl.navy.mil> To: davem@redhat.com, netdev@oss.sgi.com Cc: Mitchell Blank Jr Subject: Re: [Linux-ATM-General] [ATM] [PATCH] lanai update In-Reply-To: Message from Mitchell Blank Jr of "Mon, 01 Sep 2003 20:40:13 PDT." <20030902034013.GH15886@gaz.sfgoth.com> Date: Wed, 03 Sep 2003 13:23:53 -0400 From: chas williams X-Spam-Score: () hits=-8.8 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5541 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev please apply to 2.6 -- thanks. In message <20030902034013.GH15886@gaz.sfgoth.com>,Mitchell Blank Jr writes: >Changes: > > o Big performance improvement. The version of the driver in the kernel > still had a "mdelay(1)" after every register write. This capped > performance at about 8Mbps and ate tons of CPU time. (Luckily, most > users of this card are just terminating a DSL line where its not too > noticeable) > > However, after removing this delay the card started getting out of > sync with the driver under stress tests. After a couple days of chasing > the bug I finally determine that the card's support for transmitting > partial PDUs just doesn't quite work as advertised (before we would send > a partial PDU to completely fill a VCC's transmit buffer and then send > the rest of the skb when more buffer space filled up). The usefulness of > this is somewhat doubtful anyway and removing it cleaned up a lot of code. > > I also added some memory barriers to make sure operations to the card > happen in the correct order. > > Now for the first time ever we get near line-rate performance out of this > card (~19Mb/s TCP in netperf between two ~300Mhz machines) > > o Locking changes (essentially the patch Chas sent me a couple weeks ago > with some minor tweaking) I'm still not sure we're getting 100% of the > cases right but it's definitely FAR better than the old lock-less version. > > o Cleanup the backlog draining code in lanai_shutdown_tx_vci() > > o Remove outdated comment describing how to compile the module > > o Got rid of the "service_novcc_[tr]x" stats - it's really the same error > as "service_[tr]x" - there's no reason to count them separately. > > o Use the ATM_25_PCR constant instead of computing it for ourselves > >Patch is versus 2.6.0-test4. Chas - this is completely separate from the >net/atm patches I sent you yesterday so feel free to push this one upstream >if you're still digesting yesterday's stuff. > >The one issue I'm still chasing is some RX checksum errors that only seem >to appear with large PDUs (starting at about 4000 bytes; getting worse >as you go up) Since most users of this card are using pppoatm or rfc2483 >with ethernet-ish MTUs it probably isn't going to bite many people. [atm]: lanai performance improvements and assorted misc cleanup work --- linux-2.6.0-test4-VIRGIN/drivers/atm/lanai.c 2003-08-22 13:46:58.000000000 -0700 +++ linux-2.6.0-test4mnb1/drivers/atm/lanai.c 2003-09-01 09:09:03.919422688 -0700 @@ -15,12 +15,6 @@ * * Things not working yet: * - * o We're only set up to compile as a module currently. i.e. - * you should put the source in drivers/atm/lanai.c and then - * just do "make drivers/atm/lanai.o" from the main - * source directory. This will produce a drivers/atm/lanai.o - * file suitable for insmod'ing - * * o We don't support the Speedstream 3060 yet - this card has * an on-board DSL modem chip by Alcatel and the driver will * need some extra code added to handle it @@ -245,9 +239,6 @@ struct atm_vcc *atmvcc; /* atm_vcc who is transmitter */ int endptr; /* last endptr from service entry */ struct sk_buff_head backlog; - struct sk_buff *inprogress; /* We're streaming this PDU */ - unsigned char *pptr; /* Where we are in above */ - int inprogleft; /* Bytes left to send "inprogress" */ void (*unqueue)(struct lanai_dev *, struct lanai_vcc *, int); } tx; }; @@ -268,8 +259,6 @@ unsigned pcierr_m_target_abort; unsigned pcierr_s_target_abort; unsigned pcierr_master_parity; - unsigned service_novcc_rx; - unsigned service_novcc_tx; unsigned service_notx; unsigned service_norx; unsigned service_rxnotaal5; @@ -297,7 +286,7 @@ struct lanai_buffer aal0buf; /* AAL0 RX buffers */ u32 conf1, conf2; /* CONFIG[12] registers */ u32 status; /* STATUS register */ - spinlock_t txlock; + spinlock_t endtxlock; spinlock_t servicelock; struct atm_vcc *cbrvcc; int number; @@ -501,7 +490,6 @@ RWDEBUG("W [0x%08X] 0x%02X < 0x%08X\n", (unsigned int) lanai->base, (int) reg, val); writel(val, reg_addr(lanai, reg)); - mdelay(1); } static inline void conf1_write(const struct lanai_dev *lanai) @@ -537,63 +525,6 @@ udelay(5); } -/* -------------------- VCC LIST LOCK: */ - -/* - * The linux-atm code disables local IRQs while managing the list of - * VCCs on a card. This is good, but it doesn't save us against - * SMP. Unfortunately, fixing this will require changes in the - * API which will have to wait a little bit. It's a hard race to - * trigger accidentally, so it isn't TOO horrible so far. - * - * One possible solution would be to have an rwlock which is - * always grabbed _irq-style on writing. This would automatically - * be grabbed (for writing) by the higher layers on things that - * would result in a change in the vcc list (_open, _close, - * probably _change_qos) - thus it would also protect the - * higher-level list of vccs on each device (atm_dev->vccs). - * The driver would be responsible for grabbing it as a read_lock - * anytime it wants to consult its table of vccs - for instance - * when handling an incoming PDU. This also explains why we would - * probably want the write_lock while in _change_qos - to prevent - * handling of PDUs while possibly in an inconsistent state. - * Also, _send would grab the lock for reading. - * - * One problem with this is that _open and _close could no longer - * do anything that might provoke a schedule. First, it would - * force us to use GFP_ATOMIC memory (which is bad), but also - * some devices pretty much require scheduling due to long - * delays (see lanai_close for an example). So in this case - * we need a way to schedule without losing the spinlock. - * The cleanest way to do this is probably have a way to mark a - * VCC as "in progress" so that the interrupt handler can - * still disregard any traffic for it while _open or _close - * are sleeping on it. Then it will need to be _open and - * _close's job to relinquish the write_lock. Thus, the - * lock could be dropped around the times that scheduling - * might occur. Perhaps the _READY flag can be used for - * this purpose. - * - * One short note about this "upper layer grabs, driver - * relinquishes" write lock - since this needs to be - * an _irq lock we're going to have problem saving - * and restoring flags (_irqsave/_irqrestore). This - * shouldn't be a problem, however - we must just - * require that those syscalls are never called with - * interrupts disabled so we can use the non-flags-saving - * versions. - * - * Anyway, all of the above is vaporware currently - fixing - * this right will require changes in the API and all of - * the drivers - this will wait until 2.5.x most likely. - * The following NOP macros are just here to mark where - * the locks will be needed in the future. - */ -#define vcclist_read_lock() do {} while (0) -#define vcclist_read_unlock() do {} while (0) -#define vcclist_write_lock() do {} while (0) -#define vcclist_write_unlock() do {} while (0) - /* -------------------- CARD SRAM UTILITIES: */ /* The SRAM is mapped into normal PCI memory space - the only catch is @@ -851,36 +782,39 @@ if (lvcc->vbase == 0) /* We were never bound to a VCI */ return; /* 15.2.1 - wait for queue to drain */ - spin_lock_irqsave(&lanai->txlock, flags); - if (lvcc->tx.inprogress != NULL) { - lanai_free_skb(lvcc->tx.atmvcc, lvcc->tx.inprogress); - lvcc->tx.inprogress = NULL; - } while ((skb = skb_dequeue(&lvcc->tx.backlog)) != NULL) lanai_free_skb(lvcc->tx.atmvcc, skb); + read_lock_irqsave(&vcc_sklist_lock, flags); __clear_bit(lvcc->vci, lanai->backlog_vccs); - spin_unlock_irqrestore(&lanai->txlock, flags); - timeout = jiffies + ((lanai_buf_size(&lvcc->tx.buf) * HZ) >> 17); + read_unlock_irqrestore(&vcc_sklist_lock, flags); + /* + * We need to wait for the VCC to drain but don't wait forever. We + * give each 1K of buffer size 1/128th of a second to clear out. + * TODO: maybe disable CBR if we're about to timeout? + */ + timeout = jiffies + + (((lanai_buf_size(&lvcc->tx.buf) / 1024) * HZ) >> 7); write = TXWRITEPTR_GET_PTR(cardvcc_read(lvcc, vcc_txwriteptr)); - goto start; - while (time_before_eq(jiffies, timeout)) { - schedule_timeout(HZ / 25); - start: + for (;;) { read = TXREADPTR_GET_PTR(cardvcc_read(lvcc, vcc_txreadptr)); if (read == write && /* Is TX buffer empty? */ (lvcc->tx.atmvcc->qos.txtp.traffic_class != ATM_CBR || (cardvcc_read(lvcc, vcc_txcbr_next) & TXCBR_NEXT_BOZO) == 0)) - goto done; + break; if (read != lastread) { /* Has there been any progress? */ lastread = read; timeout += HZ / 10; } + if (unlikely(time_after(jiffies, timeout))) { + printk(KERN_ERR DEV_LABEL "(itf %d): Timed out on " + "backlog closing vci %d\n", + lvcc->tx.atmvcc->dev->number, lvcc->vci); + DPRINTK("read, write = %d, %d\n", read, write); + break; + } + schedule_timeout(HZ / 25); } - printk(KERN_ERR DEV_LABEL "(itf %d): Timed out on backlog closing " - "vci %d\n", lvcc->tx.atmvcc->dev->number, lvcc->vci); - DPRINTK("read, write = %d, %d\n", read, write); - done: /* 15.2.2 - clear out all tx registers */ cardvcc_write(lvcc, 0, vcc_txreadptr); cardvcc_write(lvcc, 0, vcc_txwriteptr); @@ -1226,8 +1160,7 @@ /* test if VCC is currently backlogged */ static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc) { - return lvcc->tx.inprogress != NULL || - !skb_queue_empty(&lvcc->tx.backlog); + return !skb_queue_empty(&lvcc->tx.backlog); } /* Bit fields in the segmentation buffer descriptor */ @@ -1264,11 +1197,11 @@ } /* Add 32-bit AAL5 trailer and leave room for its CRC */ -static inline void vcc_tx_add_aal5trailer(struct lanai_vcc *lvcc, +static inline void vcc_tx_add_aal5_trailer(struct lanai_vcc *lvcc, int len, int cpi, int uu) { APRINTK((((unsigned long) lvcc->tx.buf.ptr) & 15) == 8, - "vcc_tx_add_aal5_descriptor: bad ptr=%p\n", lvcc->tx.buf.ptr); + "vcc_tx_add_aal5_trailer: bad ptr=%p\n", lvcc->tx.buf.ptr); lvcc->tx.buf.ptr += 2; lvcc->tx.buf.ptr[-2] = cpu_to_be32((uu << 24) | (cpi << 16) | len); if (lvcc->tx.buf.ptr >= lvcc->tx.buf.end) @@ -1311,7 +1244,7 @@ } /* Update "butt" register to specify new WritePtr */ -static inline void lanai_endtx(const struct lanai_dev *lanai, +static inline void lanai_endtx(struct lanai_dev *lanai, const struct lanai_vcc *lvcc) { int i, ptr = ((unsigned char *) lvcc->tx.buf.ptr) - @@ -1320,6 +1253,14 @@ "lanai_endtx: bad ptr (%d), vci=%d, start,ptr,end=%p,%p,%p\n", ptr, lvcc->vci, lvcc->tx.buf.start, lvcc->tx.buf.ptr, lvcc->tx.buf.end); + + /* + * Since the "butt register" is a shared resounce on the card we + * serialize all accesses to it through this spinlock. This is + * mostly just paranoia sicne the register is rarely "busy" anyway + * but is needed for correctness. + */ + spin_lock(&lanai->endtxlock); /* * We need to check if the "butt busy" bit is set before * updating the butt register. In theory this should @@ -1334,131 +1275,86 @@ } udelay(5); } + /* + * Before we tall the card to start work we need to be sure 100% of + * the info in the service buffer has been written before we tell + * the card about it + */ + wmb(); reg_write(lanai, (ptr << 12) | lvcc->vci, Butt_Reg); + spin_unlock(&lanai->endtxlock); +} + +/* + * Add one AAL5 PDU to lvcc's transmit buffer. Caller garauntees there's + * space available. "pdusize" is the number of bytes the PDU will take + */ +static void lanai_send_one_aal5(struct lanai_dev *lanai, + struct lanai_vcc *lvcc, struct sk_buff *skb, int pdusize) +{ + int pad; + APRINTK(pdusize == aal5_size(skb->len), + "lanai_send_one_aal5: wrong size packet (%d != %d)\n", + pdusize, aal5_size(skb->len)); + vcc_tx_add_aal5_descriptor(lvcc, 0, pdusize); + pad = pdusize - skb->len - 8; + APRINTK(pad >= 0, "pad is negative (%d)\n", pad); + APRINTK(pad < 48, "pad is too big (%d)\n", pad); + vcc_tx_memcpy(lvcc, skb->data, skb->len); + vcc_tx_memzero(lvcc, pad); + vcc_tx_add_aal5_trailer(lvcc, skb->len, 0, 0); + lanai_endtx(lanai, lvcc); + lanai_free_skb(lvcc->tx.atmvcc, skb); + atomic_inc(&lvcc->tx.atmvcc->stats->tx); } /* Try to fill the buffer - don't call unless there is backlog */ static void vcc_tx_unqueue_aal5(struct lanai_dev *lanai, struct lanai_vcc *lvcc, int endptr) { - int pad, n; + int n; struct sk_buff *skb; int space = vcc_tx_space(lvcc, endptr); APRINTK(vcc_is_backlogged(lvcc), "vcc_tx_unqueue() called with empty backlog (vci=%d)\n", lvcc->vci); - if (space < 64) - return; /* No space for even 1 cell+descriptor */ - if (lvcc->tx.inprogress != NULL) { - APRINTK((lvcc->tx.inprogleft % 48) == 0, - "vcc_tx_unqueue_aal5: bad progleft=%d\n", - lvcc->tx.inprogleft); - if (lvcc->tx.inprogleft + 16 > space) { /* Can't send all? */ - n = aal5_spacefor(space - 16); /* Bytes to send */ - vcc_tx_add_aal5_descriptor(lvcc, - DESCRIPTOR_AAL5_STREAM, n); - pad = lvcc->tx.pptr + n - lvcc->tx.inprogress->tail; - if (pad < 0) - pad = 0; - vcc_tx_memcpy(lvcc, lvcc->tx.pptr, n - pad); - vcc_tx_memzero(lvcc, pad); - lvcc->tx.pptr += n; - lvcc->tx.inprogleft -= n; - goto end; /* Buffer is now full */ - } - /* OK, there's at least space for all of "inprogress" skb */ - vcc_tx_add_aal5_descriptor(lvcc, 0, - lvcc->tx.inprogleft); - pad = lvcc->tx.pptr + lvcc->tx.inprogleft - - lvcc->tx.inprogress->tail; - if (pad >= lvcc->tx.inprogleft) { /* Nothing but pad left */ - APRINTK(lvcc->tx.inprogleft == 48, - "vcc_tx_unqueue_aal5: bad pure-pad=%d\n", - lvcc->tx.inprogleft); - pad = 48; - } else - vcc_tx_memcpy(lvcc, lvcc->tx.pptr, - lvcc->tx.inprogleft - pad); - vcc_tx_memzero(lvcc, pad - 8); - vcc_tx_add_aal5trailer(lvcc, lvcc->tx.inprogress->len, 0, 0); - lanai_free_skb(lvcc->tx.atmvcc, lvcc->tx.inprogress); - lvcc->tx.inprogress = NULL; - space -= lvcc->tx.inprogleft + 16; - atomic_inc(&lvcc->tx.atmvcc->stats->tx); - } while (space >= 64) { - if ((skb = skb_dequeue(&lvcc->tx.backlog)) == NULL) - break; + skb = skb_dequeue(&lvcc->tx.backlog); + if (skb == NULL) + goto no_backlog; n = aal5_size(skb->len); - if (n + 16 > space) { /* Can only send part */ - int m = aal5_spacefor(space - 16); /* Bytes to send */ - vcc_tx_add_aal5_descriptor(lvcc, - DESCRIPTOR_AAL5_STREAM, m); - lvcc->tx.pptr = skb->data + m; - pad = lvcc->tx.pptr - skb->tail; - if (pad < 0) - pad = 0; - vcc_tx_memcpy(lvcc, skb->data, m - pad); - vcc_tx_memzero(lvcc, pad); - lvcc->tx.inprogleft = n - m; - lvcc->tx.inprogress = skb; - goto end; + if (n + 16 > space) { + /* No room for this packet - put it back on queue */ + skb_queue_head(&lvcc->tx.backlog, skb); + return; } - vcc_tx_add_aal5_descriptor(lvcc, 0, n); - pad = n - skb->len - 8; - vcc_tx_memcpy(lvcc, skb->data, skb->len); - vcc_tx_memzero(lvcc, pad); - lanai_free_skb(lvcc->tx.atmvcc, skb); - vcc_tx_add_aal5trailer(lvcc, skb->len, 0, 0); + lanai_send_one_aal5(lanai, lvcc, skb, n); space -= n + 16; - atomic_inc(&lvcc->tx.atmvcc->stats->tx); } - if (skb_queue_empty(&lvcc->tx.backlog)) + if (!vcc_is_backlogged(lvcc)) { + no_backlog: __clear_bit(lvcc->vci, lanai->backlog_vccs); - end: - lanai_endtx(lanai, lvcc); + } } /* Given an skb that we want to transmit either send it now or queue */ static void vcc_tx_aal5(struct lanai_dev *lanai, struct lanai_vcc *lvcc, struct sk_buff *skb) { - int space, n, pad; + int space, n; if (vcc_is_backlogged(lvcc)) /* Already backlogged */ goto queue_it; - space = vcc_tx_space(lvcc, TXREADPTR_GET_PTR(cardvcc_read(lvcc, - vcc_txreadptr))); - if (space < 64) { /* No space at all */ - __set_bit(lvcc->vci, lanai->backlog_vccs); - goto queue_it; - } - if (space >= 16 + (n = aal5_size(skb->len))) { - /* We can send the whole thing now */ - vcc_tx_add_aal5_descriptor(lvcc, 0, n); - pad = n - skb->len; - vcc_tx_memcpy(lvcc, skb->data, skb->len); - vcc_tx_memzero(lvcc, pad - 8); - vcc_tx_add_aal5trailer(lvcc, skb->len, 0, 0); - lanai_free_skb(lvcc->tx.atmvcc, skb); - atomic_inc(&lvcc->tx.atmvcc->stats->tx); - } else { /* Space for only part of skb */ - int bytes = aal5_spacefor(space - 16); /* Bytes to send */ - vcc_tx_add_aal5_descriptor(lvcc, - DESCRIPTOR_AAL5_STREAM, bytes); - pad = bytes - skb->len; - if (pad < 0) - pad = 0; - vcc_tx_memcpy(lvcc, skb->data, bytes - pad); - vcc_tx_memzero(lvcc, pad); - lvcc->tx.inprogress = skb; - lvcc->tx.inprogleft = n - bytes; - lvcc->tx.pptr = skb->data + bytes; + space = vcc_tx_space(lvcc, + TXREADPTR_GET_PTR(cardvcc_read(lvcc, vcc_txreadptr))); + n = aal5_size(skb->len); + APRINTK(n + 16 >= 64, "vcc_tx_aal5: n too small (%d)\n", n); + if (space < n + 16) { /* No space for this PDU */ __set_bit(lvcc->vci, lanai->backlog_vccs); + queue_it: + skb_queue_tail(&lvcc->tx.backlog, skb); + return; } - lanai_endtx(lanai, lvcc); - return; - queue_it: - skb_queue_tail(&lvcc->tx.backlog, skb); + lanai_send_one_aal5(lanai, lvcc, skb, n); } static void vcc_tx_unqueue_aal0(struct lanai_dev *lanai, @@ -1476,28 +1372,6 @@ lanai_free_skb(lvcc->tx.atmvcc, skb); } -/* Try to undequeue 1 backlogged vcc */ -static void iter_dequeue(struct lanai_dev *lanai, vci_t vci) -{ - struct lanai_vcc *lvcc = lanai->vccs[vci]; - int endptr; - if (lvcc == NULL || !vcc_is_backlogged(lvcc)) { - __clear_bit(vci, lanai->backlog_vccs); - return; - } - endptr = TXREADPTR_GET_PTR(cardvcc_read(lvcc, vcc_txreadptr)); - lvcc->tx.unqueue(lanai, lvcc, endptr); -} - -/* Try a dequeue on all backlogged connections */ -static inline void vcc_tx_dequeue_all(struct lanai_dev *lanai) -{ - unsigned long flags; - spin_lock_irqsave(&lanai->txlock, flags); - vci_bitfield_iterate(lanai, lanai->backlog_vccs, iter_dequeue); - spin_unlock_irqrestore(&lanai->txlock, flags); -} - /* -------------------- VCC RX BUFFER UTILITIES: */ /* unlike the _tx_ cousins, this doesn't update ptr */ @@ -1510,6 +1384,8 @@ m = 0; memcpy(dest, lvcc->rx.buf.ptr, n - m); memcpy(dest + n - m, lvcc->rx.buf.start, m); + /* Make sure that these copies don't get reordered */ + barrier(); } /* Receive AAL5 data on a VCC with a particular endptr */ @@ -1527,6 +1403,11 @@ /* Recover the second-to-last word to get true pdu length */ if ((x = &end[-2]) < lvcc->rx.buf.start) x = &lvcc->rx.buf.end[-2]; + /* + * Before we actually read from the buffer, make sure the memory + * changes have arrived + */ + rmb(); size = be32_to_cpup(x) & 0xffff; if (unlikely(n != aal5_size(size))) { /* Make sure size matches padding */ @@ -1542,9 +1423,9 @@ goto out; } skb_put(skb, size); + vcc_rx_memcpy(skb->data, lvcc, size); ATM_SKB(skb)->vcc = lvcc->rx.atmvcc; do_gettimeofday(&skb->stamp); - vcc_rx_memcpy(skb->data, lvcc, size); lvcc->rx.atmvcc->push(lvcc->rx.atmvcc, skb); atomic_inc(&lvcc->rx.atmvcc->stats->rx); out: @@ -1555,7 +1436,7 @@ static void vcc_rx_aal0(struct lanai_dev *lanai) { printk(KERN_INFO DEV_LABEL ": vcc_rx_aal0: not implemented\n"); - /* Remember to get vcclist_read_lock while looking up VC */ + /* Remember to get read_lock(&vcc_sklist_lock) while looking up VC */ /* Remember to increment lvcc->rx.atmvcc->stats->rx */ } @@ -1606,7 +1487,6 @@ memset(&lvcc->stats, 0, sizeof lvcc->stats); lvcc->rx.buf.start = lvcc->tx.buf.start = NULL; skb_queue_head_init(&lvcc->tx.backlog); - lvcc->tx.inprogress = NULL; #ifdef DEBUG lvcc->tx.unqueue = NULL; lvcc->vci = -1; @@ -1617,14 +1497,14 @@ static int lanai_get_sized_buffer(struct lanai_dev *lanai, struct lanai_buffer *buf, int max_sdu, int multiplier, - int min, const char *name) + const char *name) { int size; if (unlikely(max_sdu < 1)) max_sdu = 1; max_sdu = aal5_size(max_sdu); size = (max_sdu + 16) * multiplier + 16; - lanai_buf_allocate(buf, size, min, lanai->pci); + lanai_buf_allocate(buf, size, max_sdu + 32, lanai->pci); if (unlikely(buf->start == NULL)) return -ENOMEM; if (unlikely(lanai_buf_size(buf) < size)) @@ -1640,8 +1520,7 @@ struct lanai_vcc *lvcc, const struct atm_qos *qos) { return lanai_get_sized_buffer(lanai, &lvcc->rx.buf, - qos->rxtp.max_sdu, AAL5_RX_MULTIPLIER, qos->rxtp.max_sdu + 32, - "RX"); + qos->rxtp.max_sdu, AAL5_RX_MULTIPLIER, "RX"); } /* Setup a TX buffer for a currently unbound AAL5 vci */ @@ -1659,7 +1538,7 @@ multiplier = AAL5_TX_MULTIPLIER; } return lanai_get_sized_buffer(lanai, &lvcc->tx.buf, max_sdu, - multiplier, 80, "TX"); + multiplier, "TX"); } static inline void host_vcc_bind(struct lanai_dev *lanai, @@ -1759,21 +1638,21 @@ { vci_t vci = SERVICE_GET_VCI(s); struct lanai_vcc *lvcc; - vcclist_read_lock(); + read_lock(&vcc_sklist_lock); lvcc = lanai->vccs[vci]; if (unlikely(lvcc == NULL)) { - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); DPRINTK("(itf %d) got service entry 0x%X for nonexistent " "vcc %d\n", lanai->number, (unsigned int) s, vci); if (s & SERVICE_TX) - lanai->stats.service_novcc_tx++; + lanai->stats.service_notx++; else - lanai->stats.service_novcc_rx++; + lanai->stats.service_norx++; return 0; } if (s & SERVICE_TX) { /* segmentation interrupt */ if (unlikely(lvcc->tx.atmvcc == NULL)) { - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); DPRINTK("(itf %d) got service entry 0x%X for non-TX " "vcc %d\n", lanai->number, (unsigned int) s, vci); lanai->stats.service_notx++; @@ -1781,18 +1660,18 @@ } __set_bit(vci, lanai->transmit_ready); lvcc->tx.endptr = SERVICE_GET_END(s); - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); return 1; } if (unlikely(lvcc->rx.atmvcc == NULL)) { - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); DPRINTK("(itf %d) got service entry 0x%X for non-RX " "vcc %d\n", lanai->number, (unsigned int) s, vci); lanai->stats.service_norx++; return 0; } if (unlikely(lvcc->rx.atmvcc->qos.aal != ATM_AAL5)) { - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); DPRINTK("(itf %d) got RX service entry 0x%X for non-AAL5 " "vcc %d\n", lanai->number, (unsigned int) s, vci); lanai->stats.service_rxnotaal5++; @@ -1801,12 +1680,12 @@ } if (likely(!(s & (SERVICE_TRASH | SERVICE_STREAM | SERVICE_CRCERR)))) { vcc_rx_aal5(lvcc, SERVICE_GET_END(s)); - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); return 0; } if (s & SERVICE_TRASH) { int bytes; - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); DPRINTK("got trashed rx pdu on vci %d\n", vci); atomic_inc(&lvcc->rx.atmvcc->stats->rx_err); lvcc->stats.x.aal5.service_trash++; @@ -1819,7 +1698,7 @@ return 0; } if (s & SERVICE_STREAM) { - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); atomic_inc(&lvcc->rx.atmvcc->stats->rx_err); lvcc->stats.x.aal5.service_stream++; printk(KERN_ERR DEV_LABEL "(itf %d): Got AAL5 stream " @@ -1832,7 +1711,7 @@ lvcc->stats.x.aal5.service_rxcrc++; lvcc->rx.buf.ptr = &lvcc->rx.buf.start[SERVICE_GET_END(s) * 4]; cardvcc_write(lvcc, SERVICE_GET_END(s), vcc_rxreadptr); - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); return 0; } @@ -1840,9 +1719,8 @@ static void iter_transmit(struct lanai_dev *lanai, vci_t vci) { struct lanai_vcc *lvcc = lanai->vccs[vci]; - if (!vcc_is_backlogged(lvcc)) - return; - lvcc->tx.unqueue(lanai, lvcc, lvcc->tx.endptr); + if (vcc_is_backlogged(lvcc)) + lvcc->tx.unqueue(lanai, lvcc, lvcc->tx.endptr); } /* Run service queue -- called from interrupt context or with @@ -1862,13 +1740,11 @@ } reg_write(lanai, wreg, ServRead_Reg); if (ntx != 0) { - spin_lock(&lanai->txlock); - vcclist_read_lock(); + read_lock(&vcc_sklist_lock); vci_bitfield_iterate(lanai, lanai->transmit_ready, iter_transmit); CLEAR_BITMAP(&lanai->transmit_ready, NUM_VCI); - vcclist_read_unlock(); - spin_unlock(&lanai->txlock); + read_unlock(&vcc_sklist_lock); } } @@ -1885,22 +1761,47 @@ /* -------------------- POLLING TIMER: */ +#ifndef DEBUG_RW +/* Try to undequeue 1 backlogged vcc */ +static void iter_dequeue(struct lanai_dev *lanai, vci_t vci) +{ + struct lanai_vcc *lvcc = lanai->vccs[vci]; + int endptr; + if (lvcc == NULL || lvcc->tx.atmvcc == NULL || + !vcc_is_backlogged(lvcc)) { + __clear_bit(vci, lanai->backlog_vccs); + return; + } + endptr = TXREADPTR_GET_PTR(cardvcc_read(lvcc, vcc_txreadptr)); + lvcc->tx.unqueue(lanai, lvcc, endptr); +} +#endif /* !DEBUG_RW */ + static void lanai_timed_poll(unsigned long arg) { -#ifndef DEBUG_RW struct lanai_dev *lanai = (struct lanai_dev *) arg; +#ifndef DEBUG_RW unsigned long flags; #ifdef USE_POWERDOWN if (lanai->conf1 & CONFIG1_POWERDOWN) return; -#endif - spin_lock_irqsave(&lanai->servicelock, flags); - run_service(lanai); - spin_unlock_irqrestore(&lanai->servicelock, flags); - vcc_tx_dequeue_all(lanai); +#endif /* USE_POWERDOWN */ + local_irq_save(flags); + /* If we can grab the spinlock, check if any services need to be run */ + if (spin_trylock(&lanai->servicelock)) { + run_service(lanai); + spin_unlock(&lanai->servicelock); + } + /* ...and see if any backlogged VCs can make progress */ + /* unfortunately linux has no read_trylock() currently */ + read_lock(&vcc_sklist_lock); + vci_bitfield_iterate(lanai, lanai->backlog_vccs, iter_dequeue); + read_unlock(&vcc_sklist_lock); + local_irq_restore(flags); + get_statistics(lanai); +#endif /* !DEBUG_RW */ mod_timer(&lanai->timer, jiffies + LANAI_POLL_PERIOD); -#endif /* DEBUG_RW */ } static inline void lanai_timed_poll_start(struct lanai_dev *lanai) @@ -1914,7 +1815,7 @@ static inline void lanai_timed_poll_stop(struct lanai_dev *lanai) { - del_timer(&lanai->timer); + del_timer_sync(&lanai->timer); } /* -------------------- INTERRUPT SERVICE: */ @@ -2265,13 +2166,13 @@ #endif lanai->cbrvcc = NULL; memset(&lanai->stats, 0, sizeof lanai->stats); - spin_lock_init(&lanai->txlock); + spin_lock_init(&lanai->endtxlock); spin_lock_init(&lanai->servicelock); atmdev->ci_range.vpi_bits = 0; atmdev->ci_range.vci_bits = 0; while (1 << atmdev->ci_range.vci_bits < lanai->num_vci) atmdev->ci_range.vci_bits++; - atmdev->link_rate = ((25600000 / 8 - 8000) / 54); + atmdev->link_rate = ATM_25_PCR; /* 3.2: PCI initialization */ if ((result = lanai_pci_start(lanai)) != 0) @@ -2342,6 +2243,7 @@ goto error_vcctable; } MOD_INC_USE_COUNT; /* At this point we can't fail */ + mb(); /* Make sure that all that made it */ intr_enable(lanai, INT_ALL & ~(INT_PING | INT_WAKE)); /* 3.11: initialize loop mode (i.e. turn looping off) */ lanai->conf1 = (lanai->conf1 & ~CONFIG1_MASK_LOOPMODE) | @@ -2466,16 +2368,11 @@ atmvcc->vpi = vpi; atmvcc->vci = vci; set_bit(ATM_VF_ADDR, &atmvcc->flags); - lvcc = lanai->vccs[vci]; if (atmvcc->qos.aal != ATM_AAL0 && atmvcc->qos.aal != ATM_AAL5) return -EINVAL; -#if 0 - DPRINTK(DEV_LABEL "(itf %d): open %d.%d flags=0x%lX\n", - lanai->number, (int) vpi, vci, (unsigned long) atmvcc->flags); -#else DPRINTK(DEV_LABEL "(itf %d): open %d.%d\n", lanai->number, (int) vpi, vci); -#endif + lvcc = lanai->vccs[vci]; if (lvcc == NULL) { lvcc = new_lanai_vcc(); if (unlikely(lvcc == NULL)) @@ -2517,6 +2414,11 @@ } } host_vcc_bind(lanai, lvcc, vci); + /* + * Make sure everything made it to RAM before we tell the card about + * the VCC + */ + wmb(); if (atmvcc == lvcc->rx.atmvcc) host_vcc_start_rx(lvcc); if (atmvcc == lvcc->tx.atmvcc) { @@ -2549,9 +2451,6 @@ run_service(lanai); spin_unlock_irqrestore(&lanai->servicelock, flags); return 0; } - case 2200001: - vcc_tx_dequeue_all(lanai); - return 0; case 2200002: get_statistics(lanai); return 0; @@ -2644,18 +2543,18 @@ ATM_SKB(skb)->vcc = atmvcc; switch (atmvcc->qos.aal) { case ATM_AAL5: - spin_lock_irqsave(&lanai->txlock, flags); + read_lock_irqsave(&vcc_sklist_lock, flags); vcc_tx_aal5(lanai, lvcc, skb); - spin_unlock_irqrestore(&lanai->txlock, flags); + read_unlock_irqrestore(&vcc_sklist_lock, flags); return 0; case ATM_AAL0: if (unlikely(skb->len != ATM_CELL_SIZE-1)) goto einval; /* NOTE - this next line is technically invalid - we haven't unshared skb */ cpu_to_be32s((u32 *) skb->data); - spin_lock_irqsave(&lanai->txlock, flags); + read_lock_irqsave(&vcc_sklist_lock, flags); vcc_tx_aal0(lanai, lvcc, skb); - spin_unlock_irqrestore(&lanai->txlock, flags); + read_unlock_irqrestore(&vcc_sklist_lock, flags); return 0; } DPRINTK("lanai_send: bad aal=%d on vci=%d\n", (int) atmvcc->qos.aal, @@ -2725,10 +2624,6 @@ "master_parity=%u\n", lanai->stats.pcierr_s_target_abort, lanai->stats.pcierr_master_parity); if (left-- == 0) - return sprintf(page, "service list errors: no_vcc_rx=%u, " - "no_vcc_tx=%u,\n", lanai->stats.service_novcc_rx, - lanai->stats.service_novcc_tx); - if (left-- == 0) return sprintf(page, " no_tx=%u, " "no_rx=%u, bad_rx_aal=%u\n", lanai->stats.service_norx, lanai->stats.service_notx, @@ -2737,7 +2632,7 @@ return sprintf(page, "resets: dma=%u, card=%u\n", lanai->stats.dma_reenable, lanai->stats.card_reset); /* At this point, "left" should be the VCI we're looking for */ - vcclist_read_lock(); + read_lock(&vcc_sklist_lock); for (; ; left++) { if (left >= NUM_VCI) { left = 0; @@ -2773,7 +2668,7 @@ page[left++] = '\n'; page[left] = '\0'; out: - vcclist_read_unlock(); + read_unlock(&vcc_sklist_lock); return left; } #endif /* CONFIG_PROC_FS */ From chas@cmf.nrl.navy.mil Wed Sep 3 11:58:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 11:58:13 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83Iw3WZ026981 for ; Wed, 3 Sep 2003 11:58:04 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h83Hsnl5025209; Wed, 3 Sep 2003 13:54:49 -0400 (EDT) Message-Id: <200309031754.h83Hsnl5025209@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com Subject: [PATCH][ATM] 2.4 fixes Reply-To: chas3@users.sourceforge.net Date: Wed, 03 Sep 2003 13:54:50 -0400 From: chas williams X-Spam-Score: () hits=0.5 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5542 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev some fixes for screwups i made in the 2.4.22 kernel release. [atm]: if clip isn't a module don't __MOD_DEC_USE_COUNT() # 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.1129 -> 1.1130 # net/atm/proc.c 1.8 -> 1.9 # net/atm/common.c 1.16 -> 1.17 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/03 chas@relax.cmf.nrl.navy.mil 1.1130 # if clip isn't a module don't __MOD_DEC_USE_COUNT() # -------------------------------------------- # diff -Nru a/net/atm/common.c b/net/atm/common.c --- a/net/atm/common.c Wed Sep 3 12:31:05 2003 +++ b/net/atm/common.c Wed Sep 3 12:31:05 2003 @@ -672,7 +672,8 @@ } if (try_atm_clip_ops()) { ret_val = atm_clip_ops->clip_create(arg); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); } else ret_val = -ENOSYS; goto done; @@ -687,7 +688,8 @@ #endif if (try_atm_clip_ops()) { error = atm_clip_ops->atm_init_atmarp(vcc); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); if (!error) sock->state = SS_CONNECTED; ret_val = error; @@ -701,7 +703,8 @@ } if (try_atm_clip_ops()) { ret_val = atm_clip_ops->clip_mkip(vcc, arg); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); } else ret_val = -ENOSYS; goto done; @@ -712,7 +715,8 @@ } if (try_atm_clip_ops()) { ret_val = atm_clip_ops->clip_setentry(vcc, arg); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); } else ret_val = -ENOSYS; goto done; @@ -723,7 +727,8 @@ } if (try_atm_clip_ops()) { ret_val = atm_clip_ops->clip_encap(vcc, arg); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); } else ret_val = -ENOSYS; goto done; diff -Nru a/net/atm/proc.c b/net/atm/proc.c --- a/net/atm/proc.c Wed Sep 3 12:31:05 2003 +++ b/net/atm/proc.c Wed Sep 3 12:31:05 2003 @@ -358,7 +358,7 @@ spin_unlock_irqrestore(&dev->lock, flags); spin_unlock(&atm_dev_lock); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - if (clip_info) + if (clip_info && atm_clip_ops->owner) __MOD_DEC_USE_COUNT(atm_clip_ops->owner); #endif return strlen(buf); @@ -367,8 +367,8 @@ } spin_unlock(&atm_dev_lock); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - if (clip_info) - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (clip_info && atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); #endif return 0; } @@ -458,7 +458,8 @@ if (--count) continue; atmarp_info(n->dev,entry,NULL,buf); read_unlock_bh(&clip_tbl_hook->lock); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); return strlen(buf); } for (vcc = entry->vccs; vcc; @@ -466,12 +467,14 @@ if (--count) continue; atmarp_info(n->dev,entry,vcc,buf); read_unlock_bh(&clip_tbl_hook->lock); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); return strlen(buf); } } read_unlock_bh(&clip_tbl_hook->lock); - __MOD_DEC_USE_COUNT(atm_clip_ops->owner); + if (atm_clip_ops->owner) + __MOD_DEC_USE_COUNT(atm_clip_ops->owner); return 0; } #endif [atm]: #define'ing pci_pool_create() breaks CONFIG_MODVERSION # 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.1130 -> 1.1131 # drivers/atm/he.c 1.4 -> 1.5 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/03 chas@relax.cmf.nrl.navy.mil 1.1131 # #define'ing pci_pool_create() breaks CONFIG_MODVERSION # -------------------------------------------- # diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c --- a/drivers/atm/he.c Wed Sep 3 12:33:07 2003 +++ b/drivers/atm/he.c Wed Sep 3 12:33:07 2003 @@ -109,10 +109,6 @@ #define pci_get_drvdata(pci_dev) (pci_dev)->driver_data #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44) -#define pci_pool_create(a, b, c, d, e) pci_pool_create(a, b, c, d, e, SLAB_KERNEL) -#endif - #include "he.h" #include "suni.h" @@ -785,7 +781,7 @@ /* small buffer pool */ #ifdef USE_RBPS_POOL he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev, - CONFIG_RBPS_BUFSIZE, 8, 0); + CONFIG_RBPS_BUFSIZE, 8, 0, SLAB_KERNEL); if (he_dev->rbps_pool == NULL) { hprintk("unable to create rbps pages\n"); return -ENOMEM; @@ -849,7 +845,7 @@ /* large buffer pool */ #ifdef USE_RBPL_POOL he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev, - CONFIG_RBPL_BUFSIZE, 8, 0); + CONFIG_RBPL_BUFSIZE, 8, 0, SLAB_KERNEL); if (he_dev->rbpl_pool == NULL) { hprintk("unable to create rbpl pool\n"); return -ENOMEM; @@ -1475,7 +1471,7 @@ #ifdef USE_TPD_POOL he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev, - sizeof(struct he_tpd), TPD_ALIGNMENT, 0); + sizeof(struct he_tpd), TPD_ALIGNMENT, 0, SLAB_KERNEL); if (he_dev->tpd_pool == NULL) { hprintk("unable to create tpd pci_pool\n"); return -ENOMEM; From shemminger@osdl.org Wed Sep 3 12:38:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 12:38:38 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83Jc3WZ028808 for ; Wed, 3 Sep 2003 12:38:04 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h83IeEo02308; Wed, 3 Sep 2003 11:40:15 -0700 Date: Wed, 3 Sep 2003 11:40:00 -0700 From: Stephen Hemminger To: =?ISO-8859-1?Q?P=C3=A1sztor_Szil=C3=A1rd?= Cc: Jeff Garzik , netdev@oss.sgi.com Subject: [PATCH] comx - set owner on /proc entries Message-Id: <20030903114000.0b330411.shemminger@osdl.org> In-Reply-To: References: <013201c34f6f$0ae46410$2357e1c1@keszi> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h83Jc3WZ028808 X-archive-position: 5543 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 Set owner field on all the /proc entries created. I know this is marked as OBSOLETE today, but Pásztor is working on it and probably should include this Builds, but no hardware to test... diff -Nru a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c --- a/drivers/net/wan/comx-hw-comx.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-hw-comx.c Wed Sep 3 11:36:22 2003 @@ -1250,6 +1250,7 @@ == NULL) { goto cleanup_HW_privdata; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; @@ -1260,6 +1261,7 @@ == NULL) { goto cleanup_filename_io; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; @@ -1270,6 +1272,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_irq; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; @@ -1281,6 +1284,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_channel; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; @@ -1292,6 +1296,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_clock; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; @@ -1302,6 +1307,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_memaddr; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = NULL; @@ -1311,6 +1317,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_twin; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; new_file->write_proc = &comxhw_write_proc; diff -Nru a/drivers/net/wan/comx-hw-locomx.c b/drivers/net/wan/comx-hw-locomx.c --- a/drivers/net/wan/comx-hw-locomx.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-hw-locomx.c Wed Sep 3 11:36:22 2003 @@ -395,6 +395,7 @@ ch->procdir)) == NULL) { goto cleanup_HW_privdata; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; new_file->write_proc = &locomx_write_proc; @@ -404,6 +405,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_io; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; new_file->write_proc = &locomx_write_proc; @@ -415,6 +417,7 @@ ch->procdir)) == NULL) { return -EIO; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; new_file->write_proc = &locomx_write_proc; diff -Nru a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c --- a/drivers/net/wan/comx-hw-mixcom.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-hw-mixcom.c Wed Sep 3 11:36:22 2003 @@ -841,6 +841,7 @@ ch->procdir)) == NULL) { goto cleanup_HW_privdata; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; new_file->write_proc = &mixcom_write_proc; @@ -850,6 +851,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_io; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; new_file->write_proc = &mixcom_write_proc; @@ -860,6 +862,7 @@ ch->procdir)) == NULL) { return -EIO; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; new_file->write_proc = &mixcom_write_proc; @@ -870,6 +873,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_irq; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; new_file->write_proc = &mixcom_write_proc; @@ -879,6 +883,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_channel; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; new_file->write_proc = &mixcom_write_proc; diff -Nru a/drivers/net/wan/comx-hw-munich.c b/drivers/net/wan/comx-hw-munich.c --- a/drivers/net/wan/comx-hw-munich.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-hw-munich.c Wed Sep 3 11:36:22 2003 @@ -2672,6 +2672,7 @@ if ((new_file = create_proc_entry(FILENAME_BOARDNUM, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2683,6 +2684,7 @@ if ((new_file = create_proc_entry(FILENAME_TIMESLOTS, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2692,6 +2694,7 @@ if ((new_file = create_proc_entry(FILENAME_FRAMING, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2701,6 +2704,7 @@ if ((new_file = create_proc_entry(FILENAME_LINECODE, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2710,6 +2714,7 @@ if ((new_file = create_proc_entry(FILENAME_CLOCK_SOURCE, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2719,6 +2724,7 @@ if ((new_file = create_proc_entry(FILENAME_LOOPBACK, S_IFREG | 0644, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2729,6 +2735,7 @@ /* DEL: ez itt csak fejlesztesi celokra!! */ if ((new_file = create_proc_entry(FILENAME_REG, S_IFREG | 0200, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; @@ -2739,6 +2746,7 @@ if ((new_file = create_proc_entry(FILENAME_LBIREG, S_IFREG | 0200, ch->procdir)) == NULL) return init_escape(ch); + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &munich_read_proc; new_file->write_proc = &munich_write_proc; diff -Nru a/drivers/net/wan/comx-proto-fr.c b/drivers/net/wan/comx-proto-fr.c --- a/drivers/net/wan/comx-proto-fr.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-proto-fr.c Wed Sep 3 11:36:22 2003 @@ -810,6 +810,7 @@ ch->procdir)) == NULL) { goto cleanup_LINE_privdata; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; new_file->write_proc = &fr_write_proc; @@ -820,6 +821,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_dlci; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; new_file->write_proc = &fr_write_proc; @@ -870,6 +872,7 @@ goto cleanup_LINE_privdata; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; new_file->write_proc = &fr_write_proc; @@ -880,6 +883,7 @@ ch->procdir)) == NULL) { goto cleanup_filename_dlci; } + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; new_file->write_proc = &fr_write_proc; diff -Nru a/drivers/net/wan/comx-proto-lapb.c b/drivers/net/wan/comx-proto-lapb.c --- a/drivers/net/wan/comx-proto-lapb.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx-proto-lapb.c Wed Sep 3 11:36:22 2003 @@ -499,6 +499,7 @@ struct proc_dir_entry *new_file; if ((new_file = create_proc_entry(name, S_IFREG | mode, dir)) != NULL) { + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comxlapb_read_proc; new_file->write_proc = &comxlapb_write_proc; diff -Nru a/drivers/net/wan/comx.c b/drivers/net/wan/comx.c --- a/drivers/net/wan/comx.c Wed Sep 3 11:36:22 2003 +++ b/drivers/net/wan/comx.c Wed Sep 3 11:36:22 2003 @@ -563,7 +563,6 @@ return min_t(int, count, len - off); } - static int comx_root_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -788,6 +787,7 @@ goto cleanup_dev; } + new_dir->owner = THIS_MODULE; new_dir->nlink = 2; new_dir->data = NULL; // ide jon majd a struct dev @@ -811,6 +811,7 @@ S_IFREG | 0644, new_dir)) == NULL) { goto cleanup_filename_lineupdelay; } + debug_file->owner = THIS_MODULE; debug_file->data = (void *)debug_file; debug_file->read_proc = NULL; // see below debug_file->write_proc = &comx_write_proc; @@ -972,6 +973,7 @@ struct proc_dir_entry *new_file; if ((new_file = create_proc_entry(name, S_IFREG | mode, dir)) != NULL) { + new_file->owner = THIS_MODULE; new_file->data = (void *)new_file; new_file->read_proc = &comx_read_proc; new_file->write_proc = &comx_write_proc; @@ -1077,6 +1079,7 @@ S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, &proc_root); if (!comx_root_dir) return -ENOMEM; + comx_root_dir->owner = THIS_MODULE; comx_root_dir->proc_iops = &comx_root_inode_ops; if ((new_file = create_proc_entry(FILENAME_HARDWARELIST, @@ -1084,6 +1087,7 @@ return -ENOMEM; } + new_file->owner = THIS_MODULE; new_file->data = new_file; new_file->read_proc = &comx_root_read_proc; new_file->write_proc = NULL; @@ -1094,6 +1098,7 @@ return -ENOMEM; } + new_file->owner = THIS_MODULE; new_file->data = new_file; new_file->read_proc = &comx_root_read_proc; new_file->write_proc = NULL; From silicon@inf.bme.hu Wed Sep 3 14:39:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 03 Sep 2003 14:39:51 -0700 (PDT) Received: from kempelen.iit.bme.hu (kempelen.iit.bme.hu [152.66.241.120]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h83LdFWZ006717 for ; Wed, 3 Sep 2003 14:39:16 -0700 Received: from localhost (silicon@localhost) by kempelen.iit.bme.hu (8.11.7+Sun/8.11.6) with SMTP id h83LLX321664; Wed, 3 Sep 2003 23:21:34 +0200 (MET DST) Date: Wed, 3 Sep 2003 23:21:33 +0200 (MET DST) From: =?ISO-8859-2?Q?P=E1sztor_Szil=E1rd?= X-Sender: silicon@kempelen.iit.bme.hu To: Stephen Hemminger cc: Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] comx - set owner on /proc entries In-Reply-To: <20030903114000.0b330411.shemminger@osdl.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by oss.sgi.com id h83LdFWZ006717 X-archive-position: 5544 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: silicon@inf.bme.hu Precedence: bulk X-list: netdev Stephen Hemminger: > Set owner field on all the /proc entries created. > > I know this is marked as OBSOLETE today, but Pásztor is working on it > and probably should include this > > Builds, but no hardware to test... Thanks. Affirmative. -------------------------------------------- | Don't panic! Count to ten. Then panic. | -------------------------------------------- From pekkas@netcore.fi Thu Sep 4 06:46:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 06:47:01 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84DkNWZ029308 for ; Thu, 4 Sep 2003 06:46:25 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h83Jb0k23718; Wed, 3 Sep 2003 22:37:00 +0300 Date: Wed, 3 Sep 2003 22:36:59 +0300 (EEST) From: Pekka Savola To: Ville Nuorvala cc: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5552 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pekkas@netcore.fi Precedence: bulk X-list: netdev On Wed, 3 Sep 2003, Ville Nuorvala wrote: > Who says it isn't possible? The user who thinks he knows better can change > the accept_ra (and rtr_solicits) flag for the tunnel dev and start > receiving RAs through it. right, but.. > > _However_, that doesn't make sense unless you have a more specific route > > to the destination IPv6 tunnel endpoint. > > Yes, exactly. And what should the node do if it just has two default > routes, one through a tunnel and one through an ethernet interface? This > will be the case if a normal host receives RAs through both interfaces. > > At least two things can go wrong: > 1) A packet intended to the tunnel is sent straight through the ethernet > device > 2) A packet already encapsulated by the tunnel is rerouted through it and > is thus dropped > > Based on my own experiences, I can say things like this do happen. Well, could it too hacky to implement a check which ensures that if you add a route over a tunnel, there must be a more specific route to the tunnel endpoint? -- otherwise adding the route would fail? (not sure what it would require to make it so, or whether an approach like this would turn out to be infeasible in the end -- but this would seem to be very feasible to me..) I'm a bit concerned by this, but if folks think disabling RA's by default on ipv6-in-ipv6 tunnels is enough, fine.. -- Pekka Savola "You each name yourselves king, yet the Netcore Oy kingdom bleeds." Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings From shemminger@osdl.org Thu Sep 4 09:08:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 09:08:27 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84G8KWZ007321 for ; Thu, 4 Sep 2003 09:08:20 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84FVbo28903; Thu, 4 Sep 2003 08:31:37 -0700 Date: Thu, 4 Sep 2003 08:31:24 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] (1/8) add probe_old_netdevs hook Message-Id: <20030904083124.2a6c795c.shemminger@osdl.org> In-Reply-To: <20030903204150.14273da8.davem@redhat.com> References: <20030903164908.14705874.shemminger@osdl.org> <3F568C88.4030303@pobox.com> <20030903204150.14273da8.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5559 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 Wed, 3 Sep 2003 20:41:50 -0700 "David S. Miller" wrote: > On Wed, 03 Sep 2003 20:51:20 -0400 > Jeff Garzik wrote: > > > All the patches except for #3 look ok to me. > > > > David? Here is a patch that restores the original order. Applies after original #3 patch diff -Nru a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c --- a/drivers/net/appletalk/ltpc.c Thu Sep 4 08:30:59 2003 +++ b/drivers/net/appletalk/ltpc.c Thu Sep 4 08:30:59 2003 @@ -1046,6 +1046,16 @@ SET_MODULE_OWNER(dev); /* probe for the I/O port address */ + if (io != 0x240 && request_region(0x220,8,"ltpc")) { + x = inb_p(0x220+6); + if ( (x!=0xff) && (x>=0xf0) ) { + io = 0x220; + goto got_port; + } + else { + release_region(0x220,8); + } + } if (io != 0x220 && request_region(0x240,8,"ltpc")) { y = inb_p(0x240+6); @@ -1053,16 +1063,10 @@ io = 0x240; goto got_port; } - release_region(0x240,8); - } - if (io != 0x240 && request_region(0x220,8,"ltpc")) { - x = inb_p(0x220+6); - if ( (x!=0xff) && (x>=0xf0) ) { - io = 0x220; - goto got_port; + else { + release_region(0x240,8); } - release_region(0x220,8); - } + } /* give up in despair */ printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y); From jfbeam@bluetronic.net Thu Sep 4 13:34:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:35:11 -0700 (PDT) Received: from sweetums.bluetronic.net (sweetums.bluetronic.net [24.199.150.42]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KYOWZ015066 for ; Thu, 4 Sep 2003 13:34:25 -0700 Received: from localhost (jfbeam@localhost) by sweetums.bluetronic.net (8.11.7/8.11.7) with ESMTP id h84GL0L15367; Thu, 4 Sep 2003 12:21:00 -0400 (EDT) Date: Thu, 4 Sep 2003 12:21:00 -0400 (EDT) From: Ricky Beam To: "David S. Miller" cc: "YOSHIFUJI Hideaki / _$B5HF#1QL@" , , Subject: Re: /proc/net/* read drops data In-Reply-To: <20030904004638.1d4b001d.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5561 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jfbeam@bluetronic.net Precedence: bulk X-list: netdev On Thu, 4 Sep 2003, David S. Miller wrote: >> D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data > >This fix looks good to me. Applied. That might fix udp, but that's not the only one to be fixed. I'll compile a list. (tcp for sure.) --Ricky From jfbeam@bluetronic.net Thu Sep 4 13:34:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:35:11 -0700 (PDT) Received: from sweetums.bluetronic.net (sweetums.bluetronic.net [24.199.150.42]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KYOWb015066 for ; Thu, 4 Sep 2003 13:34:26 -0700 Received: from localhost (jfbeam@localhost) by sweetums.bluetronic.net (8.11.7/8.11.7) with ESMTP id h84GPG115429; Thu, 4 Sep 2003 12:25:16 -0400 (EDT) Date: Thu, 4 Sep 2003 12:25:16 -0400 (EDT) From: Ricky Beam To: "David S. Miller" cc: "YOSHIFUJI Hideaki / _$B5HF#1QL@" , , Subject: Re: /proc/net/* read drops data In-Reply-To: <20030904004638.1d4b001d.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5560 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jfbeam@bluetronic.net Precedence: bulk X-list: netdev On Thu, 4 Sep 2003, David S. Miller wrote: >> D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data > >This fix looks good to me. Applied. The list: (file) (bs=1) (bs=10000) /proc/net/igmp 122 191 /proc/net/route 128 384 /proc/net/rt_acct 0 4096 /proc/net/rt_cache 384 512 /proc/net/tcp 1800 1950 /proc/net/udp 1024 1152 (I don't have ipv6 enabled) --Ricky From jgarzik@pobox.com Thu Sep 4 13:46:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:47:36 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KksWZ017526 for ; Thu, 4 Sep 2003 13:46:55 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:35170 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19ubUK-0003sp-VE; Wed, 03 Sep 2003 18:32:13 +0100 Message-ID: <3F562590.60101@pobox.com> Date: Wed, 03 Sep 2003 13:32:00 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Jim Keniston CC: Greg KH , LKML , netdev , "Feldman, Scott" , Larry Kessler , Randy Dunlap , Alan Cox , Andrew Morton Subject: Re: [PATCH 1/4] Net device error logging, revised References: <3F4A8027.6FE3F594@us.ibm.com> <20030826183221.GB3167@kroah.com> <3F4BEE68.A6C862C2@us.ibm.com> <3F4BF265.5050101@pobox.com> <3F4C046D.77CF7E03@us.ibm.com> In-Reply-To: <3F4C046D.77CF7E03@us.ibm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5563 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 Jim Keniston wrote: > Jeff Garzik wrote: >>"NETIF_MSG_" is silly and should be eliminated. > > >>From this, I infer that you think that the option to "omit" the msglevel arg -- > e.g., > netdev_err(dev,, "NIC is fried!\n"); /* always logged */ > -- is silly. No big deal. Its sole purpose is to help keep netdev_* calls terse. yes >>A separate "NETIF_MSG_ALL" test is not needed, because msg_enable is a >>bitmask. A msg_enable of 0xffffffff will naturally create a NETIF_MSG_ALL. > > > But how do you code a netdev_* call where you ALWAYS want the message (including > netdev_printk-style prefix) logged, regardless of the value of msg_enable? That's > what NETIF_MSG_ALL is for (and why it might be better called NETIF_MSG_ALWAYS)... I understand the purpose of NETIF_MSG_ALL; re-read what I said. You don't need a separate _test_, as your implementation includes. Defining NETIF_MSG_ALL to 0xffffffff will naturally create the effect you seek. >>Also, whatever mechanism is created, it needs to preserve the feature of >>the existing system: >> >> if (a quick bitmask test) >> do something >> >>And preferably "do something" is not inlined, because printk'ing -- >>although it may appear in a fast path during debugging -- cannot be >>considered a fast path itself. > Sorry, I'm not sure what you're getting at here. netdev_* doesn't prevent > people from using the existing netif_msg_* macros; it just provides shorthand > for the (usual) case where "do something" is "printk". I would prefer to be more ambitious. If we're gonna go in and change every printk in a driver, we might as well do it right, and (a) make sure the driver does msg_enable, and (b) make the source code a bit more clean by hiding the "if (test bitmap)" test in your netdev_xxx stuff. Jeff From shemminger@osdl.org Thu Sep 4 13:47:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:47:41 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KlbWZ017650 for ; Thu, 4 Sep 2003 13:47:38 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84JEZo08733; Thu, 4 Sep 2003 12:14:36 -0700 Date: Thu, 4 Sep 2003 12:14:21 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] (8/8) loopback device simplification Message-Id: <20030904121421.51b2f993.shemminger@osdl.org> In-Reply-To: <20030903204105.0f01f131.davem@redhat.com> References: <20030903164921.7d923008.shemminger@osdl.org> <3F568AC0.5090601@pobox.com> <20030903204105.0f01f131.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5564 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 Wed, 3 Sep 2003 20:41:05 -0700 "David S. Miller" wrote: > On Wed, 03 Sep 2003 20:43:44 -0400 > Jeff Garzik wrote: > > > Would be nice to move dev_base and dev_base_lock somewhere, maybe > > drivers/net/net_init.c (which really should be renamed libnet.c) or > > perhaps somewhere in net/* > > Once all of the conversions are done, we can happily move > this someone. My personal preference would be net/core/dev.c, > as I believe we can limit all of the modifications to there > eventually and thus not have to export those two symbols to > the entire kernel any more. > > The fact that we export the list and it's locking makes it > really hard to change things. my current idea is to switch dev_base_lock over to RCU and change dev_base to a list macro. #define for_each_netdev(_d) list_for_each_entry_rcu(_d, &netdev_base, dev_list) ... From shemminger@osdl.org Thu Sep 4 13:47:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:47:44 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KlbWb017650 for ; Thu, 4 Sep 2003 13:47:40 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84Inao04523; Thu, 4 Sep 2003 11:49:36 -0700 Date: Thu, 4 Sep 2003 11:49:22 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com, linux-kernel@vger.kernel.org Subject: [PATCH] convert /proc/net/unix to seq_file Message-Id: <20030904114922.555841cd.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5565 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 Applies against 2.6.0-test4. diff -Nru a/net/unix/af_unix.c b/net/unix/af_unix.c --- a/net/unix/af_unix.c Thu Sep 4 10:35:58 2003 +++ b/net/unix/af_unix.c Thu Sep 4 10:35:58 2003 @@ -111,6 +111,7 @@ #include #include #include +#include #include #include #include @@ -1805,25 +1806,52 @@ #ifdef CONFIG_PROC_FS -static int unix_read_proc(char *buffer, char **start, off_t offset, - int length, int *eof, void *data) +static struct sock *unix_seq_idx(int *iter, loff_t pos) { - off_t pos=0; - off_t begin=0; - int len=0; - int i; + loff_t off = 0; struct sock *s; - - len+= sprintf(buffer,"Num RefCount Protocol Flags Type St " - "Inode Path\n"); + for (s = first_unix_socket(iter); s; s = next_unix_socket(iter, s)) { + if (off == pos) + return s; + ++off; + } + return NULL; +} + + +static void *unix_seq_start(struct seq_file *seq, loff_t *pos) +{ read_lock(&unix_table_lock); - forall_unix_sockets (i,s) - { + return *pos ? unix_seq_idx(seq->private, *pos - 1) : ((void *) 1); +} + +static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + ++*pos; + + if (v == (void *)1) + return first_unix_socket(seq->private); + return next_unix_socket(seq->private, v); +} + +static void unix_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&unix_table_lock); +} + +static int unix_seq_show(struct seq_file *seq, void *v) +{ + + if (v == (void *)1) + seq_puts(seq, "Num RefCount Protocol Flags Type St " + "Inode Path\n"); + else { + struct sock *s = v; struct unix_sock *u = unix_sk(s); unix_state_rlock(s); - len+=sprintf(buffer+len,"%p: %08X %08X %08X %04X %02X %5lu", + seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu", s, atomic_read(&s->sk_refcnt), 0, @@ -1835,39 +1863,61 @@ sock_i_ino(s)); if (u->addr) { - buffer[len++] = ' '; - memcpy(buffer+len, u->addr->name->sun_path, - u->addr->len-sizeof(short)); - if (!UNIX_ABSTRACT(s)) - len--; - else - buffer[len] = '@'; - len += u->addr->len - sizeof(short); - } - unix_state_runlock(s); + int i; + seq_putc(seq, ' '); + + for (i = 0; i < u->addr->len-sizeof(short); i++) + seq_putc(seq, u->addr->name->sun_path[i]); - buffer[len++]='\n'; - - pos = begin + len; - if(posoffset+length) - goto done; + unix_state_runlock(s); + seq_putc(seq, '\n'); } - *eof = 1; -done: - read_unlock(&unix_table_lock); - *start=buffer+(offset-begin); - len-=(offset-begin); - if(len>length) - len=length; - if (len < 0) - len = 0; - return len; + + return 0; +} + +struct seq_operations unix_seq_ops = { + .start = unix_seq_start, + .next = unix_seq_next, + .stop = unix_seq_stop, + .show = unix_seq_show, +}; + + +static int unix_seq_open(struct inode *inode, struct file *file) +{ + struct seq_file *seq; + int rc = -ENOMEM; + int *iter = kmalloc(sizeof(int), GFP_KERNEL); + + if (!iter) + goto out; + + rc = seq_open(file, &unix_seq_ops); + if (rc) + goto out_kfree; + + seq = file->private_data; + seq->private = iter; + *iter = 0; +out: + return rc; +out_kfree: + kfree(iter); + goto out; } + +static struct file_operations unix_seq_fops = { + .owner = THIS_MODULE, + .open = unix_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release_private, +}; + #endif struct proto_ops unix_stream_ops = { @@ -1947,7 +1997,7 @@ sock_register(&unix_family_ops); #ifdef CONFIG_PROC_FS - create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL); + proc_net_fops_create("unix", 0, &unix_seq_fops); #endif unix_sysctl_register(); return 0; @@ -1957,7 +2007,7 @@ { sock_unregister(PF_UNIX); unix_sysctl_unregister(); - remove_proc_entry("net/unix", 0); + proc_net_remove("unix"); kmem_cache_destroy(unix_sk_cachep); } From davem@pizda.ninka.net Thu Sep 4 13:51:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:29 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWZ018914 for ; Thu, 4 Sep 2003 13:51:55 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA20390; Thu, 4 Sep 2003 11:56:32 -0700 Date: Thu, 4 Sep 2003 11:56:32 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: netdev@oss.sgi.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] convert /proc/net/unix to seq_file Message-Id: <20030904115632.47923526.davem@redhat.com> In-Reply-To: <20030904114922.555841cd.shemminger@osdl.org> References: <20030904114922.555841cd.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5566 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 Sep 2003 11:49:22 -0700 Stephen Hemminger wrote: > Applies against 2.6.0-test4. Applied, thanks Stephen. From davem@pizda.ninka.net Thu Sep 4 13:51:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:31 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWd018914 for ; Thu, 4 Sep 2003 13:51:56 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id LAA20242; Thu, 4 Sep 2003 11:00:27 -0700 Date: Thu, 4 Sep 2003 11:00:27 -0700 From: "David S. Miller" To: chas williams Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [RFT] covert br2684 to seq_file Message-Id: <20030904110027.3e800760.davem@redhat.com> In-Reply-To: <200309041636.h84GaoSa017129@ginger.cmf.nrl.navy.mil> References: <20030902104308.08ce3fa4.shemminger@osdl.org> <200309041636.h84GaoSa017129@ginger.cmf.nrl.navy.mil> X-Mailer: Sylpheed version 0.9.2 (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: 5568 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, 04 Sep 2003 12:36:51 -0400 chas williams wrote: > dave, please apply to 2.6 -- thanks Applied. Chas, please do me a favor, start using a consistent changelog message format. I fix up every one of your commit messages so that it is of the form: [ATM]: Blab blah blah. So if you could do the same in your patches I'd appreciate it. Thanks a lot. From davem@pizda.ninka.net Thu Sep 4 13:51:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:32 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWh018914 for ; Thu, 4 Sep 2003 13:51:58 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id HAA19355; Thu, 4 Sep 2003 07:45:20 -0700 Date: Thu, 4 Sep 2003 07:45:20 -0700 From: "David S. Miller" To: John Levon Cc: netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030904074520.5dceff3e.davem@redhat.com> In-Reply-To: <20030904145204.GA27953@compsoc.man.ac.uk> References: <20030904145204.GA27953@compsoc.man.ac.uk> X-Mailer: Sylpheed version 0.9.2 (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: 5569 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 Sep 2003 15:52:04 +0100 John Levon wrote: > This file seems bitrotted and more up to date info is available in > MAINTAINERS in large part. For some reason I deleted this file from 2.4.x but I never did it for 2.5.x, fixed... From davem@pizda.ninka.net Thu Sep 4 13:51:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:30 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWb018914 for ; Thu, 4 Sep 2003 13:51:56 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id MAA20445; Thu, 4 Sep 2003 12:07:44 -0700 Date: Thu, 4 Sep 2003 12:07:43 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] (8/8) loopback device simplification Message-Id: <20030904120743.3b96e738.davem@redhat.com> In-Reply-To: <20030904121421.51b2f993.shemminger@osdl.org> References: <20030903164921.7d923008.shemminger@osdl.org> <3F568AC0.5090601@pobox.com> <20030903204105.0f01f131.davem@redhat.com> <20030904121421.51b2f993.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5567 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 Sep 2003 12:14:21 -0700 Stephen Hemminger wrote: > On Wed, 3 Sep 2003 20:41:05 -0700 > "David S. Miller" wrote: > > > The fact that we export the list and it's locking makes it > > really hard to change things. > > my current idea is to switch dev_base_lock over to RCU and > change dev_base to a list macro. > > #define for_each_netdev(_d) list_for_each_entry_rcu(_d, &netdev_base, dev_list) Also see other threads where we were discussing making it into a hash table in order to speed up search and name allocation. From davem@pizda.ninka.net Thu Sep 4 13:51:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:33 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWf018914 for ; Thu, 4 Sep 2003 13:51:57 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id JAA19802; Thu, 4 Sep 2003 09:06:02 -0700 Date: Thu, 4 Sep 2003 09:06:02 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] (1/8) add probe_old_netdevs hook Message-Id: <20030904090602.12f73b5e.davem@redhat.com> In-Reply-To: <20030904083124.2a6c795c.shemminger@osdl.org> References: <20030903164908.14705874.shemminger@osdl.org> <3F568C88.4030303@pobox.com> <20030903204150.14273da8.davem@redhat.com> <20030904083124.2a6c795c.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5570 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 Sep 2003 08:31:24 -0700 Stephen Hemminger wrote: > Here is a patch that restores the original order. > Applies after original #3 patch I already told you that I did the fix for you. Oh, the perils of doing work and replying before processing one's entire mailbox :) From COHUCK@de.ibm.com Thu Sep 4 13:52:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:52:34 -0700 (PDT) Received: from d12lmsgate.de.ibm.com (d12lmsgate-2.de.ibm.com [194.196.100.235]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KpxWZ018913 for ; Thu, 4 Sep 2003 13:52:00 -0700 Received: from d12relay02.megacenter.de.ibm.com (d12relay02.megacenter.de.ibm.com [9.149.165.196]) by d12lmsgate.de.ibm.com (8.12.9/8.12.8) with ESMTP id h84G1MEF166128; Thu, 4 Sep 2003 18:01:22 +0200 Received: from d12ml030.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12relay02.megacenter.de.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id h84G1SNl249580; Thu, 4 Sep 2003 18:01:28 +0200 Subject: Re: Bug in qeth in 2.6 To: Pete Zaitcev Cc: netdev@oss.sgi.com, Utz Bacher , Pete Zaitcev X-Mailer: Lotus Notes Release 5.0.12 February 13, 2003 Message-ID: From: "Cornelia Huck" Date: Thu, 4 Sep 2003 18:01:28 +0200 X-MIMETrack: Serialize by Router on D12ML030/12/M/IBM(Release 5.0.9a |January 7, 2002) at 04/09/2003 18:01:31 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-archive-position: 5571 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: COHUCK@de.ibm.com Precedence: bulk X-list: netdev Hi, sorry, I still don't see it... > 2.4 was like this: > > result = 0; > for (all in list) { > if (something) > result = QETH_VERIFY_IS_SOMETHING; and it stops here if something... > } ... and here follows a second loop over the list, looking for foo(). > > 2.6 is: > > result = 0; > for (all in list) { > result = (something)? QETH_VERIFY_IS_SOMETHING: foo(); and here it stops if something or foo()... > } ...no second loop here. Since it's either something or foo(), this looks like the same behaviour to me. Best regards / Mit freundlichen Gruessen Cornelia Huck zLinux Developer Tel.: +49-7031-16-4837, Mail: cohuck@de.ibm.com From davem@pizda.ninka.net Thu Sep 4 13:53:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:47 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptXD018914 for ; Thu, 4 Sep 2003 13:53:15 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17367; Wed, 3 Sep 2003 20:19:20 -0700 Date: Wed, 3 Sep 2003 20:19:20 -0700 From: "David S. Miller" To: Felipe W Damasio Cc: pekkas@netcore.fi, yoshfuji@linux-ipv6.org, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [PATCH] Kill unneeded linux/version.h include in net/ipv6 Message-Id: <20030903201920.15625d8e.davem@redhat.com> In-Reply-To: <3F55F4DD.9070301@terra.com.br> References: <3F55F4DD.9070301@terra.com.br> X-Mailer: Sylpheed version 0.9.2 (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: 5586 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, 03 Sep 2003 11:04:13 -0300 Felipe W Damasio wrote: > Removes an unneeded linux/version.h include from af_inet6.. Applied, thanks. From davem@pizda.ninka.net Thu Sep 4 13:53:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:38 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWx018914 for ; Thu, 4 Sep 2003 13:53:06 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17425; Wed, 3 Sep 2003 20:24:31 -0700 Date: Wed, 3 Sep 2003 20:24:31 -0700 From: "David S. Miller" To: chas3@users.sourceforge.net Cc: chas@cmf.nrl.navy.mil, netdev@oss.sgi.com Subject: Re: [PATCH][ATM] atm_getaddr() isn't safe Message-Id: <20030903202431.2bf3ef82.davem@redhat.com> In-Reply-To: <200309031625.h83GPFl5022616@ginger.cmf.nrl.navy.mil> References: <200309031625.h83GPFl5022616@ginger.cmf.nrl.navy.mil> X-Mailer: Sylpheed version 0.9.2 (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: 5574 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, 03 Sep 2003 12:25:16 -0400 chas williams wrote: > this patch also preserves the old behavior of atm_getaddr() in > that it does partially fill in the passed buffer. please apply > to 2.6 and 2.4. Applied, thanks Chas. From davem@pizda.ninka.net Thu Sep 4 13:53:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:45 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWv018914 for ; Thu, 4 Sep 2003 13:53:06 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17458; Wed, 3 Sep 2003 20:26:59 -0700 Date: Wed, 3 Sep 2003 20:26:59 -0700 From: "David S. Miller" To: chas williams Cc: netdev@oss.sgi.com, mitch@sfgoth.com Subject: Re: [Linux-ATM-General] [ATM] [PATCH] lanai update Message-Id: <20030903202659.306385ce.davem@redhat.com> In-Reply-To: <200309031723.h83HNql5024404@ginger.cmf.nrl.navy.mil> References: <20030902034013.GH15886@gaz.sfgoth.com> <200309031723.h83HNql5024404@ginger.cmf.nrl.navy.mil> X-Mailer: Sylpheed version 0.9.2 (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: 5582 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, 03 Sep 2003 13:23:53 -0400 chas williams wrote: > please apply to 2.6 -- thanks. Applied, thanks guys. From davem@pizda.ninka.net Thu Sep 4 13:53:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:42 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWl018914 for ; Thu, 4 Sep 2003 13:53:00 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id EAA18727; Thu, 4 Sep 2003 04:26:09 -0700 Date: Thu, 4 Sep 2003 04:26:08 -0700 From: "David S. Miller" To: Karlis Peisenieks Cc: netdev@oss.sgi.com Subject: Re: bridge bug Message-Id: <20030904042608.79b57ad2.davem@redhat.com> In-Reply-To: <20030904101900.GA32077@mt.lv> References: <20030904101900.GA32077@mt.lv> X-Mailer: Sylpheed version 0.9.2 (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: 5577 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 Sep 2003 13:19:00 +0300 Karlis Peisenieks wrote: > Attached patch fixed memory leak in 2.4.22 bridge. Have not checked > 2.6.x versions. Applied, fix was already in 2.6.x From davem@pizda.ninka.net Thu Sep 4 13:53:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:42 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWn018914 for ; Thu, 4 Sep 2003 13:53:01 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id AAA18110; Thu, 4 Sep 2003 00:44:51 -0700 Date: Thu, 4 Sep 2003 00:44:51 -0700 From: "David S. Miller" To: Andi Kleen Cc: netdev@oss.sgi.com Subject: Re: [PATCH] Remove X86_TSC dependency in net profile code Message-Id: <20030904004451.44f0babe.davem@redhat.com> In-Reply-To: <20030902230057.GA5424@averell> References: <20030902230057.GA5424@averell> X-Mailer: Sylpheed version 0.9.2 (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: 5578 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 Sep 2003 01:00:57 +0200 Andi Kleen wrote: > I did not actually compile test this because net profile is commented > out since a long time and doesn't compile. An alternative if noone comes > up to fix it would be just to remove it completely. I decided to just kill net profile for now. Thanks for bringing this to my attention Andi. From davem@pizda.ninka.net Thu Sep 4 13:53:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:45 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptX3018914 for ; Thu, 4 Sep 2003 13:53:08 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17550; Wed, 3 Sep 2003 20:35:17 -0700 Date: Wed, 3 Sep 2003 20:35:17 -0700 From: "David S. Miller" To: Francois Romieu Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] 2.6.0-test4-bk5 - Was: Re: The recent free_netdev() conversion... Message-Id: <20030903203517.2708b2ff.davem@redhat.com> In-Reply-To: <20030904003306.A14624@electric-eye.fr.zoreil.com> References: <3F535EBD.6090401@pobox.com> <20030901075345.4c35e3e6.davem@redhat.com> <3F536CB7.6060404@pobox.com> <20030901085814.5a333518.davem@redhat.com> <20030904003306.A14624@electric-eye.fr.zoreil.com> X-Mailer: Sylpheed version 0.9.2 (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: 5583 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 Sep 2003 00:33:06 +0200 Francois Romieu wrote: > Please review. Looks good, applied thanks. From davem@pizda.ninka.net Thu Sep 4 13:53:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:36 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWt018914 for ; Thu, 4 Sep 2003 13:53:05 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17708; Wed, 3 Sep 2003 20:59:45 -0700 Date: Wed, 3 Sep 2003 20:59:45 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] (3/8) ltpc - convert to new initialization Message-Id: <20030903205945.68c5103d.davem@redhat.com> In-Reply-To: <20030903164916.2809d4a5.shemminger@osdl.org> References: <20030903164916.2809d4a5.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5572 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 Nevermind, I applied this one and fixed up the port probe ordering issue myself. From davem@pizda.ninka.net Thu Sep 4 13:53:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:44 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWr018914 for ; Thu, 4 Sep 2003 13:53:05 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id AAA18065; Thu, 4 Sep 2003 00:37:06 -0700 Date: Thu, 4 Sep 2003 00:37:06 -0700 From: "David S. Miller" To: "Randy.Dunlap" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] [NET] remove duplicate includes Message-Id: <20030904003706.3178f624.davem@redhat.com> In-Reply-To: <20030903234402.08c9bbf5.rddunlap@osdl.org> References: <20030903234402.08c9bbf5.rddunlap@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5580 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 Sep 2003 23:44:02 -0700 "Randy.Dunlap" wrote: > Please apply to 2.6.0-current. Applied, thanks Randy. From davem@pizda.ninka.net Thu Sep 4 13:53:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:46 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptX1018914 for ; Thu, 4 Sep 2003 13:53:08 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17569; Wed, 3 Sep 2003 20:41:50 -0700 Date: Wed, 3 Sep 2003 20:41:50 -0700 From: "David S. Miller" To: Jeff Garzik Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] (1/8) add probe_old_netdevs hook Message-Id: <20030903204150.14273da8.davem@redhat.com> In-Reply-To: <3F568C88.4030303@pobox.com> References: <20030903164908.14705874.shemminger@osdl.org> <3F568C88.4030303@pobox.com> X-Mailer: Sylpheed version 0.9.2 (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: 5584 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, 03 Sep 2003 20:51:20 -0400 Jeff Garzik wrote: > All the patches except for #3 look ok to me. > > David? I feel the same, the probe ordering in #3 is unacceptable and has to be undone. I'll apply all the other patches except that one. From davem@pizda.ninka.net Thu Sep 4 13:53:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:44 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptX7018914 for ; Thu, 4 Sep 2003 13:53:10 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17225; Wed, 3 Sep 2003 20:05:17 -0700 Date: Wed, 3 Sep 2003 20:05:17 -0700 From: "David S. Miller" To: Arnaldo Carvalho de Melo Cc: bdschuym@pandora.be, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com Subject: Re: [PATCH] [bdschuym@pandora.be: Re: ipt_physdev.c alignment problems on parisc64] Message-Id: <20030903200517.5b031fa4.davem@redhat.com> In-Reply-To: <20030903162022.GI6405@conectiva.com.br> References: <20030903162022.GI6405@conectiva.com.br> X-Mailer: Sylpheed version 0.9.2 (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: 5581 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 Sep 2003 13:20:23 -0300 Arnaldo Carvalho de Melo wrote: > Yes, it makes ipt_pysdev.c compile on parisc, Dave, could you please > apply it? Or perhaps wait for the netfilter patches, your call. As I mentioned in another email, this patch can't be used, it breaks in mixed 32/64 bit environments. From davem@pizda.ninka.net Thu Sep 4 13:53:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:37 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWj018914 for ; Thu, 4 Sep 2003 13:52:59 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id HAA19437; Thu, 4 Sep 2003 07:59:18 -0700 Date: Thu, 4 Sep 2003 07:59:18 -0700 From: "David S. Miller" To: John Levon Cc: netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030904075918.1477ff33.davem@redhat.com> In-Reply-To: <20030904150205.GA28587@compsoc.man.ac.uk> References: <20030904145204.GA27953@compsoc.man.ac.uk> <20030904074520.5dceff3e.davem@redhat.com> <20030904150205.GA28587@compsoc.man.ac.uk> X-Mailer: Sylpheed version 0.9.2 (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: 5573 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 Sep 2003 16:02:05 +0100 John Levon wrote: > hch mentioned TUNABLE too which is also too old to be useful, that's > still hanging around in 2.6 too Although some of it is out of date, some of it is not, and the parts that are still relevant are not documented anywhere else. So it's got to stay until there is some kind of replacement for that info under Documentation/ or wherever. From davem@pizda.ninka.net Thu Sep 4 13:53:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:46 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptX5018914 for ; Thu, 4 Sep 2003 13:53:09 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17562; Wed, 3 Sep 2003 20:41:06 -0700 Date: Wed, 3 Sep 2003 20:41:05 -0700 From: "David S. Miller" To: Jeff Garzik Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] (8/8) loopback device simplification Message-Id: <20030903204105.0f01f131.davem@redhat.com> In-Reply-To: <3F568AC0.5090601@pobox.com> References: <20030903164921.7d923008.shemminger@osdl.org> <3F568AC0.5090601@pobox.com> X-Mailer: Sylpheed version 0.9.2 (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: 5585 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, 03 Sep 2003 20:43:44 -0400 Jeff Garzik wrote: > Would be nice to move dev_base and dev_base_lock somewhere, maybe > drivers/net/net_init.c (which really should be renamed libnet.c) or > perhaps somewhere in net/* Once all of the conversions are done, we can happily move this someone. My personal preference would be net/core/dev.c, as I believe we can limit all of the modifications to there eventually and thus not have to export those two symbols to the entire kernel any more. The fact that we export the list and it's locking makes it really hard to change things. From davem@pizda.ninka.net Thu Sep 4 13:53:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:43 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptXB018914 for ; Thu, 4 Sep 2003 13:53:13 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17219; Wed, 3 Sep 2003 20:04:26 -0700 Date: Wed, 3 Sep 2003 20:04:26 -0700 From: "David S. Miller" To: Bart De Schuymer Cc: acme@conectiva.com.br, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com Subject: Re: ipt_physdev.c alignment problems on parisc64 Message-Id: <20030903200426.59d0af4a.davem@redhat.com> In-Reply-To: <200309022116.41697.bdschuym@pandora.be> References: <20030902143050.GC3398@conectiva.com.br> <200309022116.41697.bdschuym@pandora.be> X-Mailer: Sylpheed version 0.9.2 (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: 5579 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 Sep 2003 21:16:41 +0200 Bart De Schuymer wrote: > On Tuesday 02 September 2003 16:30, Arnaldo Carvalho de Melo wrote: > > The 1.786.1.54 changeset (i.e. the initial ipt_physdev.c one 8) created > > Does this fix it? You can't use this fix. This header and structure are used by userspace and "unsigned long" can be a different size in the kernel than it is in user space. Please, just remove the super-silly memcmp() optimization in the ipt_physdev.c code. From davem@pizda.ninka.net Thu Sep 4 13:53:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:39 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptWp018914 for ; Thu, 4 Sep 2003 13:53:03 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id AAA18132; Thu, 4 Sep 2003 00:46:38 -0700 Date: Thu, 4 Sep 2003 00:46:38 -0700 From: "David S. Miller" To: "YOSHIFUJI Hideaki / _$B5HF#1QL@" Cc: jfbeam@bluetronic.net, linux-kernel@vger.kernel.org, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org Subject: Re: /proc/net/* read drops data Message-Id: <20030904004638.1d4b001d.davem@redhat.com> In-Reply-To: <20030903.160733.06230402.yoshfuji@linux-ipv6.org> References: <20030903.160733.06230402.yoshfuji@linux-ipv6.org> X-Mailer: Sylpheed version 0.9.2 (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: 5575 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, 03 Sep 2003 16:07:33 +0900 (JST) YOSHIFUJI Hideaki / _$B5HF#1QL@ wrote: > D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data This fix looks good to me. Applied. From davem@pizda.ninka.net Thu Sep 4 13:53:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:53:41 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptX9018914 for ; Thu, 4 Sep 2003 13:53:12 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17522; Wed, 3 Sep 2003 20:33:36 -0700 Date: Wed, 3 Sep 2003 20:33:36 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: mike.mclagan@linux.org, jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] dlci - cleanup for 2.6 Message-Id: <20030903203336.45e0bce6.davem@redhat.com> In-Reply-To: <20030903151847.7311f75f.shemminger@osdl.org> References: <20030903151847.7311f75f.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5576 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 Sep 2003 15:18:47 -0700 Stephen Hemminger wrote: > Patch for 2.6.0-test4 to cleanup DLCI driver > - keep list of arrays for devices and use a lock > - make sure header is contiguous before overlaying data structure > - dynamically allocate dev->priv with alloc_netdev > - get rid of MOD_INC/DEC > - free devices on module unload > - keep refcount on slave device's since holding a ptr Applied. I assume you added the module export of unregister_frad() because you intend to make some drivers actually make use of it? :-) From davem@pizda.ninka.net Thu Sep 4 13:53:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:54:18 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KptXF018914 for ; Thu, 4 Sep 2003 13:53:15 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id UAA17301; Wed, 3 Sep 2003 20:14:55 -0700 Date: Wed, 3 Sep 2003 20:14:55 -0700 From: "David S. Miller" To: maximilian attems Cc: kernel-janitors@osdl.org, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com, marcel@holtmann.org Subject: Re: [PATCH] list_for_each net/ Message-Id: <20030903201455.44200973.davem@redhat.com> In-Reply-To: <20030903082202.GB13662@mail.sternwelten.at> References: <20030903082202.GB13662@mail.sternwelten.at> X-Mailer: Sylpheed version 0.9.2 (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: 5587 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 Sep 2003 10:22:02 +0200 maximilian attems wrote: > again pure cosmetical changes!! I applied everything except for the ip6_fib.c part, there is no way we should be using the list_head macros for objects which are not list_heads. From yoshfuji@linux-ipv6.org Thu Sep 4 13:55:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:56:21 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KthWZ021511 for ; Thu, 4 Sep 2003 13:55:44 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h84HD71M007189; Fri, 5 Sep 2003 02:13:07 +0900 Date: Fri, 05 Sep 2003 02:13:07 +0900 (JST) Message-Id: <20030905.021307.123497946.yoshfuji@linux-ipv6.org> To: jfbeam@bluetronic.net Cc: davem@redhat.com, linux-kernel@vger.kernel.org, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org Subject: Re: /proc/net/* read drops data From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: <20030904004638.1d4b001d.davem@redhat.com> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5588 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev In article (at Thu, 4 Sep 2003 12:25:16 -0400 (EDT)), Ricky Beam says: > The list: > (file) (bs=1) (bs=10000) > /proc/net/igmp 122 191 > /proc/net/route 128 384 > /proc/net/rt_acct 0 4096 > /proc/net/rt_cache 384 512 > /proc/net/tcp 1800 1950 > /proc/net/udp 1024 1152 Okay, I'll seek the code. --yoshfuji From COHUCK@de.ibm.com Thu Sep 4 13:58:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 13:59:00 -0700 (PDT) Received: from d12lmsgate.de.ibm.com (d12lmsgate-4.de.ibm.com [194.196.100.237]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84KwPWZ022850 for ; Thu, 4 Sep 2003 13:58:26 -0700 Received: from d12relay01.megacenter.de.ibm.com (d12relay01.megacenter.de.ibm.com [9.149.165.180]) by d12lmsgate.de.ibm.com (8.12.9/8.12.8) with ESMTP id h848sZoU095242; Thu, 4 Sep 2003 10:54:35 +0200 Received: from d12ml030.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12relay01.megacenter.de.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id h848siMQ091368; Thu, 4 Sep 2003 10:54:44 +0200 Subject: Re: Bug in qeth in 2.6 To: Pete Zaitcev Cc: netdev@oss.sgi.com, zaitcev@redhat.com, "Utz Bacher" X-Mailer: Lotus Notes Release 5.0.12 February 13, 2003 Message-ID: From: "Cornelia Huck" Date: Thu, 4 Sep 2003 10:54:43 +0200 X-MIMETrack: Serialize by Router on D12ML030/12/M/IBM(Release 5.0.9a |January 7, 2002) at 04/09/2003 10:54:44 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-archive-position: 5589 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: COHUCK@de.ibm.com Precedence: bulk X-list: netdev Hi Pete, could you please elaborate what's exactly wrong with qeth_verify_dev()? It has the same behaviour as in 2.4, and it looks correct to us... Best regards / Mit freundlichen Gruessen Cornelia Huck zLinux Developer Tel.: +49-7031-16-4837, Mail: cohuck@de.ibm.com From Dax@GuruLabs.com Thu Sep 4 14:04:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:04:36 -0700 (PDT) Received: from mail.gurulabs.com (you@[66.62.77.7]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84L42WZ023748 for ; Thu, 4 Sep 2003 14:04:03 -0700 Received: from dhcp178.glwlan.gurulabs.com (dhcp178.glwlan.gurulabs.com [10.2.3.178]) by mail.gurulabs.com (Postfix) with ESMTP id C08157790 for ; Thu, 4 Sep 2003 15:04:01 -0600 (MDT) Subject: echo 0 > send_redirects broken? From: Dax Kelson To: netdev@oss.sgi.com Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-cIOIRamT7qY1i+wP+ewE" Message-Id: <1062709441.2884.34.camel@mentor.gurulabs.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Thu, 04 Sep 2003 15:04:02 -0600 X-archive-position: 5590 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Dax@GuruLabs.com Precedence: bulk X-list: netdev --=-cIOIRamT7qY1i+wP+ewE Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 192.168.0.0/24=20 .9 .10 .254 =3D=3D|=3D=3D=3D=3D=3D=3D|=3D=3D=3D=3D=3D=3D=3D|=3D=3D=3D=3D [A] [B] [Router] Hosts A and B running RHL9 with kernel 2.4.20-8. 1. Start pinging the .254 IP from host A 2. Enable ip_forwarding on host B 3. Run arpspoof on host B to poison the arp cache on host A and the router 4. On host B Turn off icmp redirects with the command: echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects Problem: Host B *still* sends ICMP redirects. Initially many redirects are sent, then the rate at which ICMP redirects are sent slows down until redirects only trickle out every few minutes. In older 2.4 kernels (2.4.9 for example) this did not happen. Turning off ICMP redirects really turned them off. Comments? --=-cIOIRamT7qY1i+wP+ewE Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQA/V6jBESq34TbtkiIRAtS0AJ9QnqGym/Ajz1HFOZ3qXQe8xRZuRQCgqPrC Ot1mGFrtzv56rD7xmEriKGM= =GT1y -----END PGP SIGNATURE----- --=-cIOIRamT7qY1i+wP+ewE-- From shemminger@osdl.org Thu Sep 4 14:14:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:14:33 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LETWZ024706 for ; Thu, 4 Sep 2003 14:14:29 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h83NnUo21778; Wed, 3 Sep 2003 16:49:30 -0700 Date: Wed, 3 Sep 2003 16:49:16 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: "David S. Miller" , netdev@oss.sgi.com Subject: [PATCH] (3/8) ltpc - convert to new initialization Message-Id: <20030903164916.2809d4a5.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5591 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 Originally from Al Viro NE11-ltpc * switched ltpc to dynamic allocation * ltpc: embedded ->priv * ltpc: fixed bugs in DMA allocation * ltpc: fixed resource leaks on failure exits * ltpc: fixed part of timer bugs (still a-f**ing-plenty of those) * ltpc: fixed order of freeing bugs Added * switch to free_netdev diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c --- a/drivers/net/Space.c Wed Sep 3 15:11:52 2003 +++ b/drivers/net/Space.c Wed Sep 3 15:11:52 2003 @@ -102,6 +102,9 @@ #ifdef CONFIG_SDLA extern struct net_device *sdla_init(void); #endif +#ifdef CONFIG_LTPC +extern struct net_device *ltpc_probe(void); +#endif /* Detachable devices ("pocket adaptors") */ extern int de620_probe(struct net_device *); @@ -392,22 +395,14 @@ /* Statically configured drivers -- order matters here. */ void probe_old_netdevs(void) { +#ifdef CONFIG_LTPC + ltpc_probe(); +#endif #ifdef CONFIG_SDLA sdla_init(); #endif } - -#if defined(CONFIG_LTPC) -extern int ltpc_probe(struct net_device *); -static struct net_device dev_ltpc = { - .name = "lt0", - .next = NEXT_DEV, - .init = ltpc_probe -}; -#undef NEXT_DEV -#define NEXT_DEV (&dev_ltpc) -#endif /* LTPC */ #if defined(CONFIG_COPS) extern int cops_probe(struct net_device *); diff -Nru a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c --- a/drivers/net/appletalk/ltpc.c Wed Sep 3 15:11:52 2003 +++ b/drivers/net/appletalk/ltpc.c Wed Sep 3 15:11:52 2003 @@ -879,34 +879,6 @@ return 0; } -static int ltpc_init(struct net_device *dev) -{ - /* Initialize the device structure. */ - - /* Fill in the fields of the device structure with ethernet-generic values. */ - ltalk_setup(dev); - dev->hard_start_xmit = ltpc_xmit; - dev->hard_header = ltpc_hard_header; - - dev->priv = kmalloc(sizeof(struct ltpc_private), GFP_KERNEL); - if(!dev->priv) - { - printk(KERN_INFO "%s: could not allocate statistics buffer\n", dev->name); - return -ENOMEM; - } - - memset(dev->priv, 0, sizeof(struct ltpc_private)); - dev->get_stats = ltpc_get_stats; - - /* add the ltpc-specific things */ - dev->do_ioctl = <pc_ioctl; - - dev->set_multicast_list = &set_multicast_list; - dev->mc_list = NULL; - - return 0; -} - static int ltpc_poll_counter; static void ltpc_poll(unsigned long l) @@ -983,35 +955,40 @@ /* initialization stuff */ -static int __init ltpc_probe_dma(int base) +static int __init ltpc_probe_dma(int base, int dma) { - int dma = 0; + int want = (dma == 3) ? 2 : (dma == 1) ? 1 : 3; unsigned long timeout; unsigned long f; - if (!request_dma(1,"ltpc")) { - f=claim_dma_lock(); - disable_dma(1); - clear_dma_ff(1); - set_dma_mode(1,DMA_MODE_WRITE); - set_dma_addr(1,virt_to_bus(ltdmabuf)); - set_dma_count(1,sizeof(struct lt_mem)); - enable_dma(1); - release_dma_lock(f); - dma|=1; - } - if (!request_dma(3,"ltpc")) { - f=claim_dma_lock(); - disable_dma(3); - clear_dma_ff(3); - set_dma_mode(3,DMA_MODE_WRITE); - set_dma_addr(3,virt_to_bus(ltdmabuf)); - set_dma_count(3,sizeof(struct lt_mem)); - enable_dma(3); - release_dma_lock(f); - dma|=2; + if (want & 1) { + if (request_dma(1,"ltpc")) { + want &= ~1; + } else { + f=claim_dma_lock(); + disable_dma(1); + clear_dma_ff(1); + set_dma_mode(1,DMA_MODE_WRITE); + set_dma_addr(1,virt_to_bus(ltdmabuf)); + set_dma_count(1,sizeof(struct lt_mem)); + enable_dma(1); + release_dma_lock(f); + } + } + if (want & 2) { + if (request_dma(3,"ltpc")) { + want &= ~2; + } else { + f=claim_dma_lock(); + disable_dma(3); + clear_dma_ff(3); + set_dma_mode(3,DMA_MODE_WRITE); + set_dma_addr(3,virt_to_bus(ltdmabuf)); + set_dma_count(3,sizeof(struct lt_mem)); + enable_dma(3); + release_dma_lock(f); + } } - /* set up request */ /* FIXME -- do timings better! */ @@ -1037,65 +1014,62 @@ /* release the other dma channel (if we opened both of them) */ - if ( (dma&0x2) && (get_dma_residue(3)==sizeof(struct lt_mem)) ){ - dma&=1; + if ((want & 2) && (get_dma_residue(3)==sizeof(struct lt_mem))) { + want &= ~2; free_dma(3); } - - if ( (dma&0x1) && (get_dma_residue(1)==sizeof(struct lt_mem)) ){ - dma&=0x2; + + if ((want & 1) && (get_dma_residue(1)==sizeof(struct lt_mem))) { + want &= ~1; free_dma(1); } - /* fix up dma number */ - dma|=1; + if (!want) + return 0; - return dma; + return (want & 2) ? 3 : 1; } -int __init ltpc_probe(struct net_device *dev) +struct net_device * __init ltpc_probe(void) { - int err; + struct net_device *dev; + int err = -ENOMEM; int x=0,y=0; int autoirq; unsigned long f; - int portfound=0; unsigned long timeout; + dev = alloc_netdev(sizeof(struct ltpc_private), "lt%d", ltalk_setup); + if (!dev) + goto out; + SET_MODULE_OWNER(dev); /* probe for the I/O port address */ - if (io != 0x240 && request_region(0x220,8,"ltpc")) { - x = inb_p(0x220+6); - if ( (x!=0xff) && (x>=0xf0) ) { - io = 0x220; - portfound=1; - } - else { - release_region(0x220,8); - } - } if (io != 0x220 && request_region(0x240,8,"ltpc")) { y = inb_p(0x240+6); if ( (y!=0xff) && (y>=0xf0) ){ io = 0x240; - portfound=1; - } - else { - release_region(0x240,8); + goto got_port; } + release_region(0x240,8); } - - if(io && !portfound && request_region(io,8,"ltpc")){ - portfound = 1; - } - if(!portfound) { - /* give up in despair */ - printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y); - return -1; + if (io != 0x240 && request_region(0x220,8,"ltpc")) { + x = inb_p(0x220+6); + if ( (x!=0xff) && (x>=0xf0) ) { + io = 0x220; + goto got_port; + } + release_region(0x220,8); } + /* give up in despair */ + printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y); + err = -ENODEV; + goto out1; + + got_port: /* probe for the IRQ line */ if (irq < 2) { unsigned long irq_mask; @@ -1111,22 +1085,21 @@ if (autoirq == 0) { printk(KERN_ERR "ltpc: probe at %#x failed to detect IRQ line.\n", io); - } - else { + } else { irq = autoirq; } } /* allocate a DMA buffer */ ltdmabuf = (unsigned char *) dma_mem_alloc(1000); - - if (ltdmabuf) ltdmacbuf = <dmabuf[800]; - if (!ltdmabuf) { printk(KERN_ERR "ltpc: mem alloc failed\n"); - return -1; + err = -ENOMEM; + goto out2; } + ltdmacbuf = <dmabuf[800]; + if(debug & DEBUG_VERBOSE) { printk("ltdmabuf pointer %08lx\n",(unsigned long) ltdmabuf); } @@ -1154,25 +1127,29 @@ already been specified */ /* well, 0 is a legal DMA channel, but the LTPC card doesn't use it... */ - if (dma == 0) { - dma = ltpc_probe_dma(io); - if (!dma) { /* no dma channel */ - printk(KERN_ERR "No DMA channel found on ltpc card.\n"); - return -1; - } + dma = ltpc_probe_dma(io, dma); + if (!dma) { /* no dma channel */ + printk(KERN_ERR "No DMA channel found on ltpc card.\n"); + err = -ENODEV; + goto out3; } /* print out friendly message */ - if(irq) printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, IR%d, DMA%d.\n",io,irq,dma); else printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, DMA%d. Using polled mode.\n",io,dma); - /* seems more logical to do this *after* probing the card... */ - err = ltpc_init(dev); - if (err) return err; + /* Fill in the fields of the device structure with ethernet-generic values. */ + dev->hard_start_xmit = ltpc_xmit; + dev->hard_header = ltpc_hard_header; + dev->get_stats = ltpc_get_stats; + + /* add the ltpc-specific things */ + dev->do_ioctl = <pc_ioctl; + dev->set_multicast_list = &set_multicast_list; + dev->mc_list = NULL; dev->base_addr = io; dev->irq = irq; dev->dma = dma; @@ -1212,6 +1189,7 @@ } else { if( irq ) printk(KERN_ERR "ltpc: IRQ already in use, using polled mode.\n"); + dev->irq = 0; /* polled mode -- 20 times per second */ /* this is really, really slow... should it poll more often? */ init_timer(<pc_timer); @@ -1221,8 +1199,23 @@ ltpc_timer.expires = jiffies + HZ/20; add_timer(<pc_timer); } + err = register_netdev(dev); + if (err) + goto out4; return 0; +out4: + del_timer_sync(<pc_timer); + if (dev->irq) + free_irq(dev->irq, dev); +out3: + free_pages((unsigned long)ltdmabuf, get_order(1000)); +out2: + release_region(io, 8); +out1: + kfree(dev); +out: + return ERR_PTR(err); } #ifndef MODULE @@ -1259,7 +1252,7 @@ __setup("ltpc=", ltpc_setup); #endif /* MODULE */ -static struct net_device dev_ltpc; +static struct net_device *dev_ltpc; #ifdef MODULE @@ -1272,79 +1265,47 @@ int __init init_module(void) { - int err, result; - if(io == 0) printk(KERN_NOTICE "ltpc: Autoprobing is not recommended for modules\n"); - /* Find a name for this unit */ - dev_ltpc.init = ltpc_probe; - err=dev_alloc_name(&dev_ltpc,"lt%d"); - - if(err<0) - return err; - - if ((result = register_netdev(&dev_ltpc)) != 0) { - printk(KERN_DEBUG "could not register Localtalk-PC device\n"); - return result; - } else { - if(debug & DEBUG_VERBOSE) printk("0 from register_netdev\n"); - return 0; - } + dev_ltpc = ltpc_probe(); + if (IS_ERR(dev_ltpc)) + return PTR_ERR(dev_ltpc); + return 0; } #endif static void __exit ltpc_cleanup(void) { - unsigned long timeout; + + if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n"); + unregister_netdev(dev_ltpc); ltpc_timer.data = 0; /* signal the poll routine that we're done */ + del_timer_sync(<pc_timer); + if(debug & DEBUG_VERBOSE) printk("freeing irq\n"); - if(dev_ltpc.irq) { - free_irq(dev_ltpc.irq,&dev_ltpc); - dev_ltpc.irq = 0; - } - - if(del_timer(<pc_timer)) - { - /* either the poll was never started, or a poll is in process */ - if(debug & DEBUG_VERBOSE) printk("waiting\n"); - /* if it's in process, wait a bit for it to finish */ - timeout = jiffies+HZ; - add_timer(<pc_timer); - while(del_timer(<pc_timer) && time_after(timeout, jiffies)) - { - add_timer(<pc_timer); - schedule(); - } - } + if (dev_ltpc->irq) + free_irq(dev_ltpc->irq, dev_ltpc); if(debug & DEBUG_VERBOSE) printk("freeing dma\n"); - if(dev_ltpc.dma) { - free_dma(dev_ltpc.dma); - dev_ltpc.dma = 0; - } + if (dev_ltpc->dma) + free_dma(dev_ltpc->dma); if(debug & DEBUG_VERBOSE) printk("freeing ioaddr\n"); - if(dev_ltpc.base_addr) { - release_region(dev_ltpc.base_addr,8); - dev_ltpc.base_addr = 0; - } + if (dev_ltpc->base_addr) + release_region(dev_ltpc->base_addr,8); + + free_netdev(dev_ltpc); if(debug & DEBUG_VERBOSE) printk("free_pages\n"); free_pages( (unsigned long) ltdmabuf, get_order(1000)); - ltdmabuf=NULL; - ltdmacbuf=NULL; - - if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n"); - - unregister_netdev(&dev_ltpc); if(debug & DEBUG_VERBOSE) printk("returning from cleanup_module\n"); } From shemminger@osdl.org Thu Sep 4 14:14:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:14:33 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LETWb024706 for ; Thu, 4 Sep 2003 14:14:30 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h83Nnco21787; Wed, 3 Sep 2003 16:49:38 -0700 Date: Wed, 3 Sep 2003 16:49:25 -0700 From: Stephen Hemminger To: "David S. Miller" , mike.mclagan@linux.org, Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (2/8) convert sdla to new initialization Message-Id: <20030903164925.5c44ce73.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5592 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 Based on Al viro's NE10-sdla * switched sdla to dynamic allocation * sdla: embedded ->priv * sdla: fixed resource leaks on failure exits Additionally fixes. * get rid of cli/sti * get rid of MOD/INC Builds and probes, but don't have the hardware. Driver has never built on 2.6 before this. diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c --- a/drivers/net/Space.c Wed Sep 3 15:30:12 2003 +++ b/drivers/net/Space.c Wed Sep 3 15:30:12 2003 @@ -100,6 +100,9 @@ extern int mac8390_probe(struct net_device *dev); extern int mac89x0_probe(struct net_device *dev); extern int mc32_probe(struct net_device *dev); +#ifdef CONFIG_SDLA +extern struct net_device *sdla_init(void); +#endif /* Detachable devices ("pocket adaptors") */ extern int de620_probe(struct net_device *); @@ -401,19 +404,11 @@ /* Statically configured drivers -- order matters here. */ void probe_old_netdevs(void) { - -} - #ifdef CONFIG_SDLA -extern int sdla_init(struct net_device *); -static struct net_device sdla0_dev = { - .name = "sdla0", - .next = NEXT_DEV, - .init = sdla_init, -}; -#undef NEXT_DEV -#define NEXT_DEV (&sdla0_dev) + sdla_init(); #endif + +} #if defined(CONFIG_LTPC) extern int ltpc_probe(struct net_device *); diff -Nru a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c --- a/drivers/net/wan/sdla.c Wed Sep 3 15:30:12 2003 +++ b/drivers/net/wan/sdla.c Wed Sep 3 15:30:12 2003 @@ -71,6 +71,8 @@ 0xD0000, 0xD2000, 0xD4000, 0xD6000, 0xD8000, 0xDA000, 0xDC000, 0xDE000, 0xE0000, 0xE2000, 0xE4000, 0xE6000, 0xE8000, 0xEA000, 0xEC000, 0xEE000}; +static spinlock_t sdla_lock = SPIN_LOCK_UNLOCKED; + /********************************************************* * * these are the core routines that access the card itself @@ -79,10 +81,10 @@ #define SDLA_WINDOW(dev,addr) outb((((addr) >> 13) & 0x1F), (dev)->base_addr + SDLA_REG_Z80_WINDOW) -static void sdla_read(struct net_device *dev, int addr, void *buf, short len) +static void __sdla_read(struct net_device *dev, int addr, void *buf, short len) { - unsigned long flags; - char *temp, *base; + char *temp; + const void *base; int offset, bytes; temp = buf; @@ -90,13 +92,10 @@ { offset = addr & SDLA_ADDR_MASK; bytes = offset + len > SDLA_WINDOW_SIZE ? SDLA_WINDOW_SIZE - offset : len; - base = (void *) (dev->mem_start + offset); + base = (const void *) (dev->mem_start + offset); - save_flags(flags); - cli(); SDLA_WINDOW(dev, addr); memcpy(temp, base, bytes); - restore_flags(flags); addr += bytes; temp += bytes; @@ -104,10 +103,19 @@ } } -static void sdla_write(struct net_device *dev, int addr, void *buf, short len) +static void sdla_read(struct net_device *dev, int addr, void *buf, short len) { unsigned long flags; - char *temp, *base; + spin_lock_irqsave(&sdla_lock, flags); + __sdla_read(dev, addr, buf, len); + spin_unlock_irqrestore(&sdla_lock, flags); +} + +static void __sdla_write(struct net_device *dev, int addr, + const void *buf, short len) +{ + const char *temp; + void *base; int offset, bytes; temp = buf; @@ -116,17 +124,27 @@ offset = addr & SDLA_ADDR_MASK; bytes = offset + len > SDLA_WINDOW_SIZE ? SDLA_WINDOW_SIZE - offset : len; base = (void *) (dev->mem_start + offset); - save_flags(flags); - cli(); + SDLA_WINDOW(dev, addr); memcpy(base, temp, bytes); - restore_flags(flags); + addr += bytes; temp += bytes; len -= bytes; } } +static void sdla_write(struct net_device *dev, int addr, + const void *buf, short len) +{ + unsigned long flags; + + spin_lock_irqsave(&sdla_lock, flags); + __sdla_write(dev, addr, buf, len); + spin_unlock_irqrestore(&sdla_lock, flags); +} + + static void sdla_clear(struct net_device *dev) { unsigned long flags; @@ -138,8 +156,7 @@ bytes = SDLA_WINDOW_SIZE; base = (void *) dev->mem_start; - save_flags(flags); - cli(); + spin_lock_irqsave(&sdla_lock, flags); while(len) { SDLA_WINDOW(dev, addr); @@ -148,7 +165,8 @@ addr += bytes; len -= bytes; } - restore_flags(flags); + spin_unlock_irqrestore(&sdla_lock, flags); + } static char sdla_byte(struct net_device *dev, int addr) @@ -158,11 +176,10 @@ temp = (void *) (dev->mem_start + (addr & SDLA_ADDR_MASK)); - save_flags(flags); - cli(); + spin_lock_irqsave(&sdla_lock, flags); SDLA_WINDOW(dev, addr); byte = *temp; - restore_flags(flags); + spin_unlock_irqrestore(&sdla_lock, flags); return(byte); } @@ -414,7 +431,8 @@ struct frad_local *flp; struct sdla_cmd *cmd_buf; unsigned long pflags; - int jiffs, ret, waiting, len; + unsigned long jiffs; + int ret, waiting, len; long window; flp = dev->priv; @@ -423,8 +441,8 @@ ret = 0; len = 0; jiffs = jiffies + HZ; /* 1 second is plenty */ - save_flags(pflags); - cli(); + + spin_lock_irqsave(&sdla_lock, pflags); SDLA_WINDOW(dev, window); cmd_buf->cmd = cmd; cmd_buf->dlci = dlci; @@ -436,7 +454,7 @@ cmd_buf->length = inlen; cmd_buf->opp_flag = 1; - restore_flags(pflags); + spin_unlock_irqrestore(&sdla_lock, pflags); waiting = 1; len = 0; @@ -444,18 +462,17 @@ { if (waiting++ % 3) { - save_flags(pflags); - cli(); + spin_lock_irqsave(&sdla_lock, pflags); SDLA_WINDOW(dev, window); waiting = ((volatile int)(cmd_buf->opp_flag)); - restore_flags(pflags); + spin_unlock_irqrestore(&sdla_lock, pflags); } } if (!waiting) { - save_flags(pflags); - cli(); + + spin_lock_irqsave(&sdla_lock, pflags); SDLA_WINDOW(dev, window); ret = cmd_buf->retval; len = cmd_buf->length; @@ -471,7 +488,7 @@ if (ret) memcpy(&status, cmd_buf->data, len > sizeof(status) ? sizeof(status) : len); - restore_flags(pflags); + spin_unlock_irqrestore(&sdla_lock, pflags); } else ret = SDLA_RET_TIMEOUT; @@ -555,7 +572,6 @@ if (i == CONFIG_DLCI_MAX) return(-EMLINK); /* #### Alan: Comments on this ?? */ - MOD_INC_USE_COUNT; flp->master[i] = master; flp->dlci[i] = -*(short *)(master->dev_addr); @@ -588,7 +604,6 @@ flp->master[i] = NULL; flp->dlci[i] = 0; - MOD_DEC_USE_COUNT; if (netif_running(slave)) { if (flp->config.station == FRAD_STATION_CPE) @@ -688,14 +703,14 @@ ret = sdla_cmd(dev, SDLA_INFORMATION_WRITE, *(short *)(skb->dev->dev_addr), 0, NULL, skb->len, &addr, &size); if (ret == SDLA_RET_OK) { - save_flags(flags); - cli(); + + spin_lock_irqsave(&sdla_lock, flags); SDLA_WINDOW(dev, addr); pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK)); - sdla_write(dev, pbuf->buf_addr, skb->data, skb->len); - SDLA_WINDOW(dev, addr); + __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len); + SDLA_WINDOW(dev, addr); pbuf->opp_flag = 1; - restore_flags(flags); + spin_unlock_irqrestore(&sdla_lock, flags); } break; } @@ -753,8 +768,7 @@ pbufi = NULL; pbuf = NULL; - save_flags(flags); - cli(); + spin_lock_irqsave(&sdla_lock, flags); switch (flp->type) { @@ -821,7 +835,7 @@ case SDLA_S502A: case SDLA_S502E: if (success) - sdla_read(dev, SDLA_502_RCV_BUF + SDLA_502_DATA_OFS, skb_put(skb,len), len); + __sdla_read(dev, SDLA_502_RCV_BUF + SDLA_502_DATA_OFS, skb_put(skb,len), len); SDLA_WINDOW(dev, SDLA_502_RCV_BUF); cmd->opp_flag = 0; @@ -834,9 +848,9 @@ split = addr + len > buf_top + 1 ? len - (buf_top - addr + 1) : 0; len2 = len - split; - sdla_read(dev, addr, skb_put(skb, len2), len2); + __sdla_read(dev, addr, skb_put(skb, len2), len2); if (split) - sdla_read(dev, buf_base, skb_put(skb, split), split); + __sdla_read(dev, buf_base, skb_put(skb, split), split); } /* increment the buffer we're looking at */ @@ -853,7 +867,7 @@ (*dlp->receive)(skb, master); } - restore_flags(flags); + spin_unlock_irqrestore(&sdla_lock, flags); } static irqreturn_t sdla_isr(int irq, void *dev_id, struct pt_regs * regs) @@ -979,8 +993,6 @@ netif_stop_queue(dev); - MOD_DEC_USE_COUNT; - return(0); } @@ -1082,8 +1094,6 @@ netif_start_queue(dev); - MOD_INC_USE_COUNT; - return(0); } @@ -1614,19 +1624,30 @@ return(&flp->stats); } -int __init sdla_init(struct net_device *dev) +static void setup_sdla(struct net_device *dev) { + dev->flags = 0; + dev->type = 0xFFFF; + dev->hard_header_len = 0; + dev->addr_len = 0; + dev->mtu = SDLA_MAX_MTU; +} + +struct net_device * __init sdla_init(void) +{ + struct net_device *dev; struct frad_local *flp; + int err = -ENOMEM; - /* allocate the private data structure */ - flp = kmalloc(sizeof(struct frad_local), GFP_KERNEL); - if (!flp) - return(-ENOMEM); + dev = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla); + if (!dev) + goto out; - memset(flp, 0, sizeof(struct frad_local)); - dev->priv = flp; + SET_MODULE_OWNER(dev); + netdev_boot_setup_check(dev); + + flp = dev->priv; - dev->flags = 0; dev->open = sdla_open; dev->stop = sdla_close; dev->do_ioctl = sdla_ioctl; @@ -1635,12 +1656,6 @@ dev->hard_start_xmit = sdla_transmit; dev->change_mtu = sdla_change_mtu; - dev->type = 0xFFFF; - dev->hard_header_len = 0; - dev->addr_len = 0; - dev->mtu = SDLA_MAX_MTU; - SET_MODULE_OWNER(dev); - flp->activate = sdla_activate; flp->deactivate = sdla_deactivate; flp->assoc = sdla_assoc; @@ -1652,7 +1667,14 @@ flp->timer.data = (unsigned long) dev; flp->timer.function = sdla_poll; - return(0); + err = register_netdev(dev); + if (err) + goto out1; + return dev; +out1: + kfree(dev); +out: + return ERR_PTR(err); } int __init sdla_c_setup(void) @@ -1663,10 +1685,7 @@ } #ifdef MODULE -static struct net_device sdla0 = { - .name = "sdla0", - .init = sdla_init -}; +static struct net_device *sdla0; #endif /* MODULE */ static int __init init_sdla(void) @@ -1675,7 +1694,9 @@ sdla_c_setup(); #ifdef MODULE - result = register_netdev(&sdla0); + sdla0 = sdla_init(); + if (IS_ERR(sdla0)) + result = PTR_ERR(sdla0); #endif return result; } @@ -1683,11 +1704,10 @@ static void __exit exit_sdla(void) { #ifdef MODULE - unregister_netdev(&sdla0); - if (sdla0.priv) - kfree(sdla0.priv); - if (sdla0.irq) - free_irq(sdla0.irq, &sdla0); + unregister_netdev(sdla0); + if (sdla0->irq) + free_irq(sdla0->irq, sdla0); + free_netdev(sdla0); #endif } From zaitcev@redhat.com Thu Sep 4 14:25:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:25:55 -0700 (PDT) Received: from devserv.devel.redhat.com (pix-525-pool.redhat.com [66.187.233.200]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LPJWb026363 for ; Thu, 4 Sep 2003 14:25:21 -0700 Received: (from zaitcev@localhost) by devserv.devel.redhat.com (8.11.6/8.11.0) id h83Isiq25081; Wed, 3 Sep 2003 14:54:44 -0400 Date: Wed, 3 Sep 2003 14:54:44 -0400 From: Pete Zaitcev To: cohuck@de.ibm.com Cc: netdev@oss.sgi.com, zaitcev@redhat.com Subject: Bug in qeth in 2.6 Message-ID: <20030903145444.I27572@devserv.devel.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-archive-position: 5594 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zaitcev@redhat.com Precedence: bulk X-list: netdev This code is obviously broken in case several cards are present, look what happens to ``result''. devices/s390/net/qeth.c: static int qeth_verify_dev(struct net_device *dev) { struct qeth_card *tmp; int result = 0; read_lock(&list_lock); tmp = firstcard; for (; tmp && (!result); tmp = tmp->next) { if (atomic_read(&tmp->shutdown_phase)) continue; result = (dev == tmp->dev)? QETH_VERIFY_IS_REAL_DEV:__qeth_verify_dev_vlan(dev, tmp); } read_unlock(&list_lock); return result; } Someone got seriously carried away with cleanups. I have to say, I'm disappointed. The original qeth in 2.4 had poor C style, but it was a mistake to run amok adding spaces. The diff between 2.4 and 2.6 is too hard to read, even with -b. Now I have to review whole darn thing line by line. Oh woe! -- Pete From zaitcev@redhat.com Thu Sep 4 14:25:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:25:54 -0700 (PDT) Received: from devserv.devel.redhat.com (pix-525-pool.redhat.com [66.187.233.200]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LPJWZ026363 for ; Thu, 4 Sep 2003 14:25:20 -0700 Received: (from zaitcev@localhost) by devserv.devel.redhat.com (8.11.6/8.11.0) id h84FjC622445; Thu, 4 Sep 2003 11:45:12 -0400 Date: Thu, 4 Sep 2003 11:45:12 -0400 From: Pete Zaitcev To: Cornelia Huck Cc: Pete Zaitcev , netdev@oss.sgi.com, Utz Bacher Subject: Re: Bug in qeth in 2.6 Message-ID: <20030904114512.A12054@devserv.devel.redhat.com> 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 COHUCK@de.ibm.com on Thu, Sep 04, 2003 at 10:54:43AM +0200 X-archive-position: 5593 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zaitcev@redhat.com Precedence: bulk X-list: netdev On Thu, Sep 04, 2003 at 10:54:43AM +0200, Cornelia Huck wrote: > could you please elaborate what's exactly wrong with qeth_verify_dev()? > > It has the same behaviour as in 2.4, and it looks correct to us... 2.4 was like this: result = 0; for (all in list) { if (something) result = QETH_VERIFY_IS_SOMETHING; } 2.6 is: result = 0; for (all in list) { result = (something)? QETH_VERIFY_IS_SOMETHING: foo(); } Results are different if two cards are present on the list and the function is asked to verify the first card. -- Pete From shemminger@osdl.org Thu Sep 4 14:29:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:29:08 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LT4WZ027137 for ; Thu, 4 Sep 2003 14:29:05 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84LSgo28883; Thu, 4 Sep 2003 14:28:42 -0700 Date: Thu, 4 Sep 2003 14:28:28 -0700 From: Stephen Hemminger To: Adrian Bunk , "David S. Miller" , Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] fix cosa to get rid of warnings and build on SMP Message-Id: <20030904142828.14218966.shemminger@osdl.org> In-Reply-To: <20030903173417.GC18025@fs.tum.de> References: <20030903173417.GC18025@fs.tum.de> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h84LT4WZ027137 X-archive-position: 5595 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 * get rid of leftover sti * no longer need MOD_INC/DEC stuff * get rid of dead code related to MOD_INC/DEC * use module_init/module_exit to cleanly run init code diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c --- a/drivers/net/wan/cosa.c Thu Sep 4 14:18:36 2003 +++ b/drivers/net/wan/cosa.c Thu Sep 4 14:18:36 2003 @@ -357,11 +357,7 @@ /* ---------- Initialization stuff ---------- */ -#ifdef MODULE -int init_module(void) -#else static int __init cosa_init(void) -#endif { int i; @@ -398,9 +394,9 @@ } return 0; } +module_init(cosa_init); -#ifdef MODULE -void cleanup_module (void) +static void __exit cosa_exit(void) { struct cosa_data *cosa; int i; @@ -424,7 +420,7 @@ } unregister_chrdev(cosa_major, "cosa"); } -#endif +module_exit(cosa_exit); /* * This function should register all the net devices needed for the @@ -513,7 +509,6 @@ if (irq < 0) { unsigned long irqs; /* printk(KERN_INFO "IRQ autoprobe\n"); */ - sti(); irqs = probe_irq_on(); /* * Enable interrupt on tx buffer empty (it sure is) @@ -624,6 +619,7 @@ if (register_netdev(d) == -1) { printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); sppp_detach(chan->pppdev.dev); + free_netdev(chan->pppdev.dev); return; } } @@ -658,7 +654,6 @@ chan->rx_done = sppp_rx_done; chan->usage=-1; chan->cosa->usage++; - MOD_INC_USE_COUNT; spin_unlock_irqrestore(&chan->cosa->lock, flags); err = sppp_open(d); @@ -666,7 +661,6 @@ spin_lock_irqsave(&chan->cosa->lock, flags); chan->usage=0; chan->cosa->usage--; - MOD_DEC_USE_COUNT; spin_unlock_irqrestore(&chan->cosa->lock, flags); return err; @@ -726,7 +720,6 @@ } chan->usage=0; chan->cosa->usage--; - MOD_DEC_USE_COUNT; spin_unlock_irqrestore(&chan->cosa->lock, flags); return 0; } @@ -1187,21 +1180,6 @@ return cosa_gettype(cosa, (char *)arg); case COSAIORIDSTR: return cosa_getidstr(cosa, (char *)arg); -/* - * These two are _very_ugly_hack_(tm). Don't even look at this. - * Implementing this saved me few reboots after some process segfaulted - * inside this module. - */ -#ifdef MODULE -#if 0 - case COSAIOMINC: - MOD_INC_USE_COUNT; - return 0; - case COSAIOMDEC: - MOD_DEC_USE_COUNT; - return 0; -#endif -#endif case COSAIONRCARDS: return nr_cards; case COSAIONRCHANS: From shemminger@osdl.org Thu Sep 4 14:43:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:43:21 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LhIWZ028504 for ; Thu, 4 Sep 2003 14:43:18 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84Lh2o32429; Thu, 4 Sep 2003 14:43:02 -0700 Date: Thu, 4 Sep 2003 14:42:48 -0700 From: Stephen Hemminger To: Jeff Garzik , "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] more sdla fixes Message-Id: <20030904144248.0599cdaf.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5596 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 Since sdla.c now has locking instead of cli/sti, it shouldn't be completely busted on SMP. Also, the frad interface registration needed to be done once (and check the result), and undone on module unload. diff -Nru a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig --- a/drivers/net/wan/Kconfig Thu Sep 4 14:41:49 2003 +++ b/drivers/net/wan/Kconfig Thu Sep 4 14:41:49 2003 @@ -465,7 +465,7 @@ config SDLA tristate "SDLA (Sangoma S502/S508) support" - depends on DLCI && ISA && BROKEN_ON_SMP + depends on DLCI && ISA help Say Y here if you need a driver for the Sangoma S502A, S502E, and S508 Frame Relay Access Devices. These are multi-protocol cards, but diff -Nru a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c --- a/drivers/net/wan/sdla.c Thu Sep 4 14:41:49 2003 +++ b/drivers/net/wan/sdla.c Thu Sep 4 14:41:49 2003 @@ -1634,12 +1634,26 @@ dev->mtu = SDLA_MAX_MTU; } +static int frad_registered; + struct net_device * __init sdla_init(void) { struct net_device *dev; struct frad_local *flp; int err = -ENOMEM; + if (!frad_registered) { + err = register_frad(devname); + if (err) { + printk(KERN_ERR "%s: frad registration failed %d\n", + devname, err); + return ERR_PTR(err); + } + frad_registered = 1; + printk("%s.\n", version); + } + + dev = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla); if (!dev) goto out; @@ -1678,39 +1692,35 @@ return ERR_PTR(err); } -int __init sdla_c_setup(void) -{ - printk("%s.\n", version); - register_frad(devname); - return 0; -} - #ifdef MODULE static struct net_device *sdla0; -#endif /* MODULE */ static int __init init_sdla(void) { int result = 0; - sdla_c_setup(); -#ifdef MODULE sdla0 = sdla_init(); if (IS_ERR(sdla0)) result = PTR_ERR(sdla0); -#endif + return result; } static void __exit exit_sdla(void) { -#ifdef MODULE + struct frad_local *flp; + unregister_netdev(sdla0); if (sdla0->irq) free_irq(sdla0->irq, sdla0); + + flp = sdla0->priv; + del_timer_sync(&flp->timer); free_netdev(sdla0); -#endif + + unregister_frad(devname); } +#endif MODULE_LICENSE("GPL"); From postmaster@q.nospam.kampsax.k-net.dk Thu Sep 4 14:43:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:43:33 -0700 (PDT) Received: from minuspol.k-net.dk (minuspol.k-net.dtu.dk [130.225.71.251]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LgmWZ028477 for ; Thu, 4 Sep 2003 14:42:50 -0700 Received: from carlsberg.kampsax.dtu.dk (carlsberg.kampsax.dtu.dk [192.38.212.2]) by minuspol.k-net.dk (Postfix) with SMTP id E8DC8311F1 for ; Thu, 4 Sep 2003 02:26:42 +0200 (CEST) Received: (qmail 24228 invoked from network); 4 Sep 2003 00:26:42 -0000 Received: from clouseau.kampsax.dtu.dk (HELO q.nospam.kampsax.k-net.dk) (dnj@192.38.215.157) by carlsberg.kampsax.dtu.dk with SMTP; 4 Sep 2003 00:26:42 -0000 Message-ID: <3F5686C2.6090600@q.nospam.kampsax.k-net.dk> Date: Thu, 04 Sep 2003 02:26:42 +0200 From: =?ISO-8859-1?Q?Dennis_J=F8rgensen?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030618 X-Accept-Language: en MIME-Version: 1.0 To: netdev@oss.sgi.com Subject: Trivial fix for wrong error message from icmp.c (2.6.0-test4) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h84LgmWZ028477 X-archive-position: 5597 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: postmaster@q.nospam.kampsax.k-net.dk Precedence: bulk X-list: netdev Hello I see this message a lot in my logs: 192.38.215.157 sent an invalid ICMP type 11, code 0 error to a broadcast: 192.38.215.255 on eth0 but thats my own ip, the following fix makes 2.6.0-test4 report the same ip as 2.4.20 did. Should I post this somewhere else/to someone else, please let me know, I couldn't find a FAQ for the list. Regards Dennis Jørgensen (not on the list) --- linux-2.6.0-test4.org/net/ipv4/icmp.c 2003-08-28 01:13:59.000000000 +0200 +++ linux-2.6.0-test4/net/ipv4/icmp.c 2003-08-28 02:12:56.000000000 +0200 @@ -661,7 +661,7 @@ printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP " "type %u, code %u " "error to a broadcast: %u.%u.%u.%u on %s\n", - NIPQUAD(iph->saddr), + NIPQUAD(skb->nh.iph->saddr), icmph->type, icmph->code, NIPQUAD(iph->daddr), skb->dev->name); From jgarzik@pobox.com Thu Sep 4 14:46:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 14:47:25 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84LkpWZ029270 for ; Thu, 4 Sep 2003 14:46:52 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:35364 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19uiIv-0001QZ-F8; Thu, 04 Sep 2003 01:48:53 +0100 Message-ID: <3F568BEA.50904@pobox.com> Date: Wed, 03 Sep 2003 20:48:42 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Stephen Hemminger CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] (3/8) ltpc - convert to new initialization References: <20030903164916.2809d4a5.shemminger@osdl.org> In-Reply-To: <20030903164916.2809d4a5.shemminger@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5598 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 Stephen Hemminger wrote: > -int __init ltpc_probe(struct net_device *dev) > +struct net_device * __init ltpc_probe(void) [...] > /* probe for the I/O port address */ > - if (io != 0x240 && request_region(0x220,8,"ltpc")) { > - x = inb_p(0x220+6); > - if ( (x!=0xff) && (x>=0xf0) ) { > - io = 0x220; > - portfound=1; > - } > - else { > - release_region(0x220,8); > - } > - } > > if (io != 0x220 && request_region(0x240,8,"ltpc")) { > y = inb_p(0x240+6); > if ( (y!=0xff) && (y>=0xf0) ){ > io = 0x240; > - portfound=1; > - } > - else { > - release_region(0x240,8); > + goto got_port; > } > + release_region(0x240,8); > } > - > - if(io && !portfound && request_region(io,8,"ltpc")){ > - portfound = 1; > - } > - if(!portfound) { > - /* give up in despair */ > - printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y); > - return -1; > + if (io != 0x240 && request_region(0x220,8,"ltpc")) { > + x = inb_p(0x220+6); > + if ( (x!=0xff) && (x>=0xf0) ) { > + io = 0x220; > + goto got_port; > + } > + release_region(0x220,8); > } why did the order of probing change? It used to be "0x220 -> 0x240", now it's "0x240 -> 0x220" Jeff From moz@compsoc.man.ac.uk Thu Sep 4 15:44:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 15:45:28 -0700 (PDT) Received: from serenity.mcc.ac.uk (serenity.mcc.ac.uk [130.88.200.93]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84MipWZ001784 for ; Thu, 4 Sep 2003 15:44:53 -0700 Received: from compsoc.umu.man.ac.uk ([130.88.22.5] helo=mrtall.compsoc.man.ac.uk ident=exim) by serenity.mcc.ac.uk with esmtp (Exim 4.20) id 19uvSv-000KCq-2v; Thu, 04 Sep 2003 15:52:05 +0100 Received: from moz by mrtall.compsoc.man.ac.uk with local (Exim 3.33 #1) id 19uvSv-0007Jb-00; Thu, 04 Sep 2003 15:52:05 +0100 Date: Thu, 4 Sep 2003 15:52:04 +0100 From: John Levon To: netdev@oss.sgi.com, davem@redhat.com Subject: [PATCH] remove net/README Message-ID: <20030904145204.GA27953@compsoc.man.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i X-Url: http://www.movementarian.org/ X-Record: King of Woolworths - L'Illustration Musicale X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19uvSv-000KCq-2v*Ry1jNCHoQPo* X-archive-position: 5599 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: levon@movementarian.org Precedence: bulk X-list: netdev This file seems bitrotted and more up to date info is available in MAINTAINERS in large part. regards john diff -Naur -X dontdiff linux-cvs/net/README linux-fixes/net/README --- linux-cvs/net/README 2002-02-06 00:13:33.000000000 +0000 +++ linux-fixes/net/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ - -Maintainers and developers for networking code sections - -Code Section Bug Report Contact --------------------+------------------------------------------- -802 [other ] alan@lxorguk.ukuu.org.uk - [token ring ] p.norton@computer.org -appletalk jschlst@samba.org -ax25 g4klx@g4klx.demon.co.uk -bridge buytenh@gnu.org -core alan@lxorguk.ukuu.org.uk -decnet SteveW@ACM.org -ethernet alan@lxorguk.ukuu.org.uk -ipv4 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se -ipv6 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se -ipx acme@conectiva.com.br -spx jschlst@samba.org -irda dagb@cs.uit.no -lapb g4klx@g4klx.demon.co.uk -netrom g4klx@g4klx.demon.co.uk -rose g4klx@g4klx.demon.co.uk -wanrouter gene@compuserve.com, jaspreet@sangoma and dm@sangoma.com -unix alan@lxorguk.ukuu.org.uk -x25 g4klx@g4klx.demon.co.uk -bluetooth maxk@qualcomm.com -8021q greearb@candelatech.com, vlan@scry.wanfear.com From jgarzik@pobox.com Thu Sep 4 15:53:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 15:53:27 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84MrKWZ002556 for ; Thu, 4 Sep 2003 15:53:21 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:35362 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19uiE7-0001MG-ED; Thu, 04 Sep 2003 01:43:55 +0100 Message-ID: <3F568AC0.5090601@pobox.com> Date: Wed, 03 Sep 2003 20:43:44 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Stephen Hemminger CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] (8/8) loopback device simplification References: <20030903164921.7d923008.shemminger@osdl.org> In-Reply-To: <20030903164921.7d923008.shemminger@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5600 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 Would be nice to move dev_base and dev_base_lock somewhere, maybe drivers/net/net_init.c (which really should be renamed libnet.c) or perhaps somewhere in net/* From devik@cdi.cz Thu Sep 4 16:00:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:01:09 -0700 (PDT) Received: from luxik.cdi.cz (inway106.cdi.cz [213.151.81.106]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84N0YWZ003288 for ; Thu, 4 Sep 2003 16:00:36 -0700 Received: from gprs148-155.eurotel.cz ([160.218.148.155] helo=devix) by luxik.cdi.cz with asmtp (Exim 3.34 #3) id 19uelR-0006Y7-00; Wed, 03 Sep 2003 23:02:06 +0200 Received: from devik (helo=localhost) by devix with local-esmtp (Exim 3.16 #8) id 19uel7-0002Wr-00; Wed, 03 Sep 2003 23:01:45 +0200 Date: Wed, 3 Sep 2003 23:01:45 +0200 (CEST) From: devik X-X-Sender: To: bert hubert cc: Subject: Re: 2.6.0-test4, 2.5.47, child qdiscs, parent not filled out? In-Reply-To: <20030903102803.GA11876@outpost.ds9a.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5601 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: devik@cdi.cz Precedence: bulk X-list: netdev > Devik (I hope we can be friends again :-)), others, yep I think so :-) > If I create a cbq with several classes, and attach a qdisc to those classes, > a later netlink dump (RTM_GETQDISCS) returns parent as 0:0 for that qdisc, > is this right? structure Qdisc has DEPRECATED field __parent pointing to parent qdisc (aparently CBQ needs it). There is no other "parent" info in the struct so it can't be returned IMHO. You will have to parse all clases from root to leaves. Maybe we could add parent handle to qdisc but it is question to Alexey probably - I'm not sure how complex would it be to keep the field in sync ... devik From jgarzik@pobox.com Thu Sep 4 16:06:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:06:45 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84N6gWZ003977 for ; Thu, 4 Sep 2003 16:06:42 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:35366 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19uiLT-0001ST-2S; Thu, 04 Sep 2003 01:51:31 +0100 Message-ID: <3F568C88.4030303@pobox.com> Date: Wed, 03 Sep 2003 20:51:20 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Stephen Hemminger CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] (1/8) add probe_old_netdevs hook References: <20030903164908.14705874.shemminger@osdl.org> In-Reply-To: <20030903164908.14705874.shemminger@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5602 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 All the patches except for #3 look ok to me. David? From shemminger@osdl.org Thu Sep 4 16:07:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:07:34 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84N7RWZ004243 for ; Thu, 4 Sep 2003 16:07:28 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h84N7Co21770; Thu, 4 Sep 2003 16:07:12 -0700 Date: Thu, 4 Sep 2003 16:06:58 -0700 From: Stephen Hemminger To: Jeff Garzik , Mirko Lindner , Ralph Roesler Cc: netdev@oss.sgi.com Subject: [RFT] simplify skge /proc interface. Message-Id: <20030904160658.5ae22c0d.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5603 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 patch is against 2.6.0-test4 and simplifys the /proc interface for the skge driver. * Use seq_file single_open interface to avoid possible buffer over run and formatting issues. * Put pointer to device in the proc dir private data to avoid having to search through devices to find the info. * Use %lld rather than special formatting code * use proc_mkdir * Don't die if proc fs is not configured or creating entries fails. New code is written in kernel style. Builds and loads but don't have real hardware. Could someone please test this with a real board? Somewhere in this 8K line driver is a 1000 line driver waiting to get out... diff -Nru a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c --- a/drivers/net/sk98lin/skge.c Thu Sep 4 15:53:18 2003 +++ b/drivers/net/sk98lin/skge.c Thu Sep 4 15:53:18 2003 @@ -526,13 +526,11 @@ ******************************************************************************/ static const char SK_Root_Dir_entry[] = "sk98lin"; + +#ifdef CONFIG_PROC_FS static struct proc_dir_entry *pSkRootDir; -extern int sk_proc_read( char *buffer, - char **buffer_location, - off_t offset, - int buffer_length, - int *eof, - void *data); +extern struct file_operations sk_proc_fops; +#endif extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); extern void SkDimDisplayModerationSettings(SK_AC *pAC); @@ -573,7 +571,6 @@ */ static int __init skge_probe (void) { - int proc_root_initialized = 0; int boards_found = 0; int vendor_flag = SK_FALSE; SK_AC *pAC; @@ -724,30 +721,31 @@ SK_MEMCPY(&SK_Root_Dir_entry, BootString, sizeof(SK_Root_Dir_entry) - 1); +#ifdef CONFIG_PROC_FS /*Create proc (directory)*/ - if(!proc_root_initialized) { - pSkRootDir = create_proc_entry(SK_Root_Dir_entry, - S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, proc_net); - pSkRootDir->owner = THIS_MODULE; - proc_root_initialized = 1; + if(!pSkRootDir) { + pSkRootDir = proc_mkdir(SK_Root_Dir_entry, + proc_net); + if (!pSkRootDir) { + printk(KERN_WARNING "%s: Unable to create /proc/net/%s", + dev->name, SK_Root_Dir_entry); + /* not fatal */ + } else + pSkRootDir->owner = THIS_MODULE; } - +#endif } - +#ifdef CONFIG_PROC_FS /* Create proc file */ - pProcFile = create_proc_entry(dev->name, - S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, - pSkRootDir); - - - pProcFile->read_proc = sk_proc_read; - pProcFile->write_proc = NULL; - pProcFile->nlink = 1; - pProcFile->size = sizeof(dev->name + 1); - pProcFile->data = (void *)pProcFile; - pProcFile->owner = THIS_MODULE; + if (pSkRootDir) { + pProcFile = create_proc_entry(dev->name, S_IRUGO, + pSkRootDir); + pProcFile->proc_fops = &sk_proc_fops; + pProcFile->data = dev; + } +#endif pNet->PortNr = 0; pNet->NetNr = 0; @@ -798,17 +796,14 @@ #endif #endif - pProcFile = create_proc_entry(dev->name, - S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, - pSkRootDir); - - - pProcFile->read_proc = sk_proc_read; - pProcFile->write_proc = NULL; - pProcFile->nlink = 1; - pProcFile->size = sizeof(dev->name + 1); - pProcFile->data = (void *)pProcFile; - pProcFile->owner = THIS_MODULE; +#ifdef CONFIG_PROC_FS + if (pSkRootDir) { + pProcFile = create_proc_entry(dev->name, S_IRUGO, + pSkRootDir); + pProcFile->proc_fops = &sk_proc_fops; + pProcFile->data = dev; + } +#endif memcpy((caddr_t) &dev->dev_addr, (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); diff -Nru a/drivers/net/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c --- a/drivers/net/sk98lin/skproc.c Thu Sep 4 15:53:18 2003 +++ b/drivers/net/sk98lin/skproc.c Thu Sep 4 15:53:18 2003 @@ -83,452 +83,219 @@ ******************************************************************************/ #include +#include #include "h/skdrv1st.h" #include "h/skdrv2nd.h" -#define ZEROPAD 1 /* pad with zero */ -#define SIGN 2 /* unsigned/signed long */ -#define PLUS 4 /* show plus */ -#define SPACE 8 /* space if plus */ -#define LEFT 16 /* left justified */ -#define SPECIALX 32 /* 0x */ -#define LARGE 64 - - extern struct net_device *SkGeRootDev; - -extern char * SkNumber( - char * str, - long long num, - int base, - int size, - int precision, - int type); - -int sk_proc_read(char *buffer, - char **buffer_location, - off_t offset, - int buffer_length, - int *eof, - void *data); +#ifdef CONFIG_PROC_FS - -/***************************************************************************** - * - * sk_proc_read - print "summaries" entry - * - * Description: - * This function fills the proc entry with statistic data about - * the ethernet device. - * - * - * Returns: buffer with statistic data - * - */ -int sk_proc_read(char *buffer, -char **buffer_location, -off_t offset, -int buffer_length, -int *eof, -void *data) +static int sk_seq_show(struct seq_file *seq, void *v) { - int len = 0; - int t; + const struct net_device *dev = v; + const struct s_DevNet *pNet = dev->priv; + const struct s_AC *pAC = pNet->pAC; + const struct s_PnmiStrucData *pPnmiStruct = &pAC->PnmiStruct; + const struct s_PnmiStat *pPnmiStat = &pPnmiStruct->Stat[0]; int i; - DEV_NET *pNet; - SK_AC *pAC; - char test_buf[100]; - char sens_msg[50]; - unsigned long Flags; - unsigned int Size; - struct SK_NET_DEVICE *next; - struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev; - - SK_PNMI_STRUCT_DATA *pPnmiStruct; - SK_PNMI_STAT *pPnmiStat; - struct proc_dir_entry *file = (struct proc_dir_entry*) data; - - while (SkgeProcDev) { - pNet = (DEV_NET*) SkgeProcDev->priv; - pAC = pNet->pAC; - next = pAC->Next; - pPnmiStruct = &pAC->PnmiStruct; - /* NetIndex in GetStruct is now required, zero is only dummy */ - - for (t=pAC->GIni.GIMacsFound; t > 0; t--) { - if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1) - t--; - - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - Size = SK_PNMI_STRUCT_SIZE; - SkPnmiGetStruct(pAC, pAC->IoBase, - pPnmiStruct, &Size, t-1); - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - - if (strcmp(pAC->dev[t-1]->name, file->name) == 0) { - pPnmiStat = &pPnmiStruct->Stat[0]; - len = sprintf(buffer, - "\nDetailed statistic for device %s\n", - pAC->dev[t-1]->name); - len += sprintf(buffer + len, - "=======================================\n"); + int unit = !(pAC->dev[0] == dev); + char sens_msg[50]; + + seq_printf(seq, + "\nDetailed statistic for device %s\n", + dev->name); + seq_puts(seq, + "=======================================\n"); + + /* Board statistics */ + seq_puts(seq, "\nBoard statistics\n\n"); - /* Board statistics */ - len += sprintf(buffer + len, - "\nBoard statistics\n\n"); - len += sprintf(buffer + len, - "Active Port %c\n", - 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. - Net[t-1].PrefPort]->PortNumber); - len += sprintf(buffer + len, - "Preferred Port %c\n", - 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. - Net[t-1].PrefPort]->PortNumber); - - len += sprintf(buffer + len, - "Bus speed (MHz) %d\n", - pPnmiStruct->BusSpeed); - - len += sprintf(buffer + len, - "Bus width (Bit) %d\n", - pPnmiStruct->BusWidth); - len += sprintf(buffer + len, - "Hardware revision v%d.%d\n", - (pAC->GIni.GIPciHwRev >> 4) & 0x0F, - pAC->GIni.GIPciHwRev & 0x0F); - - /* Print sensor informations */ - for (i=0; i < pAC->I2c.MaxSens; i ++) { - /* Check type */ - switch (pAC->I2c.SenTable[i].SenType) { - case 1: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (C)"); - len += sprintf(buffer + len, - "%-25s %d.%02d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue / 10, - pAC->I2c.SenTable[i].SenValue % 10); - - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (F)"); - len += sprintf(buffer + len, - "%-25s %d.%02d\n", - sens_msg, - ((((pAC->I2c.SenTable[i].SenValue) - *10)*9)/5 + 3200)/100, - ((((pAC->I2c.SenTable[i].SenValue) - *10)*9)/5 + 3200) % 10); - break; - case 2: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (V)"); - len += sprintf(buffer + len, - "%-25s %d.%03d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue / 1000, - pAC->I2c.SenTable[i].SenValue % 1000); - break; - case 3: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (rpm)"); - len += sprintf(buffer + len, - "%-25s %d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue); - break; - default: - break; - } - } + seq_printf(seq, "Active Port %c\n", + 'A' + pAC->Rlmt.Net[unit].Port[pAC->Rlmt. + Net[unit].PrefPort]->PortNumber); + + seq_printf(seq, "Preferred Port %c\n", + 'A' + pAC->Rlmt.Net[unit].Port[pAC->Rlmt. + Net[unit].PrefPort]->PortNumber); + + seq_printf(seq, "Bus speed (MHz) %d\n", + pPnmiStruct->BusSpeed); + + seq_printf(seq, + "Bus width (Bit) %d\n", + pPnmiStruct->BusWidth); + seq_printf(seq, + "Hardware revision v%d.%d\n", + (pAC->GIni.GIPciHwRev >> 4) & 0x0F, + pAC->GIni.GIPciHwRev & 0x0F); + + /* Print sensor informations */ + for (i=0; i < pAC->I2c.MaxSens; i ++) { + /* Check type */ + switch (pAC->I2c.SenTable[i].SenType) { + case 1: + strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); + strcat(sens_msg, " (C)"); + seq_printf(seq, + "%-25s %d.%02d\n", + sens_msg, + pAC->I2c.SenTable[i].SenValue / 10, + pAC->I2c.SenTable[i].SenValue % 10); + + strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); + strcat(sens_msg, " (F)"); + seq_printf(seq, + "%-25s %d.%02d\n", + sens_msg, + ((((pAC->I2c.SenTable[i].SenValue) + *10)*9)/5 + 3200)/100, + ((((pAC->I2c.SenTable[i].SenValue) + *10)*9)/5 + 3200) % 10); + break; + case 2: + strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); + strcat(sens_msg, " (V)"); + seq_printf(seq, + "%-25s %d.%03d\n", + sens_msg, + pAC->I2c.SenTable[i].SenValue / 1000, + pAC->I2c.SenTable[i].SenValue % 1000); + break; + case 3: + strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); + strcat(sens_msg, " (rpm)"); + seq_printf(seq, + "%-25s %d\n", + sens_msg, + pAC->I2c.SenTable[i].SenValue); + break; + default: + break; + } + } - /*Receive statistics */ - len += sprintf(buffer + len, - "\nReceive statistics\n\n"); - - len += sprintf(buffer + len, - "Received bytes %s\n", - SkNumber(test_buf, pPnmiStat->StatRxOctetsOkCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Received packets %s\n", - SkNumber(test_buf, pPnmiStat->StatRxOkCts, - 10,0,-1,0)); + /*Receive statistics */ + seq_printf(seq, + "\nReceive statistics\n\n"); + + seq_printf(seq, + "Received bytes %lld\n", + pPnmiStat->StatRxOctetsOkCts); + seq_printf(seq, + "Received packets %lld\n", + pPnmiStat->StatRxOkCts); #if 0 - if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && - pAC->HWRevision < 12) { - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxShortsCts; - pPnmiStat->StatRxShortsCts = 0; - } + if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && + pAC->HWRevision < 12) { + pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - + pPnmiStat->StatRxShortsCts; + pPnmiStat->StatRxShortsCts = 0; + } #endif - if (pNet->Mtu > 1500) - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxTooLongCts; - - len += sprintf(buffer + len, - "Receive errors %s\n", - SkNumber(test_buf, pPnmiStruct->InErrorsCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Receive dropped %s\n", - SkNumber(test_buf, pPnmiStruct->RxNoBufCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Received multicast %s\n", - SkNumber(test_buf, pPnmiStat->StatRxMulticastOkCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Receive error types\n"); - len += sprintf(buffer + len, - " length %s\n", - SkNumber(test_buf, pPnmiStat->StatRxRuntCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " buffer overflow %s\n", - SkNumber(test_buf, pPnmiStat->StatRxFifoOverflowCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " bad crc %s\n", - SkNumber(test_buf, pPnmiStat->StatRxFcsCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " framing %s\n", - SkNumber(test_buf, pPnmiStat->StatRxFramingCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " missed frames %s\n", - SkNumber(test_buf, pPnmiStat->StatRxMissedCts, - 10, 0, -1, 0)); - - if (pNet->Mtu > 1500) - pPnmiStat->StatRxTooLongCts = 0; - - len += sprintf(buffer + len, - " too long %s\n", - SkNumber(test_buf, pPnmiStat->StatRxTooLongCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " carrier extension %s\n", - SkNumber(test_buf, pPnmiStat->StatRxCextCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " too short %s\n", - SkNumber(test_buf, pPnmiStat->StatRxShortsCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " symbol %s\n", - SkNumber(test_buf, pPnmiStat->StatRxSymbolCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " LLC MAC size %s\n", - SkNumber(test_buf, pPnmiStat->StatRxIRLengthCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " carrier event %s\n", - SkNumber(test_buf, pPnmiStat->StatRxCarrierCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " jabber %s\n", - SkNumber(test_buf, pPnmiStat->StatRxJabberCts, - 10, 0, -1, 0)); - - - /*Transmit statistics */ - len += sprintf(buffer + len, - "\nTransmit statistics\n\n"); - - len += sprintf(buffer + len, - "Transmited bytes %s\n", - SkNumber(test_buf, pPnmiStat->StatTxOctetsOkCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Transmited packets %s\n", - SkNumber(test_buf, pPnmiStat->StatTxOkCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Transmit errors %s\n", - SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Transmit dropped %s\n", - SkNumber(test_buf, pPnmiStruct->TxNoBufCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Transmit collisions %s\n", - SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts, - 10,0,-1,0)); - len += sprintf(buffer + len, - "Transmit error types\n"); - len += sprintf(buffer + len, - " excessive collision %ld\n", - pAC->stats.tx_aborted_errors); - len += sprintf(buffer + len, - " carrier %s\n", - SkNumber(test_buf, pPnmiStat->StatTxCarrierCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " fifo underrun %s\n", - SkNumber(test_buf, pPnmiStat->StatTxFifoUnderrunCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " heartbeat %s\n", - SkNumber(test_buf, pPnmiStat->StatTxCarrierCts, - 10, 0, -1, 0)); - len += sprintf(buffer + len, - " window %ld\n", - pAC->stats.tx_window_errors); + seq_printf(seq,"Receive errors %lld\n", + (pNet->Mtu > 1500) + ? pPnmiStruct->InErrorsCts - pPnmiStat->StatRxTooLongCts + : pPnmiStruct->InErrorsCts); + + seq_printf(seq, + "Receive dropped %lld\n", + pPnmiStruct->RxNoBufCts); + seq_printf(seq, + "Received multicast %lld\n", + pPnmiStat->StatRxMulticastOkCts); + seq_printf(seq, + "Receive error types\n"); + seq_printf(seq, + " length %lld\n", + pPnmiStat->StatRxRuntCts); + seq_printf(seq, + " buffer overflow %lld\n", + pPnmiStat->StatRxFifoOverflowCts); + seq_printf(seq, + " bad crc %lld\n", + pPnmiStat->StatRxFcsCts); + seq_printf(seq, + " framing %lld\n", + pPnmiStat->StatRxFramingCts); + seq_printf(seq, + " missed frames %lld\n", + pPnmiStat->StatRxMissedCts); + + seq_printf(seq, + " too long %lld\n", + pPnmiStat->StatRxTooLongCts); + + seq_printf(seq, + " carrier extension %lld\n", + pPnmiStat->StatRxCextCts); + seq_printf(seq, + " too short %lld\n", + pPnmiStat->StatRxShortsCts); + seq_printf(seq, + " symbol %lld\n", + pPnmiStat->StatRxSymbolCts); + seq_printf(seq, + " LLC MAC size %lld\n", + pPnmiStat->StatRxIRLengthCts); + seq_printf(seq, + " carrier event %lld\n", + pPnmiStat->StatRxCarrierCts); + seq_printf(seq, + " jabber %lld\n", + pPnmiStat->StatRxJabberCts); + + + /*Transmit statistics */ + seq_printf(seq, + "\nTransmit statistics\n\n"); - } - } - SkgeProcDev = next; - } - if (offset >= len) { - *eof = 1; - return 0; - } + seq_printf(seq, + "Transmited bytes %lld\n", + pPnmiStat->StatTxOctetsOkCts); + seq_printf(seq, + "Transmited packets %lld\n", + pPnmiStat->StatTxOkCts); + seq_printf(seq, + "Transmit errors %lld\n", + pPnmiStat->StatTxSingleCollisionCts); + seq_printf(seq, + "Transmit dropped %lld\n", + pPnmiStruct->TxNoBufCts); + seq_printf(seq, + "Transmit collisions %lld\n", + pPnmiStat->StatTxSingleCollisionCts); + seq_printf(seq, + "Transmit error types\n"); + seq_printf(seq, + " excessive collision %ld\n", + pAC->stats.tx_aborted_errors); + seq_printf(seq, + " carrier %lld\n", + pPnmiStat->StatTxCarrierCts); + seq_printf(seq, + " fifo underrun %lld\n", + pPnmiStat->StatTxFifoUnderrunCts); + seq_printf(seq, + " heartbeat %lld\n", + pPnmiStat->StatTxCarrierCts); + seq_printf(seq, + " window %ld\n", + pAC->stats.tx_window_errors); - *buffer_location = buffer + offset; - if (buffer_length >= len - offset) { - *eof = 1; - } - return (min_t(int, buffer_length, len - offset)); + return 0; } - - - - -/***************************************************************************** - * - * SkDoDiv - convert 64bit number - * - * Description: - * This function "converts" a long long number. - * - * Returns: - * remainder of division - */ -static long SkDoDiv (long long Dividend, int Divisor, long long *pErg) +static int sk_proc_open(struct inode *inode, struct file *file) { - long Rest; - long long Ergebnis; - long Akku; - - - Akku = Dividend >> 32; - - Ergebnis = ((long long) (Akku / Divisor)) << 32; - Rest = Akku % Divisor ; - - Akku = Rest << 16; - Akku |= ((Dividend & 0xFFFF0000) >> 16); - - - Ergebnis += ((long long) (Akku / Divisor)) << 16; - Rest = Akku % Divisor ; - - Akku = Rest << 16; - Akku |= (Dividend & 0xFFFF); - - Ergebnis += (Akku / Divisor); - Rest = Akku % Divisor ; - - *pErg = Ergebnis; - return (Rest); + return single_open(file, sk_seq_show, PDE(inode)->data); } - -#if 0 -#define do_div(n,base) ({ \ -long long __res; \ -__res = ((unsigned long long) n) % (unsigned) base; \ -n = ((unsigned long long) n) / (unsigned) base; \ -__res; }) +struct file_operations sk_proc_fops = { + .owner = THIS_MODULE, + .open = sk_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif - - -/***************************************************************************** - * - * SkNumber - Print results - * - * Description: - * This function converts a long long number into a string. - * - * Returns: - * number as string - */ -char * SkNumber(char * str, long long num, int base, int size, int precision - ,int type) -{ - char c,sign,tmp[66], *strorg = str; - const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; - int i; - - if (type & LARGE) - digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if (type & LEFT) - type &= ~ZEROPAD; - if (base < 2 || base > 36) - return 0; - c = (type & ZEROPAD) ? '0' : ' '; - sign = 0; - if (type & SIGN) { - if (num < 0) { - sign = '-'; - num = -num; - size--; - } else if (type & PLUS) { - sign = '+'; - size--; - } else if (type & SPACE) { - sign = ' '; - size--; - } - } - if (type & SPECIALX) { - if (base == 16) - size -= 2; - else if (base == 8) - size--; - } - i = 0; - if (num == 0) - tmp[i++]='0'; - else while (num != 0) - tmp[i++] = digits[SkDoDiv(num,base, &num)]; - - if (i > precision) - precision = i; - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - *str++ = ' '; - if (sign) - *str++ = sign; - if (type & SPECIALX) { - if (base==8) - *str++ = '0'; - else if (base==16) { - *str++ = '0'; - *str++ = digits[33]; - } - } - if (!(type & LEFT)) - while (size-- > 0) - *str++ = c; - while (i < precision--) - *str++ = '0'; - while (i-- > 0) - *str++ = tmp[i]; - while (size-- > 0) - *str++ = ' '; - - str[0] = '\0'; - - return strorg; -} - - - From jgarzik@pobox.com Thu Sep 4 16:14:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:14:06 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84NE3WZ005168 for ; Thu, 4 Sep 2003 16:14:04 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:35368 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19uiQQ-0001Vs-9l; Thu, 04 Sep 2003 01:56:38 +0100 Message-ID: <3F568DBA.2060905@pobox.com> Date: Wed, 03 Sep 2003 20:56:26 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Francois Romieu CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] 2.6.0-test4-bk5 - Was: Re: The recent free_netdev() conversion... References: <3F535EBD.6090401@pobox.com> <20030901075345.4c35e3e6.davem@redhat.com> <3F536CB7.6060404@pobox.com> <20030901085814.5a333518.davem@redhat.com> <20030904003306.A14624@electric-eye.fr.zoreil.com> In-Reply-To: <20030904003306.A14624@electric-eye.fr.zoreil.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5604 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 looks OK to me. From ak@suse.de Thu Sep 4 16:30:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:31:27 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [195.135.220.2]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84NUgWZ006766 for ; Thu, 4 Sep 2003 16:30:43 -0700 Received: from Hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id D8C0C15B262E; Fri, 5 Sep 2003 01:07:26 +0200 (CEST) Date: Fri, 5 Sep 2003 01:07:25 +0200 From: Andi Kleen To: "David S. Miller" Cc: levon@movementarian.org, netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030905010725.5ee10cbf.ak@suse.de> In-Reply-To: <20030904074520.5dceff3e.davem@redhat.com> References: <20030904145204.GA27953@compsoc.man.ac.uk> <20030904074520.5dceff3e.davem@redhat.com> X-Mailer: Sylpheed version 0.8.9 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5605 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@suse.de Precedence: bulk X-list: netdev On Thu, 4 Sep 2003 07:45:20 -0700 "David S. Miller" wrote: > On Thu, 4 Sep 2003 15:52:04 +0100 > John Levon wrote: > > > This file seems bitrotted and more up to date info is available in > > MAINTAINERS in large part. > > For some reason I deleted this file from 2.4.x but I never > did it for 2.5.x, fixed... When you're doing janitor type stuff currently I would also suggest an update of the NET4 version numbers: Linux NET4.0 for Linux 2.x -> NET4.1 for Linux 2.6 ? (not that many changes since 2.4, but still a minor increase would be ok) NET4: Linux TCP/IP 1.0 for NET4.0 (-> 1.1 would be reasonable for TCP/IP and s/4.0/4.1/) IPv6 v0.8 for NET4.0 (IPv6 has changed a lot, it would probably deserve an 1.0 now. also 4.0 -> 4.1) Also some other users have similar version strings which could be all updated to NET4.1 (appletalk, IPX, decnet etc.) -Andi From sri@us.ibm.com Thu Sep 4 16:49:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 16:49:48 -0700 (PDT) Received: from over.ny.us.ibm.com (over.ny.us.ibm.com [32.97.182.111]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h84NnVWZ008434 for ; Thu, 4 Sep 2003 16:49:38 -0700 Received: from e6.ny.us.ibm.com ([9.14.6.106]) by pokfb.esmtp.ibm.com (8.12.9/8.12.2) with ESMTP id h84N0ZYE465844 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Thu, 4 Sep 2003 19:00:36 -0400 Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150]) by e6.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h84MtTSO312440; Thu, 4 Sep 2003 18:55:29 -0400 Received: from w-sridhar.beaverton.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay02.pok.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id h84MtR4d057878; Thu, 4 Sep 2003 18:55:28 -0400 Date: Thu, 4 Sep 2003 15:55:27 -0700 (PDT) From: Sridhar Samudrala X-X-Sender: sridhar@localhost.localdomain To: davem@redhat.com cc: netdev@oss.sgi.com Subject: [BK PATCH] SCTP updates. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5606 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sri@us.ibm.com Precedence: bulk X-list: netdev Hi Dave, Please do a bk pull http://linux-lksctp.bkbits.net/lksctp-2.5 to get the following updates to SCTP on top of linux 2.6.0-test4 The changesets include API updates to be compatible with the latest SCTP sockets API Extension draft http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpsocket-07.txt and a few bug fixes. # This patch includes the following deltas: # ChangeSet 1.1316 -> 1.1324 # include/net/sctp/user.h 1.14 -> 1.15 # net/sctp/associola.c 1.58 -> 1.59 # net/sctp/input.c 1.35 -> 1.36 # net/sctp/sm_statefuns.c 1.62 -> 1.63 # net/sctp/sm_make_chunk.c 1.58 -> 1.61 # include/net/sctp/sctp.h 1.47 -> 1.50 # net/sctp/sysctl.c 1.12 -> 1.13 # include/net/sctp/sm.h 1.27 -> 1.29 # net/sctp/protocol.c 1.57 -> 1.58 # net/sctp/ipv6.c 1.48 -> 1.49 # include/linux/sctp.h 1.7 -> 1.8 # net/sctp/bind_addr.c 1.19 -> 1.21 # include/net/sctp/structs.h 1.71 -> 1.73 # net/sctp/primitive.c 1.10 -> 1.11 # net/sctp/socket.c 1.89 -> 1.95 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/08/25 sri@us.ibm.com 1.1123.20.2 # [SCTP] draft07 API changes: sctp_getpaddrs(), sctp_getladdrs() now # return a packed array of sockaddr_in/sockaddr_in6 structures instead # of an array of sockaddr_storage structures. # -------------------------------------------- # 03/08/25 sri@us.ibm.com 1.1317 # Merge us.ibm.com:/home/sridhar/BK/linux-2.6.0-test4 # into us.ibm.com:/home/sridhar/BK/lksctp-2.6.0-test4 # -------------------------------------------- # 03/08/27 sri@us.ibm.com 1.1318 # [SCTP] SCTP_SET_PEER_PRIMARY socket option support. (Kevin Gao) # -------------------------------------------- # 03/08/29 sri@us.ibm.com 1.1319 # [SCTP] draft07 API changes: sctp_bindx() now takes a packed array of # sockaddr_in/sockaddr_in6 structures instead of an array of # sockaddr_storage structures. # -------------------------------------------- # 03/09/02 sri@us.ibm.com 1.1320 # [SCTP] Convert sctp_param2sockaddr() and sockaddr2sctp_addr() to # address family specific routines af->from_addr_parm() and # af->to_addr_param() respectively. # -------------------------------------------- # 03/09/03 sri@us.ibm.com 1.1321 # [SCTP] Fix a couple of issues with the call to sctp_ssnmap_new() in # sctp_process_init(). # # The argument passed as inbound streams to sctp_ssnmap_new() is # incorrect. Also allocating a ssnmap everytime a INIT is received is # vulnerable to DoS attacks. So delay the creation of an ssnmap if we # are processing a temporary association. # -------------------------------------------- # 03/09/03 sri@us.ibm.com 1.1322 # [SCTP] draft 07 API changes: Disable listening when backlog is 0. # -------------------------------------------- # 03/09/03 sri@us.ibm.com 1.1323 # [SCTP] draft 07 API changes: By default, all the event notifications # are turned off even for one-to-many style sockets. # -------------------------------------------- # 03/09/04 sri@us.ibm.com 1.1324 # [SCTP] Move a local variable declaration ahead of the function code. # # Apparently the new gcc 3.2.2 allows local variable declarations within # the code of a function if it is not used earlier. But older gcc's do # not allow this. # -------------------------------------------- Thanks Sridhar From amir.noam@intel.com Thu Sep 4 18:08:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:26 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWh014430 for ; Thu, 4 Sep 2003 18:08:49 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84HgQg01304 for ; Thu, 4 Sep 2003 17:42:26 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HdXL25746 for ; Thu, 4 Sep 2003 17:39:34 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410444132207 ; Thu, 04 Sep 2003 10:44:42 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 4/10] [bonding 2.6] fix kernel panic when optional feature used Date: Thu, 4 Sep 2003 20:44:41 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042044.41209.amir.noam@intel.com> X-archive-position: 5611 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:17:59 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:01 2003 @@ -1559,11 +1559,14 @@ static int bond_enslave(struct net_devic #endif bond_set_slave_inactive_flags(new_slave); } - read_lock_irqsave(&(((struct in_device *)slave_dev->ip_ptr)->lock), rflags); - ifap= &(((struct in_device *)slave_dev->ip_ptr)->ifa_list); - ifa = *ifap; - my_ip = ifa->ifa_address; - read_unlock_irqrestore(&(((struct in_device *)slave_dev->ip_ptr)->lock), rflags); + if (((struct in_device *)slave_dev->ip_ptr) != NULL) { + read_lock_irqsave(&(((struct in_device *)slave_dev->ip_ptr)->lock), rflags); + ifap= &(((struct in_device *)slave_dev->ip_ptr)->ifa_list); + ifa = *ifap; + if (ifa != NULL) + my_ip = ifa->ifa_address; + read_unlock_irqrestore(&(((struct in_device *)slave_dev->ip_ptr)->lock), rflags); + } /* if there is a primary slave, remember it */ if (primary != NULL) { @@ -2730,10 +2733,8 @@ static void activebackup_arp_monitor(str /* the current slave must tx an arp to ensure backup slaves * rx traffic */ - if ((slave != NULL) && - (((jiffies - slave->dev->last_rx) >= the_delta_in_ticks) && - (my_ip != 0))) { - arp_send_all(slave); + if ((slave != NULL) && (my_ip != 0)) { + arp_send_all(slave); } } From amir.noam@intel.com Thu Sep 4 18:08:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:26 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWf014430 for ; Thu, 4 Sep 2003 18:08:48 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hgeg01454 for ; Thu, 4 Sep 2003 17:42:40 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HdlL25890 for ; Thu, 4 Sep 2003 17:39:47 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410445511480 ; Thu, 04 Sep 2003 10:44:56 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 5/10] [bonding 2.6] fix change active command Date: Thu, 4 Sep 2003 20:44:55 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042044.55232.amir.noam@intel.com> X-archive-position: 5612 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:02 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:03 2003 @@ -1720,20 +1720,29 @@ static int bond_change_active(struct net } } + /* + * Changing to the current active: do nothing; return success. + */ + if (newactive && (newactive == oldactive)) { + write_unlock_bh(&bond->lock); + return 0; + } + if ((newactive != NULL)&& (oldactive != NULL)&& - (newactive != oldactive)&& (newactive->link == BOND_LINK_UP)&& IS_UP(newactive->dev)) { - bond_set_slave_inactive_flags(oldactive); - bond_set_slave_active_flags(newactive); + if (bond_mode == BOND_MODE_ACTIVEBACKUP) { + bond_set_slave_inactive_flags(oldactive); + bond_set_slave_active_flags(newactive); + } + bond_mc_update(bond, newactive, oldactive); bond_assign_current_slave(bond, newactive); printk("%s : activate %s(old : %s)\n", master_dev->name, newactive->dev->name, oldactive->dev->name); - } - else { + } else { ret = -EINVAL; } write_unlock_bh(&bond->lock); From amir.noam@intel.com Thu Sep 4 18:08:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:26 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWj014430 for ; Thu, 4 Sep 2003 18:08:50 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hfqg00949 for ; Thu, 4 Sep 2003 17:41:52 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84Hd0L25400 for ; Thu, 4 Sep 2003 17:39:00 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410440704569 ; Thu, 04 Sep 2003 10:44:09 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 2/10] [bonding 2.6] fix load balance problem with high UDP Tx stress Date: Thu, 4 Sep 2003 20:44:07 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042044.07510.amir.noam@intel.com> X-archive-position: 5610 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c --- a/drivers/net/bonding/bond_alb.c Thu Sep 4 20:17:54 2003 +++ b/drivers/net/bonding/bond_alb.c Thu Sep 4 20:17:55 2003 @@ -17,6 +17,13 @@ * * The full GNU General Public License is included in this distribution in the * file called LICENSE. + * + * + * Changes: + * + * 2003/06/25 - Shmulik Hen + * - Fixed signed/unsigned calculation errors that caused load sharing + * to collapse to one slave under very heavy UDP Tx stress. */ #include @@ -246,7 +253,7 @@ tlb_get_least_loaded_slave(struct bondin { struct slave *slave; struct slave *least_loaded; - u32 curr_gap, max_gap; + s64 curr_gap, max_gap; /* Find the first enabled slave */ slave = bond_get_first_slave(bond); @@ -262,15 +269,15 @@ tlb_get_least_loaded_slave(struct bondin } least_loaded = slave; - max_gap = (slave->speed * 1000000) - - (SLAVE_TLB_INFO(slave).load * 8); + max_gap = (s64)(slave->speed * 1000000) - + (s64)(SLAVE_TLB_INFO(slave).load * 8); /* Find the slave with the largest gap */ slave = bond_get_next_slave(bond, slave); while (slave) { if (SLAVE_IS_OK(slave)) { - curr_gap = (slave->speed * 1000000) - - (SLAVE_TLB_INFO(slave).load * 8); + curr_gap = (s64)(slave->speed * 1000000) - + (s64)(SLAVE_TLB_INFO(slave).load * 8); if (max_gap < curr_gap) { least_loaded = slave; max_gap = curr_gap; From amir.noam@intel.com Thu Sep 4 18:08:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:22 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWZ014430 for ; Thu, 4 Sep 2003 18:08:46 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84HfAg00477 for ; Thu, 4 Sep 2003 17:41:10 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HcIL25001 for ; Thu, 4 Sep 2003 17:38:18 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410432625910 ; Thu, 04 Sep 2003 10:43:26 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Subject: [PATCH 0/10] [bonding 2.6] port 2.4 bug fixes to 2.6 Date: Thu, 4 Sep 2003 20:43:25 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200309042043.25567.amir.noam@intel.com> X-archive-position: 5607 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev The following set ports to 2.6 numerous bug fixes that went into 2.4 recently. Patches apply on 2.6.0-test4. Compile tested only. patch1: fix 802.3ad long fail over with high UDP Tx stress patch2: fix load balance problem with high UDP Tx stress patch3: fix ARP monitoring bug patch4: fix kernel panic when optional feature used patch5: fix change active command patch6: fix OOPS in bonding driver, when removing primary patch7: embed stats struct inside bonding private struct patch8: fix error handling in init code patch9: make each bond device use its own /proc entry patch10: misc fixes: missing include, typos, comments -- Amir From amir.noam@intel.com Thu Sep 4 18:08:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:26 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWd014430 for ; Thu, 4 Sep 2003 18:08:47 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hgqg01534 for ; Thu, 4 Sep 2003 17:42:52 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HdxL25970 for ; Thu, 4 Sep 2003 17:40:00 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410450717092 ; Thu, 04 Sep 2003 10:45:08 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 6/10] [bonding 2.6] fix OOPS in bonding driver, when removing primary Date: Thu, 4 Sep 2003 20:45:07 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042045.07050.amir.noam@intel.com> X-archive-position: 5609 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:05 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:06 2003 @@ -1941,6 +1941,10 @@ static int bond_release(struct net_devic /* release the slave from its bond */ bond_detach_slave(bond, our_slave); + if (bond->primary_slave == our_slave) { + bond->primary_slave = NULL; + } + printk (KERN_INFO "%s: releasing %s interface %s", master->name, (our_slave->state == BOND_STATE_ACTIVE) ? "active" : "backup", @@ -1957,10 +1961,6 @@ static int bond_release(struct net_devic printk(KERN_INFO "%s: now running without any active interface !\n", master->name); - } - - if (bond->primary_slave == our_slave) { - bond->primary_slave = NULL; } if ((bond_mode == BOND_MODE_TLB) || From amir.noam@intel.com Thu Sep 4 18:08:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:23 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWb014430 for ; Thu, 4 Sep 2003 18:08:46 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84HgAg01162 for ; Thu, 4 Sep 2003 17:42:10 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HdHL25609 for ; Thu, 4 Sep 2003 17:39:17 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410442607879 ; Thu, 04 Sep 2003 10:44:26 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 3/10] [bonding 2.6] fix ARP monitoring bug Date: Thu, 4 Sep 2003 20:44:25 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042044.25278.amir.noam@intel.com> X-archive-position: 5608 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:17:57 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:17:58 2003 @@ -443,7 +443,7 @@ struct bond_parm_tbl { static int arp_interval = BOND_LINK_ARP_INTERV; static char *arp_ip_target[MAX_ARP_IP_TARGETS] = { NULL, }; -static unsigned long arp_target[MAX_ARP_IP_TARGETS] = { 0, } ; +static u32 arp_target[MAX_ARP_IP_TARGETS] = { 0, } ; static int arp_ip_count = 0; static u32 my_ip = 0; char *arp_target_hw_addr = NULL; @@ -3811,7 +3811,7 @@ static int __init bonding_init(void) arp_interval = 0; } else { u32 ip = in_aton(arp_ip_target[arp_ip_count]); - *(u32 *)(arp_ip_target[arp_ip_count]) = ip; + arp_target[arp_ip_count] = ip; } } From amir.noam@intel.com Thu Sep 4 18:08:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:30 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWl014430 for ; Thu, 4 Sep 2003 18:08:52 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hh2g01752 for ; Thu, 4 Sep 2003 17:43:02 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84He9L26191 for ; Thu, 4 Sep 2003 17:40:09 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410451711853 ; Thu, 04 Sep 2003 10:45:18 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 7/10] [bonding 2.6] embed stats struct inside bonding private struct Date: Thu, 4 Sep 2003 20:45:17 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042045.17273.amir.noam@intel.com> X-archive-position: 5613 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:08 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:09 2003 @@ -3295,10 +3295,10 @@ static int bond_xmit_activebackup(struct static struct net_device_stats *bond_get_stats(struct net_device *dev) { bonding_t *bond = dev->priv; - struct net_device_stats *stats = bond->stats, *sstats; + struct net_device_stats *stats = &(bond->stats), *sstats; slave_t *slave; - memset(bond->stats, 0, sizeof(struct net_device_stats)); + memset(stats, 0, sizeof(struct net_device_stats)); read_lock_bh(&bond->lock); @@ -3493,9 +3493,7 @@ static int __init bond_init(struct net_d /* initialize rwlocks */ rwlock_init(&bond->lock); rwlock_init(&bond->ptrlock); - - /* space is reserved for stats in alloc_netdev call. */ - bond->stats = (struct net_device_stats *)(bond + 1); + bond->next = bond->prev = (slave_t *)bond; bond->current_slave = NULL; bond->current_arp_slave = NULL; @@ -3868,8 +3866,7 @@ static int __init bonding_init(void) snprintf(name, IFNAMSIZ, "bond%d", no); - dev = alloc_netdev(sizeof(bonding_t) - + sizeof(struct net_device_stats), + dev = alloc_netdev(sizeof(struct bonding), name, ether_setup); if (!dev) return -ENOMEM; diff -Nuarp a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h --- a/drivers/net/bonding/bonding.h Thu Sep 4 20:18:08 2003 +++ b/drivers/net/bonding/bonding.h Thu Sep 4 20:18:09 2003 @@ -99,7 +99,7 @@ typedef struct bonding { rwlock_t ptrlock; struct timer_list mii_timer; struct timer_list arp_timer; - struct net_device_stats *stats; + struct net_device_stats stats; #ifdef CONFIG_PROC_FS struct proc_dir_entry *bond_proc_dir; struct proc_dir_entry *bond_proc_info_file; From amir.noam@intel.com Thu Sep 4 18:08:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:32 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWp014430 for ; Thu, 4 Sep 2003 18:08:57 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84HhCg01863 for ; Thu, 4 Sep 2003 17:43:12 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HeJL26314 for ; Thu, 4 Sep 2003 17:40:19 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410452722653 ; Thu, 04 Sep 2003 10:45:28 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 8/10] [bonding 2.6] fix error handling in init code Date: Thu, 4 Sep 2003 20:45:27 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042045.27041.amir.noam@intel.com> X-archive-position: 5614 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:10 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:11 2003 @@ -3470,8 +3470,9 @@ static int bond_event(struct notifier_bl struct net_device *event_dev = (struct net_device *)ptr; struct net_device *master = event_dev->master; - if (event == NETDEV_UNREGISTER && master != NULL) + if ((event == NETDEV_UNREGISTER) && (master != NULL)) { bond_release(master, event_dev); + } return NOTIFY_DONE; } @@ -3480,9 +3481,34 @@ static struct notifier_block bond_netdev .notifier_call = bond_event, }; +static void bond_deinit(struct net_device *dev) +{ + struct bonding *bond = dev->priv; + + list_del(&bond->bond_list); + +#ifdef CONFIG_PROC_FS + remove_proc_entry("info", bond->bond_proc_dir); + remove_proc_entry(dev->name, proc_net); +#endif +} + +static void bond_free_all(void) +{ + struct bonding *bond, *nxt; + + list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { + struct net_device *dev = bond->device; + + unregister_netdev(dev); + bond_deinit(dev); + kfree(dev); + } +} + static int __init bond_init(struct net_device *dev) { - bonding_t *bond; + struct bonding *bond; int count; #ifdef BONDING_DEBUG @@ -3613,6 +3639,7 @@ bond_parse_parm(char *mode_arg, struct b return -1; } + static int __init bonding_init(void) { int no; @@ -3858,49 +3885,62 @@ static int __init bonding_init(void) primary = NULL; } - register_netdevice_notifier(&bond_netdev_notifier); + rtnl_lock(); + err = 0; for (no = 0; no < max_bonds; no++) { struct net_device *dev; - char name[IFNAMSIZ]; - snprintf(name, IFNAMSIZ, "bond%d", no); + dev = alloc_netdev(sizeof(struct bonding), "", ether_setup); + if (!dev) { + err = -ENOMEM; + goto out_err; + } - dev = alloc_netdev(sizeof(struct bonding), - name, ether_setup); - if (!dev) - return -ENOMEM; + err = dev_alloc_name(dev, "bond%d"); + if (err < 0) { + kfree(dev); + goto out_err; + } + + /* bond_init() must be called after dev_alloc_name() (for the + * /proc files), but before register_netdevice(), because we + * need to set function pointers. + */ + err = bond_init(dev); + if (err < 0) { + kfree(dev); + goto out_err; + } - dev->init = bond_init; SET_MODULE_OWNER(dev); - if ( (err = register_netdev(dev)) ) { -#ifdef BONDING_DEBUG - printk(KERN_INFO "%s: register_netdev failed %d\n", - dev->name, err); -#endif + err = register_netdevice(dev); + if (err < 0) { + bond_deinit(dev); kfree(dev); - return err; - } + goto out_err; + } } + + rtnl_unlock(); + register_netdevice_notifier(&bond_netdev_notifier); + return 0; + +out_err: + rtnl_unlock(); + + /* free and unregister all bonds that were successfully added */ + bond_free_all(); + + return err; } static void __exit bonding_exit(void) { - struct bonding *bond, *nxt; - unregister_netdevice_notifier(&bond_netdev_notifier); - - list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { - struct net_device *dev = bond->device; -#ifdef CONFIG_PROC_FS - remove_proc_entry("info", bond->bond_proc_dir); - remove_proc_entry(dev->name, proc_net); -#endif - unregister_netdev(dev); - free_netdev(dev); - } + bond_free_all(); } module_init(bonding_init); From amir.noam@intel.com Thu Sep 4 18:08:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:33 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWt014430 for ; Thu, 4 Sep 2003 18:08:59 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84HhOg01947 for ; Thu, 4 Sep 2003 17:43:24 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HeVL26388 for ; Thu, 4 Sep 2003 17:40:32 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410453804556 ; Thu, 04 Sep 2003 10:45:39 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 9/10] [bonding 2.6] make each bond device use its own /proc entry Date: Thu, 4 Sep 2003 20:45:38 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042045.38523.amir.noam@intel.com> X-archive-position: 5617 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:13 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:14 2003 @@ -545,14 +545,6 @@ static int bond_release(struct net_devic static int bond_release_all(struct net_device *master); static int bond_sethwaddr(struct net_device *master, struct net_device *slave); -/* - * bond_get_info is the interface into the /proc filesystem. This is - * a different interface than the BOND_INFO_QUERY ioctl. That is done - * through the generic networking ioctl interface, and bond_info_query - * is the internal function which provides that information. - */ -static int bond_get_info(char *buf, char **start, off_t offset, int length); - /* Caller must hold bond->ptrlock for write */ static inline struct slave* bond_assign_current_slave(struct bonding *bond,struct slave *newslave) @@ -3337,132 +3329,136 @@ static struct net_device_stats *bond_get return stats; } -static int bond_get_info(char *buf, char **start, off_t offset, int length) +#ifdef CONFIG_PROC_FS +static int bond_read_proc(char *buf, char **start, off_t off, int count, int *eof, void *data) { - bonding_t *bond; + struct bonding *bond = (struct bonding *) data; int len = 0; - off_t begin = 0; u16 link; slave_t *slave = NULL; + /* make sure the bond won't be taken away */ + read_lock(&dev_base_lock); + len += sprintf(buf + len, "%s\n", version); - read_lock(&dev_base_lock); - list_for_each_entry(bond, &bond_dev_list, bond_list) { - /* - * This function locks the mutex, so we can't lock it until - * afterwards - */ - link = bond_check_mii_link(bond); + /* + * This function locks the mutex, so we can't lock it until + * afterwards + */ + link = bond_check_mii_link(bond); - len += sprintf(buf + len, "Bonding Mode: %s\n", - bond_mode_name()); + len += sprintf(buf + len, "Bonding Mode: %s\n", + bond_mode_name()); - if ((bond_mode == BOND_MODE_ACTIVEBACKUP) || - (bond_mode == BOND_MODE_TLB) || - (bond_mode == BOND_MODE_ALB)) { - read_lock_bh(&bond->lock); - read_lock(&bond->ptrlock); - if (bond->current_slave != NULL) { - len += sprintf(buf + len, - "Currently Active Slave: %s\n", - bond->current_slave->dev->name); - } - read_unlock(&bond->ptrlock); - read_unlock_bh(&bond->lock); + if ((bond_mode == BOND_MODE_ACTIVEBACKUP) || + (bond_mode == BOND_MODE_TLB) || + (bond_mode == BOND_MODE_ALB)) { + read_lock_bh(&bond->lock); + read_lock(&bond->ptrlock); + if (bond->current_slave != NULL) { + len += sprintf(buf + len, + "Currently Active Slave: %s\n", + bond->current_slave->dev->name); } + read_unlock(&bond->ptrlock); + read_unlock_bh(&bond->lock); + } - len += sprintf(buf + len, "MII Status: "); - len += sprintf(buf + len, - link == BMSR_LSTATUS ? "up\n" : "down\n"); - len += sprintf(buf + len, "MII Polling Interval (ms): %d\n", - miimon); - len += sprintf(buf + len, "Up Delay (ms): %d\n", - updelay * miimon); - len += sprintf(buf + len, "Down Delay (ms): %d\n", - downdelay * miimon); - len += sprintf(buf + len, "Multicast Mode: %s\n", - multicast_mode_name()); + len += sprintf(buf + len, "MII Status: "); + len += sprintf(buf + len, + link == BMSR_LSTATUS ? "up\n" : "down\n"); + len += sprintf(buf + len, "MII Polling Interval (ms): %d\n", + miimon); + len += sprintf(buf + len, "Up Delay (ms): %d\n", + updelay * miimon); + len += sprintf(buf + len, "Down Delay (ms): %d\n", + downdelay * miimon); + len += sprintf(buf + len, "Multicast Mode: %s\n", + multicast_mode_name()); - read_lock_bh(&bond->lock); + read_lock_bh(&bond->lock); - if (bond_mode == BOND_MODE_8023AD) { - struct ad_info ad_info; + if (bond_mode == BOND_MODE_8023AD) { + struct ad_info ad_info; - len += sprintf(buf + len, "\n802.3ad info\n"); + len += sprintf(buf + len, "\n802.3ad info\n"); - if (bond_3ad_get_active_agg_info(bond, &ad_info)) { - len += sprintf(buf + len, "bond %s has no active aggregator\n", bond->device->name); - } else { - len += sprintf(buf + len, "Active Aggregator Info:\n"); + if (bond_3ad_get_active_agg_info(bond, &ad_info)) { + len += sprintf(buf + len, "bond %s has no active aggregator\n", bond->device->name); + } else { + len += sprintf(buf + len, "Active Aggregator Info:\n"); - len += sprintf(buf + len, "\tAggregator ID: %d\n", ad_info.aggregator_id); - len += sprintf(buf + len, "\tNumber of ports: %d\n", ad_info.ports); - len += sprintf(buf + len, "\tActor Key: %d\n", ad_info.actor_key); - len += sprintf(buf + len, "\tPartner Key: %d\n", ad_info.partner_key); - len += sprintf(buf + len, "\tPartner Mac Address: %02x:%02x:%02x:%02x:%02x:%02x\n", - ad_info.partner_system[0], - ad_info.partner_system[1], - ad_info.partner_system[2], - ad_info.partner_system[3], - ad_info.partner_system[4], - ad_info.partner_system[5]); - } + len += sprintf(buf + len, "\tAggregator ID: %d\n", ad_info.aggregator_id); + len += sprintf(buf + len, "\tNumber of ports: %d\n", ad_info.ports); + len += sprintf(buf + len, "\tActor Key: %d\n", ad_info.actor_key); + len += sprintf(buf + len, "\tPartner Key: %d\n", ad_info.partner_key); + len += sprintf(buf + len, "\tPartner Mac Address: %02x:%02x:%02x:%02x:%02x:%02x\n", + ad_info.partner_system[0], + ad_info.partner_system[1], + ad_info.partner_system[2], + ad_info.partner_system[3], + ad_info.partner_system[4], + ad_info.partner_system[5]); } + } - for (slave = bond->prev; slave != (slave_t *)bond; - slave = slave->prev) { - len += sprintf(buf + len, "\nSlave Interface: %s\n", slave->dev->name); - - len += sprintf(buf + len, "MII Status: "); - - len += sprintf(buf + len, - slave->link == BOND_LINK_UP ? - "up\n" : "down\n"); - len += sprintf(buf + len, "Link Failure Count: %d\n", - slave->link_failure_count); - - if (app_abi_ver >= 1) { - len += sprintf(buf + len, - "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n", - slave->perm_hwaddr[0], - slave->perm_hwaddr[1], - slave->perm_hwaddr[2], - slave->perm_hwaddr[3], - slave->perm_hwaddr[4], - slave->perm_hwaddr[5]); - } + for (slave = bond->prev; slave != (slave_t *)bond; + slave = slave->prev) { + len += sprintf(buf + len, "\nSlave Interface: %s\n", slave->dev->name); - if (bond_mode == BOND_MODE_8023AD) { - struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; + len += sprintf(buf + len, "MII Status: "); - if (agg) { - len += sprintf(buf + len, "Aggregator ID: %d\n", - agg->aggregator_identifier); - } else { - len += sprintf(buf + len, "Aggregator ID: N/A\n"); - } - } - } - read_unlock_bh(&bond->lock); + len += sprintf(buf + len, + slave->link == BOND_LINK_UP ? + "up\n" : "down\n"); + len += sprintf(buf + len, "Link Failure Count: %d\n", + slave->link_failure_count); - /* - * Figure out the calcs for the /proc/net interface - */ - *start = buf + (offset - begin); - len -= (offset - begin); - if (len > length) { - len = length; + if (app_abi_ver >= 1) { + len += sprintf(buf + len, + "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n", + slave->perm_hwaddr[0], + slave->perm_hwaddr[1], + slave->perm_hwaddr[2], + slave->perm_hwaddr[3], + slave->perm_hwaddr[4], + slave->perm_hwaddr[5]); } - if (len < 0) { - len = 0; + + if (bond_mode == BOND_MODE_8023AD) { + struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; + + if (agg) { + len += sprintf(buf + len, "Aggregator ID: %d\n", + agg->aggregator_identifier); + } else { + len += sprintf(buf + len, "Aggregator ID: N/A\n"); + } } + } + read_unlock_bh(&bond->lock); + /* + * Figure out the calcs for the /proc/net interface + */ + if (len <= off + count) { + *eof = 1; } + *start = buf + off; + len -= off; + if (len > count) { + len = count; + } + if (len < 0) { + len = 0; + } + read_unlock(&dev_base_lock); return len; } +#endif /* CONFIG_PROC_FS */ static int bond_event(struct notifier_block *this, unsigned long event, void *ptr) @@ -3594,8 +3590,8 @@ static int __init bond_init(struct net_d bond->bond_proc_dir->owner = THIS_MODULE; bond->bond_proc_info_file = - create_proc_info_entry("info", 0, bond->bond_proc_dir, - bond_get_info); + create_proc_read_entry("info", 0, bond->bond_proc_dir, + bond_read_proc, bond); if (bond->bond_proc_info_file == NULL) { printk(KERN_ERR "%s: Cannot init /proc/net/%s/info\n", dev->name, dev->name); From amir.noam@intel.com Thu Sep 4 18:08:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:33 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWn014430 for ; Thu, 4 Sep 2003 18:08:56 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hfdg00770 for ; Thu, 4 Sep 2003 17:41:39 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HckL25253 for ; Thu, 4 Sep 2003 17:38:46 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410435422346 ; Thu, 04 Sep 2003 10:43:55 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Amir Noam Subject: [PATCH 1/10] [bonding 2.6] fix 802.3ad long fail over with high UDP Tx stress Date: Thu, 4 Sep 2003 20:43:53 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042043.53654.amir.noam@intel.com> X-MIME-Autoconverted: from 8bit to quoted-printable by hermes.hd.intel.com id h84Hfdg00770 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h8518jWn014430 X-archive-position: 5616 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c --- a/drivers/net/bonding/bond_3ad.c Thu Sep 4 20:17:51 2003 +++ b/drivers/net/bonding/bond_3ad.c Thu Sep 4 20:17:52 2003 @@ -37,6 +37,16 @@ * 2003/05/01 - Shmulik Hen * - Renamed bond_3ad_link_status_changed() to * bond_3ad_handle_link_change() for compatibility with TLB. + * + * 2003/05/20 - Amir Noam + * - Fix long fail over time when releasing last slave of an active + * aggregator - send LACPDU on unbind of slave to tell partner this + * port is no longer aggregatable. + * + * 2003/06/25 - Tsippy Mendelson + * - Send LACPDU as highest priority packet to further fix the above + * problem on very high Tx traffic load where packets may get dropped + * by the slave. */ #include @@ -45,6 +55,7 @@ #include #include #include +#include #include "bonding.h" #include "bond_3ad.h" @@ -905,6 +916,7 @@ static int ad_lacpdu_send(struct port *p skb->mac.raw = skb->data; skb->nh.raw = skb->data + ETH_HLEN; skb->protocol = PKT_TYPE_LACPDU; + skb->priority = TC_PRIO_CONTROL; lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); diff -Nuarp a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h --- a/drivers/net/bonding/bond_3ad.h Thu Sep 4 20:17:51 2003 +++ b/drivers/net/bonding/bond_3ad.h Thu Sep 4 20:17:52 2003 @@ -165,7 +165,7 @@ typedef struct marker { // = 0x02 (marker response information) u8 marker_length; // = 0x16 u16 requester_port; // The number assigned to the port by the requester - struct mac_addr requester_system; // The requester’s system id + struct mac_addr requester_system; // The requester's system id u32 requester_transaction_id; // The transaction id allocated by the requester, u16 pad; // = 0 u8 tlv_type_terminator; // = 0x00 From amir.noam@intel.com Thu Sep 4 18:08:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 18:09:33 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8518jWr014430 for ; Thu, 4 Sep 2003 18:08:58 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.82 2003/09/04 16:03:37 rfjohns1 Exp $) with ESMTP id h84Hhcg02153 for ; Thu, 4 Sep 2003 17:43:38 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h84HejL26575 for ; Thu, 4 Sep 2003 17:40:45 GMT Received: from jrslxjul4.npdj.intel.com ([10.12.254.188]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090410455302787 ; Thu, 04 Sep 2003 10:45:54 -0700 Content-Type: text/plain; charset="us-ascii" From: Amir Noam Subject: [PATCH 10/10] [bonding 2.6] misc fixes: missing include, typos, comments Date: Thu, 4 Sep 2003 20:45:53 +0300 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Message-Id: <200309042045.53223.amir.noam@intel.com> X-archive-position: 5615 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: amir.noam@intel.com Precedence: bulk X-list: netdev diff -Nuarp a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c --- a/Documentation/networking/ifenslave.c Thu Sep 4 20:18:16 2003 +++ b/Documentation/networking/ifenslave.c Thu Sep 4 20:18:17 2003 @@ -140,6 +140,7 @@ static const char *howto_msg = #include #include #include +#include #include #include #include diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:16 2003 +++ b/drivers/net/bonding/bond_main.c Thu Sep 4 20:18:17 2003 @@ -278,7 +278,7 @@ * bonding round-robin mode ignoring links after failover/recovery * * 2003/03/17 - Jay Vosburgh - * - kmalloc fix (GPF_KERNEL to GPF_ATOMIC) reported by + * - kmalloc fix (GFP_KERNEL to GFP_ATOMIC) reported by * Shmulik dot Hen at intel.com. * - Based on discussion on mailing list, changed use of * update_slave_cnt(), created wrapper functions for adding/removing @@ -323,22 +323,22 @@ * 2003/03/18 - Amir Noam , * Tsippy Mendelson and * Shmulik Hen - * - Added support for IEEE 802.3ad Dynamic link aggregation mode. + * - Added support for IEEE 802.3ad Dynamic link aggregation mode. * * 2003/05/01 - Amir Noam - * - Added ABI version control to restore compatibility between - * new/old ifenslave and new/old bonding. + * - Added ABI version control to restore compatibility between + * new/old ifenslave and new/old bonding. * * 2003/05/01 - Shmulik Hen - * - Fixed bug in bond_release_all(): save old value of current_slave - * before setting it to NULL. - * - Changed driver versioning scheme to include version number instead - * of release date (that is already in another field). There are 3 - * fields X.Y.Z where: - * X - Major version - big behavior changes - * Y - Minor version - addition of features - * Z - Extra version - minor changes and bug fixes - * The current version is 1.0.0 as a base line. + * - Fixed bug in bond_release_all(): save old value of current_slave + * before setting it to NULL. + * - Changed driver versioning scheme to include version number instead + * of release date (that is already in another field). There are 3 + * fields X.Y.Z where: + * X - Major version - big behavior changes + * Y - Minor version - addition of features + * Z - Extra version - minor changes and bug fixes + * The current version is 1.0.0 as a base line. * * 2003/05/01 - Tsippy Mendelson and * Amir Noam @@ -371,6 +371,43 @@ * - Added support for Adaptive load balancing mode which is * equivalent to Transmit load balancing + Receive load balancing. * new version - 2.2.0 + * + * 2003/05/15 - Jay Vosburgh + * - Applied fix to activebackup_arp_monitor posted to bonding-devel + * by Tony Cureington . Fixes ARP + * monitor endless failover bug. Version to 2.2.10 + * + * 2003/05/20 - Amir Noam + * - Fixed bug in ABI version control - Don't commit to a specific + * ABI version if receiving unsupported ioctl commands. + * + * 2003/05/22 - Jay Vosburgh + * - Fix ifenslave -c causing bond to loose existing routes; + * added bond_set_mac_address() that doesn't require the + * bond to be down. + * - In conjunction with fix for ifenslave -c, in + * bond_change_active(), changing to the already active slave + * is no longer an error (it successfully does nothing). + * + * 2003/06/30 - Amir Noam + * - Fixed bond_change_active() for ALB/TLB modes. + * Version to 2.2.14. + * + * 2003/07/29 - Amir Noam + * - Fixed ARP monitoring bug. + * Version to 2.2.15. + * + * 2003/07/31 - Willy Tarreau + * - Fixed kernel panic when using ARP monitoring without + * setting bond's IP address. + * Version to 2.2.16. + * + * 2003/08/06 - Amir Noam + * - Back port from 2.6: use alloc_netdev(); fix /proc handling; + * made stats a part of bond struct so no need to allocate + * and free it separately; use standard list operations instead + * of pre-allocated array of bonds. + * Version to 2.3.0. */ #include @@ -415,10 +452,10 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.2.0" -#define DRV_RELDATE "April 15, 2003" -#define DRV_NAME "bonding" -#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" +#define DRV_VERSION "2.3.0" +#define DRV_RELDATE "August 6, 2003" +#define DRV_NAME "bonding" +#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" static const char *version = DRV_NAME ".c:v" DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -474,8 +511,8 @@ static struct bond_parm_tbl bond_mode_tb { "balance-xor", BOND_MODE_XOR}, { "broadcast", BOND_MODE_BROADCAST}, { "802.3ad", BOND_MODE_8023AD}, -{ "tlb", BOND_MODE_TLB}, -{ "alb", BOND_MODE_ALB}, +{ "balance-tlb", BOND_MODE_TLB}, +{ "balance-alb", BOND_MODE_ALB}, { NULL, -1}, }; @@ -505,7 +542,7 @@ MODULE_PARM_DESC(max_bonds, "Max number MODULE_PARM(miimon, "i"); MODULE_PARM_DESC(miimon, "Link check interval in milliseconds"); MODULE_PARM(use_carrier, "i"); -MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; 09 for off, 1 for on (default)"); +MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default)"); MODULE_PARM(mode, "s"); MODULE_PARM_DESC(mode, "Mode of operation : 0 for round robin, 1 for active-backup, 2 for xor"); MODULE_PARM(arp_interval, "i"); @@ -2988,7 +3025,7 @@ static int bond_ioctl(struct net_device } else if (orig_app_abi_ver != app_abi_ver) { printk(KERN_ERR "bonding: Error: already using ifenslave ABI " - "version %d; to upgrade ifenslave to version %d," + "version %d; to upgrade ifenslave to version %d, " "you must first reload bonding.\n", orig_app_abi_ver, app_abi_ver); return -EINVAL; @@ -3601,8 +3638,8 @@ static int __init bond_init(struct net_d bond->bond_proc_info_file->owner = THIS_MODULE; #endif /* CONFIG_PROC_FS */ - list_add_tail(&bond->bond_list, &bond_dev_list); + return 0; } From akpm@osdl.org Thu Sep 4 23:26:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 23:27:00 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h856QPx4002031 for ; Thu, 4 Sep 2003 23:26:26 -0700 Received: from mnm (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h856QJo05158 for ; Thu, 4 Sep 2003 23:26:19 -0700 Date: Thu, 4 Sep 2003 23:27:13 -0700 From: Andrew Morton To: netdev@oss.sgi.com Subject: Fw: [PATCH] pktgen divides by zero on short runs Message-Id: <20030904232713.7dd4e99f.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5618 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Begin forwarded message: Date: Fri, 5 Sep 2003 01:40:27 -0400 (EDT) From: Najati Imam To: linux-kernel@vger.kernel.org Subject: [PATCH] pktgen divides by zero on short runs On very short runs when computing the packets per second the time that is used can be zero. For small packets this can happen with as many as 100, maybe more, packets. The patch below checks the denominator before dividing and if it is zero puts a notice in the results output that explains why pbs, bps and mbps are all zero, like so Result: OK: 10(c10+d0) usec, 1 (64byte,0frags) 0pps 0Mb/sec (0bps) \ (Time too short to measure) errors: 0 Hope this hasn't already been addressed (it was present in 2.6.0-test4, which is what I generated the patch from), also this is my first submission, so if I did it all wrong, I will accept the appropriate punishment. Najati Imam diff -urN linux-2.6.0-test4/net/core/pktgen.c linux-2.6.0-test4-nri/net/core/pktgen.c --- linux-2.6.0-test4/net/core/pktgen.c 2003-08-22 19:57:49.000000000 -0400 +++ linux-2.6.0-test4-nri/net/core/pktgen.c 2003-09-05 01:15:20.000000000 -0400 @@ -50,6 +50,9 @@ * Fix refcount off by one if first packet fails, potential null deref, * memleak 030710- KJP * + * Check for potential div by zero in the event of a really short send time + * 030905 NRI + * * See Documentation/networking/pktgen.txt for how to use this. */ @@ -720,9 +723,10 @@ { char *p = info->result; - __u64 pps = (__u32)(info->sofar * 1000) / ((__u32)(total) / 1000); + __u32 tt = ((__u32)(total) / 1000); + __u64 pps = (tt) ? (__u32)(info->sofar * 1000) / ((__u32)(total) / 1000) : 0; __u64 bps = pps * 8 * (info->pkt_size + 4); /* take 32bit ethernet CRC into account */ - p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) errors: %llu", + p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) %s errors: %llu", (unsigned long long) total, (unsigned long long) (total - idle), (unsigned long long) idle, @@ -732,6 +736,7 @@ (unsigned long long) pps, (unsigned long long) (bps / (u64) 1024 / (u64) 1024), (unsigned long long) bps, + (tt) ? "" : "(Time too short to measure)", (unsigned long long) info->errors ); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ From davem@pizda.ninka.net Thu Sep 4 23:52:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Sep 2003 23:52:36 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h856pxx4008068 for ; Thu, 4 Sep 2003 23:52:00 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id WAA21778; Thu, 4 Sep 2003 22:58:23 -0700 Date: Thu, 4 Sep 2003 22:58:23 -0700 From: "David S. Miller" To: Andi Kleen Cc: levon@movementarian.org, netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030904225823.68a7b7cd.davem@redhat.com> In-Reply-To: <20030905010725.5ee10cbf.ak@suse.de> References: <20030904145204.GA27953@compsoc.man.ac.uk> <20030904074520.5dceff3e.davem@redhat.com> <20030905010725.5ee10cbf.ak@suse.de> X-Mailer: Sylpheed version 0.9.2 (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: 5619 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 Sep 2003 01:07:25 +0200 Andi Kleen wrote: > When you're doing janitor type stuff currently I would also suggest > an update of the NET4 version numbers: I don't think we need to print all this crap out at all. The only reason I really kept it in there was to keep giving credit to the Swansea Computer Society, but Alan indicated that that isn't necessary any more. Really, if someone says they're running kernel x.y.z we know what networking code they're running :) From hch@infradead.org Fri Sep 5 00:11:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 00:12:11 -0700 (PDT) Received: from phoenix.infradead.org (pub234.cambridge.redhat.com [213.86.99.234] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h857Bbx4011390 for ; Fri, 5 Sep 2003 00:11:37 -0700 Received: from hch by phoenix.infradead.org with local (Exim 4.22) id 19v9jf-0003ew-6R; Fri, 05 Sep 2003 07:06:19 +0100 Date: Fri, 5 Sep 2003 07:06:19 +0100 From: Christoph Hellwig To: Stephen Hemminger Cc: "David S. Miller" , mike.mclagan@linux.org, Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH] (2/8) convert sdla to new initialization Message-ID: <20030905070619.A13947@infradead.org> References: <20030903164925.5c44ce73.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: <20030903164925.5c44ce73.shemminger@osdl.org>; from shemminger@osdl.org on Wed, Sep 03, 2003 at 04:49:25PM -0700 X-archive-position: 5620 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 Wed, Sep 03, 2003 at 04:49:25PM -0700, Stephen Hemminger wrote: > extern int mac8390_probe(struct net_device *dev); > extern int mac89x0_probe(struct net_device *dev); > extern int mc32_probe(struct net_device *dev); > +#ifdef CONFIG_SDLA > +extern struct net_device *sdla_init(void); > +#endif Please don't add ifdefs around prototypes. From davem@pizda.ninka.net Fri Sep 5 01:26:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 01:27:25 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h858Qhx4028597 for ; Fri, 5 Sep 2003 01:26:44 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id BAA22061; Fri, 5 Sep 2003 01:16:56 -0700 Date: Fri, 5 Sep 2003 01:16:56 -0700 From: "David S. Miller" To: Andrew Morton Cc: netdev@oss.sgi.com Subject: Re: Fw: [PATCH] pktgen divides by zero on short runs Message-Id: <20030905011656.26ac1133.davem@redhat.com> In-Reply-To: <20030904232713.7dd4e99f.akpm@osdl.org> References: <20030904232713.7dd4e99f.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5621 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 Andrew, I'm starting to think it's actually your mailer that's changing the tabs to spaces when you forward other people's patches to me or the networking lists. Every forwarded patch you've sent to me or to netdev has had this problem. Can you make the forwarded emails be attachments or similar? I thought sylpheed did that by default :) From jgarzik@pobox.com Fri Sep 5 01:36:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 01:36:55 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h858aGx4001067 for ; Fri, 5 Sep 2003 01:36:17 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:36276 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19vC4j-00014Y-Kq; Fri, 05 Sep 2003 09:36:14 +0100 Message-ID: <3F584AE6.7070806@pobox.com> Date: Fri, 05 Sep 2003 04:35:50 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Amir Noam CC: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com Subject: Re: [PATCH 0/10] [bonding 2.6] port 2.4 bug fixes to 2.6 References: <200309042043.25567.amir.noam@intel.com> In-Reply-To: <200309042043.25567.amir.noam@intel.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5622 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 Amir Noam wrote: > The following set ports to 2.6 numerous bug fixes that went into > 2.4 recently. Patches apply on 2.6.0-test4. Compile tested only. > > patch1: fix 802.3ad long fail over with high UDP Tx stress > patch2: fix load balance problem with high UDP Tx stress > patch3: fix ARP monitoring bug > patch4: fix kernel panic when optional feature used > patch5: fix change active command > patch6: fix OOPS in bonding driver, when removing primary > patch7: embed stats struct inside bonding private struct > patch8: fix error handling in init code > patch9: make each bond device use its own /proc entry > patch10: misc fixes: missing include, typos, comments Thanks! Looking over and will (probably) apply... Jeff From akpm@osdl.org Fri Sep 5 02:10:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:10:59 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859AJx4009237 for ; Fri, 5 Sep 2003 02:10:20 -0700 Received: from mnm (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h859A6o01736; Fri, 5 Sep 2003 02:10:06 -0700 Date: Fri, 5 Sep 2003 02:11:01 -0700 From: Andrew Morton To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: Fw: [PATCH] pktgen divides by zero on short runs Message-Id: <20030905021101.6e8b409c.akpm@osdl.org> In-Reply-To: <20030905011656.26ac1133.davem@redhat.com> References: <20030904232713.7dd4e99f.akpm@osdl.org> <20030905011656.26ac1133.davem@redhat.com> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5623 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev "David S. Miller" wrote: > > > Andrew, I'm starting to think it's actually your mailer > that's changing the tabs to spaces when you forward other > people's patches to me or the networking lists. Nope, Najati's patch on lkml is all-spaces. > Every forwarded patch you've sent to me or to netdev has > had this problem. Can you make the forwarded emails > be attachments or similar? I thought sylpheed did that > by default :) I think it's OK... From mlindner@syskonnect.de Fri Sep 5 02:26:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:26:34 -0700 (PDT) Received: from gatekeeper.syskonnect.de (13.telemaxx.net [213.144.13.149] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859Pwx4018066 for ; Fri, 5 Sep 2003 02:25:59 -0700 Received: from syskonnect.de (spock [10.9.15.1]) by gatekeeper.syskonnect.de (8.12.9/8.12.9) with ESMTP id h859Q01t007495; Fri, 5 Sep 2003 11:26:01 +0200 (MET DST) Received: from mlindner-lin.skd.de (localhost [127.0.0.1]) by syskonnect.de (8.12.9/8.12.9) with ESMTP id h859Pqr7026584; Fri, 5 Sep 2003 11:25:52 +0200 (MET DST) X-Authentication-Warning: spock.skd.de: iscan owned process doing -bs Subject: Re: [RFT] simplify skge /proc interface. From: Mirko Lindner To: Stephen Hemminger Cc: Jeff Garzik , Ralph Roesler , netdev@oss.sgi.com In-Reply-To: <20030904160658.5ae22c0d.shemminger@osdl.org> References: <20030904160658.5ae22c0d.shemminger@osdl.org> Content-Type: text/plain; charset=UTF-8 Organization: Message-Id: <1220606764.18887.129.camel@mlindner-lin> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 05 Sep 2008 11:26:04 +0200 X-MIME-Autoconverted: from 8bit to quoted-printable by gatekeeper.syskonnect.de id h859Q01t007495 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h859Pwx4018066 X-archive-position: 5624 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mlindner@syskonnect.de Precedence: bulk X-list: netdev Thank you for the submission, the latest driver version 6.17 (still by Linus) has a lot of proc-changes. I´ll insert the remaining changes into our tree and make a new release next week. Cheers, Mirko On Fri, 2003-09-05 at 01:06, Stephen Hemminger wrote: > This patch is against 2.6.0-test4 and simplifys the /proc interface for > the skge driver. > > * Use seq_file single_open interface to avoid possible buffer over > run and formatting issues. > * Put pointer to device in the proc dir private data to avoid having > to search through devices to find the info. > * Use %lld rather than special formatting code > * use proc_mkdir > * Don't die if proc fs is not configured or creating entries fails. > > New code is written in kernel style. > > Builds and loads but don't have real hardware. Could someone > please test this with a real board? > > Somewhere in this 8K line driver is a 1000 line driver waiting to get out... > From davem@pizda.ninka.net Fri Sep 5 02:36:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:36:43 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859a8x4022210 for ; Fri, 5 Sep 2003 02:36:09 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22235; Fri, 5 Sep 2003 02:26:19 -0700 Date: Fri, 5 Sep 2003 02:26:19 -0700 From: "David S. Miller" To: Andi Kleen Cc: netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030905022619.1283a64e.davem@redhat.com> In-Reply-To: <20030905112242.2ad1a358.ak@suse.de> References: <20030904145204.GA27953@compsoc.man.ac.uk> <20030904074520.5dceff3e.davem@redhat.com> <20030905010725.5ee10cbf.ak@suse.de> <20030904225823.68a7b7cd.davem@redhat.com> <20030905112242.2ad1a358.ak@suse.de> X-Mailer: Sylpheed version 0.9.2 (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: 5625 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 Sep 2003 11:22:42 +0200 Andi Kleen wrote: > Are you doing it or should I send a patch? I'll take care of this and add a /proc/net/protocols or somesuch. From davem@pizda.ninka.net Fri Sep 5 02:46:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:46:39 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859k5x4028972 for ; Fri, 5 Sep 2003 02:46:06 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22287; Fri, 5 Sep 2003 02:35:36 -0700 Date: Fri, 5 Sep 2003 02:35:36 -0700 From: "David S. Miller" To: chas3@users.sourceforge.net Cc: chas@cmf.nrl.navy.mil, netdev@oss.sgi.com, levon@movementarian.org Subject: Re: [PATCH][ATM] a few patches from John Levon Message-Id: <20030905023536.68e808e7.davem@redhat.com> In-Reply-To: <200309041917.h84JHrSa020864@ginger.cmf.nrl.navy.mil> References: <200309041917.h84JHrSa020864@ginger.cmf.nrl.navy.mil> X-Mailer: Sylpheed version 0.9.2 (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: 5626 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, 04 Sep 2003 15:17:55 -0400 chas williams wrote: All applied, although: > # [ATM]: fix atm_dev module refcount bug (from levon@movementarian.org) You included this patch twice :-) Thanks. From davem@pizda.ninka.net Fri Sep 5 02:53:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:54:07 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859rXx4032626 for ; Fri, 5 Sep 2003 02:53:33 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22343; Fri, 5 Sep 2003 02:43:45 -0700 Date: Fri, 5 Sep 2003 02:43:45 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: bunk@fs.tum.de, jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] fix cosa to get rid of warnings and build on SMP Message-Id: <20030905024345.77bd6953.davem@redhat.com> In-Reply-To: <20030904142828.14218966.shemminger@osdl.org> References: <20030903173417.GC18025@fs.tum.de> <20030904142828.14218966.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5627 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 Sep 2003 14:28:28 -0700 Stephen Hemminger wrote: > * get rid of leftover sti > * no longer need MOD_INC/DEC stuff > * get rid of dead code related to MOD_INC/DEC > * use module_init/module_exit to cleanly run init code Applied, thanks. From davem@pizda.ninka.net Fri Sep 5 02:56:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:56:43 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859u9x4001689 for ; Fri, 5 Sep 2003 02:56:09 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22375; Fri, 5 Sep 2003 02:46:22 -0700 Date: Fri, 5 Sep 2003 02:46:22 -0700 From: "David S. Miller" To: Stephen Hemminger Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] more sdla fixes Message-Id: <20030905024622.19c87878.davem@redhat.com> In-Reply-To: <20030904144248.0599cdaf.shemminger@osdl.org> References: <20030904144248.0599cdaf.shemminger@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5628 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 Sep 2003 14:42:48 -0700 Stephen Hemminger wrote: > Since sdla.c now has locking instead of cli/sti, it shouldn't be > completely busted on SMP. > > Also, the frad interface registration needed to be done once > (and check the result), and undone on module unload. Looks good, applied. From davem@pizda.ninka.net Fri Sep 5 02:57:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:57:42 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859vUx4002508 for ; Fri, 5 Sep 2003 02:57:31 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22402; Fri, 5 Sep 2003 02:47:36 -0700 Date: Fri, 5 Sep 2003 02:47:36 -0700 From: "David S. Miller" To: Dennis =?ISO-8859-1?Q?J=F8rgensen?= Cc: netdev@oss.sgi.com Subject: Re: Trivial fix for wrong error message from icmp.c (2.6.0-test4) Message-Id: <20030905024736.4acefe68.davem@redhat.com> In-Reply-To: <3F5686C2.6090600@q.nospam.kampsax.k-net.dk> References: <3F5686C2.6090600@q.nospam.kampsax.k-net.dk> X-Mailer: Sylpheed version 0.9.2 (GTK+ 1.2.6; sparc-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h859vUx4002508 X-archive-position: 5629 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, 04 Sep 2003 02:26:42 +0200 Dennis Jørgensen wrote: > Should I post this somewhere else/to someone else, please let me know, I > couldn't find a FAQ for the list. You're posting it to the correct place, but your patch does not apply because your mail client has turned all the tabs in the patch into spaces. I can't apply this patch until you fix that up. From davem@pizda.ninka.net Fri Sep 5 02:59:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 02:59:39 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h859x0x4003635 for ; Fri, 5 Sep 2003 02:59:00 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22424; Fri, 5 Sep 2003 02:49:12 -0700 Date: Fri, 5 Sep 2003 02:49:12 -0700 From: "David S. Miller" To: Sridhar Samudrala Cc: netdev@oss.sgi.com Subject: Re: [BK PATCH] SCTP updates. Message-Id: <20030905024912.3c63fd04.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5630 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 Sep 2003 15:55:27 -0700 (PDT) Sridhar Samudrala wrote: > Please do a > bk pull http://linux-lksctp.bkbits.net/lksctp-2.5 > to get the following updates to SCTP on top of linux 2.6.0-test4 Looks good, pulled thanks. From davem@pizda.ninka.net Fri Sep 5 03:00:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 03:01:11 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85A0Wx4004631 for ; Fri, 5 Sep 2003 03:00:32 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22438; Fri, 5 Sep 2003 02:50:42 -0700 Date: Fri, 5 Sep 2003 02:50:42 -0700 From: "David S. Miller" To: Christoph Hellwig Cc: shemminger@osdl.org, mike.mclagan@linux.org, jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] (2/8) convert sdla to new initialization Message-Id: <20030905025042.2ff7939d.davem@redhat.com> In-Reply-To: <20030905070619.A13947@infradead.org> References: <20030903164925.5c44ce73.shemminger@osdl.org> <20030905070619.A13947@infradead.org> X-Mailer: Sylpheed version 0.9.2 (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: 5631 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 Sep 2003 07:06:19 +0100 Christoph Hellwig wrote: > On Wed, Sep 03, 2003 at 04:49:25PM -0700, Stephen Hemminger wrote: > > extern int mac8390_probe(struct net_device *dev); > > extern int mac89x0_probe(struct net_device *dev); > > extern int mc32_probe(struct net_device *dev); > > +#ifdef CONFIG_SDLA > > +extern struct net_device *sdla_init(void); > > +#endif > > Please don't add ifdefs around prototypes. I fixed this all up. From davem@pizda.ninka.net Fri Sep 5 03:01:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 03:02:10 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85A1bx4005218 for ; Fri, 5 Sep 2003 03:01:37 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22452; Fri, 5 Sep 2003 02:51:47 -0700 Date: Fri, 5 Sep 2003 02:51:47 -0700 From: "David S. Miller" To: Andrew Morton Cc: netdev@oss.sgi.com Subject: Re: Fw: [PATCH] pktgen divides by zero on short runs Message-Id: <20030905025147.0a56d4d5.davem@redhat.com> In-Reply-To: <20030905021101.6e8b409c.akpm@osdl.org> References: <20030904232713.7dd4e99f.akpm@osdl.org> <20030905011656.26ac1133.davem@redhat.com> <20030905021101.6e8b409c.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.2 (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: 5632 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 Sep 2003 02:11:01 -0700 Andrew Morton wrote: > Nope, Najati's patch on lkml is all-spaces. Ok, please tell him to fix his mailer so I can apply the patches he submits. You can also tell him to send such patches to netdev and then you'll never have to forward patches for him again :) From davem@pizda.ninka.net Fri Sep 5 03:05:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 03:06:23 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85A5cx4007408 for ; Fri, 5 Sep 2003 03:05:39 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id CAA22489; Fri, 5 Sep 2003 02:55:46 -0700 Date: Fri, 5 Sep 2003 02:55:46 -0700 From: "David S. Miller" To: John Levon Cc: chas3@users.sourceforge.net, chas@cmf.nrl.navy.mil, netdev@oss.sgi.com Subject: Re: [PATCH][ATM] a few patches from John Levon Message-Id: <20030905025546.77505271.davem@redhat.com> In-Reply-To: <20030905095539.GD38861@compsoc.man.ac.uk> References: <200309041917.h84JHrSa020864@ginger.cmf.nrl.navy.mil> <20030905023536.68e808e7.davem@redhat.com> <20030905095539.GD38861@compsoc.man.ac.uk> X-Mailer: Sylpheed version 0.9.2 (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: 5633 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 Sep 2003 10:55:39 +0100 John Levon wrote: > Hmm, then I think you're missing patch 5 : Looks good to me, applied. From ak@suse.de Fri Sep 5 03:31:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 03:32:25 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [195.135.220.2]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85AVcx4019847 for ; Fri, 5 Sep 2003 03:31:39 -0700 Received: from Hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id B452115B387B; Fri, 5 Sep 2003 11:22:44 +0200 (CEST) Date: Fri, 5 Sep 2003 11:22:42 +0200 From: Andi Kleen To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] remove net/README Message-Id: <20030905112242.2ad1a358.ak@suse.de> In-Reply-To: <20030904225823.68a7b7cd.davem@redhat.com> References: <20030904145204.GA27953@compsoc.man.ac.uk> <20030904074520.5dceff3e.davem@redhat.com> <20030905010725.5ee10cbf.ak@suse.de> <20030904225823.68a7b7cd.davem@redhat.com> X-Mailer: Sylpheed version 0.8.9 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5634 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@suse.de Precedence: bulk X-list: netdev On Thu, 4 Sep 2003 22:58:23 -0700 "David S. Miller" wrote: > On Fri, 5 Sep 2003 01:07:25 +0200 > Andi Kleen wrote: > > > When you're doing janitor type stuff currently I would also suggest > > an update of the NET4 version numbers: > > I don't think we need to print all this crap out at all. Makes sense. Especially since the version numbers tended to be stale traditionally. I would keep at least one printk for high level networking so that we know it has started (useful to get some clue where we are on a total hang) One small disadvantage when e.g. the appletalk or ipx printks are killed is that you cannot check if the user has compiled them in or loaded. But that's probably tolerable. If it should be a problem a /proc/net/protocols would be probably a better solution. Are you doing it or should I send a patch? -Andi From ams@wiw.org Fri Sep 5 03:46:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 03:47:23 -0700 (PDT) Received: from miranda.org (IDENT:qmailr@miranda.org [209.58.150.153]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85Aknx4027924 for ; Fri, 5 Sep 2003 03:46:50 -0700 Received: (qmail 25269 invoked from network); 5 Sep 2003 10:46:44 -0000 Received: from miranda.org (HELO lustre.dyn.wiw.org) (ams@209.58.150.153) by miranda.org with SMTP; 5 Sep 2003 10:46:44 -0000 Received: from ams by lustre.dyn.wiw.org with local (Exim 4.20) id 19vE70-0007kZ-3p; Fri, 05 Sep 2003 16:16:42 +0530 Date: Fri, 5 Sep 2003 16:16:42 +0530 From: Abhijit Menon-Sen To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: how is recv(..., MSG_PEEK) racy? Message-ID: <20030905161642.A29720@lustre.dyn.wiw.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-archive-position: 5635 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ams@wiw.org Precedence: bulk X-list: netdev (I posted this To: netdev twice, but it didn't show up, even though I am receiving other posts from the list. I apologise if anyone gets multiple copies of this message.) I'm trying to understand a fetchmail problem that causes large downloads from IMAP servers to fail randomly. For some reason, fetchmail uses the following bizarre code inside a loop to read data from the server: if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0) return (-1); if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; if ((n = read(sock, bp, n)) == -1) return (-1); The problem occurs (at an unpredictable time, but very often, and with a greater probability with a larger attachment) when the recv() returns 0, although tcpdump doesn't show the server closing the connection, or any other unusual behaviour. Are there any circumstances other than the connection being closed where recv(..., MSG_PEEK) can return 0? (Stevens/SUSv3 don't mention any.) I found the following (paraphrased) comment in net/ipv4/tcp.c: if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) { printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n", current->comm, current->pid); While fetchmail doesn't seem to be triggering that printk(), I'm curious about what the race condition is. Google found a post by DaveM saying it has something to do with URG data, but without any further details. I'd appreciate any explanation of the problem(s). Thank you. -- ams From hadi@cyberus.ca Fri Sep 5 05:01:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 05:01:54 -0700 (PDT) Received: from mail.cyberus.ca (mail.cyberus.ca [209.195.118.111]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85C1Ix4028242 for ; Fri, 5 Sep 2003 05:01:19 -0700 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.12) id 19vFH1-000ItN-00; Fri, 05 Sep 2003 08:01:07 -0400 Subject: Re: 2.6.0-test4, 2.5.47, child qdiscs, parent not filled out? From: jamal Reply-To: hadi@cyberus.ca To: devik Cc: bert hubert , netdev@oss.sgi.com In-Reply-To: References: Content-Type: text/plain Organization: jamalopolis Message-Id: <1062763235.1459.14.camel@jzny.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 05 Sep 2003 08:00:36 -0400 Content-Transfer-Encoding: 7bit X-archive-position: 5636 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 olla, Actually HTB does seem to be missing something; havent looked at the code - just looking at a black box perspective. Try a very simple test: Add a root CBQ qdisc and watch the netlink messages produced. Observe CBQ creating both a root qdisc and class where the children will be attached. Repeat same test for HTB - it doesnt create the top class. I believe it is needed. Sorry too tied up elsewhere to help right now. cheers, jamal On Wed, 2003-09-03 at 17:01, devik wrote: > > Devik (I hope we can be friends again :-)), others, > > yep I think so :-) > > > If I create a cbq with several classes, and attach a qdisc to those classes, > > a later netlink dump (RTM_GETQDISCS) returns parent as 0:0 for that qdisc, > > is this right? > > structure Qdisc has DEPRECATED field __parent pointing to parent > qdisc (aparently CBQ needs it). > There is no other "parent" info in the struct so it can't be returned > IMHO. > You will have to parse all clases from root to leaves. > > Maybe we could add parent handle to qdisc but it is question to > Alexey probably - I'm not sure how complex would it be to keep > the field in sync ... > > devik > > > From stuge-vlan@cdy.org Fri Sep 5 05:08:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 05:09:04 -0700 (PDT) Received: from foo.birdnet.se (qmailr@foo.birdnet.se [213.88.146.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85C8Sx4031377 for ; Fri, 5 Sep 2003 05:08:29 -0700 Received: (qmail 19985 invoked by uid 501); 5 Sep 2003 11:42:14 -0000 Date: Fri, 5 Sep 2003 13:42:14 +0200 From: Peter Stuge To: Bart De Schuymer Cc: "David S.Miller" , netdev@oss.sgi.com, vlan@wanfear.com Subject: Re: [VLAN] Re: [PATCH/RFC] disallow vlan devices on top of a logical bridge device Message-ID: <20030905114214.GC17851@foo.birdnet.se> Mail-Followup-To: Bart De Schuymer , "David S.Miller" , netdev@oss.sgi.com, vlan@wanfear.com References: <200308301504.03241.bdschuym@pandora.be> <3F50FF0E.9020004@candelatech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F50FF0E.9020004@candelatech.com> X-archive-position: 5637 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: stuge-vlan@cdy.org Precedence: bulk X-list: netdev On Sat, Aug 30, 2003 at 12:46:22PM -0700, Ben Greear wrote: > Bart De Schuymer wrote: > >The patch below disables making vlan devices on top of bridge > >devices, f.e. br0.12 would be impossible. > >I'm no vlan expert, but I don't see the use for this and allowing it > >will make the bridge-nf code hairy if we want to let {ip,arp}tables see > >{IP,ARP} traffic that is embedded in a vlan header. I think being able to make a br0.12 is a very good thing, but if it isn't working properly all the way through *tables, I'd say it's better to take the possibility away. When someone needs br0.12 bad enough she or he can deal with the bridge-nf code as well. > >Also, situations like eth0.15 being a bridge port of br0.16 seem > >unwanted (to me). Not neccessarily, since Linux can be connected to multiple "VLAN domains" (is there a proper term for it?) - that is, all of the VLANs on one interface could be completely separate from all VLANs on another interface, making eth0.15 a bridge port of br0.16 only logical. Admittedly large setups, though. > However, I'm forwarding this to the vlan mailing list, as I know there > are folks there who use vlans and bridging a lot.... For those who > care, please speak up if you need this functionality for some reason... If {i,ar}ptables doesn't deal with VLANs on bridge ports there's no point in keeping it, IMHO. //Peter From chas@cmf.nrl.navy.mil Fri Sep 5 05:41:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 05:42:27 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85Cfox4018841 for ; Fri, 5 Sep 2003 05:41:51 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h85CePSa005097; Fri, 5 Sep 2003 08:40:25 -0400 (EDT) Message-Id: <200309051240.h85CePSa005097@ginger.cmf.nrl.navy.mil> To: "David S. Miller" cc: John Levon , netdev@oss.sgi.com Reply-To: chas3@users.sourceforge.net Subject: Re: [PATCH][ATM] a few patches from John Levon In-reply-to: Your message of "Fri, 05 Sep 2003 02:55:46 PDT." <20030905025546.77505271.davem@redhat.com> Date: Fri, 05 Sep 2003 08:40:26 -0400 From: chas williams X-Spam-Score: () hits=-0.9 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5638 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev In message <20030905025546.77505271.davem@redhat.com>,"David S. Miller" writes: >On Fri, 5 Sep 2003 10:55:39 +0100 >John Levon wrote: >> Hmm, then I think you're missing patch 5 : >Looks good to me, applied. yes, i apparently included the wrong file. sorry about that and thanks for resending it! From chas@cmf.nrl.navy.mil Fri Sep 5 05:52:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 05:52:40 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85CqZx4019721 for ; Fri, 5 Sep 2003 05:52:36 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h85CqKSa005300; Fri, 5 Sep 2003 08:52:20 -0400 (EDT) Message-Id: <200309051252.h85CqKSa005300@ginger.cmf.nrl.navy.mil> To: davem@redhat.com, John Levon cc: linux-atm-general@lists.sourceforge.net, netdev@oss.sgi.com Reply-To: chas3@users.sourceforge.net Reply-To: chas3@users.sourceforge.net Subject: Re: [Linux-ATM-General] [PATCH] ATM - remove unnecessary GFP_ATOMIC allocation In-reply-to: Your message of "Fri, 05 Sep 2003 12:53:08 BST." <20030905115308.GA96209@compsoc.man.ac.uk> Date: Fri, 05 Sep 2003 08:52:22 -0400 From: chas williams X-Spam-Score: () hits=-2.9 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5639 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev In message <20030905115308.GA96209@compsoc.man.ac.uk>,John Levon writes: >There's no reason to allocate with GFP_ATOMIC in __alloc_atm_dev(). It has one >callsite that is not under a spin lock (quick audit of drivers calling >atm_dev_register() too). it used to be under a spinlock (the infamous atm global spinlock). that's no longer the case so it doesnt need to be ATOMIC anymore. i probably missed it when i fixed the spinlock. dave, please apply to 2.6 (and 2.4) --thanks [ATM]: remove unnecessary GFP_ATOMIC allocation (from levon@movementarian.org) diff -Naurp -X dontdiff linux-cvs/net/atm/resources.c linux-fixes/net/atm/resources.c --- linux-cvs/net/atm/resources.c 2003-07-09 14:19:52.000000000 +0100 +++ linux-fixes/net/atm/resources.c 2003-09-05 13:14:08.000000000 +0100 @@ -30,7 +30,7 @@ { struct atm_dev *dev; - dev = kmalloc(sizeof(*dev), GFP_ATOMIC); + dev = kmalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return NULL; memset(dev, 0, sizeof(*dev)); From mgm@paktronix.com Fri Sep 5 07:00:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 07:01:02 -0700 (PDT) Received: from pakmon.pakuni.net (pak59.pakuni.net [65.103.169.59]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85E0Ix4005840 for ; Fri, 5 Sep 2003 07:00:27 -0700 Received: from netmonster.pakint.net (netmonster.pakint.net [192.168.3.13]) by pakmon.pakuni.net (8.12.9/8.12.9) with ESMTP id h85DxhE4010056; Fri, 5 Sep 2003 08:59:43 -0500 Date: Fri, 5 Sep 2003 09:08:58 -0500 (CDT) From: "Matthew G. Marsh" X-X-Sender: mgm@netmonster.pakint.net To: Stephen Hemminger cc: Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH 2.5.72] Red Creek VPN update In-Reply-To: <20030617163116.1f7b6d78.shemminger@osdl.org> Message-ID: References: <20030617163116.1f7b6d78.shemminger@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5640 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mgm@paktronix.com Precedence: bulk X-list: netdev On Tue, 17 Jun 2003, Stephen Hemminger wrote: > Some cleanup's to Red Creek VPN driver. > - use alloc_etherdev instead of init_etherdev > - don't decrement module ref count negative in case of error. > > Don't have the hardware to actually test the real thing. But the driver builds > and loads fine. Hi - sorry for the late response - I have 57 of these in production. I am now trying to get together a 2.6test machine and this is one of the first parts I will test. How would you like bug reports? I will try to gen patches where possible but I don't have bk. Thank you for your work on this! -------------------------------------------------- Matthew G. Marsh, President Paktronix Systems LLC 1506 North 59th Street Omaha NE 68104 Phone: (402) 553-2288 Email: mgm@paktronix.com WWW: http://www.paktronix.com -------------------------------------------------- From vnuorval@tcs.hut.fi Fri Sep 5 07:22:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 07:23:04 -0700 (PDT) Received: from smtp-2.hut.fi (root@smtp-2.hut.fi [130.233.228.92]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85EMPx4010363 for ; Fri, 5 Sep 2003 07:22:26 -0700 Received: from neon.tcs.hut.fi (neon.tcs.hut.fi [130.233.215.20]) by smtp-2.hut.fi (8.12.9/8.12.9) with ESMTP id h83Gvv5t003096; Wed, 3 Sep 2003 19:57:58 +0300 Received: from rhea.tcs.hut.fi (rhea.tcs.hut.fi [130.233.215.147]) by neon.tcs.hut.fi (Postfix) with ESMTP id 49B908000AE; Wed, 3 Sep 2003 19:57:57 +0300 (EEST) Received: from rhea.tcs.hut.fi (localhost [127.0.0.1]) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83Gvv9s006555; Wed, 3 Sep 2003 19:57:57 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-6.4) with ESMTP id h83Gvueh006550; Wed, 3 Sep 2003 19:57:56 +0300 Date: Wed, 3 Sep 2003 19:57:56 +0300 (EEST) From: Ville Nuorvala To: Pekka Savola Cc: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= , , , Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-RAVMilter-Version: 8.4.3(snapshot 20030212) (smtp-2.hut.fi) X-DCC-HUTCC-Metrics: smtp-2.hut.fi 1165; Body=6 Fuz1=6 Fuz2=6 X-archive-position: 5641 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 On Wed, 3 Sep 2003, Pekka Savola wrote: > On Wed, 3 Sep 2003, Ville Nuorvala wrote: > > > > The other end of the tunnel might not yet be set up to receive the packet, > > which causes an ICMP error message to be sent back to the sender. > > > > Besides, RS and RA over a ipv6-in-ipv6 tunnel is a _bad_ idea. A default > > route through a tunnel without more advanced (policy/flow/srcaddr/? based) > > routing schemes can lead to local routing loops. > > Who are you to say it's a bad idea? Someone who has been tackling with the issue of default routes through tunnel interfaces in MIPL (our MIPv6 for Linux implementation) for quite some time now ;) > Users may have a lot of ideas, which some may think are bad but are OK. Well, I did already mention routing loops (and ICMP errors caused by IPv6 encapsulated RSs on a virtual link that isn't up yet). I think that qualifies as bad enough :( > There is nothing wrong with RS/RA over an IPv6-over-IPv6 tunnel. I'd > probably be concerned myself if it wasn't possible. Who says it isn't possible? The user who thinks he knows better can change the accept_ra (and rtr_solicits) flag for the tunnel dev and start receiving RAs through it. > _However_, that doesn't make sense unless you have a more specific route > to the destination IPv6 tunnel endpoint. Yes, exactly. And what should the node do if it just has two default routes, one through a tunnel and one through an ethernet interface? This will be the case if a normal host receives RAs through both interfaces. At least two things can go wrong: 1) A packet intended to the tunnel is sent straight through the ethernet device 2) A packet already encapsulated by the tunnel is rerouted through it and is thus dropped Based on my own experiences, I can say things like this do happen. > At the moment, I don't know who'd like to get a default IPv6 route over an > IPv6 tunnel, though.. IPv6 VPN users? MIPv6 users who restrict themselves > to bidirectional tunneling through the home agent, maybe? In MIPL, the MN uses a "default" ::/0 route through the IPv6 tunnel, but it is only used for packets using the MN's home address as source. All other traffic (including packets already encapsulated by the IPv6 tunnel, thus having the care-of address as source) is routed normally through the physical device. Things like this aren't possible in the current IPv6 routing code, so I had to modify the route lookup so it first checks the source address of the packet, then the destination. I sent a patch for this source address based routing, but it didn't make it into the kernel, partly because the USAGI team has plans to introduce IPv6 policy routing, which should also fix the problems. -Ville -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 From davem@pizda.ninka.net Fri Sep 5 07:42:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 07:42:40 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85Eg6x4013492 for ; Fri, 5 Sep 2003 07:42:06 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id HAA23341; Fri, 5 Sep 2003 07:31:14 -0700 Date: Fri, 5 Sep 2003 07:31:14 -0700 From: "David S. Miller" To: Ville Nuorvala Cc: pekkas@netcore.fi, yoshfuji@linux-ipv6.org, usagi-core@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6: (5/5+1) Autoconfig link-local addr to IPv6 tunnels Message-Id: <20030905073114.7a9a19e1.davem@redhat.com> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (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: 5642 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 Sep 2003 19:57:56 +0300 (EEST) Ville Nuorvala wrote: > In MIPL, the MN uses a "default" ::/0 route through the IPv6 tunnel, but > it is only used for packets using the MN's home address as source. All > other traffic (including packets already encapsulated by the IPv6 tunnel, > thus having the care-of address as source) is routed normally through the > physical device. > > Things like this aren't possible in the current IPv6 routing code, so I > had to modify the route lookup so it first checks the source address of > the packet, then the destination. > > I sent a patch for this source address based routing, but it didn't make > it into the kernel, partly because the USAGI team has plans to introduce > IPv6 policy routing, which should also fix the problems. Well, it was rejected for another reason :-) Doing route selection in the way you propose is completely backwards. Routing engine is asked only where one would like to go, and in response we are told how to get there and who to advertise ourselves as (ie. source address selection). That is, source address selection is a product of the routing lookup not an input. The whole engine works this way. When TCP connects, unless user has specified a specific source address when bind()'ing the socket, we take source address from the route. Source address selection is routing task. I do not see what it is about MIPV6 which changes this. So you either have to show me this thing, or accept what I say :-) From akpm@osdl.org Fri Sep 5 09:05:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 09:06:12 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85G5ax4023760 for ; Fri, 5 Sep 2003 09:05:37 -0700 Received: from dhcp-140-201.pao.digeo.com (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h85G5Uo15587; Fri, 5 Sep 2003 09:05:30 -0700 Date: Fri, 5 Sep 2003 08:48:25 -0700 From: Andrew Morton To: netdev@oss.sgi.com Cc: Brendan Keessen Subject: Fw: ksoftirqd causing severe network performance problems Message-Id: <20030905084825.4b60169f.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5643 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Begin forwarded message: Date: Fri, 5 Sep 2003 12:57:18 +0200 From: Brendan Keessen To: linux-kernel@vger.kernel.org Subject: ksoftirqd causing severe network performance problems Hi, More than a week ago we replaced our old linux core routers (in a failover setup), with a new one. The old used 2 100 mbit NICs and worked very well, however we needed more than a 100 mbit throughput, so we replaced the setup with an almost identical setup based on two new servers with 2 1g NICs. At peek time it processes about 70 Mbits/sec of traffic and we use vlan's and use iptables, firewalling and DNAT of almost all the connections, the same as in the old setup. At the end of last week, the new setup had network problems and what we saw on the linux router was that the kernel threads ksoftirqd_CPU1 and ksoftirqd_CPU0 were using almost 100% of system time and the network throughput collapsed. This happens every day once or twice but the first one seems reasonably predictable and happens when the network traffic raises from a constant throughput from 3 Mbit/sec to 46 Mbit/sec in 3 hours. At a rough 40 Mbit/sec the problem occures and a failover to the slave router solves the problem. On the faulty server (previously master) the 100% CPU usage drops to almost 100% idle. When the backup is working fine, we can't use the faulty server anymore for routing/firewalling because failing back to it again results in an instant 100% system time again. Rebooting the system helps. Because the router was a new server (Dell 2650/Dual Xeon) and it had a new network card (Gigabit Broadcom 5703, which we never used before in our servers) we thought that maybe the driver for the card was causing the problem. After switching drivers and switching between kernel versions (2.4.21/2.4.22/ 2.4.18(which ran perfectly on our old router))we eventually choose to replace the server with a dell 1650 which has 2 gigabit e1000 interfaces. Different kernels and e1000 drivers resulted in the same problem again. Now we are running 2.4.18 with the 4.3.2 e1000 driver. I know we don't use the newest kernel and newest driver but this doesn't seem to cause the problem because we tested with other network cards, drivers and kernel versions. The same problem still exists on the new server with totally different network cards. In the kernel logfiles we don't see any messages at all which are related to the problem. Here is some info which tells something about the server when the network performance collapses and ksoftirqd_CPU0/ksoftirqd_CPU1 are using 99% system time: routing cache (no. entries): $ ip r ls cache | grep from | wc -l 69323 $ cat /proc/sys/net/ipv4/route/max_size 131072 $ cat /proc/sys/net/ipv4/route/gc_thresh 8192 We thought maybe for some reasom the routing cache is thrashing so we experimented with changing the max_size to 4 times the current value and raising the gc_thresh to 80% of that value and gc_elasticity to 32. But that didn't help and the same problem occured again. info on ip conntrack (no. entries): $ cat /proc/net/ip_conntrack | wc -l 126804 The ip_conntrack module is loaded with the hashsize parameter: ip_conntrack hashsize=2097152 To give you more input I turned on profiling. Read and clear profiling info every 60 second. The kernel functions which use the most clockticks (top 10) during the problem are: 31 handle_IRQ_event 0.2500 32 add_timer 0.1311 34 net_rx_action 0.0467 35 __kfree_skb 0.1136 35 batch_entropy_store 0.1944 40 dev_queue_xmit 0.0535 50 ip_route_input 0.1238 676 __write_lock_failed 21.1250 2928 __read_lock_failed 146.4000 3620 default_idle 69.6154 A few minutes before the problem occured (normal state): 37 __kfree_skb 0.1201 49 net_rx_action 0.0673 50 dev_queue_xmit 0.0668 50 handle_IRQ_event 0.4032 54 ip_route_input 0.1337 56 schedule 0.0422 68 __write_lock_failed 2.1250 73 batch_entropy_store 0.4056 742 __read_lock_failed 37.1000 8893 default_idle 171.0192 I also monitored interrupts (/proc/interrupts) of eth0 and eth1 but the interrupts seem related with the throughput at that moment and no strange burst of interrupts occure: Before and during the problem occures the interrupts are about: eth0: 5000/s eth1: 4200/s Does anybody know why we have this problem and how to solve it. Or could you maybe tell me what more info is needed and how I can get it, to resolve the problem. Thanks, Brendan Keessen - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ From romieu@fr.zoreil.com Fri Sep 5 09:38:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 09:39:01 -0700 (PDT) Received: from fr.zoreil.com (electric-eye.fr.zoreil.com [213.41.134.224]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85GcQx4026511 for ; Fri, 5 Sep 2003 09:38:27 -0700 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 h85GbOxA008884; Fri, 5 Sep 2003 18:37:24 +0200 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.12.8/8.12.1) id h85GbO16008883; Fri, 5 Sep 2003 18:37:24 +0200 Date: Fri, 5 Sep 2003 18:37:24 +0200 From: Francois Romieu To: "Matthew G. Marsh" Cc: Stephen Hemminger , Jeff Garzik , netdev@oss.sgi.com Subject: Re: [PATCH 2.5.72] Red Creek VPN update Message-ID: <20030905183724.A8467@electric-eye.fr.zoreil.com> References: <20030617163116.1f7b6d78.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: ; from mgm@paktronix.com on Fri, Sep 05, 2003 at 09:08:58AM -0500 X-archive-position: 5644 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 Matthew G. Marsh : [...] > Hi - sorry for the late response - I have 57 of these in production. I am > now trying to get together a 2.6test machine and this is one of the first > parts I will test. > > How would you like bug reports? I will try to gen patches where possible > but I don't have bk. You will find an history of the changes applied during the 2.5 serie at: http://linux.bkbits.net:8080/linux-2.5/related/drivers/net/rcpci45.c?nav=index.html|src/.|src/drivers|src/drivers/net If something goes wrong, the latest changes are not necessarily the most suspect. -- Ueimor From moz@compsoc.man.ac.uk Fri Sep 5 10:12:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 10:13:00 -0700 (PDT) Received: from serenity.mcc.ac.uk (serenity.mcc.ac.uk [130.88.200.93]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85HCNx4029040 for ; Fri, 5 Sep 2003 10:12:24 -0700 Received: from compsoc.umu.man.ac.uk ([130.88.22.5] helo=mrtall.compsoc.man.ac.uk ident=exim) by serenity.mcc.ac.uk with esmtp (Exim 4.20) id 19vK8F-0009jn-7L; Fri, 05 Sep 2003 18:12:23 +0100 Received: from moz by mrtall.compsoc.man.ac.uk with local (Exim 3.33 #1) id 19vK8F-0009tn-00; Fri, 05 Sep 2003 18:12:23 +0100 Date: Fri, 5 Sep 2003 18:12:23 +0100 From: John Levon To: linux-atm-general@lists.sourceforge.net, netdev@oss.sgi.com Subject: [PATCH] ATM - kill __free_atm_dev() Message-ID: <20030905171223.GA37920@compsoc.man.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i X-Url: http://www.movementarian.org/ X-Record: King of Woolworths - L'Illustration Musicale X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19vK8F-0009jn-7L*KwvBFeTRyOY* X-archive-position: 5645 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: levon@movementarian.org Precedence: bulk X-list: netdev Apply the "Levonov abstraction penalty" - the wrapping of kfree() is pure obfuscation. regards john diff -Naurp -X dontdiff linux-cvs/net/atm/resources.c linux-fixes/net/atm/resources.c --- linux-cvs/net/atm/resources.c 2003-06-23 23:08:56.000000000 +0100 +++ linux-fixes/net/atm/resources.c 2003-09-05 18:35:02.000000000 +0100 @@ -42,11 +42,6 @@ static struct atm_dev *__alloc_atm_dev(c return dev; } -static void __free_atm_dev(struct atm_dev *dev) -{ - kfree(dev); -} - static struct atm_dev *__atm_dev_lookup(int number) { struct atm_dev *dev; @@ -88,7 +83,7 @@ struct atm_dev *atm_dev_register(const c if ((inuse = __atm_dev_lookup(number))) { atm_dev_put(inuse); spin_unlock(&atm_dev_lock); - __free_atm_dev(dev); + kfree(dev); return NULL; } dev->number = number; @@ -119,7 +114,7 @@ struct atm_dev *atm_dev_register(const c spin_lock(&atm_dev_lock); list_del(&dev->dev_list); spin_unlock(&atm_dev_lock); - __free_atm_dev(dev); + kfree(dev); return NULL; } } @@ -154,7 +149,7 @@ void atm_dev_deregister(struct atm_dev * } } - __free_atm_dev(dev); + kfree(dev); } void shutdown_atm_dev(struct atm_dev *dev) From chas@cmf.nrl.navy.mil Fri Sep 5 11:14:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 11:14:59 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85IEsx4000793 for ; Fri, 5 Sep 2003 11:14:55 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h85IEiSa011949; Fri, 5 Sep 2003 14:14:44 -0400 (EDT) Message-Id: <200309051814.h85IEiSa011949@ginger.cmf.nrl.navy.mil> To: John Levon cc: netdev@oss.sgi.com, shemminger@osdl.org, linux-atm-general@lists.sourceforge.net Subject: Re: [Linux-ATM-General] [PATCH] ATM - fix seqfile compile failure In-Reply-To: Message from John Levon of "Fri, 05 Sep 2003 18:51:13 BST." <20030905175113.GA40730@compsoc.man.ac.uk> Date: Fri, 05 Sep 2003 14:14:45 -0400 From: chas williams X-Spam-Score: (*) hits=1.7 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5646 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev >The recent conversion to seq_file breaks CONFIG_ATM_BR2684_IPFILTER >compile. i sent in a patch for this already. i did a bit of testing. >I have absolutely no idea what the original author was attempting to >achieve with the "pos" thing, btw ... *shrug* the "pos" stuff was used by the old proc interface. From shemminger@osdl.org Fri Sep 5 11:25:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 11:25:56 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85IPNx4002269 for ; Fri, 5 Sep 2003 11:25:24 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h85IP1o15682; Fri, 5 Sep 2003 11:25:01 -0700 Date: Fri, 5 Sep 2003 11:24:46 -0700 From: Stephen Hemminger To: Scott Feldman , Jeff Garzik Cc: netdev@oss.sgi.com Subject: Crash with e100 and ethtool on 2.6.0-test4 latest Message-Id: <20030905112446.00ba4e32.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5647 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 # ethtool -K eth0 rx off Unable to handle kernel paging request at virtual address f8875000 printing eip: f8874fff *pde = 0389e067 *pte = 00000000 Oops: 0000 [#1] CPU: 7 EIP: 0060:[] Not tainted EFLAGS: 00010282 EIP is at 0xf8874fff eax: f68243a0 ebx: f68243a0 ecx: f6824184 edx: 00000000 esi: 00000000 edi: 00000000 ebp: f5fefda8 esp: f5fefd90 ds: 007b es: 007b ss: 0068 Process ethtool (pid: 1815, threadinfo=f5fee000 task=f6820d00) Stack: f885f6b9 f68243a0 f885f2ea f68243a0 f6824184 f68242a8 f5fefed4 f8861f9e f68243a0 bffff020 00000008 f68243a0 c0328800 c0328b80 00000015 00000000 c0142acf c35dc5a8 00000000 f5fefe08 c014e6f3 00000286 00000246 00000000 Call Trace: [] e100_hw_init+0x14/0x106 [e100] [] e100_close+0x67/0x7a [e100] [] e100_do_ethtool_ioctl+0x533/0x88a [e100] [] buffered_rmqueue+0xc0/0x193 [] zap_pte_range+0x71/0x208 [] __alloc_pages+0x8a/0x324 [] find_get_page+0x37/0x94 [] filemap_nopage+0x239/0x315 [] pte_chain_alloc+0x64/0x67 [] do_no_page+0x1f5/0x410 [] pte_alloc_map+0xd9/0x12e [] dev_ethtool+0x95/0x2f9 [] rtnl_lock+0x22/0x38 [] dev_ioctl+0x1a0/0x34f [] inet_ioctl+0x102/0x112 [] sock_ioctl+0x154/0x34a [] sys_socketcall+0xb7/0x29a [] sys_ioctl+0x147/0x305 [] sys_munmap+0x58/0x77 [] sysenter_past_esp+0x52/0x71 Code: 00 Bad EIP value. Segmentation fault From krkumar@us.ibm.com Fri Sep 5 11:27:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 11:27:48 -0700 (PDT) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.131]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85IREx4002654 for ; Fri, 5 Sep 2003 11:27:15 -0700 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e33.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h85IQIhu318378; Fri, 5 Sep 2003 14:26:18 -0400 Received: from us.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id h85IQGsF107988; Fri, 5 Sep 2003 12:26:16 -0600 Message-ID: <3F58D567.2050201@us.ibm.com> Date: Fri, 05 Sep 2003 11:26:47 -0700 From: Krishna Kumar Organization: IBM 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: "David S. Miller" CC: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@oss.sgi.com, Krishna Kumar Subject: Re: O/M flags against 2.6.0-test1 References: <20030730220223.4c25fcfe.davem@redhat.com> <20030804165746.133f370a.davem@redhat.com> In-Reply-To: <20030804165746.133f370a.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5648 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: krkumar@us.ibm.com Precedence: bulk X-list: netdev Hi Dave, > Krishna is away, but let us make more progress on this patch. I have just got back and I didn't see any follow up on this. I also found that it is not yet in the 2.6.0-test4 kernel, so would like to find out what needs to be done to get it included. To answer your comments : > Ok, how does this actually work? The code does RTA_PUT(...IFLA_INET6_*...) > but IFLA_PROTINFO is not actually used anywhere. This cannot work, it makes > these RTA attributes just look like whatever IFLA_* ones have the > same values as the inet6 ones in this enumeration. The inet6_fill_ifinfo adds a IFLA_PROTINFO msg to the skb and then adds the sub-attribute like IFLA_INET6_FLAGS, IFLA_INET6_CONF, sets the length of sub-attr, etc. Code snippet : subattr = (struct rtattr*)skb->tail; RTA_PUT(skb, IFLA_PROTINFO, 0, NULL); /* return the device flags */ RTA_PUT(skb, IFLA_INET6_FLAGS, sizeof(__u32), &idev->if_flags); > > + /* return the device sysctl params */ > > + if ((array = kmalloc(DEVCONF_MAX * sizeof(*array), GFP_KERNEL)) == NULL) > > + goto rtattr_failure; > > + ipv6_store_devconf(&idev->cnf, array); > > + RTA_PUT(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(*array), array); > This is what I'm talking about. Maybe there is something I'm missing. > How does APP know to interpret IFLA_INET6_CONF as "sub-attribute" > of IFLA_PROTINFO? I think this is answered above. Please correct me if I have missed something. > Also, missing "memset(array, 0, sizeof(*array));" else we leak > uninitialized kernel memory into user space. Is that needed since the array allocated is exactly DEVCONF_MAX sized and the ipv6_store_devconf writes exactly DEVCONF_MAX entries and the rta_len is marked accordinging to finish at the end of the array. But I can still add it for clarity... > Another bug, GFP_KERNEL memory allocation with dev_base_lock held. Yes, that should be changed to GFP_ATOMIC. > Otherwise I am OK with the patch. OK, should I fix these two bugs and re-submit against test4 kernel ? Dave, I would like to get the prefix list and O/M flags information included in 2.4 kernel too, are you OK with that ? Thanks, - KK From chas@cmf.nrl.navy.mil Fri Sep 5 11:33:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 11:33:12 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85IX6x4003268 for ; Fri, 5 Sep 2003 11:33:07 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h84GaoSa017129; Thu, 4 Sep 2003 12:36:50 -0400 (EDT) Message-Id: <200309041636.h84GaoSa017129@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: Stephen Hemminger , netdev@oss.sgi.com Subject: Re: [RFT] covert br2684 to seq_file In-Reply-To: Message from Stephen Hemminger of "Tue, 02 Sep 2003 10:43:08 PDT." <20030902104308.08ce3fa4.shemminger@osdl.org> Date: Thu, 04 Sep 2003 12:36:51 -0400 From: chas williams X-Spam-Score: () hits=-0.3 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5649 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev dave, please apply to 2.6 -- thanks [i made a few minor changes, like alignment and missing #ifdef for remove_proc_entry during __exit] In message <20030902104308.08ce3fa4.shemminger@osdl.org>,Stephen Hemminger writ es: >Convert the /proc/net/atm/br2684 to seq_file interface. >It builds and runs, but without any real atm hardware the table >is empty... # 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.1418 -> 1.1419 # net/atm/br2684.c 1.9 -> 1.10 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1419 # convert the /proc/net/atm/br2684 to seq_file interface (from shemminger@osdl.org) # -------------------------------------------- # diff -Nru a/net/atm/br2684.c b/net/atm/br2684.c --- a/net/atm/br2684.c Thu Sep 4 12:32:14 2003 +++ b/net/atm/br2684.c Thu Sep 4 12:32:14 2003 @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -666,31 +667,57 @@ return -ENOIOCTLCMD; } -/* Never put more than 256 bytes in at once */ -static int br2684_proc_engine(loff_t pos, char *buf) +#ifdef CONFIG_PROC_FS +static void *br2684_seq_start(struct seq_file *seq, loff_t *pos) { - struct list_head *lhd, *lhc; - struct net_device *net_dev; - struct br2684_dev *brdev; - struct br2684_vcc *brvcc; - list_for_each(lhd, &br2684_devs) { - net_dev = list_entry_brdev(lhd); - brdev = BRPRIV(net_dev); - if (pos-- == 0) - return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:" - "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, - brdev->number, - net_dev->dev_addr[0], - net_dev->dev_addr[1], - net_dev->dev_addr[2], - net_dev->dev_addr[3], - net_dev->dev_addr[4], - net_dev->dev_addr[5], - brdev->mac_was_set ? "set" : "auto"); - list_for_each(lhc, &brdev->brvccs) { - brvcc = list_entry_brvcc(lhc); - if (pos-- == 0) - return sprintf(buf, " vcc %d.%d.%d: encaps=%s" + loff_t offs = 0; + struct br2684_dev *brd; + + read_lock(&devs_lock); + + list_for_each_entry(brd, &br2684_devs, br2684_devs) { + if (offs == *pos) + return brd; + ++offs; + } + return NULL; +} + +static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct br2684_dev *brd = v; + + ++*pos; + + brd = list_entry(brd->br2684_devs.next, + struct br2684_dev, br2684_devs); + return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; +} + +static void br2684_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&devs_lock); +} + +static int br2684_seq_show(struct seq_file *seq, void *v) +{ + const struct br2684_dev *brdev = v; + const struct net_device *net_dev = brdev->net_dev; + const struct br2684_vcc *brvcc; + + seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:" + "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, + brdev->number, + net_dev->dev_addr[0], + net_dev->dev_addr[1], + net_dev->dev_addr[2], + net_dev->dev_addr[3], + net_dev->dev_addr[4], + net_dev->dev_addr[5], + brdev->mac_was_set ? "set" : "auto"); + + list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { + seq_printf(seq, " vcc %d.%d.%d: encaps=%s" #ifndef FASTER_VERSION ", failed copies %u/%u" #endif /* FASTER_VERSION */ @@ -711,63 +738,41 @@ #undef bs #undef b1 #endif /* CONFIG_ATM_BR2684_IPFILTER */ - } } return 0; } -static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count, - loff_t *pos) +static struct seq_operations br2684_seq_ops = { + .start = br2684_seq_start, + .next = br2684_seq_next, + .stop = br2684_seq_stop, + .show = br2684_seq_show, +}; + +static int br2684_proc_open(struct inode *inode, struct file *file) { - unsigned long page; - int len = 0, x, left; - page = get_zeroed_page(GFP_KERNEL); - if (!page) - return -ENOMEM; - left = PAGE_SIZE - 256; - if (count < left) - left = count; - read_lock(&devs_lock); - for (;;) { - x = br2684_proc_engine(*pos, &((char *) page)[len]); - if (x == 0) - break; - if (x > left) - /* - * This should only happen if the user passed in - * a "count" too small for even one line - */ - x = -EINVAL; - if (x < 0) { - len = x; - break; - } - len += x; - left -= x; - (*pos)++; - if (left < 256) - break; - } - read_unlock(&devs_lock); - if (len > 0 && copy_to_user(buf, (char *) page, len)) - len = -EFAULT; - free_page(page); - return len; + return seq_open(file, &br2684_seq_ops); } -static struct file_operations br2684_proc_operations = { - .owner = THIS_MODULE, - .read = br2684_proc_read, +static struct file_operations br2684_proc_ops = { + .owner = THIS_MODULE, + .open = br2684_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ +#endif static int __init br2684_init(void) { +#ifdef CONFIG_PROC_FS struct proc_dir_entry *p; if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL) return -ENOMEM; - p->proc_fops = &br2684_proc_operations; + p->proc_fops = &br2684_proc_ops; +#endif br2684_ioctl_set(br2684_ioctl); return 0; } @@ -779,7 +784,9 @@ struct br2684_vcc *brvcc; br2684_ioctl_set(NULL); +#ifdef CONFIG_PROC_FS remove_proc_entry("br2684", atm_proc_root); +#endif while (!list_empty(&br2684_devs)) { net_dev = list_entry_brdev(br2684_devs.next); From laforge@netfilter.org Fri Sep 5 13:39:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 13:40:25 -0700 (PDT) Received: from coruscant.gnumonks.org (mail@coruscant.franken.de [193.174.159.226]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85Kdjx4002898 for ; Fri, 5 Sep 2003 13:39:47 -0700 Received: from uucp by coruscant.gnumonks.org with local-bsmtp (Exim 4.20) id 19vNMt-00051H-Hr for netdev@oss.sgi.com; Fri, 05 Sep 2003 22:39:43 +0200 Received: from laforge by obroa-skai.gnumonks.org with local (Exim 3.36 #1) id 19vIYy-0000yI-00; Fri, 05 Sep 2003 17:31:52 +0200 Date: Fri, 5 Sep 2003 17:31:52 +0200 From: Harald Welte To: "David S. Miller" Cc: Bart De Schuymer , acme@conectiva.com.br, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com Subject: Re: ipt_physdev.c alignment problems on parisc64 Message-ID: <20030905153152.GA3623@obroa-skai.de.gnumonks.org> Mail-Followup-To: Harald Welte , "David S. Miller" , Bart De Schuymer , acme@conectiva.com.br, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com References: <200309022116.41697.bdschuym@pandora.be> <20030903200426.59d0af4a.davem@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline In-Reply-To: <20030903200426.59d0af4a.davem@redhat.com> X-Operating-System: Linux obroa-skai.de.gnumonks.org 2.6.0-test4 X-Date: Today is Pungenday, the 29th day of Bureaucracy in the YOLD 3169 User-Agent: Mutt/1.5.4i X-archive-position: 5650 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 --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 03, 2003 at 08:04:26PM -0700, David S. Miller wrote: > On Tue, 2 Sep 2003 21:16:41 +0200 > Bart De Schuymer wrote: >=20 > > On Tuesday 02 September 2003 16:30, Arnaldo Carvalho de Melo wrote: > > > The 1.786.1.54 changeset (i.e. the initial ipt_physdev.c one 8) creat= ed > >=20 > > Does this fix it? >=20 > You can't use this fix. This header and structure are used by > userspace and "unsigned long" can be a different size in the > kernel than it is in user space. >=20 > Please, just remove the super-silly memcmp() optimization in > the ipt_physdev.c code. Dave, the respective code in ipt_physdev.c seems to be copied from the ip_tables.c interface name match (which definitely has the same alignment issues, btw). The problem is that it is _not_ a simple reimplementation of memcmp(), but a mask-compare. People can do stuff like "-i ppp+", meaning that traffic from all interfaces called "ppp" are matched. --=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 --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/WKxnXaXGVTD0i/8RAuNfAKCihA9rrd0JcJDQzSqEChRHsGianQCgnmLd k7bel9I7IL3TuD6rd7X4Stc= =lQcX -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy-- From shemminger@osdl.org Fri Sep 5 14:00:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 14:00:48 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85L02x4009025 for ; Fri, 5 Sep 2003 14:00:15 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h85Kxoo24683; Fri, 5 Sep 2003 13:59:50 -0700 Date: Fri, 5 Sep 2003 13:59:35 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] unneeded proc_fs.h includes in packet schedulers Message-Id: <20030905135935.682936bc.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5651 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 Following include proc_fs.h but don't use it. diff -Nru a/net/sched/estimator.c b/net/sched/estimator.c --- a/net/sched/estimator.c Fri Sep 5 13:57:10 2003 +++ b/net/sched/estimator.c Fri Sep 5 13:57:10 2003 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff -Nru a/net/sched/police.c b/net/sched/police.c --- a/net/sched/police.c Fri Sep 5 13:57:10 2003 +++ b/net/sched/police.c Fri Sep 5 13:57:10 2003 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include From shemminger@osdl.org Fri Sep 5 14:01:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 14:01:48 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h85L1Vx4009340 for ; Fri, 5 Sep 2003 14:01:31 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h85L1Jo25021; Fri, 5 Sep 2003 14:01:19 -0700 Date: Fri, 5 Sep 2003 14:01:04 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] convert packet scheduler API to single_open Message-Id: <20030905140104.6a9ed33a.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5652 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 Convert /proc/net/psched to use seq_file; almost trivial. Patch against 2.6.0-test4 bk latest. diff -Nru a/net/sched/sch_api.c b/net/sched/sch_api.c --- a/net/sched/sch_api.c Fri Sep 5 13:58:01 2003 +++ b/net/sched/sch_api.c Fri Sep 5 13:58:01 2003 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -1059,27 +1060,27 @@ int psched_tick_per_us = 1; #ifdef CONFIG_PROC_FS -static int psched_read_proc(char *buffer, char **start, off_t offset, - int length, int *eof, void *data) +static int psched_show(struct seq_file *seq, void *v) { - int len; - - len = sprintf(buffer, "%08x %08x %08x %08x\n", + seq_printf(seq, "%08x %08x %08x %08x\n", psched_tick_per_us, psched_us_per_tick, 1000000, HZ); - len -= offset; - - if (len > length) - len = length; - if(len < 0) - len = 0; - - *start = buffer + offset; - *eof = 1; + return 0; +} - return len; +static int psched_open(struct inode *inode, struct file *file) +{ + return single_open(file, psched_show, PDE(inode)->data); } + +static struct file_operations psched_fops = { + .owner = THIS_MODULE, + .open = psched_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif #if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY @@ -1250,9 +1251,7 @@ tc_filter_init(); #endif -#ifdef CONFIG_PROC_FS - create_proc_read_entry("net/psched", 0, 0, psched_read_proc, NULL); -#endif + proc_net_fops_create("psched", 0, &psched_fops); return 0; } From scott.feldman@intel.com Fri Sep 5 17:18:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 17:19:00 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h860IPx4005221 for ; Fri, 5 Sep 2003 17:18:25 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h860G0E23210 for ; Sat, 6 Sep 2003 00:16:00 GMT Received: from orsmsxvs041.jf.intel.com (orsmsxvs041.jf.intel.com [192.168.65.54]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h860D7B29352 for ; Sat, 6 Sep 2003 00:13:07 GMT Received: from orsmsx331.amr.corp.intel.com ([192.168.65.56]) by orsmsxvs041.jf.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090517181821006 ; Fri, 05 Sep 2003 17:18:18 -0700 Received: from orsmsx402.amr.corp.intel.com ([192.168.65.208]) by orsmsx331.amr.corp.intel.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 5 Sep 2003 17:18:17 -0700 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.6375.0 Subject: RE: Crash with e100 and ethtool on 2.6.0-test4 latest Date: Fri, 5 Sep 2003 17:18:17 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Crash with e100 and ethtool on 2.6.0-test4 latest Thread-Index: AcNz2w6z/FdShX4oSt+3b1WRh7vK2QAMIqMw From: "Feldman, Scott" To: "Stephen Hemminger" , "Jeff Garzik" Cc: X-OriginalArrivalTime: 06 Sep 2003 00:18:17.0918 (UTC) FILETIME=[5F063DE0:01C3740C] Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h860IPx4005221 X-archive-position: 5653 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 > # ethtool -K eth0 rx off > > Unable to handle kernel paging request at virtual address f8875000 Works for me with ethtool 1.8. What's your ethtool version? Also, what rev is the e100 nic (lspci)? -scott From mike@server-mrozhavsky.dyndns.org Fri Sep 5 17:26:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 17:27:31 -0700 (PDT) Received: from server (h24-83-10-252.vc.shawcable.net [24.83.10.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h860Qtx4005967 for ; Fri, 5 Sep 2003 17:26:55 -0700 Received: by server (Postfix, from userid 1000) id 4FDD955F1F; Fri, 5 Sep 2003 17:26:49 -0700 (PDT) Date: Fri, 5 Sep 2003 17:26:49 -0700 From: Michael Rozhavsky To: netdev@oss.sgi.com Subject: [PATCH] fix locking Message-ID: <20030906002649.GA32369@server-mrozhavsky.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="i0/AhcQY5QxfSsSZ" Content-Disposition: inline User-Agent: Mutt/1.5.4i X-archive-position: 5654 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mike@minantech.com Precedence: bulk X-list: netdev --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I've found two problems with locking in networking code. -- Michael --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tcp_ipv4.c.diff" --- ../../../linux-2.4.22/net/ipv4/tcp_ipv4.c Mon Aug 25 04:44:44 2003 +++ tcp_ipv4.c Fri Sep 5 16:56:54 2003 @@ -907,9 +907,9 @@ req->expires = jiffies + TCP_TIMEOUT_INIT; req->retrans = 0; req->sk = NULL; - req->dl_next = lopt->syn_table[h]; write_lock(&tp->syn_wait_lock); + req->dl_next = lopt->syn_table[h]; lopt->syn_table[h] = req; write_unlock(&tp->syn_wait_lock); --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="sit.c.diff" --- sit.c.orig Fri Sep 5 17:07:55 2003 +++ sit.c Fri Sep 5 17:08:37 2003 @@ -125,14 +125,14 @@ { struct ip_tunnel **tp; + write_lock_bh(&ipip6_lock); for (tp = ipip6_bucket(t); *tp; tp = &(*tp)->next) { if (t == *tp) { - write_lock_bh(&ipip6_lock); *tp = t->next; - write_unlock_bh(&ipip6_lock); break; } } + write_unlock_bh(&ipip6_lock); } static void ipip6_tunnel_link(struct ip_tunnel *t) @@ -141,8 +141,8 @@ write_lock_bh(&ipip6_lock); t->next = *tp; - write_unlock_bh(&ipip6_lock); *tp = t; + write_unlock_bh(&ipip6_lock); } struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int create) --i0/AhcQY5QxfSsSZ-- From joe@perches.com Fri Sep 5 18:46:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:47:25 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861kox4028594 for ; Fri, 5 Sep 2003 18:46:50 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13353; Fri, 5 Sep 2003 19:36:27 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN Add #define to seq_file.h (1/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812809.16845.163.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:46:49 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5655 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev Code that includes seq_file.h use a magic pointer "(void*)1" to start a header seq_printf. These patches convert the magic pointer use to a #define diff -urN linux-2.6.0-test4/include/linux/seq_file.h SEQ_START_TOKEN/include/linux/seq_file.h -- linux-2.6.0-test4/include/linux/seq_file.h 2003-08-22 17:02:49.000000000 -0700 +++ SEQ_START_TOKEN/include/linux/seq_file.h 2003-09-04 17:28:19.000000000 -0700 @@ -65,5 +65,8 @@ int single_open(struct file *, int (*)(struct seq_file *, void *), void *); int single_release(struct inode *, struct file *); int seq_release_private(struct inode *, struct file *); + +#define SEQ_START_TOKEN ((void *)1) + #endif #endif From joe@perches.com Fri Sep 5 18:47:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:47:57 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861lGx4028622 for ; Fri, 5 Sep 2003 18:47:16 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13358; Fri, 5 Sep 2003 19:36:52 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN net/* (2/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812834.16845.165.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:47:14 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5656 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev diff -urN linux-2.6.0-test4/net/8021q/vlanproc.c SEQ_START_TOKEN/net/8021q/vlanproc.c -- linux-2.6.0-test4/net/8021q/vlanproc.c 2003-08-22 16:53:55.000000000 -0700 +++ SEQ_START_TOKEN/net/8021q/vlanproc.c 2003-09-04 20:26:49.000000000 -0700 @@ -46,10 +46,6 @@ static void vlan_seq_stop(struct seq_file *seq, void *); static int vlandev_seq_show(struct seq_file *seq, void *v); -/* Miscellaneous */ -#define SEQ_START_TOKEN ((void *) 1) - - /* * Global Data */ diff -urN linux-2.6.0-test4/net/appletalk/aarp.c SEQ_START_TOKEN/net/appletalk/aarp.c -- linux-2.6.0-test4/net/appletalk/aarp.c 2003-09-02 12:52:45.000000000 -0700 +++ SEQ_START_TOKEN/net/appletalk/aarp.c 2003-09-04 20:27:42.000000000 -0700 @@ -941,7 +941,7 @@ iter->table = resolved; iter->bucket = 0; - return *pos ? iter_next(iter, pos) : ((void *)1); + return *pos ? iter_next(iter, pos) : SEQ_START_TOKEN; } static void *aarp_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -952,7 +952,7 @@ ++*pos; /* first line after header */ - if (v == ((void *)1)) + if (v == SEQ_START_TOKEN) entry = iter_next(iter, NULL); /* next entry in current bucket */ @@ -987,7 +987,7 @@ struct aarp_entry *entry = v; unsigned long now = jiffies; - if (v == ((void *)1)) + if (v == SEQ_START_TOKEN) seq_puts(seq, "Address Interface Hardware Address" " Expires LastSend Retry Status\n"); diff -urN linux-2.6.0-test4/net/appletalk/atalk_proc.c SEQ_START_TOKEN/net/appletalk/atalk_proc.c -- linux-2.6.0-test4/net/appletalk/atalk_proc.c 2003-09-02 12:52:45.000000000 -0700 +++ SEQ_START_TOKEN/net/appletalk/atalk_proc.c 2003-09-04 20:27:44.000000000 -0700 @@ -33,7 +33,7 @@ loff_t l = *pos; read_lock_bh(&atalk_interfaces_lock); - return l ? atalk_get_interface_idx(--l) : (void *)1; + return l ? atalk_get_interface_idx(--l) : SEQ_START_TOKEN; } static void *atalk_seq_interface_next(struct seq_file *seq, void *v, loff_t *pos) @@ -41,7 +41,7 @@ struct atalk_iface *i; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { i = NULL; if (atalk_interfaces) i = atalk_interfaces; @@ -62,7 +62,7 @@ { struct atalk_iface *iface; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Interface Address Networks " "Status\n"); goto out; @@ -92,7 +92,7 @@ loff_t l = *pos; read_lock_bh(&atalk_routes_lock); - return l ? atalk_get_route_idx(--l) : (void *)1; + return l ? atalk_get_route_idx(--l) : SEQ_START_TOKEN; } static void *atalk_seq_route_next(struct seq_file *seq, void *v, loff_t *pos) @@ -100,7 +100,7 @@ struct atalk_route *r; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { r = NULL; if (atalk_routes) r = atalk_routes; @@ -121,7 +121,7 @@ { struct atalk_route *rt; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Target Router Flags Dev\n"); goto out; } @@ -160,7 +160,7 @@ loff_t l = *pos; read_lock_bh(&atalk_sockets_lock); - return l ? atalk_get_socket_idx(--l) : (void *)1; + return l ? atalk_get_socket_idx(--l) : SEQ_START_TOKEN; } static void *atalk_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) @@ -168,7 +168,7 @@ struct sock *i; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { i = sk_head(&atalk_sockets); goto out; } @@ -187,7 +187,7 @@ struct sock *s; struct atalk_sock *at; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "Type Local_addr Remote_addr Tx_queue " "Rx_queue St UID\n"); goto out; diff -urN linux-2.6.0-test4/net/core/dev.c SEQ_START_TOKEN/net/core/dev.c -- linux-2.6.0-test4/net/core/dev.c 2003-09-02 12:52:45.000000000 -0700 +++ SEQ_START_TOKEN/net/core/dev.c 2003-09-04 20:06:43.000000000 -0700 @@ -1844,13 +1844,13 @@ void *dev_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? dev_get_idx(*pos - 1) : (void *)1; + return *pos ? dev_get_idx(*pos - 1) : SEQ_START_TOKEN; } void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return v == (void *)1 ? dev_base : ((struct net_device *)v)->next; + return v == SEQ_START_TOKEN ? dev_base : ((struct net_device *)v)->next; } void dev_seq_stop(struct seq_file *seq, void *v) @@ -1890,7 +1890,7 @@ */ static int dev_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_puts(seq, "Inter-| Receive " " | Transmit\n" " face |bytes packets errs drop fifo frame " diff -urN linux-2.6.0-test4/net/core/wireless.c SEQ_START_TOKEN/net/core/wireless.c -- linux-2.6.0-test4/net/core/wireless.c 2003-08-22 16:58:39.000000000 -0700 +++ SEQ_START_TOKEN/net/core/wireless.c 2003-09-04 19:55:08.000000000 -0700 @@ -458,7 +458,7 @@ */ static int wireless_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "Inter-| sta-| Quality | Discarded " "packets | Missed | WE\n" " face | tus | link level noise | nwid " diff -urN linux-2.6.0-test4/net/decnet/af_decnet.c SEQ_START_TOKEN/net/decnet/af_decnet.c -- linux-2.6.0-test4/net/decnet/af_decnet.c 2003-08-22 16:56:22.000000000 -0700 +++ SEQ_START_TOKEN/net/decnet/af_decnet.c 2003-09-04 20:27:37.000000000 -0700 @@ -2146,14 +2146,14 @@ static void *dn_socket_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? dn_socket_get_idx(seq, *pos - 1) : (void*)1; + return *pos ? dn_socket_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } static void *dn_socket_seq_next(struct seq_file *seq, void *v, loff_t *pos) { void *rc; - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { rc = dn_socket_get_idx(seq, 0); goto out; } @@ -2169,7 +2169,7 @@ static void dn_socket_seq_stop(struct seq_file *seq, void *v) { - if (v && v != (void*)1) + if (v && v != SEQ_START_TOKEN) read_unlock_bh(&dn_hash_lock); } @@ -2269,7 +2269,7 @@ static int dn_socket_seq_show(struct seq_file *seq, void *v) { - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Local Remote\n"); } else { dn_socket_format_entry(seq, v); diff -urN linux-2.6.0-test4/net/decnet/dn_dev.c SEQ_START_TOKEN/net/decnet/dn_dev.c -- linux-2.6.0-test4/net/decnet/dn_dev.c 2003-08-22 16:54:17.000000000 -0700 +++ SEQ_START_TOKEN/net/decnet/dn_dev.c 2003-09-04 20:27:39.000000000 -0700 @@ -1366,7 +1366,7 @@ read_unlock(&dev_base_lock); return dev; } - return (void*)1; + return SEQ_START_TOKEN; } static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -1374,7 +1374,7 @@ struct net_device *dev = v; loff_t one = 1; - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { dev = dn_dev_seq_start(seq, &one); } else { dev = dn_dev_get_next(seq, dev); @@ -1387,7 +1387,7 @@ static void dn_dev_seq_stop(struct seq_file *seq, void *v) { - if (v && v != (void*)1) + if (v && v != SEQ_START_TOKEN) read_unlock(&dev_base_lock); } @@ -1407,7 +1407,7 @@ static int dn_dev_seq_show(struct seq_file *seq, void *v) { - if (v == (void*)1) + if (v == SEQ_START_TOKEN) seq_puts(seq, "Name Flags T1 Timer1 T3 Timer3 BlkSize Pri State DevType Router Peer\n"); else { struct net_device *dev = v; diff -urN linux-2.6.0-test4/net/decnet/dn_neigh.c SEQ_START_TOKEN/net/decnet/dn_neigh.c -- linux-2.6.0-test4/net/decnet/dn_neigh.c 2003-08-22 16:57:50.000000000 -0700 +++ SEQ_START_TOKEN/net/decnet/dn_neigh.c 2003-09-04 20:27:34.000000000 -0700 @@ -604,7 +604,7 @@ static void *dn_neigh_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? dn_neigh_get_idx(seq, *pos - 1) : (void*)1; + return *pos ? dn_neigh_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } static void *dn_neigh_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -612,7 +612,7 @@ void *rc; - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { rc = dn_neigh_get_idx(seq, 0); goto out; } @@ -628,7 +628,7 @@ static void dn_neigh_seq_stop(struct seq_file *seq, void *v) { - if (v && v != (void*)1) + if (v && v != SEQ_START_TOKEN) read_unlock_bh(&dn_neigh_table.lock); } @@ -653,7 +653,7 @@ static int dn_neigh_seq_show(struct seq_file *seq, void *v) { - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Addr Flags State Use Blksize Dev\n"); } else { dn_neigh_format_entry(seq, v); diff -urN linux-2.6.0-test4/net/ipv4/arp.c SEQ_START_TOKEN/net/ipv4/arp.c -- linux-2.6.0-test4/net/ipv4/arp.c 2003-08-22 16:58:59.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/arp.c 2003-09-04 20:06:32.000000000 -0700 @@ -1275,7 +1275,7 @@ static void *arp_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? arp_get_idx(seq, *pos - 1) : (void *)1; + return *pos ? arp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } static void *arp_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -1283,7 +1283,7 @@ void *rc; struct arp_iter_state* state; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { rc = arp_get_idx(seq, 0); goto out; } @@ -1306,7 +1306,7 @@ { struct arp_iter_state* state = seq->private; - if (!state->is_pneigh && v != (void *)1) + if (!state->is_pneigh && v != SEQ_START_TOKEN) read_unlock_bh(&arp_tbl.lock); } @@ -1359,7 +1359,7 @@ static int arp_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_puts(seq, "IP address HW type Flags " "HW address Mask Device\n"); else { diff -urN linux-2.6.0-test4/net/ipv4/fib_hash.c SEQ_START_TOKEN/net/ipv4/fib_hash.c -- linux-2.6.0-test4/net/ipv4/fib_hash.c 2003-08-22 16:55:42.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/fib_hash.c 2003-09-04 20:06:39.000000000 -0700 @@ -979,14 +979,14 @@ read_lock(&fib_hash_lock); if (ip_fib_main_table) - v = *pos ? fib_get_next(seq) : (void *)1; + v = *pos ? fib_get_next(seq) : SEQ_START_TOKEN; return v; } static void *fib_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return v == (void *)1 ? fib_get_first(seq) : fib_get_next(seq); + return v == SEQ_START_TOKEN ? fib_get_first(seq) : fib_get_next(seq); } static void fib_seq_stop(struct seq_file *seq, void *v) @@ -1025,7 +1025,7 @@ struct fib_node *f; struct fib_info *fi; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "%-127s\n", "Iface\tDestination\tGateway " "\tFlags\tRefCnt\tUse\tMetric\tMask\t\tMTU" "\tWindow\tIRTT"); diff -urN linux-2.6.0-test4/net/ipv4/igmp.c SEQ_START_TOKEN/net/ipv4/igmp.c -- linux-2.6.0-test4/net/ipv4/igmp.c 2003-09-02 12:52:45.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/igmp.c 2003-09-04 20:08:40.000000000 -0700 @@ -2162,13 +2162,13 @@ static void *igmp_mc_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp_mc_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp_mc_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *igmp_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct ip_mc_list *im; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) im = igmp_mc_get_first(seq); else im = igmp_mc_get_next(seq, v); @@ -2190,7 +2190,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "Idx\tDevice : Count Querier\tGroup Users Timer\tReporter\n"); else { @@ -2337,13 +2337,13 @@ static void *igmp_mcf_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp_mcf_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp_mcf_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *igmp_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct ip_sf_list *psf; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) psf = igmp_mcf_get_first(seq); else psf = igmp_mcf_get_next(seq, v); @@ -2372,7 +2372,7 @@ struct ip_sf_list *psf = (struct ip_sf_list *)v; struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "%3s %6s " "%10s %10s %6s %6s\n", "Idx", diff -urN linux-2.6.0-test4/net/ipv4/raw.c SEQ_START_TOKEN/net/ipv4/raw.c -- linux-2.6.0-test4/net/ipv4/raw.c 2003-08-22 16:56:34.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/raw.c 2003-09-04 20:06:37.000000000 -0700 @@ -736,14 +736,14 @@ static void *raw_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&raw_v4_lock); - return *pos ? raw_get_idx(seq, *pos) : (void *)1; + return *pos ? raw_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct sock *sk; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) sk = raw_get_first(seq); else sk = raw_get_next(seq, v); @@ -778,7 +778,7 @@ { char tmpbuf[129]; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "%-127s\n", " sl local_address rem_address st tx_queue " "rx_queue tr tm->when retrnsmt uid timeout " diff -urN linux-2.6.0-test4/net/ipv4/route.c SEQ_START_TOKEN/net/ipv4/route.c -- linux-2.6.0-test4/net/ipv4/route.c 2003-09-02 12:52:46.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/route.c 2003-09-04 20:29:01.000000000 -0700 @@ -259,14 +259,14 @@ static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? rt_cache_get_idx(seq, *pos) : (void *)1; + return *pos ? rt_cache_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct rtable *r = NULL; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) r = rt_cache_get_first(seq); else r = rt_cache_get_next(seq, v); @@ -276,13 +276,13 @@ static void rt_cache_seq_stop(struct seq_file *seq, void *v) { - if (v && v != (void *)1) + if (v && v != SEQ_START_TOKEN) rcu_read_unlock(); } static int rt_cache_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "%-127s\n", "Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\t" "Metric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\t" diff -urN linux-2.6.0-test4/net/ipv4/tcp_ipv4.c SEQ_START_TOKEN/net/ipv4/tcp_ipv4.c -- linux-2.6.0-test4/net/ipv4/tcp_ipv4.c 2003-08-22 16:53:54.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/tcp_ipv4.c 2003-09-04 20:52:09.000000000 -0700 @@ -2351,7 +2351,7 @@ static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? tcp_get_idx(seq, *pos - 1) : (void *)1; + return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } static void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -2359,7 +2359,7 @@ void *rc = NULL; struct tcp_iter_state* st; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { rc = tcp_get_idx(seq, 0); goto out; } @@ -2397,7 +2397,7 @@ read_unlock_bh(&tp->syn_wait_lock); } case TCP_SEQ_STATE_LISTENING: - if (v != (void *)1) + if (v != SEQ_START_TOKEN) tcp_listen_unlock(); break; case TCP_SEQ_STATE_TIME_WAIT: @@ -2559,7 +2559,7 @@ struct tcp_iter_state* st; char tmpbuf[TMPSZ + 1]; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "%-*s\n", TMPSZ - 1, " sl local_address rem_address st tx_queue " "rx_queue tr tm->when retrnsmt uid timeout " diff -urN linux-2.6.0-test4/net/ipv4/udp.c SEQ_START_TOKEN/net/ipv4/udp.c -- linux-2.6.0-test4/net/ipv4/udp.c 2003-08-22 16:52:55.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv4/udp.c 2003-09-04 19:58:50.000000000 -0700 @@ -1380,7 +1380,7 @@ static void *udp_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&udp_hash_lock); - return *pos ? udp_get_bucket(seq, pos) : (void *)1; + return *pos ? udp_get_bucket(seq, pos) : SEQ_START_TOKEN; } static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -1389,7 +1389,7 @@ struct hlist_node *node; struct udp_iter_state *state; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { sk = udp_get_bucket(seq, pos); goto out; } @@ -1496,7 +1496,7 @@ static int udp4_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "%-127s\n", " sl local_address rem_address st tx_queue " "rx_queue tr tm->when retrnsmt uid timeout " diff -urN linux-2.6.0-test4/net/ipv6/addrconf.c SEQ_START_TOKEN/net/ipv6/addrconf.c -- linux-2.6.0-test4/net/ipv6/addrconf.c 2003-08-22 17:00:35.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/addrconf.c 2003-09-04 20:17:07.000000000 -0700 @@ -2171,7 +2171,7 @@ static void *if6_seq_start(struct seq_file *seq, loff_t *pos) { read_lock_bh(&addrconf_hash_lock); - return *pos ? if6_get_bucket(seq, pos) : (void *)1; + return *pos ? if6_get_bucket(seq, pos) : SEQ_START_TOKEN; } static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -2179,7 +2179,7 @@ struct inet6_ifaddr *ifa; struct if6_iter_state *state; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { ifa = if6_get_bucket(seq, pos); goto out; } @@ -2215,7 +2215,7 @@ static int if6_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) return 0; else if6_iface_seq_show(seq, v); diff -urN linux-2.6.0-test4/net/ipv6/ip6_flowlabel.c SEQ_START_TOKEN/net/ipv6/ip6_flowlabel.c -- linux-2.6.0-test4/net/ipv6/ip6_flowlabel.c 2003-08-22 16:53:09.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/ip6_flowlabel.c 2003-09-04 20:15:36.000000000 -0700 @@ -599,14 +599,14 @@ static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos) { read_lock_bh(&ip6_fl_lock); - return *pos ? ip6fl_get_idx(seq, *pos) : (void *)1; + return *pos ? ip6fl_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *ip6fl_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct ip6_flowlabel *fl; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) fl = ip6fl_get_first(seq); else fl = ip6fl_get_next(seq, v); @@ -640,7 +640,7 @@ static int ip6fl_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, "Label S Owner Users Linger Expires " "Dst Opt\n"); else diff -urN linux-2.6.0-test4/net/ipv6/mcast.c SEQ_START_TOKEN/net/ipv6/mcast.c -- linux-2.6.0-test4/net/ipv6/mcast.c 2003-09-02 12:52:46.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/mcast.c 2003-09-04 20:29:18.000000000 -0700 @@ -2278,13 +2278,13 @@ static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp6_mcf_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp6_mcf_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *igmp6_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct ip6_sf_list *psf; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) psf = igmp6_mcf_get_first(seq); else psf = igmp6_mcf_get_next(seq, v); @@ -2313,7 +2313,7 @@ struct ip6_sf_list *psf = (struct ip6_sf_list *)v; struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "%3s %6s " "%32s %32s %6s %6s\n", "Idx", diff -urN linux-2.6.0-test4/net/ipv6/raw.c SEQ_START_TOKEN/net/ipv6/raw.c -- linux-2.6.0-test4/net/ipv6/raw.c 2003-08-22 16:54:29.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/raw.c 2003-09-04 20:15:32.000000000 -0700 @@ -961,14 +961,14 @@ static void *raw6_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&raw_v6_lock); - return *pos ? raw6_get_idx(seq, *pos) : (void *)1; + return *pos ? raw6_get_idx(seq, *pos) : SEQ_START_TOKEN; } static void *raw6_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct sock *sk; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) sk = raw6_get_first(seq); else sk = raw6_get_next(seq, v); @@ -1010,7 +1010,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, " sl " "local_address " diff -urN linux-2.6.0-test4/net/ipv6/tcp_ipv6.c SEQ_START_TOKEN/net/ipv6/tcp_ipv6.c -- linux-2.6.0-test4/net/ipv6/tcp_ipv6.c 2003-08-22 16:56:34.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/tcp_ipv6.c 2003-09-04 20:17:17.000000000 -0700 @@ -2027,7 +2027,7 @@ { struct tcp_iter_state *st; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, " sl " "local_address " diff -urN linux-2.6.0-test4/net/ipv6/udp.c SEQ_START_TOKEN/net/ipv6/udp.c -- linux-2.6.0-test4/net/ipv6/udp.c 2003-08-22 16:58:49.000000000 -0700 +++ SEQ_START_TOKEN/net/ipv6/udp.c 2003-09-04 20:17:13.000000000 -0700 @@ -1113,7 +1113,7 @@ static int udp6_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) + if (v == SEQ_START_TOKEN) seq_printf(seq, " sl " "local_address " diff -urN linux-2.6.0-test4/net/ipx/ipx_proc.c SEQ_START_TOKEN/net/ipx/ipx_proc.c -- linux-2.6.0-test4/net/ipx/ipx_proc.c 2003-08-22 16:50:53.000000000 -0700 +++ SEQ_START_TOKEN/net/ipx/ipx_proc.c 2003-09-04 20:13:59.000000000 -0700 @@ -39,7 +39,7 @@ loff_t l = *pos; spin_lock_bh(&ipx_interfaces_lock); - return l ? ipx_get_interface_idx(--l) : (void *)1; + return l ? ipx_get_interface_idx(--l) : SEQ_START_TOKEN; } static void *ipx_seq_interface_next(struct seq_file *seq, void *v, loff_t *pos) @@ -47,7 +47,7 @@ struct ipx_interface *i; ++*pos; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) i = ipx_interfaces_head(); else i = ipx_interfaces_next(v); @@ -63,7 +63,7 @@ { struct ipx_interface *i; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Network Node_Address Primary Device " "Frame_Type"); #ifdef IPX_REFCNT_DEBUG @@ -123,7 +123,7 @@ { loff_t l = *pos; read_lock_bh(&ipx_routes_lock); - return l ? ipx_get_route_idx(--l) : (void *)1; + return l ? ipx_get_route_idx(--l) : SEQ_START_TOKEN; } static void *ipx_seq_route_next(struct seq_file *seq, void *v, loff_t *pos) @@ -131,7 +131,7 @@ struct ipx_route *r; ++*pos; - if (v == (void *)1) + if (v == SEQ_START_TOKEN) r = ipx_routes_head(); else r = ipx_routes_next(v); @@ -147,7 +147,7 @@ { struct ipx_route *rt; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Network Router_Net Router_Node\n"); goto out; } @@ -195,7 +195,7 @@ loff_t l = *pos; spin_lock_bh(&ipx_interfaces_lock); - return l ? ipx_get_socket_idx(--l) : (void *)1; + return l ? ipx_get_socket_idx(--l) : SEQ_START_TOKEN; } static void *ipx_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) @@ -205,7 +205,7 @@ struct ipx_opt *ipxs; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { sk = NULL; i = ipx_interfaces_head(); if (!i) @@ -245,7 +245,7 @@ struct sock *s; struct ipx_opt *ipxs; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { #ifdef CONFIG_IPX_INTERN seq_puts(seq, "Local_Address " "Remote_Address Tx_Queue " diff -urN linux-2.6.0-test4/net/llc/llc_proc.c SEQ_START_TOKEN/net/llc/llc_proc.c -- linux-2.6.0-test4/net/llc/llc_proc.c 2003-09-02 12:52:46.000000000 -0700 +++ SEQ_START_TOKEN/net/llc/llc_proc.c 2003-09-04 20:11:06.000000000 -0700 @@ -67,7 +67,7 @@ loff_t l = *pos; read_lock_bh(&llc_main_station.sap_list.lock); - return l ? llc_get_sk_idx(--l) : (void *)1; + return l ? llc_get_sk_idx(--l) : SEQ_START_TOKEN; } static void *llc_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -77,7 +77,7 @@ struct llc_sap *sap; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { sk = llc_get_sk_idx(0); goto out; } @@ -123,7 +123,7 @@ struct sock* sk; struct llc_opt *llc; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "SKt Mc local_mac_sap remote_mac_sap " " tx_queue rx_queue st uid link\n"); goto out; @@ -172,7 +172,7 @@ struct sock* sk; struct llc_opt *llc; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Connection list:\n" "dsap state retr txw rxw pf ff sf df rs cs " "tack tpfc trs tbs blog busr\n"); diff -urN linux-2.6.0-test4/net/rxrpc/proc.c SEQ_START_TOKEN/net/rxrpc/proc.c -- linux-2.6.0-test4/net/rxrpc/proc.c 2003-08-22 16:57:07.000000000 -0700 +++ SEQ_START_TOKEN/net/rxrpc/proc.c 2003-09-04 20:30:33.000000000 -0700 @@ -226,7 +226,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -248,7 +248,7 @@ (*pos)++; _p = v; - _p = v==(void*)1 ? rxrpc_proc_transports.next : _p->next; + _p = v==SEQ_START_TOKEN ? rxrpc_proc_transports.next : _p->next; return _p!=&rxrpc_proc_transports ? _p : NULL; } /* end rxrpc_proc_transports_next() */ @@ -272,7 +272,7 @@ struct rxrpc_transport *trans = list_entry(v,struct rxrpc_transport,proc_link); /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "LOCAL USE\n"); return 0; } @@ -319,7 +319,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -341,7 +341,7 @@ (*pos)++; _p = v; - _p = v==(void*)1 ? rxrpc_peers.next : _p->next; + _p = v==SEQ_START_TOKEN ? rxrpc_peers.next : _p->next; return _p!=&rxrpc_peers ? _p : NULL; } /* end rxrpc_proc_peers_next() */ @@ -366,7 +366,7 @@ signed long timeout; /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m,"LOCAL REMOTE USAGE CONNS TIMEOUT MTU RTT(uS)\n"); return 0; } @@ -422,7 +422,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -444,7 +444,7 @@ (*pos)++; _p = v; - _p = v==(void*)1 ? rxrpc_conns.next : _p->next; + _p = v==SEQ_START_TOKEN ? rxrpc_conns.next : _p->next; return _p!=&rxrpc_conns ? _p : NULL; } /* end rxrpc_proc_conns_next() */ @@ -469,7 +469,7 @@ signed long timeout; /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "LOCAL REMOTE RPORT SRVC CONN END SERIALNO CALLNO MTU TIMEOUT" "\n"); @@ -530,7 +530,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -552,7 +552,7 @@ (*pos)++; _p = v; - _p = v==(void*)1 ? rxrpc_calls.next : _p->next; + _p = v==SEQ_START_TOKEN ? rxrpc_calls.next : _p->next; return _p!=&rxrpc_calls ? _p : NULL; } /* end rxrpc_proc_calls_next() */ @@ -576,7 +576,7 @@ struct rxrpc_call *call = list_entry(v,struct rxrpc_call,call_link); /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "LOCAL REMOT SRVC CONN CALL DIR USE " " L STATE OPCODE ABORT ERRNO\n" diff -urN linux-2.6.0-test4/net/sunrpc/cache.c SEQ_START_TOKEN/net/sunrpc/cache.c -- linux-2.6.0-test4/net/sunrpc/cache.c 2003-08-22 16:56:58.000000000 -0700 +++ SEQ_START_TOKEN/net/sunrpc/cache.c 2003-09-04 20:11:09.000000000 -0700 @@ -1035,7 +1035,7 @@ read_lock(&cd->hash_lock); if (!n--) - return (void *)1; + return SEQ_START_TOKEN; hash = n >> 32; entry = n & ((1LL<<32) - 1); @@ -1060,7 +1060,7 @@ int hash = (*pos >> 32); struct cache_detail *cd = ((struct handle*)m->private)->cd; - if (p == (void *)1) + if (p == SEQ_START_TOKEN) hash = 0; else if (ch->next == NULL) { hash++; @@ -1092,7 +1092,7 @@ struct cache_head *cp = p; struct cache_detail *cd = ((struct handle*)m->private)->cd; - if (p == (void *)1) + if (p == SEQ_START_TOKEN) return cd->cache_show(m, cd, NULL); ifdebug(CACHE) diff -urN linux-2.6.0-test4/net/wanrouter/wanproc.c SEQ_START_TOKEN/net/wanrouter/wanproc.c -- linux-2.6.0-test4/net/wanrouter/wanproc.c 2003-08-22 16:55:39.000000000 -0700 +++ SEQ_START_TOKEN/net/wanrouter/wanproc.c 2003-09-04 20:29:56.000000000 -0700 @@ -86,7 +86,7 @@ lock_kernel(); if (!l--) - return (void *)1; + return SEQ_START_TOKEN; for (wandev = wanrouter_router_devlist; l-- && wandev; wandev = wandev->next) ; @@ -97,7 +97,7 @@ { struct wan_device *wandev = v; (*pos)++; - return (v == (void *)1) ? wanrouter_router_devlist : wandev->next; + return (v == SEQ_START_TOKEN) ? wanrouter_router_devlist : wandev->next; } static void r_stop(struct seq_file *m, void *v) @@ -108,7 +108,7 @@ static int config_show(struct seq_file *m, void *v) { struct wan_device *p = v; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "Device name | port |IRQ|DMA| mem.addr |" "mem.size|option1|option2|option3|option4\n"); return 0; @@ -124,7 +124,7 @@ static int status_show(struct seq_file *m, void *v) { struct wan_device *p = v; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "Device name |protocol|station|interface|" "clocking|baud rate| MTU |ndev|link state\n"); return 0; diff -urN linux-2.6.0-test4/net/x25/x25_proc.c SEQ_START_TOKEN/net/x25/x25_proc.c -- linux-2.6.0-test4/net/x25/x25_proc.c 2003-08-22 16:52:54.000000000 -0700 +++ SEQ_START_TOKEN/net/x25/x25_proc.c 2003-09-04 20:29:43.000000000 -0700 @@ -44,7 +44,7 @@ loff_t l = *pos; read_lock_bh(&x25_route_list_lock); - return l ? x25_get_route_idx(--l) : (void *)1; + return l ? x25_get_route_idx(--l) : SEQ_START_TOKEN; } static void *x25_seq_route_next(struct seq_file *seq, void *v, loff_t *pos) @@ -52,7 +52,7 @@ struct x25_route *rt; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { rt = NULL; if (!list_empty(&x25_route_list)) rt = list_entry(x25_route_list.next, @@ -77,7 +77,7 @@ { struct x25_route *rt; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Address Digits Device\n"); goto out; } @@ -108,7 +108,7 @@ loff_t l = *pos; read_lock_bh(&x25_list_lock); - return l ? x25_get_socket_idx(--l) : (void *)1; + return l ? x25_get_socket_idx(--l) : SEQ_START_TOKEN; } static void *x25_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) @@ -116,7 +116,7 @@ struct sock *s; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { s = sk_head(&x25_list); goto out; } @@ -137,7 +137,7 @@ struct net_device *dev; const char *devname; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "dest_addr src_addr dev lci st vs vr " "va t t2 t21 t22 t23 Snd-Q Rcv-Q inode\n"); goto out; From joe@perches.com Fri Sep 5 18:47:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:48:03 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861lSx4028639 for ; Fri, 5 Sep 2003 18:47:29 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13362; Fri, 5 Sep 2003 19:37:06 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN arch/* (3/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812848.16851.167.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:47:28 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5657 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev diff -urN linux-2.6.0-test4/arch/arm/kernel/setup.c SEQ_START_TOKEN/arch/arm/kernel/setup.c -- linux-2.6.0-test4/arch/arm/kernel/setup.c 2003-08-22 16:56:28.000000000 -0700 +++ SEQ_START_TOKEN/arch/arm/kernel/setup.c 2003-09-04 19:47:27.000000000 -0700 @@ -824,7 +824,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < 1 ? (void *)1 : NULL; + return *pos < 1 ? SEQ_START_TOKEN : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) diff -urN linux-2.6.0-test4/arch/arm26/kernel/setup.c SEQ_START_TOKEN/arch/arm26/kernel/setup.c -- linux-2.6.0-test4/arch/arm26/kernel/setup.c 2003-09-02 12:52:32.000000000 -0700 +++ SEQ_START_TOKEN/arch/arm26/kernel/setup.c 2003-09-04 19:47:50.000000000 -0700 @@ -537,7 +537,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < 1 ? (void *)1 : NULL; + return *pos < 1 ? SEQ_START_TOKEN : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) diff -urN linux-2.6.0-test4/arch/cris/kernel/setup.c SEQ_START_TOKEN/arch/cris/kernel/setup.c -- linux-2.6.0-test4/arch/cris/kernel/setup.c 2003-08-22 16:59:39.000000000 -0700 +++ SEQ_START_TOKEN/arch/cris/kernel/setup.c 2003-09-04 19:47:55.000000000 -0700 @@ -170,7 +170,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) { /* We only got one CPU... */ - return *pos < 1 ? (void *)1 : NULL; + return *pos < 1 ? SEQ_START_TOKEN : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) diff -urN linux-2.6.0-test4/arch/m68k/kernel/setup.c SEQ_START_TOKEN/arch/m68k/kernel/setup.c -- linux-2.6.0-test4/arch/m68k/kernel/setup.c 2003-08-22 17:00:51.000000000 -0700 +++ SEQ_START_TOKEN/arch/m68k/kernel/setup.c 2003-09-04 19:47:42.000000000 -0700 @@ -480,7 +480,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < 1 ? (void *)1 : NULL; + return *pos < 1 ? SEQ_START_TOKEN : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { diff -urN linux-2.6.0-test4/arch/parisc/kernel/setup.c SEQ_START_TOKEN/arch/parisc/kernel/setup.c -- linux-2.6.0-test4/arch/parisc/kernel/setup.c 2003-08-22 17:01:28.000000000 -0700 +++ SEQ_START_TOKEN/arch/parisc/kernel/setup.c 2003-09-04 19:47:04.000000000 -0700 @@ -163,7 +163,7 @@ * through CPUs for example. Since we print all cpu info in our * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above) * we only allow for one "position". */ - return ((long)*pos < 1) ? (void *)1 : NULL; + return ((long)*pos < 1) ? SEQ_START_TOKEN : NULL; } static void * From joe@perches.com Fri Sep 5 18:47:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:48:17 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861lhx4028679 for ; Fri, 5 Sep 2003 18:47:43 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13366; Fri, 5 Sep 2003 19:37:20 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN drivers/md (4/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812862.16851.169.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:47:42 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5658 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev diff -urN linux-2.6.0-test4/drivers/md/md.c SEQ_START_TOKEN/drivers/md/md.c -- linux-2.6.0-test4/drivers/md/md.c 2003-09-02 12:52:39.000000000 -0700 +++ SEQ_START_TOKEN/drivers/md/md.c 2003-09-04 19:50:46.000000000 -0700 @@ -2858,7 +2858,7 @@ return NULL; if (!l--) /* header */ - return (void*)1; + return SEQ_START_TOKEN; spin_lock(&all_mddevs_lock); list_for_each(tmp,&all_mddevs) @@ -2884,7 +2884,7 @@ return NULL; spin_lock(&all_mddevs_lock); - if (v == (void*)1) + if (v == SEQ_START_TOKEN) tmp = all_mddevs.next; else tmp = mddev->all_mddevs.next; @@ -2896,7 +2896,7 @@ } spin_unlock(&all_mddevs_lock); - if (v != (void*)1) + if (v != SEQ_START_TOKEN) mddev_put(mddev); return next_mddev; @@ -2906,7 +2906,7 @@ { mddev_t *mddev = v; - if (mddev && v != (void*)1 && v != (void*)2) + if (mddev && v != SEQ_START_TOKEN && v != (void*)2) mddev_put(mddev); } @@ -2918,7 +2918,7 @@ mdk_rdev_t *rdev; int i; - if (v == (void*)1) { + if (v == SEQ_START_TOKEN) { seq_printf(seq, "Personalities : "); spin_lock(&pers_lock); for (i = 0; i < MAX_PERSONALITY; i++) From joe@perches.com Fri Sep 5 18:48:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:48:24 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861mAx4028878 for ; Fri, 5 Sep 2003 18:48:11 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13376; Fri, 5 Sep 2003 19:37:48 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN drivers/net (5/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812890.16851.171.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:48:10 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5659 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev diff -urN linux-2.6.0-test4/drivers/net/pppoe.c SEQ_START_TOKEN/drivers/net/pppoe.c -- linux-2.6.0-test4/drivers/net/pppoe.c 2003-08-22 16:57:18.000000000 -0700 +++ SEQ_START_TOKEN/drivers/net/pppoe.c 2003-09-04 19:46:59.000000000 -0700 @@ -986,7 +986,7 @@ struct pppox_opt *po; char *dev_name; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(seq, "Id Address Device\n"); goto out; } @@ -1025,7 +1025,7 @@ loff_t l = *pos; read_lock_bh(&pppoe_hash_lock); - return l ? pppoe_get_idx(--l) : (void *)1; + return l ? pppoe_get_idx(--l) : SEQ_START_TOKEN; } static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -1033,7 +1033,7 @@ struct pppox_opt *po; ++*pos; - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { po = pppoe_get_idx(0); goto out; } From joe@perches.com Fri Sep 5 18:48:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 05 Sep 2003 18:48:59 -0700 (PDT) Received: from Perches.com (DSL022.LABridge.com [206.117.136.22]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h861mNx4029073 for ; Fri, 5 Sep 2003 18:48:23 -0700 Received: from [192.168.1.128] (local128.perches.com [192.168.1.128]) by Perches.com (8.9.3/8.9.3) with ESMTP id TAA13387; Fri, 5 Sep 2003 19:38:00 -0700 Subject: [PATCH] 2.6.0-test4 SEQ_START_TOKEN fs/* (6/6) From: Joe Perches To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Content-Type: text/plain Message-Id: <1062812902.16851.173.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 18:48:23 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 5660 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: joe@perches.com Precedence: bulk X-list: netdev diff -urN linux-2.6.0-test4/fs/afs/proc.c SEQ_START_TOKEN/fs/afs/proc.c -- linux-2.6.0-test4/fs/afs/proc.c 2003-08-22 16:53:39.000000000 -0700 +++ SEQ_START_TOKEN/fs/afs/proc.c 2003-09-04 20:13:29.000000000 -0700 @@ -188,7 +188,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -210,7 +210,7 @@ (*pos)++; _p = v; - _p = v==(void*)1 ? afs_proc_cells.next : _p->next; + _p = v==SEQ_START_TOKEN ? afs_proc_cells.next : _p->next; return _p!=&afs_proc_cells ? _p : NULL; } /* end afs_proc_cells_next() */ @@ -234,7 +234,7 @@ afs_cell_t *cell = list_entry(v,afs_cell_t,proc_link); /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "USE NAME\n"); return 0; } @@ -432,7 +432,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -457,7 +457,7 @@ (*_pos)++; _p = v; - _p = v==(void*)1 ? cell->vl_list.next : _p->next; + _p = v==SEQ_START_TOKEN ? cell->vl_list.next : _p->next; return _p!=&cell->vl_list ? _p : NULL; } /* end afs_proc_cell_volumes_next() */ @@ -483,7 +483,7 @@ afs_vlocation_t *vlocation = list_entry(v,afs_vlocation_t,link); /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "USE VLID[0] VLID[1] VLID[2] NAME\n"); return 0; } @@ -556,7 +556,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; if (pos>=cell->vl_naddrs) @@ -673,7 +673,7 @@ /* allow for the header line */ if (!pos) - return (void *)1; + return SEQ_START_TOKEN; pos--; /* find the n'th element in the list */ @@ -698,7 +698,7 @@ (*_pos)++; _p = v; - _p = v==(void*)1 ? cell->sv_list.next : _p->next; + _p = v==SEQ_START_TOKEN ? cell->sv_list.next : _p->next; return _p!=&cell->sv_list ? _p : NULL; } /* end afs_proc_cell_servers_next() */ @@ -725,7 +725,7 @@ char ipaddr[20]; /* display header on line 1 */ - if (v == (void *)1) { + if (v == SEQ_START_TOKEN) { seq_puts(m, "USE ADDR STATE\n"); return 0; } diff -urN linux-2.6.0-test4/fs/nfsd/export.c SEQ_START_TOKEN/fs/nfsd/export.c -- linux-2.6.0-test4/fs/nfsd/export.c 2003-08-22 16:57:00.000000000 -0700 +++ SEQ_START_TOKEN/fs/nfsd/export.c 2003-09-04 19:51:24.000000000 -0700 @@ -935,7 +935,7 @@ exp_readlock(); read_lock(&svc_export_cache.hash_lock); if (!n--) - return (void *)1; + return SEQ_START_TOKEN; hash = n >> 32; export = n & ((1LL<<32) - 1); @@ -959,7 +959,7 @@ struct cache_head *ch = p; int hash = (*pos >> 32); - if (p == (void *)1) + if (p == SEQ_START_TOKEN) hash = 0; else if (ch->next == NULL) { hash++; @@ -1029,7 +1029,7 @@ struct svc_export *exp = container_of(cp, struct svc_export, h); svc_client *clp; - if (p == (void *)1) { + if (p == SEQ_START_TOKEN) { seq_puts(m, "# Version 1.1\n"); seq_puts(m, "# Path Client(Flags) # IPs\n"); return 0; From yoshfuji@linux-ipv6.org Sat Sep 6 00:04:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 00:04:55 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8674Ix4016693 for ; Sat, 6 Sep 2003 00:04:22 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h8674w1M018639; Sat, 6 Sep 2003 16:04:58 +0900 Date: Sat, 06 Sep 2003 16:04:58 +0900 (JST) Message-Id: <20030906.160458.39800982.yoshfuji@linux-ipv6.org> To: davem@redhat.com, netdev@oss.sgi.com CC: yoshfuji@linux-ipv6.org Subject: Re: /proc/net/* read drops data From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: <20030904004638.1d4b001d.davem@redhat.com> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5661 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev In article (at Thu, 4 Sep 2003 12:25:16 -0400 (EDT)), Ricky Beam says: > >This fix looks good to me. Applied. > > The list: > (file) (bs=1) (bs=10000) > /proc/net/igmp 122 191 > /proc/net/route 128 384 > /proc/net/rt_acct 0 4096 > /proc/net/rt_cache 384 512 > /proc/net/tcp 1800 1950 > /proc/net/udp 1024 1152 Well, I'm about to post 3 patches. [1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data [2/3] /proc/net/if_inet6 may drop some data [3/3] clean up /proc/net/{anycast6,igmp6} Note 0: These confilct with SEQ_START_TOKEN patches; I'll regenerate if SEQ_START_TOKEN accepted. Note 1: /proc/net/rt_acct does not use seq_file Note 2: /proc/net/{route,tcp,tcp6} is not fixed by these -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From yoshfuji@linux-ipv6.org Sat Sep 6 00:10:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 00:10:39 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h867A3x4017325 for ; Sat, 6 Sep 2003 00:10:04 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h867Ai1M018705; Sat, 6 Sep 2003 16:10:44 +0900 Date: Sat, 06 Sep 2003 16:10:44 +0900 (JST) Message-Id: <20030906.161044.46842553.yoshfuji@linux-ipv6.org> To: davem@redhat.com, netdev@oss.sgi.com Cc: yoshfuji@linux-ipv6.org Subject: [PATCH 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data (Re: /proc/net/* read drops data) From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030906.160458.39800982.yoshfuji@linux-ipv6.org> References: <20030904004638.1d4b001d.davem@redhat.com> <20030906.160458.39800982.yoshfuji@linux-ipv6.org> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5662 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data Index: linux-2.6/net/ipv4/igmp.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/igmp.c,v retrieving revision 1.34 diff -u -r1.34 igmp.c --- linux-2.6/net/ipv4/igmp.c 1 Sep 2003 05:52:50 -0000 1.34 +++ linux-2.6/net/ipv4/igmp.c 6 Sep 2003 04:23:07 -0000 @@ -2162,7 +2162,7 @@ static void *igmp_mc_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp_mc_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp_mc_get_idx(seq, *pos - 1) : (void *)1; } static void *igmp_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos) @@ -2337,7 +2337,7 @@ static void *igmp_mcf_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp_mcf_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp_mcf_get_idx(seq, *pos - 1) : (void *)1; } static void *igmp_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv4/raw.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/raw.c,v retrieving revision 1.35 diff -u -r1.35 raw.c --- linux-2.6/net/ipv4/raw.c 11 Jul 2003 04:06:16 -0000 1.35 +++ linux-2.6/net/ipv4/raw.c 6 Sep 2003 04:23:07 -0000 @@ -736,7 +736,7 @@ static void *raw_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&raw_v4_lock); - return *pos ? raw_get_idx(seq, *pos) : (void *)1; + return *pos ? raw_get_idx(seq, *pos - 1) : (void *)1; } static void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv4/route.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/route.c,v retrieving revision 1.58 diff -u -r1.58 route.c --- linux-2.6/net/ipv4/route.c 1 Sep 2003 05:52:50 -0000 1.58 +++ linux-2.6/net/ipv4/route.c 6 Sep 2003 04:23:07 -0000 @@ -259,7 +259,7 @@ static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) { - return *pos ? rt_cache_get_idx(seq, *pos) : (void *)1; + return *pos ? rt_cache_get_idx(seq, *pos - 1) : (void *)1; } static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv6/ip6_flowlabel.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/ip6_flowlabel.c,v retrieving revision 1.8 diff -u -r1.8 ip6_flowlabel.c --- linux-2.6/net/ipv6/ip6_flowlabel.c 2 Sep 2003 14:48:07 -0000 1.8 +++ linux-2.6/net/ipv6/ip6_flowlabel.c 6 Sep 2003 04:23:07 -0000 @@ -603,7 +603,7 @@ static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos) { read_lock_bh(&ip6_fl_lock); - return *pos ? ip6fl_get_idx(seq, *pos) : (void *)1; + return *pos ? ip6fl_get_idx(seq, *pos - 1) : (void *)1; } static void *ip6fl_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv6/mcast.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v retrieving revision 1.31 diff -u -r1.31 mcast.c --- linux-2.6/net/ipv6/mcast.c 1 Sep 2003 05:52:50 -0000 1.31 +++ linux-2.6/net/ipv6/mcast.c 6 Sep 2003 04:23:07 -0000 @@ -2278,7 +2278,7 @@ static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp6_mcf_get_idx(seq, *pos) : (void *)1; + return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : (void *)1; } static void *igmp6_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv6/raw.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/raw.c,v retrieving revision 1.37 diff -u -r1.37 raw.c --- linux-2.6/net/ipv6/raw.c 18 Aug 2003 10:14:52 -0000 1.37 +++ linux-2.6/net/ipv6/raw.c 6 Sep 2003 04:23:07 -0000 @@ -961,7 +961,7 @@ static void *raw6_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&raw_v6_lock); - return *pos ? raw6_get_idx(seq, *pos) : (void *)1; + return *pos ? raw6_get_idx(seq, *pos - 1) : (void *)1; } static void *raw6_seq_next(struct seq_file *seq, void *v, loff_t *pos) -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From yoshfuji@linux-ipv6.org Sat Sep 6 00:10:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 00:10:41 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h867A7x4017336 for ; Sat, 6 Sep 2003 00:10:08 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h867Am1M018711; Sat, 6 Sep 2003 16:10:48 +0900 Date: Sat, 06 Sep 2003 16:10:48 +0900 (JST) Message-Id: <20030906.161048.102426251.yoshfuji@linux-ipv6.org> To: davem@redhat.com, netdev@oss.sgi.com Cc: yoshfuji@linux-ipv6.org Subject: [PATCH 2/3] /proc/net/if_inet6 may drop some data (Re: /proc/net/* read drops data) From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030906.160458.39800982.yoshfuji@linux-ipv6.org> References: <20030904004638.1d4b001d.davem@redhat.com> <20030906.160458.39800982.yoshfuji@linux-ipv6.org> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5663 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [2/3] /proc/net/if_inet6 may drop some data Index: linux-2.6/net/ipv6/addrconf.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/addrconf.c,v retrieving revision 1.52 diff -u -r1.52 addrconf.c --- linux-2.6/net/ipv6/addrconf.c 4 Sep 2003 15:47:07 -0000 1.52 +++ linux-2.6/net/ipv6/addrconf.c 6 Sep 2003 04:23:07 -0000 @@ -2149,59 +2149,65 @@ int bucket; }; -static inline struct inet6_ifaddr *if6_get_bucket(struct seq_file *seq, loff_t *pos) +static struct inet6_ifaddr *if6_get_first(struct seq_file *seq) { - int i; struct inet6_ifaddr *ifa = NULL; - loff_t l = *pos; struct if6_iter_state *state = seq->private; - for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) - for (i = 0, ifa = inet6_addr_lst[state->bucket]; ifa; ++i, ifa=ifa->lst_next) { - if (l--) - continue; - *pos = i; - goto out; - } -out: + for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { + ifa = inet6_addr_lst[state->bucket]; + if (ifa) + break; + } + return ifa; +} + +static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa) +{ + struct if6_iter_state *state = seq->private; + + ifa = ifa->lst_next; +try_again: + if (!ifa && ++state->bucket < IN6_ADDR_HSIZE) { + ifa = inet6_addr_lst[state->bucket]; + goto try_again; + } return ifa; } +static struct inet6_ifaddr *if6_get_idx(struct seq_file *seq, loff_t pos) +{ + struct inet6_ifaddr *ifa = if6_get_first(seq); + + if (ifa) + while(pos && (ifa = if6_get_next(seq, ifa)) != NULL) + --pos; + return pos ? NULL : ifa; +} + static void *if6_seq_start(struct seq_file *seq, loff_t *pos) { read_lock_bh(&addrconf_hash_lock); - return *pos ? if6_get_bucket(seq, pos) : (void *)1; + return if6_get_idx(seq, *pos); } static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct inet6_ifaddr *ifa; - struct if6_iter_state *state; - - if (v == (void *)1) { - ifa = if6_get_bucket(seq, pos); - goto out; - } - - state = seq->private; - - ifa = v; - ifa = ifa->lst_next; - if (ifa) - goto out; - - if (++state->bucket >= IN6_ADDR_HSIZE) - goto out; - *pos = 0; - ifa = if6_get_bucket(seq, pos); -out: + ifa = if6_get_next(seq, v); ++*pos; return ifa; } -static inline void if6_iface_seq_show(struct seq_file *seq, struct inet6_ifaddr *ifp) +static void if6_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock_bh(&addrconf_hash_lock); +} + +static int if6_seq_show(struct seq_file *seq, void *v) { + struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; seq_printf(seq, "%04x%04x%04x%04x%04x%04x%04x%04x %02x %02x %02x %02x %8s\n", NIP6(ifp->addr), @@ -2210,20 +2216,7 @@ ifp->scope, ifp->flags, ifp->idev->dev->name); -} - -static int if6_seq_show(struct seq_file *seq, void *v) -{ - if (v == (void *)1) - return 0; - else - if6_iface_seq_show(seq, v); return 0; -} - -static void if6_seq_stop(struct seq_file *seq, void *v) -{ - read_unlock_bh(&addrconf_hash_lock); } static struct seq_operations if6_seq_ops = { -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From yoshfuji@linux-ipv6.org Sat Sep 6 00:10:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 00:10:45 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h867ACx4017342 for ; Sat, 6 Sep 2003 00:10:12 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h867Ar1M018717; Sat, 6 Sep 2003 16:10:53 +0900 Date: Sat, 06 Sep 2003 16:10:53 +0900 (JST) Message-Id: <20030906.161053.26466972.yoshfuji@linux-ipv6.org> To: davem@redhat.com, netdev@oss.sgi.com Cc: yoshfuji@linux-ipv6.org Subject: [PATCH 3/3] clean up /proc/net/{anycast6,igmp6} (Re: /proc/net/* read drops data) From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030906.160458.39800982.yoshfuji@linux-ipv6.org> References: <20030904004638.1d4b001d.davem@redhat.com> <20030906.160458.39800982.yoshfuji@linux-ipv6.org> Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5664 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [3/3] clean up /proc/net/{anycast6,igmp6} Index: linux-2.6/net/ipv6/anycast.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/anycast.c,v retrieving revision 1.7 diff -u -r1.7 anycast.c --- linux-2.6/net/ipv6/anycast.c 25 Jul 2003 17:11:54 -0000 1.7 +++ linux-2.6/net/ipv6/anycast.c 6 Sep 2003 04:23:07 -0000 @@ -505,7 +505,7 @@ static void *ac6_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? ac6_get_idx(seq, *pos) : ac6_get_first(seq); + return ac6_get_idx(seq, *pos); } static void *ac6_seq_next(struct seq_file *seq, void *v, loff_t *pos) Index: linux-2.6/net/ipv6/mcast.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v retrieving revision 1.31 diff -u -r1.31 mcast.c --- linux-2.6/net/ipv6/mcast.c 1 Sep 2003 05:52:50 -0000 1.31 +++ linux-2.6/net/ipv6/mcast.c 6 Sep 2003 04:23:07 -0000 @@ -2119,7 +2119,7 @@ static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&dev_base_lock); - return *pos ? igmp6_mc_get_idx(seq, *pos) : igmp6_mc_get_first(seq); + return igmp6_mc_get_idx(seq, *pos); } static void *igmp6_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos) -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From moz@compsoc.man.ac.uk Sat Sep 6 01:26:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 01:26:42 -0700 (PDT) Received: from probity.mcc.ac.uk (probity.mcc.ac.uk [130.88.200.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h868Q7x4004903 for ; Sat, 6 Sep 2003 01:26:08 -0700 Received: from compsoc.umu.man.ac.uk ([130.88.22.5] helo=mrtall.compsoc.man.ac.uk ident=exim) by probity.mcc.ac.uk with esmtp (Exim 4.20) id 19vDJb-000HvA-5c; Fri, 05 Sep 2003 10:55:39 +0100 Received: from moz by mrtall.compsoc.man.ac.uk with local (Exim 3.33 #1) id 19vDJb-000Fua-00; Fri, 05 Sep 2003 10:55:39 +0100 Date: Fri, 5 Sep 2003 10:55:39 +0100 From: John Levon To: "David S. Miller" Cc: chas3@users.sourceforge.net, chas@cmf.nrl.navy.mil, netdev@oss.sgi.com Subject: Re: [PATCH][ATM] a few patches from John Levon Message-ID: <20030905095539.GD38861@compsoc.man.ac.uk> References: <200309041917.h84JHrSa020864@ginger.cmf.nrl.navy.mil> <20030905023536.68e808e7.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030905023536.68e808e7.davem@redhat.com> User-Agent: Mutt/1.3.25i X-Url: http://www.movementarian.org/ X-Record: King of Woolworths - L'Illustration Musicale X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19vDJb-000HvA-5c*HzwNdVy0eOM* X-archive-position: 5665 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: levon@movementarian.org Precedence: bulk X-list: netdev On Fri, Sep 05, 2003 at 02:35:36AM -0700, David S. Miller wrote: > All applied, although: > > > # [ATM]: fix atm_dev module refcount bug (from levon@movementarian.org) > > You included this patch twice :-) Hmm, then I think you're missing patch 5 : diff -Naur -X dontdiff linux-cvs/net/atm/pppoatm.c linux-fixes/net/atm/pppoatm.c --- linux-cvs/net/atm/pppoatm.c 2003-08-29 16:57:07.000000000 +0100 +++ linux-fixes/net/atm/pppoatm.c 2003-09-04 10:51:19.000000000 +0100 @@ -341,16 +341,13 @@ return -ENOIOCTLCMD; } -/* the following avoids some spurious warnings from the compiler */ -#define UNUSED __attribute__((unused)) - -static int __init UNUSED pppoatm_init(void) +static int __init pppoatm_init(void) { pppoatm_ioctl_set(pppoatm_ioctl); return 0; } -static void __exit UNUSED pppoatm_exit(void) +static void __exit pppoatm_exit(void) { pppoatm_ioctl_set(NULL); } From moz@compsoc.man.ac.uk Sat Sep 6 04:10:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 04:10:50 -0700 (PDT) Received: from serenity.mcc.ac.uk (serenity.mcc.ac.uk [130.88.200.93]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h86BADx4028706 for ; Sat, 6 Sep 2003 04:10:14 -0700 Received: from compsoc.umu.man.ac.uk ([130.88.22.5] helo=mrtall.compsoc.man.ac.uk ident=exim) by serenity.mcc.ac.uk with esmtp (Exim 4.20) id 19vKjp-0006rp-JU; Fri, 05 Sep 2003 18:51:13 +0100 Received: from moz by mrtall.compsoc.man.ac.uk with local (Exim 3.33 #1) id 19vKjp-000BNU-00; Fri, 05 Sep 2003 18:51:13 +0100 Date: Fri, 5 Sep 2003 18:51:13 +0100 From: John Levon To: netdev@oss.sgi.com, shemminger@osdl.org, linux-atm-general@lists.sourceforge.net Subject: [PATCH] ATM - fix seqfile compile failure Message-ID: <20030905175113.GA40730@compsoc.man.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i X-Url: http://www.movementarian.org/ X-Record: King of Woolworths - L'Illustration Musicale X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19vKjp-0006rp-JU*Tvq5J9s2aGU* X-archive-position: 5666 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: levon@movementarian.org Precedence: bulk X-list: netdev The recent conversion to seq_file breaks CONFIG_ATM_BR2684_IPFILTER compile. I have absolutely no idea what the original author was attempting to achieve with the "pos" thing, btw ... *shrug* Entirely untested. regards john diff -Naurp -X dontdiff linux-cvs/net/atm/br2684.c linux-fixes/net/atm/br2684.c --- linux-cvs/net/atm/br2684.c 2003-09-05 07:06:15.000000000 +0100 +++ linux-fixes/net/atm/br2684.c 2003-09-05 18:55:15.000000000 +0100 @@ -732,8 +732,8 @@ static int br2684_seq_show(struct seq_fi #ifdef CONFIG_ATM_BR2684_IPFILTER #define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte] #define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3) - if (brvcc->filter.netmask != 0 && pos-- == 0) - return sprintf(buf, " filter=%d.%d.%d.%d/" + if (brvcc->filter.netmask != 0) + seq_printf(seq, " filter=%d.%d.%d.%d/" "%d.%d.%d.%d\n", bs(prefix), bs(netmask)); #undef bs #undef b1 From q@kampsax.dtu.dk Sat Sep 6 05:30:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 05:31:19 -0700 (PDT) Received: from minuspol.k-net.dk (minuspol.k-net.dtu.dk [130.225.71.251]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h86CUTx4020195 for ; Sat, 6 Sep 2003 05:30:30 -0700 Received: from carlsberg.kampsax.dtu.dk (carlsberg.kampsax.dtu.dk [192.38.212.2]) by minuspol.k-net.dk (Postfix) with SMTP id CFDA53164F for ; Sat, 6 Sep 2003 14:30:27 +0200 (CEST) Received: (qmail 3703 invoked from network); 6 Sep 2003 12:30:27 -0000 Received: from carlsberg.kampsax.dtu.dk (HELO carlsberg) (q@192.38.212.2) by carlsberg.kampsax.dtu.dk with SMTP; 6 Sep 2003 12:30:27 -0000 Date: Sat, 6 Sep 2003 14:30:27 +0200 (CEST) From: =?iso-8859-1?Q?Dennis_J=F8rgensen?= To: "David S. Miller" Cc: Subject: Re: Trivial fix for wrong error message from icmp.c (2.6.0-test4) In-Reply-To: <20030905024736.4acefe68.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by oss.sgi.com id h86CUTx4020195 X-archive-position: 5667 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: q@kampsax.dtu.dk Precedence: bulk X-list: netdev On Fri, 5 Sep 2003, David S. Miller wrote: > On Thu, 04 Sep 2003 02:26:42 +0200 > Dennis Jørgensen wrote: > > > Should I post this somewhere else/to someone else, please let me know, I > > couldn't find a FAQ for the list. > > You're posting it to the correct place, but your patch does not > apply because your mail client has turned all the tabs in the > patch into spaces. That wasn't very nice of it. > I can't apply this patch until you fix that up. It should be better now. Sorry for the inconvenience. Dennis Jørgensen --- linux-2.6.0-test4.org/net/ipv4/icmp.c 2003-08-28 01:13:59.000000000 +0200 +++ linux-2.6.0-test4/net/ipv4/icmp.c 2003-08-28 02:12:56.000000000 +0200 @@ -661,7 +661,7 @@ printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP " "type %u, code %u " "error to a broadcast: %u.%u.%u.%u on %s\n", - NIPQUAD(iph->saddr), + NIPQUAD(skb->nh.iph->saddr), icmph->type, icmph->code, NIPQUAD(iph->daddr), skb->dev->name); From juergen.nagler@informatik.uni-ulm.de Sat Sep 6 12:18:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 12:19:02 -0700 (PDT) Received: from mail.informatik.uni-ulm.de (ns.informatik.uni-ulm.de [134.60.68.63]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h86JIrx4020667 for ; Sat, 6 Sep 2003 12:18:54 -0700 Received: from p5091488d.dip0.t-ipconnect.de ([80.145.72.141] helo=informatik.uni-ulm.de) by mail.informatik.uni-ulm.de with esmtp (Exim 3.36 #1) id 19viaA-0000mn-00 for netdev@oss.sgi.com; Sat, 06 Sep 2003 21:18:50 +0200 Message-ID: <3F5A32F6.9060109@informatik.uni-ulm.de> Date: Sat, 06 Sep 2003 21:18:14 +0200 From: =?ISO-8859-1?Q?J=FCrgen_Nagler-Ihlein?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: de-de, de, en-us, en MIME-Version: 1.0 To: netdev@oss.sgi.com Subject: Who is responsable for this server? X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-archive-position: 5668 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: juergen.nagler@informatik.uni-ulm.de Precedence: bulk X-list: netdev After I tried sending a mail to ecartis@oss.sgi.com for some weeks now and got no response I finally sent to postmaster@oss.sgi.com. But even this wasn't a valid address. So please tell me who's responsable for this ecartis server and will answer all my mails which were only autoresponded with "The post has been forwarded to the list administrator" Thanks in advance Jürgen Nagler-Ihlein From daniele@justmailz.com Sat Sep 6 15:06:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 15:06:54 -0700 (PDT) Received: from host (customer-203-168-22-32.ph.inter.net [203.168.22.32] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h86M6Dx4027868 for ; Sat, 6 Sep 2003 15:06:18 -0700 Received: from localhost ([203.168.22.32]) by host with Microsoft SMTPSVC(5.0.2195.5329); Sun, 7 Sep 2003 05:51:33 -0700 X-Sender: daniele@justmailz.com From: Daniele To: netdev@oss.sgi.com Date: Sun, 07 Sep 2003 05:51:33 -0700 Subject: Simple, Reliable and Online Home Business! Reply-To: dvallestero@yahoo.com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Message-ID: X-OriginalArrivalTime: 07 Sep 2003 12:51:33.0909 (UTC) FILETIME=[C458EC50:01C3753E] X-archive-position: 5669 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: daniele@justmailz.com Precedence: bulk X-list: netdev Hello, GREETINGS! First, I hope my message finds you doing well, I know you want to know how did I get your mail address, so let me tell you first I am totaly respecting your privacy and I am sorry if this message bothered you. I got your e-mail address from one of these sources : *you may a member at the same safe-list as I. *you may a member of the same interest groups (yahoo,msn,ICQ,lycos) as I. *we have exchanged messages at the past . Note: If you have already received this message from me before and responded it before then please ignore it and accept my apology. We all know that people earn their living at a job... and 8 hour job... they get up early, commute to work and back, it's a routinary thing for a common person, and still their income often falls well below their needs. Today we all aware that there are plenty of opportunities by just working at home, yes, it's possible with the power of the internet. If I can show you a way to earn a living at home with a great home-based business, using a simple, reliable, online business-building system, would you take a minutes to check it out? If you have 2 to 3 hours a day, you will be able to earn a full income in a few months. And there is absolutely no limit as how much you can earn. It is designed to gain momentum after some time. But I prefer to avoid such statements as "You will get rich". I read it everywhere and I do not want to sound like them. Just take a test drive for free and you may cancel anytime you want if you feel it is not for you. Send an email to danbizopt@netscape.net and put "Free Sign UP" in the subject and your fullname in the body of your email. You can also use another e-mail address for signing as a FREE Member of our opportunity. If so, please indicate your chosen e-mail address and i'll arrange for your FREE Membership using that new e-mail address. If you want also to have an unlimited ISP connection with a very minimal monthly for only US$14.95 or less? Be a free member and I will show you the way. Best regards, Daniele Vallestero From daniele@justmailz.com Sat Sep 6 15:11:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 15:12:23 -0700 (PDT) Received: from host (customer-203-168-22-32.ph.inter.net [203.168.22.32] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h86MBdx4030149 for ; Sat, 6 Sep 2003 15:11:47 -0700 Received: from localhost ([203.168.22.32]) by host with Microsoft SMTPSVC(5.0.2195.5329); Sun, 7 Sep 2003 06:01:31 -0700 X-Sender: daniele@justmailz.com From: Daniele To: netdev@oss.sgi.com Date: Sun, 07 Sep 2003 06:01:31 -0700 Subject: Simple, Reliable and Online Home Business! Reply-To: dvallestero@yahoo.com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Message-ID: X-OriginalArrivalTime: 07 Sep 2003 13:01:31.0261 (UTC) FILETIME=[28659AD0:01C37540] X-archive-position: 5670 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: daniele@justmailz.com Precedence: bulk X-list: netdev Hello, GREETINGS! First, I hope my message finds you doing well, I know you want to know how did I get your mail address, so let me tell you first I am totaly respecting your privacy and I am sorry if this message bothered you. I got your e-mail address from one of these sources : *you may a member at the same safe-list as I. *you may a member of the same interest groups (yahoo,msn,ICQ,lycos) as I. *we have exchanged messages at the past . Note: If you have already received this message from me before and responded it before then please ignore it and accept my apology. We all know that people earn their living at a job... and 8 hour job... they get up early, commute to work and back, it's a routinary thing for a common person, and still their income often falls well below their needs. Today we all aware that there are plenty of opportunities by just working at home, yes, it's possible with the power of the internet. If I can show you a way to earn a living at home with a great home-based business, using a simple, reliable, online business-building system, would you take a minutes to check it out? If you have 2 to 3 hours a day, you will be able to earn a full income in a few months. And there is absolutely no limit as how much you can earn. It is designed to gain momentum after some time. But I prefer to avoid such statements as "You will get rich". I read it everywhere and I do not want to sound like them. Just take a test drive for free and you may cancel anytime you want if you feel it is not for you. Send an email to danbizopt@netscape.net and put "Free Sign UP" in the subject and your fullname in the body of your email. You can also use another e-mail address for signing as a FREE Member of our opportunity. If so, please indicate your chosen e-mail address and i'll arrange for your FREE Membership using that new e-mail address. If you want also to have an unlimited ISP connection with a very minimal monthly for only US$14.95 or less? Be a free member and I will show you the way. Best regards, Daniele Vallestero From akpm@osdl.org Sat Sep 6 18:46:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 18:46:50 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h871kHx4016546 for ; Sat, 6 Sep 2003 18:46:18 -0700 Received: from mnm (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h871k2o29760; Sat, 6 Sep 2003 18:46:02 -0700 Date: Sat, 6 Sep 2003 18:47:15 -0700 From: Andrew Morton To: Anton Blanchard Cc: jeremy@goop.org, linux-kernel@vger.kernel.org, bos@serpentine.com, netdev@oss.sgi.com Subject: Re: 2.6.0-test4-mm6: locking imbalance with rtnl_lock/unlock? Message-Id: <20030906184715.38bf70d9.akpm@osdl.org> In-Reply-To: <20030906222436.GB15327@krispykreme> References: <1062885603.24475.7.camel@ixodes.goop.org> <20030906222436.GB15327@krispykreme> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5671 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Anton Blanchard wrote: > > > > which is SIOCGIFADDR. It seems to me the down() is actually the > > rtnl_lock() called at net/ipv4/devinet.c:536 in devinet_ioctl. This > > happens even when netplugd is no longer running. It looks like someone > > isn't releasing the lock. > > > > I'm going over all the uses of rtnl_lock() to see if I can find a > > problem, but no sign yet. I wonder if someone might have broken this > > recently: I'm running 2.6.0-test4-mm6, but I think Bryan is running an > > older kernel (2.6.0-test4?), and hasn't seen any problems. > > Yep I saw this too when updating from test2 to BK from a few days ago. > >From memory the cpu that had the rtnl_lock was stuck in dev_close, > probably netif_poll_disable. I got side tracked and wasnt able to look > into it. If the caller of netif_poll_disable() has a signal pending, netif_poll_disable() becomes a busy loop, which might be causing a lockup. Probably not, but it needs to use TASK_UNINTERRUPTIBLE. I doubt if that explains Jeremy's deadlock though... From mitch@sfgoth.com Sat Sep 6 21:23:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 21:24:35 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h874Nsx4023493 for ; Sat, 6 Sep 2003 21:23:54 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h874VqkV038433; Sat, 6 Sep 2003 21:31:52 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h874Vq91038432; Sat, 6 Sep 2003 21:31:52 -0700 (PDT) (envelope-from mitch) Date: Sat, 6 Sep 2003 21:31:51 -0700 From: Mitchell Blank Jr To: sparclinux@vger.kernel.org Cc: netdev@oss.sgi.com Subject: sunhme stopped working somewhere in 2.6.0-test4 Message-ID: <20030907043151.GB33595@gaz.sfgoth.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-archive-position: 5672 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev I had been running 2.6.0-test4 on my Ultra 10 for the last week without problems. Tonight I tried upgrading it to 2.6.0-test4-bk8 (which works fine on my i386 test box) and the builtin sunhme card no longer functions. When you try to do a "ifconfig eth0 up" I get the following on this console... happy meal: Aieee, transceiver MIF write bolixed happy meal: Aieee, transceiver MIF read bolixed ...and the operation fails. It looks like there's been a number of changes to sunhme in the last week (ethtool stuff, maybe some other things).... does anyone have a hunch what I should try to change (or has this already been fixed in BK perhaps?) -Mitch From mitch@sfgoth.com Sat Sep 6 21:37:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 06 Sep 2003 21:37:56 -0700 (PDT) Received: from gaz.sfgoth.com ([63.205.85.133]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h874b5x4030180 for ; Sat, 6 Sep 2003 21:37:05 -0700 Received: from gaz.sfgoth.com (localhost.sfgoth.com [127.0.0.1]) by gaz.sfgoth.com (8.12.9/8.12.6) with ESMTP id h874j1kV038692; Sat, 6 Sep 2003 21:45:01 -0700 (PDT) (envelope-from mitch@gaz.sfgoth.com) Received: (from mitch@localhost) by gaz.sfgoth.com (8.12.9/8.12.6/Submit) id h874j1I2038691; Sat, 6 Sep 2003 21:45:01 -0700 (PDT) (envelope-from mitch) Date: Sat, 6 Sep 2003 21:45:01 -0700 From: Mitchell Blank Jr To: sparclinux@vger.kernel.org Cc: netdev@oss.sgi.com Subject: Re: sunhme stopped working somewhere in 2.6.0-test4 Message-ID: <20030907044501.GC33595@gaz.sfgoth.com> References: <20030907043151.GB33595@gaz.sfgoth.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030907043151.GB33595@gaz.sfgoth.com> User-Agent: Mutt/1.4.1i X-archive-position: 5673 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mitch@sfgoth.com Precedence: bulk X-list: netdev Mitchell Blank Jr wrote: > ...and the operation fails. It looks like there's been a number of changes > to sunhme in the last week (ethtool stuff, maybe some other things).... BTW, it turns out that this stuff is NOT the problem; I just tried copying the 2.6.0-test4 version of sunhme.c into my tree (and verified that I now have driver version "2.01" instead of "2.02" in dmesg), but I still have the same problem. So something broke, but I guess the problem is deeper... -Mitch From chas@cmf.nrl.navy.mil Sun Sep 7 05:03:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 05:03:48 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87C38x4000334 for ; Sun, 7 Sep 2003 05:03:08 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h84JHrSa020864; Thu, 4 Sep 2003 15:17:53 -0400 (EDT) Message-Id: <200309041917.h84JHrSa020864@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com, levon@movementarian.org Subject: [PATCH][ATM] a few patches from John Levon Reply-To: chas3@users.sourceforge.net Date: Thu, 04 Sep 2003 15:17:55 -0400 From: chas williams X-Spam-Score: () hits=-2.1 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5674 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev In message <20030904022700.GA67203@compsoc.man.ac.uk>,John Levon writes: >Kconfig in 2.6 seems to let ATM be compiled as a module, but the >proto_ops and net_proto_family ops won't be refcounted. I haven't >tested, but it looks to me like this would allow a rmmod on live code. # 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.1420 -> 1.1421 # net/atm/pvc.c 1.20 -> 1.21 # net/atm/svc.c 1.24 -> 1.25 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1421 # [ATM]: pvc/svc missing .owner for proto_ops/family (from levon@movementarian.org) # -------------------------------------------- # diff -Nru a/net/atm/pvc.c b/net/atm/pvc.c --- a/net/atm/pvc.c Thu Sep 4 15:03:08 2003 +++ b/net/atm/pvc.c Thu Sep 4 15:03:08 2003 @@ -104,6 +104,7 @@ static struct proto_ops pvc_proto_ops = { .family = PF_ATMPVC, + .owner = THIS_MODULE, .release = vcc_release, .bind = pvc_bind, @@ -134,6 +135,7 @@ static struct net_proto_family pvc_family_ops = { .family = PF_ATMPVC, .create = pvc_create, + .owner = THIS_MODULE, }; diff -Nru a/net/atm/svc.c b/net/atm/svc.c --- a/net/atm/svc.c Thu Sep 4 15:03:08 2003 +++ b/net/atm/svc.c Thu Sep 4 15:03:08 2003 @@ -513,6 +513,7 @@ static struct proto_ops svc_proto_ops = { .family = PF_ATMSVC, + .owner = THIS_MODULE, .release = svc_release, .bind = svc_bind, @@ -549,6 +550,7 @@ static struct net_proto_family svc_family_ops = { .family = PF_ATMSVC, .create = svc_create, + .owner = THIS_MODULE, }; In message <20030904073612.GA79992@compsoc.man.ac.uk>,John Levon writes: >Here's an updated patch. # 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.1421 -> 1.1422 # net/atm/common.c 1.49 -> 1.50 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1422 # [ATM]: fix atm_dev module refcount bug (from levon@movementarian.org) # -------------------------------------------- # diff -Nru a/net/atm/common.c b/net/atm/common.c --- a/net/atm/common.c Thu Sep 4 14:58:58 2003 +++ b/net/atm/common.c Thu Sep 4 14:58:58 2003 @@ -422,26 +422,31 @@ } if (!error) error = adjust_tp(&vcc->qos.txtp,vcc->qos.aal); if (!error) error = adjust_tp(&vcc->qos.rxtp,vcc->qos.aal); - if (error) { - vcc_remove_socket(vcc->sk); - return error; - } + if (error) + goto fail; DPRINTK("VCC %d.%d, AAL %d\n",vpi,vci,vcc->qos.aal); DPRINTK(" TX: %d, PCR %d..%d, SDU %d\n",vcc->qos.txtp.traffic_class, vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu); DPRINTK(" RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class, vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu); - if (!try_module_get(dev->ops->owner)) - return -ENODEV; + if (!try_module_get(dev->ops->owner)) { + error = -ENODEV; + goto fail; + } + if (dev->ops->open) { - error = dev->ops->open(vcc,vpi,vci); - if (error) { - module_put(dev->ops->owner); - vcc_remove_socket(vcc->sk); - return error; - } + if ((error = dev->ops->open(vcc,vpi,vci))) + goto put_module_fail; } return 0; + +put_module_fail: + module_put(dev->ops->owner); +fail: + vcc_remove_socket(vcc->sk); + /* ensure we get dev module ref count correct */ + vcc->dev = NULL; + return error; } In message <20030904085844.GA87022@compsoc.man.ac.uk>,John Levon writes: >This re-arranges things a bit to remove some clutter from the .c >code as per preferred coding style. Against current Linus CVS. [editor's note: i added the /* nothing */ in the empty inline stubs to hopefully reduce any confusion.] # 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.1419 -> 1.1420 # net/atm/proc.c 1.25 -> 1.26 # net/atm/common.h 1.18 -> 1.19 # net/atm/resources.h 1.10 -> 1.11 # net/atm/resources.c 1.16 -> 1.17 # net/atm/common.c 1.48 -> 1.49 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1420 # [ATM]: reduce CONFIG_PROC_FS #ifdef clutter in .c code (from levon@movementarian.org) # -------------------------------------------- # diff -Nru a/net/atm/common.c b/net/atm/common.c --- a/net/atm/common.c Thu Sep 4 14:35:33 2003 +++ b/net/atm/common.c Thu Sep 4 14:35:33 2003 @@ -1109,12 +1109,10 @@ printk(KERN_ERR "atmsvc_init() failed with %d\n", error); goto failure; } -#ifdef CONFIG_PROC_FS if ((error = atm_proc_init()) < 0) { printk(KERN_ERR "atm_proc_init() failed with %d\n",error); goto failure; } -#endif return 0; failure: @@ -1125,9 +1123,7 @@ static void __exit atm_exit(void) { -#ifdef CONFIG_PROC_FS atm_proc_exit(); -#endif atmsvc_exit(); atmpvc_exit(); } diff -Nru a/net/atm/common.h b/net/atm/common.h --- a/net/atm/common.h Thu Sep 4 14:35:33 2003 +++ b/net/atm/common.h Thu Sep 4 14:35:33 2003 @@ -33,8 +33,21 @@ void atmpvc_exit(void); int atmsvc_init(void); void atmsvc_exit(void); + +#ifdef CONFIG_PROC_FS int atm_proc_init(void); void atm_proc_exit(void); +#else +static inline int atm_proc_init(void) +{ + return 0; +} + +static inline void atm_proc_exit(void) +{ + /* nothing */ +} +#endif /* CONFIG_PROC_FS */ /* SVC */ diff -Nru a/net/atm/proc.c b/net/atm/proc.c --- a/net/atm/proc.c Thu Sep 4 14:35:33 2003 +++ b/net/atm/proc.c Thu Sep 4 14:35:33 2003 @@ -895,6 +895,10 @@ int digits,num; int error; + /* No proc info */ + if (!dev->ops->proc_read) + return 0; + error = -ENOMEM; digits = 0; for (num = dev->number; num; num /= 10) digits++; @@ -920,6 +924,9 @@ void atm_proc_dev_deregister(struct atm_dev *dev) { + if (!dev->ops->proc_read) + return; + remove_proc_entry(dev->proc_name, atm_proc_root); kfree(dev->proc_name); } diff -Nru a/net/atm/resources.c b/net/atm/resources.c --- a/net/atm/resources.c Thu Sep 4 14:35:33 2003 +++ b/net/atm/resources.c Thu Sep 4 14:35:33 2003 @@ -110,20 +110,16 @@ list_add_tail(&dev->dev_list, &atm_devs); spin_unlock(&atm_dev_lock); -#ifdef CONFIG_PROC_FS - if (ops->proc_read) { - if (atm_proc_dev_register(dev) < 0) { - printk(KERN_ERR "atm_dev_register: " - "atm_proc_dev_register failed for dev %s\n", - type); - spin_lock(&atm_dev_lock); - list_del(&dev->dev_list); - spin_unlock(&atm_dev_lock); - __free_atm_dev(dev); - return NULL; - } + if (atm_proc_dev_register(dev) < 0) { + printk(KERN_ERR "atm_dev_register: " + "atm_proc_dev_register failed for dev %s\n", + type); + spin_lock(&atm_dev_lock); + list_del(&dev->dev_list); + spin_unlock(&atm_dev_lock); + __free_atm_dev(dev); + return NULL; } -#endif return dev; } @@ -133,10 +129,8 @@ { unsigned long warning_time; -#ifdef CONFIG_PROC_FS - if (dev->ops->proc_read) - atm_proc_dev_deregister(dev); -#endif + atm_proc_dev_deregister(dev); + spin_lock(&atm_dev_lock); list_del(&dev->dev_list); spin_unlock(&atm_dev_lock); diff -Nru a/net/atm/resources.h b/net/atm/resources.h --- a/net/atm/resources.h Thu Sep 4 14:35:33 2003 +++ b/net/atm/resources.h Thu Sep 4 14:35:33 2003 @@ -29,6 +29,18 @@ int atm_proc_dev_register(struct atm_dev *dev); void atm_proc_dev_deregister(struct atm_dev *dev); -#endif +#else + +static inline int atm_proc_dev_register(struct atm_dev *dev) +{ + return 0; +} + +static inline void atm_proc_dev_deregister(struct atm_dev *dev) +{ + /* nothing */ +} + +#endif /* CONFIG_PROC_FS */ #endif In message <20030904092414.GF87022@compsoc.man.ac.uk>,John Levon writes: >The problem UNUSED solves has been solved in the module_init/exit() >macros for quite some time. # 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.1421 -> 1.1422 # net/atm/common.c 1.49 -> 1.50 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1422 # [ATM]: fix atm_dev module refcount bug (from levon@movementarian.org) # -------------------------------------------- # diff -Nru a/net/atm/common.c b/net/atm/common.c --- a/net/atm/common.c Thu Sep 4 15:14:04 2003 +++ b/net/atm/common.c Thu Sep 4 15:14:04 2003 @@ -422,26 +422,31 @@ } if (!error) error = adjust_tp(&vcc->qos.txtp,vcc->qos.aal); if (!error) error = adjust_tp(&vcc->qos.rxtp,vcc->qos.aal); - if (error) { - vcc_remove_socket(vcc->sk); - return error; - } + if (error) + goto fail; DPRINTK("VCC %d.%d, AAL %d\n",vpi,vci,vcc->qos.aal); DPRINTK(" TX: %d, PCR %d..%d, SDU %d\n",vcc->qos.txtp.traffic_class, vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu); DPRINTK(" RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class, vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu); - if (!try_module_get(dev->ops->owner)) - return -ENODEV; + if (!try_module_get(dev->ops->owner)) { + error = -ENODEV; + goto fail; + } + if (dev->ops->open) { - error = dev->ops->open(vcc,vpi,vci); - if (error) { - module_put(dev->ops->owner); - vcc_remove_socket(vcc->sk); - return error; - } + if ((error = dev->ops->open(vcc,vpi,vci))) + goto put_module_fail; } return 0; + +put_module_fail: + module_put(dev->ops->owner); +fail: + vcc_remove_socket(vcc->sk); + /* ensure we get dev module ref count correct */ + vcc->dev = NULL; + return error; } From yoshfuji@linux-ipv6.org Sun Sep 7 11:40:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 11:40:56 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87IeMx4011212 for ; Sun, 7 Sep 2003 11:40:23 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h87If51M028690; Mon, 8 Sep 2003 03:41:05 +0900 Date: Mon, 08 Sep 2003 03:41:05 +0900 (JST) Message-Id: <20030908.034105.113815606.yoshfuji@linux-ipv6.org> To: davem@redhat.com CC: netdev@oss.sgi.com Subject: [PATCH 2/3] NET: Use proc_net_fops_create() and proc_net_remove() in net/ipv4 From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5676 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [2/3] Use proc_net_fops_create() and proc_net_remove() in net/ipv4. Index: linux-2.6/net/ipv4/arp.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/arp.c,v retrieving revision 1.27 diff -u -r1.27 arp.c --- linux-2.6/net/ipv4/arp.c 20 Aug 2003 04:27:26 -0000 1.27 +++ linux-2.6/net/ipv4/arp.c 7 Sep 2003 16:51:04 -0000 @@ -1416,14 +1416,9 @@ static int __init arp_proc_init(void) { - int rc = 0; - struct proc_dir_entry *p = create_proc_entry("arp", S_IRUGO, proc_net); - - if (p) - p->proc_fops = &arp_seq_fops; - else - rc = -ENOMEM; - return rc; + if (!proc_net_fops_create("arp", S_IRUGO, &arp_seq_fops)) + return -ENOMEM; + return 0; } #else /* CONFIG_PROC_FS */ Index: linux-2.6/net/ipv4/fib_hash.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/fib_hash.c,v retrieving revision 1.16 diff -u -r1.16 fib_hash.c --- linux-2.6/net/ipv4/fib_hash.c 26 May 2003 05:17:28 -0000 1.16 +++ linux-2.6/net/ipv4/fib_hash.c 7 Sep 2003 16:51:04 -0000 @@ -1096,19 +1096,13 @@ int __init fib_proc_init(void) { - struct proc_dir_entry *p; - int rc = 0; - - p = create_proc_entry("route", S_IRUGO, proc_net); - if (p) - p->proc_fops = &fib_seq_fops; - else - rc = -ENOMEM; - return rc; + if (!proc_net_fops_create("route", S_IRUGO, &fib_seq_fops)) + return -ENOMEM; + return 0; } void __init fib_proc_exit(void) { - remove_proc_entry("route", proc_net); + proc_net_remove("route"); } #endif /* CONFIG_PROC_FS */ Index: linux-2.6/net/ipv4/igmp.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/igmp.c,v retrieving revision 1.34 diff -u -r1.34 igmp.c --- linux-2.6/net/ipv4/igmp.c 1 Sep 2003 05:52:50 -0000 1.34 +++ linux-2.6/net/ipv4/igmp.c 7 Sep 2003 16:51:04 -0000 @@ -2430,15 +2430,8 @@ int __init igmp_mc_proc_init(void) { - struct proc_dir_entry *p; - - p = create_proc_entry("igmp", S_IRUGO, proc_net); - if (p) - p->proc_fops = &igmp_mc_seq_fops; - - p = create_proc_entry("mcfilter", S_IRUGO, proc_net); - if (p) - p->proc_fops = &igmp_mcf_seq_fops; + proc_net_fops_create("igmp", S_IRUGO, &igmp_mc_seq_fops); + proc_net_fops_create("mcfilter", S_IRUGO, &igmp_mcf_seq_fops); return 0; } #endif Index: linux-2.6/net/ipv4/proc.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/proc.c,v retrieving revision 1.14 diff -u -r1.14 proc.c --- linux-2.6/net/ipv4/proc.c 22 May 2003 08:13:13 -0000 1.14 +++ linux-2.6/net/ipv4/proc.c 7 Sep 2003 16:51:04 -0000 @@ -238,28 +238,21 @@ int __init ip_misc_proc_init(void) { int rc = 0; - struct proc_dir_entry *p; - p = create_proc_entry("netstat", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("netstat", S_IRUGO, &netstat_seq_fops)) goto out_netstat; - p->proc_fops = &netstat_seq_fops; - p = create_proc_entry("snmp", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("snmp", S_IRUGO, &snmp_seq_fops)) goto out_snmp; - p->proc_fops = &snmp_seq_fops; - p = create_proc_entry("sockstat", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("sockstat", S_IRUGO, &sockstat_seq_fops)) goto out_sockstat; - p->proc_fops = &sockstat_seq_fops; out: return rc; out_sockstat: - remove_proc_entry("snmp", proc_net); + proc_net_remove("snmp"); out_snmp: - remove_proc_entry("netstat", proc_net); + proc_net_remove("netstat"); out_netstat: rc = -ENOMEM; goto out; Index: linux-2.6/net/ipv4/raw.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/raw.c,v retrieving revision 1.35 diff -u -r1.35 raw.c --- linux-2.6/net/ipv4/raw.c 11 Jul 2003 04:06:16 -0000 1.35 +++ linux-2.6/net/ipv4/raw.c 7 Sep 2003 16:51:04 -0000 @@ -831,19 +831,13 @@ int __init raw_proc_init(void) { - struct proc_dir_entry *p; - int rc = 0; - - p = create_proc_entry("raw", S_IRUGO, proc_net); - if (p) - p->proc_fops = &raw_seq_fops; - else - rc = -ENOMEM; - return rc; + if (!proc_net_fops_create("raw", S_IRUGO, &raw_seq_fops)) + return -ENOMEM; + return 0; } void __init raw_proc_exit(void) { - remove_proc_entry("raw", proc_net); + proc_net_remove("raw"); } #endif /* CONFIG_PROC_FS */ Index: linux-2.6/net/ipv4/tcp_ipv4.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/tcp_ipv4.c,v retrieving revision 1.56 diff -u -r1.56 tcp_ipv4.c --- linux-2.6/net/ipv4/tcp_ipv4.c 18 Aug 2003 07:06:49 -0000 1.56 +++ linux-2.6/net/ipv4/tcp_ipv4.c 7 Sep 2003 16:51:05 -0000 @@ -2413,11 +2413,15 @@ { struct tcp_seq_afinfo *afinfo = PDE(inode)->data; struct seq_file *seq; - int rc = -ENOMEM; - struct tcp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); + struct tcp_iter_state *s; + int rc; + if (unlikely(afinfo == NULL)) + return -EINVAL; + + s = kmalloc(sizeof(*s), GFP_KERNEL); if (!s) - goto out; + return -ENOMEM; memset(s, 0, sizeof(*s)); s->family = afinfo->family; s->seq_ops.start = tcp_seq_start; @@ -2450,11 +2454,10 @@ afinfo->seq_fops->llseek = seq_lseek; afinfo->seq_fops->release = seq_release_private; - p = create_proc_entry(afinfo->name, S_IRUGO, proc_net); - if (p) { + p = proc_net_fops_create(afinfo->name, S_IRUGO, afinfo->seq_fops); + if (p) p->data = afinfo; - p->proc_fops = afinfo->seq_fops; - } else + else rc = -ENOMEM; return rc; } @@ -2463,7 +2466,7 @@ { if (!afinfo) return; - remove_proc_entry(afinfo->name, proc_net); + proc_net_remove(afinfo->name); memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); } Index: linux-2.6/net/ipv4/udp.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv4/udp.c,v retrieving revision 1.39 diff -u -r1.39 udp.c --- linux-2.6/net/ipv4/udp.c 4 Sep 2003 15:47:07 -0000 1.39 +++ linux-2.6/net/ipv4/udp.c 7 Sep 2003 16:51:05 -0000 @@ -1460,11 +1460,10 @@ afinfo->seq_fops->llseek = seq_lseek; afinfo->seq_fops->release = seq_release_private; - p = create_proc_entry(afinfo->name, S_IRUGO, proc_net); - if (p) { + p = proc_net_fops_create(afinfo->name, S_IRUGO, afinfo->seq_fops); + if (p) p->data = afinfo; - p->proc_fops = afinfo->seq_fops; - } else + else rc = -ENOMEM; return rc; } @@ -1473,7 +1472,7 @@ { if (!afinfo) return; - remove_proc_entry(afinfo->name, proc_net); + proc_net_remove(afinfo->name); memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); } -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From yoshfuji@linux-ipv6.org Sun Sep 7 11:40:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 11:40:54 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87IeKx4011205 for ; Sun, 7 Sep 2003 11:40:21 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h87If21M028687; Mon, 8 Sep 2003 03:41:02 +0900 Date: Mon, 08 Sep 2003 03:41:02 +0900 (JST) Message-Id: <20030908.034102.33137738.yoshfuji@linux-ipv6.org> To: davem@redhat.com CC: netdev@oss.sgi.com Subject: [PATCH 1/3] NET: Use proc_net_fops_create() and proc_net_remove() in net/core From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5675 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [1/3] Use proc_net_fops_create() and proc_net_remove() in net/core. Index: linux-2.6/net/core/dev.c =================================================================== RCS file: /home/cvs/linux-2.5/net/core/dev.c,v retrieving revision 1.85 diff -u -r1.85 dev.c --- linux-2.6/net/core/dev.c 2 Sep 2003 01:25:27 -0000 1.85 +++ linux-2.6/net/core/dev.c 7 Sep 2003 17:02:52 -0000 @@ -1994,26 +1994,21 @@ static int __init dev_proc_init(void) { - struct proc_dir_entry *p; int rc = -ENOMEM; - p = create_proc_entry("dev", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("dev", S_IRUGO, &dev_seq_fops)) goto out; - p->proc_fops = &dev_seq_fops; - p = create_proc_entry("softnet_stat", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("softnet_stat", S_IRUGO, &softnet_seq_fops)) goto out_dev; - p->proc_fops = &softnet_seq_fops; if (wireless_proc_init()) goto out_softnet; rc = 0; out: return rc; out_softnet: - remove_proc_entry("softnet_stat", proc_net); + proc_net_remove("softnet_stat"); out_dev: - remove_proc_entry("dev", proc_net); + proc_net_remove("dev"); goto out; } #else -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From yoshfuji@linux-ipv6.org Sun Sep 7 11:40:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 11:40:57 -0700 (PDT) Received: from yue.hongo.wide.ad.jp (yue.hongo.wide.ad.jp [203.178.139.94]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87IeOx4011221 for ; Sun, 7 Sep 2003 11:40:25 -0700 Received: from localhost (localhost [127.0.0.1]) by yue.hongo.wide.ad.jp (8.12.3+3.5Wbeta/8.12.3/Debian-5) with ESMTP id h87If71M028693; Mon, 8 Sep 2003 03:41:07 +0900 Date: Mon, 08 Sep 2003 03:41:07 +0900 (JST) Message-Id: <20030908.034107.96819866.yoshfuji@linux-ipv6.org> To: davem@redhat.com CC: netdev@oss.sgi.com Subject: [PATCH 3/3] NET: Use proc_net_fops_create() and proc_net_remove() in net/ipv6 From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= Organization: USAGI Project X-URL: http://www.yoshifuji.org/%7Ehideaki/ X-Fingerprint: 90 22 65 EB 1E CF 3A D1 0B DF 80 D8 48 07 F8 94 E0 62 0E EA X-PGP-Key-URL: http://www.yoshifuji.org/%7Ehideaki/hideaki@yoshifuji.org.asc X-Face: "5$Al-.M>NJ%a'@hhZdQm:."qn~PA^gq4o*>iCFToq*bAi#4FRtx}enhuQKz7fNqQz\BYU] $~O_5m-9'}MIs`XGwIEscw;e5b>n"B_?j/AkL~i/MEaZBLP X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 5677 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@linux-ipv6.org Precedence: bulk X-list: netdev [3/3] Use proc_net_fops_create() and proc_net_remove() in net/ipv6. Index: linux-2.6/net/ipv6/addrconf.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/addrconf.c,v retrieving revision 1.52 diff -u -r1.52 addrconf.c --- linux-2.6/net/ipv6/addrconf.c 4 Sep 2003 15:47:07 -0000 1.52 +++ linux-2.6/net/ipv6/addrconf.c 7 Sep 2003 16:51:14 -0000 @@ -2266,16 +2266,11 @@ int __init if6_proc_init(void) { - struct proc_dir_entry *p; - int rc = 0; - - p = create_proc_entry("if_inet6", S_IRUGO, proc_net); - if (p) - p->proc_fops = &if6_fops; - else - rc = -ENOMEM; - return rc; + if (!proc_net_fops_create("if_inet6", S_IRUGO, &if6_fops)) + return -ENOMEM; + return 0; } + void if6_proc_exit(void) { proc_net_remove("if_inet6"); Index: linux-2.6/net/ipv6/anycast.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/anycast.c,v retrieving revision 1.7 diff -u -r1.7 anycast.c --- linux-2.6/net/ipv6/anycast.c 25 Jul 2003 17:11:54 -0000 1.7 +++ linux-2.6/net/ipv6/anycast.c 7 Sep 2003 16:51:14 -0000 @@ -581,11 +581,9 @@ int __init ac6_proc_init(void) { - struct proc_dir_entry *p; + if (!proc_net_fops_create("anycast6", S_IRUGO, &ac6_seq_fops)) + return -ENOMEM; - p = create_proc_entry("anycast6", S_IRUGO, proc_net); - if (p) - p->proc_fops = &ac6_seq_fops; return 0; } Index: linux-2.6/net/ipv6/ip6_flowlabel.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/ip6_flowlabel.c,v retrieving revision 1.8 diff -u -r1.8 ip6_flowlabel.c --- linux-2.6/net/ipv6/ip6_flowlabel.c 2 Sep 2003 14:48:07 -0000 1.8 +++ linux-2.6/net/ipv6/ip6_flowlabel.c 7 Sep 2003 16:51:14 -0000 @@ -695,12 +695,7 @@ void ip6_flowlabel_init() { #ifdef CONFIG_PROC_FS - struct proc_dir_entry *p; -#endif -#ifdef CONFIG_PROC_FS - p = create_proc_entry("ip6_flowlabel", S_IRUGO, proc_net); - if (p) - p->proc_fops = &ip6fl_seq_fops; + proc_net_fops_create("ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops); #endif } Index: linux-2.6/net/ipv6/mcast.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v retrieving revision 1.31 diff -u -r1.31 mcast.c --- linux-2.6/net/ipv6/mcast.c 1 Sep 2003 05:52:50 -0000 1.31 +++ linux-2.6/net/ipv6/mcast.c 7 Sep 2003 16:51:14 -0000 @@ -2378,9 +2378,6 @@ struct ipv6_pinfo *np; struct sock *sk; int err; -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *p; -#endif err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &igmp6_socket); if (err < 0) { @@ -2399,12 +2396,8 @@ np->hop_limit = 1; #ifdef CONFIG_PROC_FS - p = create_proc_entry("igmp6", S_IRUGO, proc_net); - if (p) - p->proc_fops = &igmp6_mc_seq_fops; - p = create_proc_entry("mcfilter6", S_IRUGO, proc_net); - if (p) - p->proc_fops = &igmp6_mcf_seq_fops; + proc_net_fops_create("igmp6", S_IRUGO, &igmp6_mc_seq_fops); + proc_net_fops_create("mcfilter6", S_IRUGO, &igmp6_mcf_seq_fops); #endif return 0; @@ -2414,6 +2407,7 @@ { sock_release(igmp6_socket); igmp6_socket = NULL; /* for safety */ + #ifdef CONFIG_PROC_FS proc_net_remove("mcfilter6"); proc_net_remove("igmp6"); Index: linux-2.6/net/ipv6/proc.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/proc.c,v retrieving revision 1.18 diff -u -r1.18 proc.c --- linux-2.6/net/ipv6/proc.c 9 Jul 2003 05:55:17 -0000 1.18 +++ linux-2.6/net/ipv6/proc.c 7 Sep 2003 16:51:14 -0000 @@ -273,21 +273,16 @@ int __init ipv6_misc_proc_init(void) { int rc = 0; - struct proc_dir_entry *p; - p = create_proc_entry("snmp6", S_IRUGO, proc_net); - if (!p) + if (!proc_net_fops_create("snmp6", S_IRUGO, &snmp6_seq_fops)) goto proc_snmp6_fail; - else - p->proc_fops = &snmp6_seq_fops; + proc_net_devsnmp6 = proc_mkdir("dev_snmp6", proc_net); if (!proc_net_devsnmp6) goto proc_dev_snmp6_fail; - p = create_proc_entry("sockstat6", S_IRUGO, proc_net); - if (!p) + + if (!proc_net_fops_create("sockstat6", S_IRUGO, &sockstat6_seq_fops)) goto proc_sockstat6_fail; - else - p->proc_fops = &sockstat6_seq_fops; out: return rc; Index: linux-2.6/net/ipv6/raw.c =================================================================== RCS file: /home/cvs/linux-2.5/net/ipv6/raw.c,v retrieving revision 1.37 diff -u -r1.37 raw.c --- linux-2.6/net/ipv6/raw.c 18 Aug 2003 10:14:52 -0000 1.37 +++ linux-2.6/net/ipv6/raw.c 7 Sep 2003 16:51:14 -0000 @@ -1059,12 +1059,8 @@ int __init raw6_proc_init(void) { - struct proc_dir_entry *p = create_proc_entry("raw6", S_IRUGO, proc_net); - - if (!p) + if (!proc_net_fops_create("raw6", S_IRUGO, &raw6_seq_fops)) return -ENOMEM; - p->proc_fops = &raw6_seq_fops; - return 0; } -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From mail@jan-ischebeck.de Sun Sep 7 14:47:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 14:47:45 -0700 (PDT) Received: from mail.netbeat.de (mail.netbeat.de [62.208.140.19] (may be forged)) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87Ll6x4000670 for ; Sun, 7 Sep 2003 14:47:07 -0700 Received: (qmail 24408 invoked from network); 7 Sep 2003 21:52:04 -0000 Received: from xdsl-195-14-220-216.netcologne.de (195.14.220.216) by mail.netbeat.de with SMTP; 7 Sep 2003 21:52:04 -0000 Subject: [2.6-test4-mm5] modprobe e100 after ifplugd -> oops From: Jan Ischebeck To: netdev@oss.sgi.com Cc: lkml Content-Type: text/plain Message-Id: <1062971256.13515.9.camel@JHome.uni-bonn.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Sun, 07 Sep 2003 23:47:36 +0200 Content-Transfer-Encoding: 7bit X-archive-position: 5678 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mail@jan-ischebeck.de Precedence: bulk X-list: netdev Using kernel 2.6.0-test4-mm5 I got on oops when inserting the e100 module after running ifplugd. When I load the module before starting ifplugd everything is ok. I didn't check yet, if it occurs with previous kernel versions too. after a modprobe kernel: Intel(R) PRO/100 Network Driver - version 2.3.18-k1 kernel: Copyright (c) 2003 Intel Corporation kernel: kernel: Unable to handle kernel NULL pointer dereference at virtual address 00000004 kernel: printing eip: kernel: d0a5250f kernel: *pde = 00000000 kernel: Oops: 0000 [#1] kernel: PREEMPT kernel: CPU: 0 kernel: EIP: 0060:[__crc_pcmcia_request_irq+5867872/7156875] Not tainted VLI kernel: EFLAGS: 00010203 kernel: EIP is at e100_free_rfd_pool+0x14/0xdc [e100] kernel: eax: 00000000 ebx: 00000000 ecx: 00000020 edx: 00000000 kernel: esi: c7b95200 edi: c7b95220 ebp: 00000000 esp: ccd13e78 kernel: ds: 007b es: 007b ss: 0068 kernel: Process ifplugd (pid: 774, threadinfo=ccd12000 ta: kernel: Stack: c1367454 c7b95200 c7b95200 c7b95000 d0a527c6 c7b95200 fffffff4 d0a51a7e kernel: c7b95200 00000003 ccd13ec8 c3e6b940 0008d42c c7b95000 00000000 00001003 kernel: 00000000 c028eb1a c7b95000 ccd12000 c02939ea c7b95000 00001002 c02900b8 kernel: Call Trace: kernel: [__crc_pcmcia_request_irq+5868567/7156875] e100_clear_pools+0x1a/0x2a [e100] kernel: [__crc_pcmcia_request_irq+5865167/7156875] e100_open+0x13b/0x198 [e100] kernel: [dev_open+121/134] dev_open+0x79/0x86 kernel: [dev_mc_upload+37/67] dev_mc_upload+0x25/0x43 kernel: [dev_change_flags+81/288] dev_change_flags+0x51/0x120 kernel: [devinet_ioctl+643/1538] devinet_ioctl+0x283/0x602 kernel: [inet_ioctl+178/248] inet_ioctl+0xb2/0xf8 kernel: [sock_ioctl+0/676] sock_ioctl+0x0/0x2a4 kernel: [sock_ioctl+245/676] sock_ioctl+0xf5/0x2a4 kernel: [sock_ioctl+0/676] sock_ioctl+0x0/0x2a4 kernel: [sys_ioctl+253/626] sys_ioctl+0xfd/0x272 kernel: [sys_munmap+68/100] sys_munmap+0x44/0x64 kernel: [syscall_call+7/11] syscall_call+0x7/0xb kernel: kernel: Code: 00 c7 43 40 00 00 00 00 c7 43 3c 00 00 00 00 8b 5c 24 10 83 c4 14 c3 57 56 53 83 ec 04 8b 74 24 14 8d 7e 20 8b 5e 20 39 fb 74 5a <8b> 53 04 39 1a 0f 85 b0 00 00 00 8b 03 39 58 04 0f 85 98 00 00 kernel: <7>e100: selftest OK. kernel: e100: eth0: Intel(R) PRO/100 Network Connection kernel: Hardware receive checksums enabled kernel: Config: # CONFIG_DGRS is not set CONFIG_EEPRO100=m # CONFIG_EEPRO100_PIO is not set CONFIG_E100=m # CONFIG_FEALNX is not set # CONFIG_NATSEMI is not set System is a Thinkpad R40 2722. Jan (Please CC on reply) -- Jan Ischebeck From eric@lnxi.com Sun Sep 7 15:14:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 15:14:50 -0700 (PDT) Received: from ash.lnxi.com ([208.177.141.226]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h87MEGx4003967 for ; Sun, 7 Sep 2003 15:14:17 -0700 Received: (qmail 910 invoked by uid 104); 7 Sep 2003 22:14:38 -0000 Received: from eric@lnxi.com by ash by uid 101 with qmail-scanner-1.20rc1 (sweep: 2.14/3.73. Clear:RC:1:. Processed in 0.019823 secs); 07 Sep 2003 22:14:38 -0000 Received: from maxwell.lnxi.com (192.168.20.129) by ash.lnxi.com with SMTP; 7 Sep 2003 22:14:38 -0000 Received: from eric by maxwell.lnxi.com with local (Exim 3.35 #1 (Debian)) id 19w7uo-0007uO-00; Sun, 07 Sep 2003 16:21:50 -0600 To: Jeff Garzik , "David S. Miller" CC: netdev@oss.sgi.com, Subject: How do I track TG3 peculiarities? From: ebiederman@lnxi.com (Eric W. Biederman) Date: 07 Sep 2003 16:21:50 -0600 Message-ID: Lines: 177 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 5679 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ebiederman@lnxi.com Precedence: bulk X-list: netdev Running 2.4.21 we are seeing some very weird problems with the tg3 driver. The test setup is a medium sized cluster with 256 dual opetron machines running in 32bit mode, against and extreme networks switch. All ports running at gigabit speeds. The current problem reproducer is to run linpack on all of the nodes. I am looking for something simpler. We have just escalated the problem from trying a few simple things like swapping drivers to serious debugging. I will do what tracing I can but as I am not especially familiar with the linux network stack I am asking for help as to suggestions as to reasonable interpretations of events and places to start looking. This problem is currently a show stopper for us so we will solve it one way or another. Below is one good oops we have captured. I would have to check but I believe we have updated the tg3 driver in this instance to the one that comes with 2.4.23-pre3. The very puzzling part is that in the crashes I don't see the tg3 driver at all just the network stack. All module addresses according to /proc/ksyms started with at 0xf8, and the tg3 driver was built as a module. I have been having trouble understanding why skb_clone would be called to transmit a packet. Any ideas? <1>Unable to handle kernel NULL pointer dereference at virtual address 00000004 printing eip: c0258575 *pde = 00000000 Oops: 0002 CPU: 0 EIP: 0010:[] Not tainted EFLAGS: 00010016 eax: 00000000 ebx: f7510180 ecx: 00000000 edx: c03f5240 esi: f7616b80 edi: 00000202 ebp: f7bc90e8 esp: f774de44 ds: 0018 es: 0018 ss: 0018 Process init (pid: 15, stackpage=f774d000) Stack: 00000098 00000286 00000246 f7bc91bc f7616b80 000005a8 c0289554 f7616b80 00000020 f7bc9080 c0258114 00000000 00000001 eb307d90 f7bc91bc f7bc9080 c027d3d5 f7bc9080 00000001 00000098 00000000 f774dee4 00000000 c0317c34 Call Trace: [] [] [] [] [] [] [] [] [] Code: 89 50 04 89 81 40 52 3f c0 c7 43 04 00 00 00 00 c7 03 00 00 ************************ HERE IS THE ksymoops ************************* ksymoops 2.4.5 on i686 2.4.21-cm26_lnxi2smp. Options used -V (default) -k /proc/ksyms (default) -l /proc/modules (default) -o /lib/modules/2.4.21-cm26_lnxi2smp/ (default) -m /boot/System.map-2.4.21-cm26_lnxi2smp (default) Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options. Warning (expand_objects): object /tmp/amd76xrom.o for module amd76xrom has changed since load ksymoops: No such file or directory Warning (expand_objects): object /tmp/cfi_cmdset_0002.o for module cfi_cmdset_0002 has changed since load Error (expand_objects): cannot stat(/modules/tg3.o) for tg3 Error (expand_objects): cannot stat(/modules/bproc.o) for bproc ksymoops: No such file or directory ksymoops: No such file or directory ksymoops: No such file or directory Error (expand_objects): cannot stat(/modules/vmadump.o) for vmadump Error (add_ss_object): cannot stat(/lib/modules/2.4.21-cm26_lnxi2smp/) Error (regular_file): read_nm_symbols stat /lib/modules/2.4.21-cm26_lnxi2smp/ failed ksymoops: No such file or directory Warning (read_object): no symbols in /lib/modules/2.4.21-cm26_lnxi2smp/ Error (regular_file): read_system_map stat /boot/System.map-2.4.21-cm26_lnxi2smp failed ksymoops: No such file or directory Warning (map_ksym_to_module): cannot match loaded module tg3 to a unique module object. Trace may not be reliable. Warning (map_ksym_to_module): cannot match loaded module bproc to a unique module object. Trace may not be reliable. Warning (map_ksym_to_module): cannot match loaded module vmadump to a unique module object. Trace may not be reliable. Fatal Error (find_fullpath): could not find executable ksymoops [root@bluesteel conman]# ksymoops /tmp/oops ksymoops 2.4.5 on i686 2.4.21-cm26_lnxi2smp. Options used -V (default) -k /proc/ksyms (default) -l /proc/modules (default) -o /lib/modules/2.4.21-cm26_lnxi2smp/ (default) -m /boot/System.map-2.4.21-cm26_lnxi2smp (default) Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options. Error (expand_objects): cannot stat(/lib/ext3.o) for ext3 ksymoops: No such file or directory Error (expand_objects): cannot stat(/lib/jbd.o) for jbd ksymoops: No such file or directory Warning (map_ksym_to_module): cannot match loaded module ext3 to a unique module object. Trace may not be reliable. <1>Unable to handle kernel NULL pointer dereference at virtual address 00000004 c0258575 *pde = 00000000 Oops: 0002 CPU: 0 EIP: 0010:[] Not tainted Using defaults from ksymoops -t elf32-i386 -a i386 EFLAGS: 00010016 eax: 00000000 ebx: f7510180 ecx: 00000000 edx: c03f5240 esi: f7616b80 edi: 00000202 ebp: f7bc90e8 esp: f774de44 ds: 0018 es: 0018 ss: 0018 Process init (pid: 15, stackpage=f774d000) Stack: 00000098 00000286 00000246 f7bc91bc f7616b80 000005a8 c0289554 f7616b80 00000020 f7bc9080 c0258114 00000000 00000001 eb307d90 f7bc91bc f7bc9080 c027d3d5 f7bc9080 00000001 00000098 00000000 f774dee4 00000000 c0317c34 Call Trace: [] [] [] [] [] [] [] [] [] Code: 89 50 04 89 81 40 52 3f c0 c7 43 04 00 00 00 00 c7 03 00 00 >>EIP; c0258575 <===== >>ebx; f7510180 <_end+37103a84/38400964> >>edx; c03f5240 >>esi; f7616b80 <_end+3720a484/38400964> >>ebp; f7bc90e8 <_end+377bc9ec/38400964> >>esp; f774de44 <_end+37341748/38400964> Trace; c0289554 Trace; c0258114 Trace; c027d3d5 Trace; c013e02c <__alloc_pages+4c/1a0> Trace; c029dca2 Trace; c02544c5 Trace; c025475e Trace; c0145be3 Trace; c01094af Code; c0258575 00000000 <_EIP>: Code; c0258575 <===== 0: 89 50 04 mov %edx,0x4(%eax) <===== Code; c0258578 3: 89 81 40 52 3f c0 mov %eax,0xc03f5240(%ecx) Code; c025857e 9: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx) Code; c0258585 10: c7 03 00 00 00 00 movl $0x0,(%ebx) 2 warnings and 2 errors issued. Results may not be reliable. From adilger@clusterfs.com Sun Sep 7 21:10:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 21:11:38 -0700 (PDT) Received: from schatzie.adilger.int (h68-147-142-75.cg.shawcable.net [68.147.142.75]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h884Ahx4009665 for ; Sun, 7 Sep 2003 21:10:45 -0700 Received: (from adilger@localhost) by schatzie.adilger.int (8.11.6/8.11.6) id h8849Rh15896; Sun, 7 Sep 2003 22:09:27 -0600 Date: Sun, 7 Sep 2003 22:09:26 -0600 From: Andreas Dilger To: "Eric W. Biederman" Cc: Jeff Garzik , "David S. Miller" , netdev@oss.sgi.com, linux-kernel@vger.kernel.org Subject: Re: How do I track TG3 peculiarities? Message-ID: <20030907220926.G18482@schatzie.adilger.int> Mail-Followup-To: "Eric W. Biederman" , Jeff Garzik , "David S. Miller" , netdev@oss.sgi.com, linux-kernel@vger.kernel.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 ebiederman@lnxi.com on Sun, Sep 07, 2003 at 04:21:50PM -0600 X-GPG-Key: 1024D/0D35BED6 X-GPG-Fingerprint: 7A37 5D79 BF1B CECA D44F 8A29 A488 39F5 0D35 BED6 X-archive-position: 5680 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: adilger@clusterfs.com Precedence: bulk X-list: netdev On Sep 07, 2003 16:21 -0600, Eric W. Biederman wrote: > Below is one good oops we have captured. I would have to check but > I believe we have updated the tg3 driver in this instance to the > one that comes with 2.4.23-pre3. > > The very puzzling part is that in the crashes I don't see the tg3 > driver at all just the network stack. All module addresses according > to /proc/ksyms started with at 0xf8, and the tg3 driver was built as > a module. > > I have been having trouble understanding why skb_clone would be called > to transmit a packet. Any ideas? Do you have the stack overflow checking enabled? That has been a source of problems for us. It was especially difficult to reproduce, because it only happened during a double interrupt. Cheers, Andreas -- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/ From akpm@osdl.org Sun Sep 7 23:20:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 07 Sep 2003 23:21:10 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h886KZx4009673 for ; Sun, 7 Sep 2003 23:20:36 -0700 Received: from mnm (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h886KIo19704; Sun, 7 Sep 2003 23:20:18 -0700 Date: Sun, 7 Sep 2003 23:21:45 -0700 From: Andrew Morton To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: netif_poll_disable() hangs Message-Id: <20030907232145.6ec197fd.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5681 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Very simple: ifup eth0 ifdown eth0 ifup eth0 ifdown eth0 <- hangs in dev_close -> netif_poll_disable() Because the first close sets __LINK_STATE_RX_SCHED and nothing ever clears it. From jgarzik@pobox.com Mon Sep 8 00:18:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 00:18:40 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h887I2x4017310 for ; Mon, 8 Sep 2003 00:18:03 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:38136 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19wGHe-0001bU-6e; Mon, 08 Sep 2003 08:17:58 +0100 Message-ID: <3F5C2D1A.5050500@pobox.com> Date: Mon, 08 Sep 2003 03:17:46 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Andrew Morton CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: netif_poll_disable() hangs References: <20030907232145.6ec197fd.akpm@osdl.org> In-Reply-To: <20030907232145.6ec197fd.akpm@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5683 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 Content-Length: 518 Lines: 23 Andrew Morton wrote: > Very simple: > > ifup eth0 > ifdown eth0 > ifup eth0 > ifdown eth0 <- hangs in dev_close -> netif_poll_disable() > > > Because the first close sets __LINK_STATE_RX_SCHED and nothing ever clears > it. Weird. Looking at older 2.4 and 2.6, the bit has always been set that way. process_backlog() has always been the only site that ever clears that bit... maybe process_backlog() is called when interface is up'd, which is why it worked before (and should be working now)? Jeff From akpm@osdl.org Mon Sep 8 00:28:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 00:28:26 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h887S0x4021936 for ; Mon, 8 Sep 2003 00:28:01 -0700 Received: from mnm (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h887Rko30103; Mon, 8 Sep 2003 00:27:46 -0700 Date: Mon, 8 Sep 2003 00:29:14 -0700 From: Andrew Morton To: Jeff Garzik Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: netif_poll_disable() hangs Message-Id: <20030908002914.737122a9.akpm@osdl.org> In-Reply-To: <3F5C2D1A.5050500@pobox.com> References: <20030907232145.6ec197fd.akpm@osdl.org> <3F5C2D1A.5050500@pobox.com> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 5684 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akpm@osdl.org Precedence: bulk X-list: netdev Content-Length: 427 Lines: 19 Jeff Garzik wrote: > > Andrew Morton wrote: > > Very simple: > > > > ifup eth0 > > ifdown eth0 > > ifup eth0 > > ifdown eth0 <- hangs in dev_close -> netif_poll_disable() > > > > > > Because the first close sets __LINK_STATE_RX_SCHED and nothing ever clears > > it. > > > Weird. Looking at older 2.4 and 2.6, the bit has always been set that way. 2.4 does test_bit, 2.6 does test_and_set_bit. From shemminger@osdl.org Mon Sep 8 09:37:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 09:37:16 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88GbDx4027994 for ; Mon, 8 Sep 2003 09:37:14 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88Gb0o05715; Mon, 8 Sep 2003 09:37:00 -0700 Date: Mon, 8 Sep 2003 09:36:44 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: bridge@osdl.org, netdev@oss.sgi.com Subject: [PATCH 2.4] clear hw checksum flags when bridging Message-Id: <20030908093644.290c2f8e.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5685 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 Content-Length: 635 Lines: 17 The hardware checksumming flags need to be cleared when forwarding packets. Bridging just needs to forward what ever checksum is in the existing skbuff, it doesn't want or need the packet to be resummed. Without this fix, forwarding between smart/dumb interfaces causes an oops. diff -Nru a/net/bridge/br_forward.c b/net/bridge/br_forward.c --- a/net/bridge/br_forward.c Mon Sep 8 09:29:44 2003 +++ b/net/bridge/br_forward.c Mon Sep 8 09:29:44 2003 @@ -59,6 +59,7 @@ indev = skb->dev; skb->dev = to->dev; + skb->ip_summed = CHECKSUM_NONE; NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev, __br_forward_finish); From shemminger@osdl.org Mon Sep 8 09:37:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 09:37:20 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88GbHx4027995 for ; Mon, 8 Sep 2003 09:37:18 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88Gb5o05737; Mon, 8 Sep 2003 09:37:05 -0700 Date: Mon, 8 Sep 2003 09:36:49 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: bridge@osdl.org, netdev@oss.sgi.com Subject: [PATCH 2.6] clear hw checksum flags when bridging Message-Id: <20030908093649.5b6dafc1.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5686 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 Content-Length: 402 Lines: 13 same patch as 2.4, just the offsets are changed. diff -Nru a/net/bridge/br_forward.c b/net/bridge/br_forward.c --- a/net/bridge/br_forward.c Mon Sep 8 09:31:19 2003 +++ b/net/bridge/br_forward.c Mon Sep 8 09:31:19 2003 @@ -69,6 +69,7 @@ indev = skb->dev; skb->dev = to->dev; + skb->ip_summed = CHECKSUM_NONE; NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev, br_forward_finish); From shemminger@osdl.org Mon Sep 8 09:57:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 09:57:43 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88Gvbx4030286 for ; Mon, 8 Sep 2003 09:57:38 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88GvPo09986; Mon, 8 Sep 2003 09:57:25 -0700 Date: Mon, 8 Sep 2003 09:57:08 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: Linus Torvalds , netdev@oss.sgi.com Subject: [PATCH] sdla non-module build fix. Message-Id: <20030908095708.107b98c4.shemminger@osdl.org> In-Reply-To: <3F5B7ED7.2070908@pobox.com> References: <3F5B7ED7.2070908@pobox.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5687 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 Content-Length: 376 Lines: 17 Last round of changes broke sdla build if not a module. diff -Nru a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c --- a/drivers/net/wan/sdla.c Mon Sep 8 09:49:56 2003 +++ b/drivers/net/wan/sdla.c Mon Sep 8 09:49:56 2003 @@ -1719,9 +1719,9 @@ unregister_frad(devname); } -#endif MODULE_LICENSE("GPL"); module_init(init_sdla); module_exit(exit_sdla); +#endif From torvalds@osdl.org Mon Sep 8 10:32:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 10:32:38 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88HWYx4006234 for ; Mon, 8 Sep 2003 10:32:35 -0700 Received: from localhost (build.pdx.osdl.net [172.20.1.2]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h88HWQo18383; Mon, 8 Sep 2003 10:32:26 -0700 Date: Mon, 8 Sep 2003 10:32:26 -0700 (PDT) From: Linus Torvalds To: Stephen Hemminger cc: Jeff Garzik , Subject: Re: [PATCH] sdla non-module build fix. In-Reply-To: <20030908095708.107b98c4.shemminger@osdl.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5688 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: torvalds@osdl.org Precedence: bulk X-list: netdev Content-Length: 406 Lines: 14 On Mon, 8 Sep 2003, Stephen Hemminger wrote: > > Last round of changes broke sdla build if not a module. This patch can't be right. It may fix the compile, but it looks like init/exit_sdla is never registered at all if it's built-in. I suspect the whole #ifdef should go away. A driver that does things differently depending on whether it is a module or not is generally a _broken_ driver. Linus From shemminger@osdl.org Mon Sep 8 10:33:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 10:33:57 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88HXrx4006530 for ; Mon, 8 Sep 2003 10:33:54 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88HXeo18556; Mon, 8 Sep 2003 10:33:40 -0700 Date: Mon, 8 Sep 2003 10:33:24 -0700 From: Stephen Hemminger To: Linus Torvalds Cc: Jeff Garzik , Subject: Re: [PATCH] sdla non-module build fix. Message-Id: <20030908103324.6545cdeb.shemminger@osdl.org> In-Reply-To: References: <20030908095708.107b98c4.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5689 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 Content-Length: 623 Lines: 19 On Mon, 8 Sep 2003 10:32:26 -0700 (PDT) Linus Torvalds wrote: > > On Mon, 8 Sep 2003, Stephen Hemminger wrote: > > > > Last round of changes broke sdla build if not a module. > > This patch can't be right. It may fix the compile, but it looks like > init/exit_sdla is never registered at all if it's built-in. > > I suspect the whole #ifdef should go away. A driver that does things > differently depending on whether it is a module or not is generally a > _broken_ driver. > > Linus The registration for non-modular takes place via drivers/net/Space.c calling sdla_init like it always did. From garzik@gtf.org Mon Sep 8 11:09:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 11:09:26 -0700 (PDT) Received: from havoc.gtf.org (havoc.gtf.org [63.247.75.124]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88I9Ax4010737 for ; Mon, 8 Sep 2003 11:09:10 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id AA7FD6644; Mon, 8 Sep 2003 13:36:44 -0400 (EDT) Date: Mon, 8 Sep 2003 13:36:44 -0400 From: Jeff Garzik To: Linus Torvalds Cc: Stephen Hemminger , netdev@oss.sgi.com Subject: Re: [PATCH] sdla non-module build fix. Message-ID: <20030908173644.GA22629@gtf.org> References: <20030908095708.107b98c4.shemminger@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-archive-position: 5690 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 Content-Length: 1103 Lines: 30 On Mon, Sep 08, 2003 at 10:32:26AM -0700, Linus Torvalds wrote: > > On Mon, 8 Sep 2003, Stephen Hemminger wrote: > > > > Last round of changes broke sdla build if not a module. > > This patch can't be right. It may fix the compile, but it looks like > init/exit_sdla is never registered at all if it's built-in. > > I suspect the whole #ifdef should go away. A driver that does things > differently depending on whether it is a module or not is generally a > _broken_ driver. Nope, this is one of those weird two-ways-of-initialization things, like drivers/net/Space.c or drivers/video/fbmem.c. If you look at the sdla code, just above where Stephen's patch's context ends, you see "sdla_init" which is called by both modular and non-modular code. So -- with the exception of #ifdef'ing out MODULE_LICENSE, Stephen's patch is ok. Now that said, this situation is only temporary, until we get all the network device structs being allocated dynamically, and interface ordering issues are resolved. Once that happens, you are absolutely right: sdla's #ifdef MODULE should be removed. Jeff From cfriesen@nortelnetworks.com Mon Sep 8 12:43:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 12:44:13 -0700 (PDT) Received: from zcars0m9.nortelnetworks.com (zcars0m9.nortelnetworks.com [47.129.242.157]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88Jhdx4018435 for ; Mon, 8 Sep 2003 12:43:40 -0700 Received: from zcard309.ca.nortel.com (zcard309.ca.nortel.com [47.129.242.69]) by zcars0m9.nortelnetworks.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id h88JhRR09609; Mon, 8 Sep 2003 15:43:27 -0400 (EDT) Received: from zcard0k6.ca.nortel.com ([47.129.242.158]) by zcard309.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id RY5ABRZM; Mon, 8 Sep 2003 15:43:28 -0400 Received: from pcard0ks.ca.nortel.com ([47.129.117.131]) by zcard0k6.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id Q8C6KLC0; Mon, 8 Sep 2003 15:43:27 -0400 Received: from nortelnetworks.com (localhost.localdomain [127.0.0.1]) by pcard0ks.ca.nortel.com (Postfix) with ESMTP id C805A2D957; Mon, 8 Sep 2003 15:43:26 -0400 (EDT) Message-ID: <3F5CDBDE.8000604@nortelnetworks.com> Date: Mon, 08 Sep 2003 15:43:26 -0400 X-Sybari-Space: 00000000 00000000 00000000 00000000 From: Chris Friesen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org Subject: any plans for a really lowlevel netfilter hook? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5691 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: cfriesen@nortelnetworks.com Precedence: bulk X-list: netdev Content-Length: 915 Lines: 25 I've got a wn2k session running in vmware configured with bridged ethernet. In this mode, windows accessses the hardware and gets a separate IP address from the linux host. I assume that it's done through a packet socket or something like that. Anyways, I had been hoping to be able to filter the packets, but it seems that they get pulled off before they hit the ip stack, and so iptables is useless. ebtables seems to only affect bridged stuff, so I don't think that it would be applicable either. What I'd like would be some kind of netfilter hook really early and really late (before and after packet sockets, respectively). Any plans for such? Chris -- Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com From chas@cmf.nrl.navy.mil Mon Sep 8 13:41:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 13:42:15 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88Kffx4023608 for ; Mon, 8 Sep 2003 13:41:42 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h88KfISa003500; Mon, 8 Sep 2003 16:41:18 -0400 (EDT) Message-Id: <200309082041.h88KfISa003500@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com, romieu@fr.zoreil.com Subject: [PATCH][ATM] seqfile conversion for net/atm/proc.c Reply-To: chas3@users.sourceforge.net Date: Mon, 08 Sep 2003 16:41:19 -0400 From: chas williams X-Spam-Score: () hits=0.5 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5693 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev Content-Length: 49429 Lines: 1782 please apply to 2.6 (please note this patch has been split into 8 pieces) -- thanks [ATM]: seq_file for /proc/net/atm (devices) [1/8] (from romieu@fr.zoreil.com) seq_file conversion for proc/atm/devices: - code inspired from seq_file use in net/core/dev.c; - atm_dev_lock taken/released in atm_dev_seq_{start/stop}; - add a helper CREATE_SEQ_ENTRY() similar to CREATE_ENTRY() (both are removed once conversion is done). - atm_dev_seq_{start/stop/next} done in net/atm/resource.[ch] to ease future handling of atm_devs and locking structure (per Chas suggestion) net/atm/proc.c | 86 +++++++++++++++++++++++++++++++--------------------- net/atm/resources.c | 29 +++++++++++++++++ net/atm/resources.h | 5 +++ 3 files changed, 86 insertions(+), 34 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-devices net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-devices Sat Sep 6 23:22:58 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:22:58 2003 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -64,32 +65,30 @@ static struct file_operations proc_spec_ .read = proc_spec_atm_read, }; -static void add_stats(char *buf,const char *aal, +static void add_stats(struct seq_file *seq, const char *aal, const struct k_atm_aal_stats *stats) { - sprintf(strchr(buf,0),"%s ( %d %d %d %d %d )",aal, + seq_printf(seq, "%s ( %d %d %d %d %d )", aal, atomic_read(&stats->tx),atomic_read(&stats->tx_err), atomic_read(&stats->rx),atomic_read(&stats->rx_err), atomic_read(&stats->rx_drop)); } - -static void atm_dev_info(const struct atm_dev *dev,char *buf) +static void atm_dev_info(struct seq_file *seq, const struct atm_dev *dev) { - int off,i; + int i; - off = sprintf(buf,"%3d %-8s",dev->number,dev->type); + seq_printf(seq, "%3d %-8s", dev->number, dev->type); for (i = 0; i < ESI_LEN; i++) - off += sprintf(buf+off,"%02x",dev->esi[i]); - strcat(buf," "); - add_stats(buf,"0",&dev->stats.aal0); - strcat(buf," "); - add_stats(buf,"5",&dev->stats.aal5); - sprintf(strchr(buf,0), "\t[%d]", atomic_read(&dev->refcnt)); - strcat(buf,"\n"); + seq_printf(seq, "%02x", dev->esi[i]); + seq_puts(seq, " "); + add_stats(seq, "0", &dev->stats.aal0); + seq_puts(seq, " "); + add_stats(seq, "5", &dev->stats.aal5); + seq_printf(seq, "\t[%d]", atomic_read(&dev->refcnt)); + seq_putc(seq, '\n'); } - #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) @@ -303,29 +302,40 @@ lec_info(struct lec_arp_table *entry, ch #endif -static int atm_devices_info(loff_t pos,char *buf) +static int atm_dev_seq_show(struct seq_file *seq, void *v) { - struct atm_dev *dev; - struct list_head *p; - int left; + static char atm_dev_banner[] = + "Itf Type ESI/\"MAC\"addr " + "AAL(TX,err,RX,err,drop) ... [refcnt]\n"; + + if (v == (void *)1) + seq_puts(seq, atm_dev_banner); + else { + struct atm_dev *dev = list_entry(v, struct atm_dev, dev_list); - if (!pos) { - return sprintf(buf,"Itf Type ESI/\"MAC\"addr " - "AAL(TX,err,RX,err,drop) ... [refcnt]\n"); - } - left = pos-1; - spin_lock(&atm_dev_lock); - list_for_each(p, &atm_devs) { - dev = list_entry(p, struct atm_dev, dev_list); - if (left-- == 0) { - atm_dev_info(dev,buf); - spin_unlock(&atm_dev_lock); - return strlen(buf); - } + atm_dev_info(seq, dev); } - spin_unlock(&atm_dev_lock); - return 0; + return 0; } + +static struct seq_operations atm_dev_seq_ops = { + .start = atm_dev_seq_start, + .next = atm_dev_seq_next, + .stop = atm_dev_seq_stop, + .show = atm_dev_seq_show, +}; + +static int atm_dev_seq_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &atm_dev_seq_ops); +} + +static struct file_operations devices_seq_fops = { + .open = atm_dev_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; /* * FIXME: it isn't safe to walk the VCC list without turning off interrupts. @@ -630,6 +640,14 @@ void atm_proc_dev_deregister(struct atm_ kfree(dev->proc_name); } +#define CREATE_SEQ_ENTRY(name) \ + do { \ + name = create_proc_entry(#name, S_IRUGO, atm_proc_root); \ + if (!name) \ + goto cleanup; \ + name->proc_fops = & name##_seq_fops; \ + name->owner = THIS_MODULE; \ + } while (0) #define CREATE_ENTRY(name) \ name = create_proc_entry(#name,0,atm_proc_root); \ @@ -663,7 +681,7 @@ int __init atm_proc_init(void) atm_proc_root = proc_mkdir("net/atm",NULL); if (!atm_proc_root) return -ENOMEM; - CREATE_ENTRY(devices); + CREATE_SEQ_ENTRY(devices); CREATE_ENTRY(pvc); CREATE_ENTRY(svc); CREATE_ENTRY(vc); diff -puN net/atm/resources.c~atm-proc-seq-devices net/atm/resources.c --- linux-2.6.0-test4-bk8/net/atm/resources.c~atm-proc-seq-devices Sat Sep 6 23:22:58 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/resources.c Sat Sep 6 23:22:58 2003 @@ -395,6 +395,35 @@ done: return error; } +static __inline__ void *dev_get_idx(loff_t left) +{ + struct list_head *p; + + list_for_each(p, &atm_devs) { + if (!--left) + break; + } + return (p != &atm_devs) ? p : NULL; +} + +void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) +{ + spin_lock(&atm_dev_lock); + return *pos ? dev_get_idx(*pos) : (void *) 1; +} + +void atm_dev_seq_stop(struct seq_file *seq, void *v) +{ + spin_unlock(&atm_dev_lock); +} + +void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + ++*pos; + v = (v == (void *)1) ? atm_devs.next : ((struct list_head *)v)->next; + return (v == &atm_devs) ? NULL : v; +} + EXPORT_SYMBOL(atm_dev_register); EXPORT_SYMBOL(atm_dev_deregister); diff -puN net/atm/resources.h~atm-proc-seq-devices net/atm/resources.h --- linux-2.6.0-test4-bk8/net/atm/resources.h~atm-proc-seq-devices Sat Sep 6 23:22:58 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/resources.h Sat Sep 6 23:22:58 2003 @@ -21,6 +21,11 @@ int atm_dev_ioctl(unsigned int cmd, unsi #include +void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos); +void atm_dev_seq_stop(struct seq_file *seq, void *v); +void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); + + int atm_proc_dev_register(struct atm_dev *dev); void atm_proc_dev_deregister(struct atm_dev *dev); [ATM]: seq_file for /proc/net/atm (vc utils) [2/8] (from romieu@fr.zoreil.com) Helpers for seq_file conversion of proc/atm/{pvc/svc/vc}: - struct vcc_state keeps 1) the struct sock from which the current struct atm_vcc is deduced 2) the family to which must belong the vcc (PF_ATM{SVC/PVC/any}) 3) the availability of clip module - vcc_seq{start/stop} are responsible for vcc_sklist locking - __vcc_seq_open and vcc_seq_release take care of get/put for the clip module. Chas's suggestions applied since last version: - atm_vc_xxx renamed to vcc_xxx - atm_vc_common_seq_open renamed __vcc_seq_open (future name clashes avoidance) net/atm/proc.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 100 insertions(+) diff -puN net/atm/proc.c~atm-proc-seq-vc-utils net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-vc-utils Sat Sep 6 23:25:10 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:25:10 2003 @@ -161,6 +161,106 @@ static void atmarp_info(struct net_devic #endif +struct vcc_state { + struct sock *sk; + int family; + int clip_info; +}; + +static inline int compare_family(struct sock *sk, int family) +{ + struct atm_vcc *vcc = atm_sk(sk); + + return !family || (vcc->sk->sk_family == family); +} + +static int __vcc_walk(struct sock **sock, int family, loff_t l) +{ + struct sock *sk = *sock; + + if (sk == (void *)1) { + sk = hlist_empty(&vcc_sklist) ? NULL : __sk_head(&vcc_sklist); + l--; + } + for (; sk; sk = sk_next(sk)) { + l -= compare_family(sk, family); + if (l < 0) + goto out; + } + sk = (void *)1; +out: + *sock = sk; + return (l < 0); +} + +static inline void *vcc_walk(struct vcc_state *state, loff_t l) +{ + return __vcc_walk(&state->sk, state->family, l) ? + state : NULL; +} + +static int __vcc_seq_open(struct inode *inode, struct file *file, + int family, struct seq_operations *ops) +{ + struct vcc_state *state; + struct seq_file *seq; + int rc = -ENOMEM; + + state = kmalloc(sizeof(*state), GFP_KERNEL); + if (!state) + goto out; + + rc = seq_open(file, ops); + if (rc) + goto out_kfree; + + state->family = family; + state->clip_info = try_atm_clip_ops(); + + seq = file->private_data; + seq->private = state; +out: + return rc; +out_kfree: + kfree(state); + goto out; +} + +static int vcc_seq_release(struct inode *inode, struct file *file) +{ +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) + struct seq_file *seq = file->private_data; + struct vcc_state *state = seq->private; + + if (state->clip_info) + module_put(atm_clip_ops->owner); +#endif + return seq_release_private(inode, file); +} + +static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) +{ + struct vcc_state *state = seq->private; + loff_t left = *pos; + + read_lock(&vcc_sklist_lock); + state->sk = (void *)1; + return left ? vcc_walk(state, left) : (void *)1; +} + +static void vcc_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&vcc_sklist_lock); +} + +static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct vcc_state *state = seq->private; + + v = vcc_walk(state, 1); + *pos += !!PTR_ERR(v); + return v; +} static void pvc_info(struct atm_vcc *vcc, char *buf, int clip_info) { [ATM]: seq_file for /proc/net/atm (pvc) [3/8] (from romieu@fr.zoreil.com) seq_file support for /proc/net/atm/pvc: - pvc_info(): seq_printf/seq_putc replaces sprintf; - atm_pvc_info() removal; - the vc helpers (vcc__seq_xxx) do the remaining work. Chas's suggestions applied since last version: - atm_pvc_xxx renamed to pvc_xxx - atm_seq_pvc_fops renamed to pvc_seq_fops net/atm/proc.c | 81 +++++++++++++++++++++++---------------------------------- 1 files changed, 34 insertions(+), 47 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-pvc-conversion net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-pvc-conversion Sat Sep 6 23:26:53 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:26:53 2003 @@ -262,7 +262,7 @@ static void *vcc_seq_next(struct seq_fil return v; } -static void pvc_info(struct atm_vcc *vcc, char *buf, int clip_info) +static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc, int clip_info) { static const char *class_name[] = { "off","UBR","CBR","VBR","ABR" }; static const char *aal_name[] = { @@ -270,9 +270,8 @@ static void pvc_info(struct atm_vcc *vcc "???", "5", "???", "???", /* 4- 7 */ "???", "???", "???", "???", /* 8-11 */ "???", "0", "???", "???"}; /* 12-15 */ - int off; - off = sprintf(buf,"%3d %3d %5d %-3s %7d %-5s %7d %-6s", + seq_printf(seq, "%3d %3d %5d %-3s %7d %-5s %7d %-6s", vcc->dev->number,vcc->vpi,vcc->vci, vcc->qos.aal >= sizeof(aal_name)/sizeof(aal_name[0]) ? "err" : aal_name[vcc->qos.aal],vcc->qos.rxtp.min_pcr, @@ -284,18 +283,14 @@ static void pvc_info(struct atm_vcc *vcc struct net_device *dev; dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : NULL; - off += sprintf(buf+off,"CLIP, Itf:%s, Encap:", + seq_printf(seq, "CLIP, Itf:%s, Encap:", dev ? dev->name : "none?"); - if (clip_vcc->encap) - off += sprintf(buf+off,"LLC/SNAP"); - else - off += sprintf(buf+off,"None"); + seq_printf(seq, "%s", clip_vcc->encap ? "LLC/SNAP" : "None"); } #endif - strcpy(buf+off,"\n"); + seq_putc(seq, '\n'); } - static const char *vcc_state(struct atm_vcc *vcc) { static const char *map[] = { ATM_VS2TXT_MAP }; @@ -437,48 +432,40 @@ static struct file_operations devices_se .release = seq_release, }; -/* - * FIXME: it isn't safe to walk the VCC list without turning off interrupts. - * What is really needed is some lock on the devices. Ditto for ATMARP. - */ - -static int atm_pvc_info(loff_t pos,char *buf) +static int pvc_seq_show(struct seq_file *seq, void *v) { - struct hlist_node *node; - struct sock *s; - struct atm_vcc *vcc; - int left, clip_info = 0; + static char atm_pvc_banner[] = + "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n"; - if (!pos) { - return sprintf(buf,"Itf VPI VCI AAL RX(PCR,Class) " - "TX(PCR,Class)\n"); - } - left = pos-1; -#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - if (try_atm_clip_ops()) - clip_info = 1; -#endif - read_lock(&vcc_sklist_lock); - sk_for_each(s, node, &vcc_sklist) { - vcc = atm_sk(s); - if (vcc->sk->sk_family == PF_ATMPVC && vcc->dev && !left--) { - pvc_info(vcc,buf,clip_info); - read_unlock(&vcc_sklist_lock); -#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - if (clip_info) - module_put(atm_clip_ops->owner); -#endif - return strlen(buf); - } + if (v == (void *)1) + seq_puts(seq, atm_pvc_banner); + else { + struct vcc_state *state = seq->private; + struct atm_vcc *vcc = atm_sk(state->sk); + + pvc_info(seq, vcc, state->clip_info); } - read_unlock(&vcc_sklist_lock); -#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - if (clip_info) - module_put(atm_clip_ops->owner); -#endif return 0; } +static struct seq_operations pvc_seq_ops = { + .start = vcc_seq_start, + .next = vcc_seq_next, + .stop = vcc_seq_stop, + .show = pvc_seq_show, +}; + +static int pvc_seq_open(struct inode *inode, struct file *file) +{ + return __vcc_seq_open(inode, file, PF_ATMPVC, &pvc_seq_ops); +} + +static struct file_operations pvc_seq_fops = { + .open = pvc_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = vcc_seq_release, +}; static int atm_vc_info(loff_t pos,char *buf) { @@ -782,7 +769,7 @@ int __init atm_proc_init(void) if (!atm_proc_root) return -ENOMEM; CREATE_SEQ_ENTRY(devices); - CREATE_ENTRY(pvc); + CREATE_SEQ_ENTRY(pvc); CREATE_ENTRY(svc); CREATE_ENTRY(vc); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) [ATM]: seq_file for /proc/net/atm (svc) [4/8] (from romieu@fr.zoreil.com) seq_file support for /proc/net/atm/svc: Exactly same comments as pvc. Just s/p/s/ net/atm/proc.c | 81 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 44 insertions(+), 37 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-svc-conversion net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-svc-conversion Sat Sep 6 23:29:31 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:29:31 2003 @@ -323,29 +323,26 @@ static void vc_info(struct atm_vcc *vcc, atomic_read(&vcc->sk->sk_rmem_alloc), vcc->sk->sk_rcvbuf); } - -static void svc_info(struct atm_vcc *vcc,char *buf) +static void svc_info(struct seq_file *seq, struct atm_vcc *vcc) { - char *here; - int i; - if (!vcc->dev) - sprintf(buf,sizeof(void *) == 4 ? "N/A@%p%10s" : "N/A@%p%2s", - vcc,""); - else sprintf(buf,"%3d %3d %5d ",vcc->dev->number,vcc->vpi, - vcc->vci); - here = strchr(buf,0); - here += sprintf(here,"%-10s ",vcc_state(vcc)); - here += sprintf(here,"%s%s",vcc->remote.sas_addr.pub, + seq_printf(seq, sizeof(void *) == 4 ? + "N/A@%p%10s" : "N/A@%p%2s", vcc, ""); + else + seq_printf(seq, "%3d %3d %5d ", + vcc->dev->number, vcc->vpi, vcc->vci); + seq_printf(seq, "%-10s ", vcc_state(vcc)); + seq_printf(seq, "%s%s", vcc->remote.sas_addr.pub, *vcc->remote.sas_addr.pub && *vcc->remote.sas_addr.prv ? "+" : ""); - if (*vcc->remote.sas_addr.prv) + if (*vcc->remote.sas_addr.prv) { + int i; + for (i = 0; i < ATM_ESA_LEN; i++) - here += sprintf(here,"%02x", - vcc->remote.sas_addr.prv[i]); - strcat(here,"\n"); + seq_printf(seq, "%02x", vcc->remote.sas_addr.prv[i]); + } + seq_putc(seq, '\n'); } - #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) static char* @@ -493,31 +490,41 @@ static int atm_vc_info(loff_t pos,char * return 0; } - -static int atm_svc_info(loff_t pos,char *buf) +static int svc_seq_show(struct seq_file *seq, void *v) { - struct hlist_node *node; - struct sock *s; - struct atm_vcc *vcc; - int left; + static char atm_svc_banner[] = + "Itf VPI VCI State Remote\n"; - if (!pos) - return sprintf(buf,"Itf VPI VCI State Remote\n"); - left = pos-1; - read_lock(&vcc_sklist_lock); - sk_for_each(s, node, &vcc_sklist) { - vcc = atm_sk(s); - if (vcc->sk->sk_family == PF_ATMSVC && !left--) { - svc_info(vcc,buf); - read_unlock(&vcc_sklist_lock); - return strlen(buf); - } - } - read_unlock(&vcc_sklist_lock); + if (v == (void *)1) + seq_puts(seq, atm_svc_banner); + else { + struct vcc_state *state = seq->private; + struct atm_vcc *vcc = atm_sk(state->sk); + svc_info(seq, vcc); + } return 0; } +static struct seq_operations svc_seq_ops = { + .start = vcc_seq_start, + .next = vcc_seq_next, + .stop = vcc_seq_stop, + .show = svc_seq_show, +}; + +static int svc_seq_open(struct inode *inode, struct file *file) +{ + return __vcc_seq_open(inode, file, PF_ATMSVC, &svc_seq_ops); +} + +static struct file_operations svc_seq_fops = { + .open = svc_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = vcc_seq_release, +}; + #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) static int atm_arp_info(loff_t pos,char *buf) { @@ -770,7 +777,7 @@ int __init atm_proc_init(void) return -ENOMEM; CREATE_SEQ_ENTRY(devices); CREATE_SEQ_ENTRY(pvc); - CREATE_ENTRY(svc); + CREATE_SEQ_ENTRY(svc); CREATE_ENTRY(vc); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) CREATE_ENTRY(arp); [ATM]: seq_file for /proc/net/atm (vc) [5/8] (from romieu@fr.zoreil.com) seq_file support for /proc/net/atm/vc: Same comments as for pvc and svc. Extra Chas's suggestion applied since last version: - atm_vc_xxx renamed to vcc_xxx. net/atm/proc.c | 90 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 48 insertions(+), 42 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-vc-conversion net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-vc-conversion Sat Sep 6 23:30:55 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:30:55 2003 @@ -298,29 +298,27 @@ static const char *vcc_state(struct atm_ return map[ATM_VF2VS(vcc->flags)]; } - -static void vc_info(struct atm_vcc *vcc,char *buf) +static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc) { - char *here; - - here = buf+sprintf(buf,"%p ",vcc); - if (!vcc->dev) here += sprintf(here,"Unassigned "); - else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi, - vcc->vci); + seq_printf(seq, "%p ", vcc); + if (!vcc->dev) + seq_printf(seq, "Unassigned "); + else + seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi, + vcc->vci); switch (vcc->sk->sk_family) { case AF_ATMPVC: - here += sprintf(here,"PVC"); + seq_printf(seq, "PVC"); break; case AF_ATMSVC: - here += sprintf(here,"SVC"); + seq_printf(seq, "SVC"); break; default: - here += sprintf(here, "%3d", vcc->sk->sk_family); + seq_printf(seq, "%3d", vcc->sk->sk_family); } - here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags, - vcc->sk->sk_err, - atomic_read(&vcc->sk->sk_wmem_alloc), vcc->sk->sk_sndbuf, - atomic_read(&vcc->sk->sk_rmem_alloc), vcc->sk->sk_rcvbuf); + seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d\n", vcc->flags, vcc->sk->sk_err, + atomic_read(&vcc->sk->sk_wmem_alloc),vcc->sk->sk_sndbuf, + atomic_read(&vcc->sk->sk_rmem_alloc),vcc->sk->sk_rcvbuf); } static void svc_info(struct seq_file *seq, struct atm_vcc *vcc) @@ -464,31 +462,39 @@ static struct file_operations pvc_seq_fo .release = vcc_seq_release, }; -static int atm_vc_info(loff_t pos,char *buf) +static int vcc_seq_show(struct seq_file *seq, void *v) { - struct atm_vcc *vcc; - struct hlist_node *node; - struct sock *s; - int left; - - if (!pos) - return sprintf(buf,sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", - "Address"," Itf VPI VCI Fam Flags Reply Send buffer" - " Recv buffer\n"); - left = pos-1; - read_lock(&vcc_sklist_lock); - sk_for_each(s, node, &vcc_sklist) { - vcc = atm_sk(s); - if (!left--) { - vc_info(vcc,buf); - read_unlock(&vcc_sklist_lock); - return strlen(buf); - } - } - read_unlock(&vcc_sklist_lock); - - return 0; + if (v == (void *)1) { + seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", + "Address ", "Itf VPI VCI Fam Flags Reply " + "Send buffer Recv buffer\n"); + } else { + struct vcc_state *state = seq->private; + struct atm_vcc *vcc = atm_sk(state->sk); + + vcc_info(seq, vcc); + } + return 0; +} + +static struct seq_operations vcc_seq_ops = { + .start = vcc_seq_start, + .next = vcc_seq_next, + .stop = vcc_seq_stop, + .show = vcc_seq_show, +}; + +static int vcc_seq_open(struct inode *inode, struct file *file) +{ + return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); } + +static struct file_operations vcc_seq_fops = { + .open = vcc_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = vcc_seq_release, +}; static int svc_seq_show(struct seq_file *seq, void *v) { @@ -751,7 +757,7 @@ void atm_proc_dev_deregister(struct atm_ name->owner = THIS_MODULE static struct proc_dir_entry *devices = NULL, *pvc = NULL, - *svc = NULL, *arp = NULL, *lec = NULL, *vc = NULL; + *svc = NULL, *arp = NULL, *lec = NULL, *vcc = NULL; static void atm_proc_cleanup(void) { @@ -765,8 +771,8 @@ static void atm_proc_cleanup(void) remove_proc_entry("arp",atm_proc_root); if (lec) remove_proc_entry("lec",atm_proc_root); - if (vc) - remove_proc_entry("vc",atm_proc_root); + if (vcc) + remove_proc_entry("vcc",atm_proc_root); remove_proc_entry("net/atm",NULL); } @@ -778,7 +784,7 @@ int __init atm_proc_init(void) CREATE_SEQ_ENTRY(devices); CREATE_SEQ_ENTRY(pvc); CREATE_SEQ_ENTRY(svc); - CREATE_ENTRY(vc); + CREATE_SEQ_ENTRY(vcc); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) CREATE_ENTRY(arp); #endif _ [ATM]: seq_file for /proc/net/atm (arp) [6/8] (from romieu@fr.zoreil.com) seq_file support for /proc/net/atm/arp: - svc_addr/atmarp_info(): seq_printf/seq_putc replace sprintf and friends; - arp_getidx/arp_vcc_walk() take care of the usual seq_file cursor positionning: they both return NULL until the cursor has reached its position. struct atm_arp_state is updated accordingly; - arp_seq_{stop/start} are responsible for clip_tbl_hook (un)locking; - module refcounting is done in arp_seq_open()/arp_seq_release(); - atm_lec_info() is removed. Chas's suggestions applied since last version: - atm_arp_xxx renamed to arp_xxx; - atm_seq_arp_fops renamed to arp_seq_fops. Chas didn't ask for it but I renamed arp_vc_walk to arp_vcc_walk. net/atm/proc.c | 269 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 185 insertions(+), 84 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-arp-conversion net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-arp-conversion Sat Sep 6 23:31:55 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sat Sep 6 23:31:55 2003 @@ -91,75 +91,67 @@ static void atm_dev_info(struct seq_file #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - -static int svc_addr(char *buf,struct sockaddr_atmsvc *addr) +static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) { static int code[] = { 1,2,10,6,1,0 }; static int e164[] = { 1,8,4,6,1,0 }; - int *fields; - int len,i,j,pos; - len = 0; if (*addr->sas_addr.pub) { - strcpy(buf,addr->sas_addr.pub); - len = strlen(addr->sas_addr.pub); - buf += len; - if (*addr->sas_addr.prv) { - *buf++ = '+'; - len++; - } + seq_printf(seq, "%s", addr->sas_addr.pub); + if (*addr->sas_addr.prv) + seq_putc(seq, '+'); + } else if (!*addr->sas_addr.prv) { + seq_printf(seq, "%s", "(none)"); + return; } - else if (!*addr->sas_addr.prv) { - strcpy(buf,"(none)"); - return strlen(buf); - } if (*addr->sas_addr.prv) { - len += 44; - pos = 0; - fields = *addr->sas_addr.prv == ATM_AFI_E164 ? e164 : code; + unsigned char *prv = addr->sas_addr.prv; + int *fields; + int i, j; + + fields = *prv == ATM_AFI_E164 ? e164 : code; for (i = 0; fields[i]; i++) { - for (j = fields[i]; j; j--) { - sprintf(buf,"%02X",addr->sas_addr.prv[pos++]); - buf += 2; - } - if (fields[i+1]) *buf++ = '.'; + for (j = fields[i]; j; j--) + seq_printf(seq, "%02X", *prv++); + if (fields[i+1]) + seq_putc(seq, '.'); } } - return len; } - -static void atmarp_info(struct net_device *dev,struct atmarp_entry *entry, - struct clip_vcc *clip_vcc,char *buf) +static void atmarp_info(struct seq_file *seq, struct net_device *dev, + struct atmarp_entry *entry, struct clip_vcc *clip_vcc) { - unsigned char *ip; - int svc,off,ip_len; + char buf[17]; + int svc, off; svc = !clip_vcc || clip_vcc->vcc->sk->sk_family == AF_ATMSVC; - off = sprintf(buf,"%-6s%-4s%-4s%5ld ",dev->name,svc ? "SVC" : "PVC", + seq_printf(seq, "%-6s%-4s%-4s%5ld ", dev->name, svc ? "SVC" : "PVC", !clip_vcc || clip_vcc->encap ? "LLC" : "NULL", - (jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/ - HZ); - ip = (unsigned char *) &entry->ip; - ip_len = sprintf(buf+off,"%d.%d.%d.%d",ip[0],ip[1],ip[2],ip[3]); - off += ip_len; - while (ip_len++ < 16) buf[off++] = ' '; - if (!clip_vcc) + (jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/HZ); + + off = snprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", NIPQUAD(entry->ip)); + while (off < 16) + buf[off++] = ' '; + buf[off] = '\0'; + seq_printf(seq, "%s", buf); + + if (!clip_vcc) { if (time_before(jiffies, entry->expires)) - strcpy(buf+off,"(resolving)\n"); - else sprintf(buf+off,"(expired, ref %d)\n", - atomic_read(&entry->neigh->refcnt)); - else if (!svc) - sprintf(buf+off,"%d.%d.%d\n",clip_vcc->vcc->dev->number, - clip_vcc->vcc->vpi,clip_vcc->vcc->vci); - else { - off += svc_addr(buf+off,&clip_vcc->vcc->remote); - strcpy(buf+off,"\n"); - } + seq_printf(seq, "(resolving)\n"); + else + seq_printf(seq, "(expired, ref %d)\n", + atomic_read(&entry->neigh->refcnt)); + } else if (!svc) { + seq_printf(seq, "%d.%d.%d\n", clip_vcc->vcc->dev->number, + clip_vcc->vcc->vpi, clip_vcc->vcc->vci); + } else { + svc_addr(seq, &clip_vcc->vcc->remote); + seq_putc(seq, '\n'); + } } - -#endif +#endif /* CONFIG_ATM_CLIP */ struct vcc_state { struct sock *sk; @@ -532,45 +524,154 @@ static struct file_operations svc_seq_fo }; #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) -static int atm_arp_info(loff_t pos,char *buf) + +struct arp_state { + int bucket; + struct neighbour *n; + struct clip_vcc *vcc; +}; + +static void *arp_vcc_walk(struct arp_state *state, + struct atmarp_entry *e, loff_t *l) { - struct neighbour *n; - int i,count; + struct clip_vcc *vcc = state->vcc; - if (!pos) { - return sprintf(buf,"IPitf TypeEncp Idle IP address " - "ATM address\n"); + if (!vcc) + vcc = e->vccs; + if (vcc == (void *)1) { + vcc = e->vccs; + --*l; + } + for (; vcc; vcc = vcc->next) { + if (--*l < 0) + break; } - if (!try_atm_clip_ops()) - return 0; - count = pos; + state->vcc = vcc; + return (*l < 0) ? state : NULL; +} + +static void *arp_get_idx(struct arp_state *state, loff_t l) +{ + void *v = NULL; + + for (; state->bucket <= NEIGH_HASHMASK; state->bucket++) { + for (; state->n; state->n = state->n->next) { + v = arp_vcc_walk(state, NEIGH2ENTRY(state->n), &l); + if (v) + goto done; + } + state->n = clip_tbl_hook->hash_buckets[state->bucket + 1]; + } +done: + return v; +} + +static void *arp_seq_start(struct seq_file *seq, loff_t *pos) +{ + struct arp_state *state = seq->private; + void *ret = (void *)1; + + if (!clip_tbl_hook) { + state->bucket = -1; + goto out; + } + read_lock_bh(&clip_tbl_hook->lock); - for (i = 0; i <= NEIGH_HASHMASK; i++) - for (n = clip_tbl_hook->hash_buckets[i]; n; n = n->next) { - struct atmarp_entry *entry = NEIGH2ENTRY(n); - struct clip_vcc *vcc; - - if (!entry->vccs) { - if (--count) continue; - atmarp_info(n->dev,entry,NULL,buf); - read_unlock_bh(&clip_tbl_hook->lock); - module_put(atm_clip_ops->owner); - return strlen(buf); - } - for (vcc = entry->vccs; vcc; - vcc = vcc->next) { - if (--count) continue; - atmarp_info(n->dev,entry,vcc,buf); - read_unlock_bh(&clip_tbl_hook->lock); - module_put(atm_clip_ops->owner); - return strlen(buf); - } - } - read_unlock_bh(&clip_tbl_hook->lock); + state->bucket = 0; + state->n = clip_tbl_hook->hash_buckets[0]; + state->vcc = (void *)1; + if (*pos) + ret = arp_get_idx(state, *pos); +out: + return ret; +} + +static void arp_seq_stop(struct seq_file *seq, void *v) +{ + struct arp_state *state = seq->private; + + if (state->bucket != -1) + read_unlock_bh(&clip_tbl_hook->lock); +} + +static void *arp_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct arp_state *state = seq->private; + + v = arp_get_idx(state, 1); + *pos += !!PTR_ERR(v); + return v; +} + +static int arp_seq_show(struct seq_file *seq, void *v) +{ + static char atm_arp_banner[] = + "IPitf TypeEncp Idle IP address ATM address\n"; + + if (v == (void *)1) + seq_puts(seq, atm_arp_banner); + else { + struct arp_state *state = seq->private; + struct neighbour *n = state->n; + struct clip_vcc *vcc = state->vcc; + + atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc); + } + return 0; +} + +static struct seq_operations arp_seq_ops = { + .start = arp_seq_start, + .next = arp_seq_next, + .stop = arp_seq_stop, + .show = arp_seq_show, +}; + +static int arp_seq_open(struct inode *inode, struct file *file) +{ + struct arp_state *state; + struct seq_file *seq; + int rc = -EAGAIN; + + if (!try_atm_clip_ops()) + goto out; + + state = kmalloc(sizeof(*state), GFP_KERNEL); + if (!state) { + rc = -ENOMEM; + goto out_put; + } + + rc = seq_open(file, &arp_seq_ops); + if (rc) + goto out_kfree; + + seq = file->private_data; + seq->private = state; +out: + return rc; + +out_put: module_put(atm_clip_ops->owner); - return 0; +out_kfree: + kfree(state); + goto out; } -#endif + +static int arp_seq_release(struct inode *inode, struct file *file) +{ + module_put(atm_clip_ops->owner); + return seq_release_private(inode, file); +} + +static struct file_operations arp_seq_fops = { + .open = arp_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = arp_seq_release, +}; + +#endif /* CONFIG_ATM_CLIP */ #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) static int atm_lec_info(loff_t pos,char *buf) @@ -786,7 +887,7 @@ int __init atm_proc_init(void) CREATE_SEQ_ENTRY(svc); CREATE_SEQ_ENTRY(vcc); #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - CREATE_ENTRY(arp); + CREATE_SEQ_ENTRY(arp); #endif #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) CREATE_ENTRY(lec); [ATM] seq_file conversion of /proc/net/atm [7/8] seq_file support for /proc/net/atm/lec: - lec_info(): seq_printf/seq_putc replaces sprintf; - traversal of the lec structure needs to walk: -> the lec interfaces -> the tables of arp tables(lec_arp_tables); -> the arp tables themselves -> the misc tables (lec_arp_empty_ones/lec_no_forward/mcast_fwds) Sum up of the call tree: atm_lec_seq_start()/atm_lec_seq_next() -> atm_lec_get_idx() -> atm_lec_itf_walk() (responsible for dev_lec/dev_put handling) -> atm_lec_priv_walk() (responsible for lec_priv locking) -> atm_lec_arp_walk() -> atm_lec_tbl_walk() -> atm_lec_misc_walk() -> atm_lec_tbl_walk() Each of the dedicated functions follows the same convention: return NULL as long as the seq_file cursor hasn't been digested (i.e. until < 0). Locking is only done when an entry (i.e. a lec_arp_table) is referenced. atm_lec_seq_stop()/atm_lec_itf_walk()/atm_lec_priv_walk() are responsible for getting this point right. - module refcounting is done in atm_lec_seq_open()/atm_lec_seq_release(); - atm_lec_info() is removed. Chas's suggestions applied since last version: - atm_seq_lec_fops renamed to lec_seq_fops; - change in state handling: it wasn't correctly set to its reset value after a complete interface walk; - lec_arp_get_status_string() bugfix. net/atm/proc.c | 342 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 236 insertions(+), 106 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-lec-conversion net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-lec-conversion Sat Sep 6 23:34:01 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sun Sep 7 00:33:49 2003 @@ -335,54 +335,46 @@ static void svc_info(struct seq_file *se #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) -static char* -lec_arp_get_status_string(unsigned char status) +static char* lec_arp_get_status_string(unsigned char status) { - switch(status) { - case ESI_UNKNOWN: - return "ESI_UNKNOWN "; - case ESI_ARP_PENDING: - return "ESI_ARP_PENDING "; - case ESI_VC_PENDING: - return "ESI_VC_PENDING "; - case ESI_FLUSH_PENDING: - return "ESI_FLUSH_PENDING "; - case ESI_FORWARD_DIRECT: - return "ESI_FORWARD_DIRECT"; - default: - return " "; - } -} - -static void -lec_info(struct lec_arp_table *entry, char *buf) -{ - int j, offset=0; - - for(j=0;jmac_addr[j]); + static char *lec_arp_status_string[] = { + "ESI_UNKNOWN ", + "ESI_ARP_PENDING ", + "ESI_VC_PENDING ", + " ", + "ESI_FLUSH_PENDING ", + "ESI_FORWARD_DIRECT", + "" + }; + + if (status > ESI_FORWARD_DIRECT) + status = ESI_FORWARD_DIRECT + 1; + return lec_arp_status_string[status]; +} + +static void lec_info(struct seq_file *seq, struct lec_arp_table *entry) +{ + int i; + + for (i = 0; i < ETH_ALEN; i++) + seq_printf(seq, "%2.2x", entry->mac_addr[i] & 0xff); + seq_printf(seq, " "); + for (i = 0; i < ATM_ESA_LEN; i++) + seq_printf(seq, "%2.2x", entry->atm_addr[i] & 0xff); + seq_printf(seq, " %s %4.4x", lec_arp_get_status_string(entry->status), + entry->flags & 0xffff); + if (entry->vcc) + seq_printf(seq, "%3d %3d ", entry->vcc->vpi, entry->vcc->vci); + else + seq_printf(seq, " "); + if (entry->recv_vcc) { + seq_printf(seq, " %3d %3d", entry->recv_vcc->vpi, + entry->recv_vcc->vci); } - offset+=sprintf(buf+offset, " "); - for(j=0;jatm_addr[j]); - } - offset+=sprintf(buf+offset, " %s %4.4x", - lec_arp_get_status_string(entry->status), - entry->flags&0xffff); - if (entry->vcc) { - offset+=sprintf(buf+offset, "%3d %3d ", entry->vcc->vpi, - entry->vcc->vci); - } else - offset+=sprintf(buf+offset, " "); - if (entry->recv_vcc) { - offset+=sprintf(buf+offset, " %3d %3d", - entry->recv_vcc->vpi, entry->recv_vcc->vci); - } - - sprintf(buf+offset,"\n"); + seq_putc(seq, '\n'); } -#endif +#endif /* CONFIG_ATM_LANE */ static int atm_dev_seq_show(struct seq_file *seq, void *v) { @@ -674,78 +666,216 @@ static struct file_operations arp_seq_fo #endif /* CONFIG_ATM_CLIP */ #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) -static int atm_lec_info(loff_t pos,char *buf) -{ + +struct lec_state { unsigned long flags; - struct lec_priv *priv; + struct lec_priv *locked; struct lec_arp_table *entry; - int i, count, d, e; struct net_device *dev; + int itf; + int arp_table; + int misc_table; +}; - if (!pos) { - return sprintf(buf,"Itf MAC ATM destination" - " Status Flags " - "VPI/VCI Recv VPI/VCI\n"); +static void *lec_tbl_walk(struct lec_state *state, struct lec_arp_table *tbl, + loff_t *l) +{ + struct lec_arp_table *e = state->entry; + + if (!e) + e = tbl; + if (e == (void *)1) { + e = tbl; + --*l; } - if (!try_atm_lane_ops()) - return 0; /* the lane module is not there yet */ + for (; e; e = e->next) { + if (--*l < 0) + break; + } + state->entry = e; + return (*l < 0) ? state : NULL; +} + +static void *lec_arp_walk(struct lec_state *state, loff_t *l, + struct lec_priv *priv) +{ + void *v = NULL; + int p; - count = pos; - for(d = 0; d < MAX_LEC_ITF; d++) { - dev = atm_lane_ops->get_lec(d); - if (!dev || !(priv = (struct lec_priv *) dev->priv)) - continue; - spin_lock_irqsave(&priv->lec_arp_lock, flags); - for(i = 0; i < LEC_ARP_TABLE_SIZE; i++) { - for(entry = priv->lec_arp_tables[i]; entry; entry = entry->next) { - if (--count) - continue; - e = sprintf(buf,"%s ", dev->name); - lec_info(entry, buf+e); - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); - dev_put(dev); - module_put(atm_lane_ops->owner); - return strlen(buf); - } - } - for(entry = priv->lec_arp_empty_ones; entry; entry = entry->next) { - if (--count) - continue; - e = sprintf(buf,"%s ", dev->name); - lec_info(entry, buf+e); - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); - dev_put(dev); - module_put(atm_lane_ops->owner); - return strlen(buf); - } - for(entry = priv->lec_no_forward; entry; entry=entry->next) { - if (--count) - continue; - e = sprintf(buf,"%s ", dev->name); - lec_info(entry, buf+e); - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); - dev_put(dev); - module_put(atm_lane_ops->owner); - return strlen(buf); - } - for(entry = priv->mcast_fwds; entry; entry = entry->next) { - if (--count) - continue; - e = sprintf(buf,"%s ", dev->name); - lec_info(entry, buf+e); - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); - dev_put(dev); - module_put(atm_lane_ops->owner); - return strlen(buf); - } - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + for (p = state->arp_table; p < LEC_ARP_TABLE_SIZE; p++) { + v = lec_tbl_walk(state, priv->lec_arp_tables[p], l); + if (v) + break; + } + state->arp_table = p; + return v; +} + +static void *lec_misc_walk(struct lec_state *state, loff_t *l, + struct lec_priv *priv) +{ + struct lec_arp_table *lec_misc_tables[] = { + priv->lec_arp_empty_ones, + priv->lec_no_forward, + priv->mcast_fwds + }; + void *v = NULL; + int q; + + for (q = state->misc_table; q < ARRAY_SIZE(lec_misc_tables); q++) { + v = lec_tbl_walk(state, lec_misc_tables[q], l); + if (v) + break; + } + state->misc_table = q; + return v; +} + +static void *lec_priv_walk(struct lec_state *state, loff_t *l, + struct lec_priv *priv) +{ + if (!state->locked) { + state->locked = priv; + spin_lock_irqsave(&priv->lec_arp_lock, state->flags); + } + if (!lec_arp_walk(state, l, priv) && + !lec_misc_walk(state, l, priv)) { + spin_unlock_irqrestore(&priv->lec_arp_lock, state->flags); + state->locked = NULL; + /* Partial state reset for the next time we get called */ + state->arp_table = state->misc_table = 0; + } + return state->locked; +} + +static void *lec_itf_walk(struct lec_state *state, loff_t *l) +{ + struct net_device *dev; + void *v; + + dev = state->dev ? state->dev : atm_lane_ops->get_lec(state->itf); + v = (dev && dev->priv) ? lec_priv_walk(state, l, dev->priv) : NULL; + if (!v && dev) { dev_put(dev); + /* Partial state reset for the next time we get called */ + dev = NULL; + } + state->dev = dev; + return v; +} + +static void *lec_get_idx(struct lec_state *state, loff_t l) +{ + void *v = NULL; + + for (; state->itf < MAX_LEC_ITF; state->itf++) { + v = lec_itf_walk(state, &l); + if (v) + break; + } + return v; +} + +static void *lec_seq_start(struct seq_file *seq, loff_t *pos) +{ + struct lec_state *state = seq->private; + + state->itf = 0; + state->dev = NULL; + state->locked = NULL; + state->arp_table = 0; + state->misc_table = 0; + state->entry = (void *)1; + + return *pos ? lec_get_idx(state, *pos) : (void*)1; +} + +static void lec_seq_stop(struct seq_file *seq, void *v) +{ + struct lec_state *state = seq->private; + + if (state->dev) { + spin_unlock_irqrestore(&state->locked->lec_arp_lock, + state->flags); + dev_put(state->dev); + } +} + +static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct lec_state *state = seq->private; + + v = lec_get_idx(state, 1); + *pos += !!PTR_ERR(v); + return v; +} + +static int lec_seq_show(struct seq_file *seq, void *v) +{ + static char lec_banner[] = "Itf MAC ATM destination" + " Status Flags " + "VPI/VCI Recv VPI/VCI\n"; + + if (v == (void *)1) + seq_puts(seq, lec_banner); + else { + struct lec_state *state = seq->private; + struct net_device *dev = state->dev; + + seq_printf(seq, "%s ", dev->name); + lec_info(seq, state->entry); } - module_put(atm_lane_ops->owner); return 0; } -#endif +static struct seq_operations lec_seq_ops = { + .start = lec_seq_start, + .next = lec_seq_next, + .stop = lec_seq_stop, + .show = lec_seq_show, +}; + +static int lec_seq_open(struct inode *inode, struct file *file) +{ + struct lec_state *state; + struct seq_file *seq; + int rc = -EAGAIN; + + if (!try_atm_lane_ops()) + goto out; + + state = kmalloc(sizeof(*state), GFP_KERNEL); + if (!state) { + rc = -ENOMEM; + goto out; + } + + rc = seq_open(file, &lec_seq_ops); + if (rc) + goto out_kfree; + seq = file->private_data; + seq->private = state; +out: + return rc; +out_kfree: + kfree(state); + goto out; +} + +static int lec_seq_release(struct inode *inode, struct file *file) +{ + module_put(atm_lane_ops->owner); + return seq_release_private(inode, file); +} + +static struct file_operations lec_seq_fops = { + .open = lec_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = lec_seq_release, +}; + +#endif /* CONFIG_ATM_LANE */ static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, loff_t *pos) @@ -890,7 +1020,7 @@ int __init atm_proc_init(void) CREATE_SEQ_ENTRY(arp); #endif #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) - CREATE_ENTRY(lec); + CREATE_SEQ_ENTRY(lec); #endif return 0; [ATM]: seq_file conversion of /proc/net/atm [8/8] (from romieu@fr.zoreil.com) - introduction of the struct array 'atm_proc_ents': - removal of code duplication in atm_proc_cleanup(); - removal of code duplication in atm_proc_init(); - removal of the macros CREATE_SEQ_ENTRY() and CREATE_ENTRY(); - /proc/net/atm/vcc returns to /proc/net/atm/vc; - credits at the top of the file; - replaced proc_dev_atm_operations by proc_atm_dev_ops; - atm_proc_dev_register: removal of tasteless "fail0/fail1" labels. net/atm/proc.c | 143 +++++++++++++++++++++++++-------------------------------- 1 files changed, 64 insertions(+), 79 deletions(-) diff -puN net/atm/proc.c~atm-proc-seq-post-conversion-removal net/atm/proc.c --- linux-2.6.0-test4-bk8/net/atm/proc.c~atm-proc-seq-post-conversion-removal Sun Sep 7 00:36:05 2003 +++ linux-2.6.0-test4-bk8-fr/net/atm/proc.c Sun Sep 7 00:36:05 2003 @@ -1,21 +1,13 @@ -/* net/atm/proc.c - ATM /proc interface */ - -/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ - -/* - * The mechanism used here isn't designed for speed but rather for convenience - * of implementation. We only return one entry per read system call, so we can - * be reasonably sure not to overrun the page and race conditions may lead to - * the addition or omission of some lines but never to any corruption of a - * line's internal structure. +/* net/atm/proc.c - ATM /proc interface + * + * Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA * - * Making the whole thing slightly more efficient is left as an exercise to the - * reader. (Suggestions: wrapper which loops to get several entries per system - * call; or make --left slightly more clever to avoid O(n^2) characteristics.) - * I find it fast enough on my unloaded 266 MHz Pentium 2 :-) + * seq_file api usage by romieu@fr.zoreil.com + * + * Evaluating the efficiency of the whole thing if left as an exercise to + * the reader. */ - #include #include /* for EXPORT_SYMBOL */ #include @@ -52,19 +44,12 @@ static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, loff_t *pos); -static ssize_t proc_spec_atm_read(struct file *file,char *buf,size_t count, - loff_t *pos); -static struct file_operations proc_dev_atm_operations = { +static struct file_operations proc_atm_dev_ops = { .owner = THIS_MODULE, .read = proc_dev_atm_read, }; -static struct file_operations proc_spec_atm_operations = { - .owner = THIS_MODULE, - .read = proc_spec_atm_read, -}; - static void add_stats(struct seq_file *seq, const char *aal, const struct k_atm_aal_stats *stats) { @@ -903,28 +888,6 @@ } -static ssize_t proc_spec_atm_read(struct file *file,char *buf,size_t count, - loff_t *pos) -{ - unsigned long page; - int length; - int (*info)(loff_t,char *); - info = PDE(file->f_dentry->d_inode)->data; - - if (count == 0) return 0; - page = get_zeroed_page(GFP_KERNEL); - if (!page) return -ENOMEM; - length = (*info)(*pos,(char *) page); - if (length > count) length = -EINVAL; - if (length >= 0) { - if (copy_to_user(buf,(char *) page,length)) length = -EFAULT; - (*pos)++; - } - free_page(page); - return length; -} - - struct proc_dir_entry *atm_proc_root; EXPORT_SYMBOL(atm_proc_root); @@ -945,19 +908,19 @@ dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL); if (!dev->proc_name) - goto fail1; + goto err_out; sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); dev->proc_entry = create_proc_entry(dev->proc_name, 0, atm_proc_root); if (!dev->proc_entry) - goto fail0; + goto err_free_name; dev->proc_entry->data = dev; - dev->proc_entry->proc_fops = &proc_dev_atm_operations; + dev->proc_entry->proc_fops = &proc_atm_dev_ops; dev->proc_entry->owner = THIS_MODULE; return 0; -fail0: +err_free_name: kfree(dev->proc_name); -fail1: +err_out: return error; } @@ -971,65 +934,65 @@ kfree(dev->proc_name); } -#define CREATE_SEQ_ENTRY(name) \ - do { \ - name = create_proc_entry(#name, S_IRUGO, atm_proc_root); \ - if (!name) \ - goto cleanup; \ - name->proc_fops = & name##_seq_fops; \ - name->owner = THIS_MODULE; \ - } while (0) - -#define CREATE_ENTRY(name) \ - name = create_proc_entry(#name,0,atm_proc_root); \ - if (!name) goto cleanup; \ - name->data = atm_##name##_info; \ - name->proc_fops = &proc_spec_atm_operations; \ - name->owner = THIS_MODULE - -static struct proc_dir_entry *devices = NULL, *pvc = NULL, - *svc = NULL, *arp = NULL, *lec = NULL, *vcc = NULL; - -static void atm_proc_cleanup(void) -{ - if (devices) - remove_proc_entry("devices",atm_proc_root); - if (pvc) - remove_proc_entry("pvc",atm_proc_root); - if (svc) - remove_proc_entry("svc",atm_proc_root); - if (arp) - remove_proc_entry("arp",atm_proc_root); - if (lec) - remove_proc_entry("lec",atm_proc_root); - if (vcc) - remove_proc_entry("vcc",atm_proc_root); - remove_proc_entry("net/atm",NULL); +static struct atm_proc_entry { + char *name; + struct file_operations *proc_fops; + struct proc_dir_entry *dirent; +} atm_proc_ents[] = { + { .name = "devices", .proc_fops = &devices_seq_fops }, + { .name = "pvc", .proc_fops = &pvc_seq_fops }, + { .name = "svc", .proc_fops = &svc_seq_fops }, + { .name = "vc", .proc_fops = &vcc_seq_fops }, +#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) + { .name = "arp", .proc_fops = &arp_seq_fops }, +#endif +#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) + { .name = "lec", .proc_fops = &lec_seq_fops }, +#endif + { .name = NULL, .proc_fops = NULL } +}; + +static void atm_proc_dirs_remove(void) +{ + static struct atm_proc_entry *e; + + for (e = atm_proc_ents; e->name; e++) { + if (e->dirent) + remove_proc_entry(e->name, atm_proc_root); + } + remove_proc_entry("net/atm", NULL); } int __init atm_proc_init(void) { + static struct atm_proc_entry *e; + int ret; + atm_proc_root = proc_mkdir("net/atm",NULL); if (!atm_proc_root) - return -ENOMEM; - CREATE_SEQ_ENTRY(devices); - CREATE_SEQ_ENTRY(pvc); - CREATE_SEQ_ENTRY(svc); - CREATE_SEQ_ENTRY(vcc); -#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) - CREATE_SEQ_ENTRY(arp); -#endif -#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) - CREATE_SEQ_ENTRY(lec); -#endif - return 0; + goto err_out; + for (e = atm_proc_ents; e->name; e++) { + struct proc_dir_entry *dirent; + + dirent = create_proc_entry(e->name, S_IRUGO, atm_proc_root); + if (!dirent) + goto err_out_remove; + dirent->proc_fops = e->proc_fops; + dirent->owner = THIS_MODULE; + e->dirent = dirent; + } + ret = 0; +out: + return ret; -cleanup: - atm_proc_cleanup(); - return -ENOMEM; +err_out_remove: + atm_proc_dirs_remove(); +err_out: + ret = -ENOMEM; + goto out; } -void atm_proc_exit(void) +void __exit atm_proc_exit(void) { - atm_proc_cleanup(); + atm_proc_dirs_remove(); } From chas@cmf.nrl.navy.mil Mon Sep 8 13:50:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 13:51:09 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88KoZx4024391 for ; Mon, 8 Sep 2003 13:50:36 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h88KoUSa003672; Mon, 8 Sep 2003 16:50:30 -0400 (EDT) Message-Id: <200309082050.h88KoUSa003672@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com, mitch@sfgoth.com Subject: [PATCH][ATM] don't export llc_oui Reply-To: chas3@users.sourceforge.net Date: Mon, 08 Sep 2003 16:50:30 -0400 From: chas williams X-Spam-Score: () hits=0.5 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5694 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev Content-Length: 3256 Lines: 108 llc_oui[] is only used in two places. the overhead of exporting probably isnt worth the effort. please apply to 2.6. -- thanks! [ATM]: exporting llc_oui[] isn't worth it (from mitch@sfgoth.com) # 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.1423 -> 1.1424 # net/atm/ipcommon.c 1.2 -> 1.3 # net/sched/sch_atm.c 1.13 -> 1.14 # include/linux/atmclip.h 1.1 -> 1.2 # net/atm/clip.c 1.25 -> 1.26 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/04 chas@relax.cmf.nrl.navy.mil 1.1424 # [ATM]: exporting llc_oui[] isn't worth it (from mitch@sfgoth.com) # -------------------------------------------- # diff -Nru a/include/linux/atmclip.h b/include/linux/atmclip.h --- a/include/linux/atmclip.h Mon Sep 8 16:38:01 2003 +++ b/include/linux/atmclip.h Mon Sep 8 16:38:01 2003 @@ -18,8 +18,4 @@ #define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ -#ifdef __KERNEL__ -extern const unsigned char llc_oui[6]; -#endif - #endif diff -Nru a/net/atm/clip.c b/net/atm/clip.c --- a/net/atm/clip.c Mon Sep 8 16:38:01 2003 +++ b/net/atm/clip.c Mon Sep 8 16:38:01 2003 @@ -193,6 +193,13 @@ return 0; } +static const unsigned char llc_oui[] = { + 0xaa, /* DSAP: non-ISO */ + 0xaa, /* SSAP: non-ISO */ + 0x03, /* Ctrl: Unnumbered Information Command PDU */ + 0x00, /* OUI: EtherType */ + 0x00, + 0x00 }; static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) { diff -Nru a/net/atm/ipcommon.c b/net/atm/ipcommon.c --- a/net/atm/ipcommon.c Mon Sep 8 16:38:01 2003 +++ b/net/atm/ipcommon.c Mon Sep 8 16:38:01 2003 @@ -22,15 +22,6 @@ #endif -const unsigned char llc_oui[] = { - 0xaa, /* DSAP: non-ISO */ - 0xaa, /* SSAP: non-ISO */ - 0x03, /* Ctrl: Unnumbered Information Command PDU */ - 0x00, /* OUI: EtherType */ - 0x00, - 0x00 }; - - /* * skb_migrate appends the list at "from" to "to", emptying "from" in the * process. skb_migrate is atomic with respect to all other skb operations on @@ -67,5 +58,4 @@ } -EXPORT_SYMBOL(llc_oui); EXPORT_SYMBOL(skb_migrate); diff -Nru a/net/sched/sch_atm.c b/net/sched/sch_atm.c --- a/net/sched/sch_atm.c Mon Sep 8 16:38:01 2003 +++ b/net/sched/sch_atm.c Mon Sep 8 16:38:01 2003 @@ -216,6 +216,13 @@ tasklet_schedule(&p->task); } +static const u8 llc_oui_ip[] = { + 0xaa, /* DSAP: non-ISO */ + 0xaa, /* SSAP: non-ISO */ + 0x03, /* Ctrl: Unnumbered Information Command PDU */ + 0x00, /* OUI: EtherType */ + 0x00, 0x00, + 0x08, 0x00 }; /* Ethertype IP (0800) */ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, struct rtattr **tca, unsigned long *arg) @@ -322,11 +329,10 @@ flow->next = p->link.next; p->link.next = flow; flow->hdr_len = hdr_len; - if (hdr) memcpy(flow->hdr,hdr,hdr_len); - else { - memcpy(flow->hdr,llc_oui,sizeof(llc_oui)); - ((u16 *) flow->hdr)[3] = htons(ETH_P_IP); - } + if (hdr) + memcpy(flow->hdr,hdr,hdr_len); + else + memcpy(flow->hdr,llc_oui_ip,sizeof(llc_oui_ip)); *arg = (unsigned long) flow; return 0; err_out: From shemminger@osdl.org Mon Sep 8 14:15:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 14:15:22 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88LFIx4027214 for ; Mon, 8 Sep 2003 14:15:18 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88LFBo09423; Mon, 8 Sep 2003 14:15:11 -0700 Date: Mon, 8 Sep 2003 14:12:46 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (3/4) dlci locking and registration changes Message-Id: <20030908141246.5782437a.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5697 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 Content-Length: 3485 Lines: 161 Change the locking for the dlci device list and registration. - use RTNL instead of a private lock (needed for net notifier in next patch). - reorder the checks in the dlci_add to avoid complicated unwinds - use dev->destructor to free - hold RTNL around deassoc to protect callback from races diff -Nru a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c --- a/drivers/net/wan/dlci.c Mon Sep 8 14:02:46 2003 +++ b/drivers/net/wan/dlci.c Mon Sep 8 14:02:46 2003 @@ -58,7 +58,6 @@ static const char version[] = "DLCI driver v0.35, 4 Jan 1997, mike.mclagan@linux.org"; static LIST_HEAD(dlci_devs); -static spinlock_t dlci_dev_lock = SPIN_LOCK_UNLOCKED; static void dlci_setup(struct net_device *); @@ -360,34 +359,38 @@ struct net_device *master, *slave; struct dlci_local *dlp; struct frad_local *flp; - int err; + int err = -EINVAL; /* validate slave device */ slave = dev_get_by_name(dlci->devname); if (!slave) - return(-ENODEV); + return -ENODEV; - if (slave->type != ARPHRD_FRAD) { - dev_put(slave); - return(-EINVAL); - } + if (slave->type != ARPHRD_FRAD || slave->priv == NULL) + goto err1; /* create device name */ master = alloc_netdev( sizeof(struct dlci_local), "dlci%d", dlci_setup); if (!master) { - dev_put(slave); - return(-ENOMEM); + err = -ENOMEM; + goto err1; } - err = register_netdev(master); - if (err < 0) { - dev_put(slave); - kfree(master); - return(err); + /* make sure same slave not already registered */ + rtnl_lock(); + list_for_each_entry(dlp, &dlci_devs, list) { + if (dlp->slave == slave) { + err = -EBUSY; + goto err2; + } } + err = dev_alloc_name(master, master->name); + if (err < 0) + goto err2; + *(short *)(master->dev_addr) = dlci->dlci; dlp = (struct dlci_local *) master->priv; @@ -395,22 +398,27 @@ dlp->master = master; flp = slave->priv; - err = flp ? (*flp->assoc)(slave, master) : -EINVAL; + err = (*flp->assoc)(slave, master); if (err < 0) - { - unregister_netdev(master); - dev_put(slave); - free_netdev(master); - return(err); - } + goto err2; + + err = register_netdevice(master); + if (err < 0) + goto err2; strcpy(dlci->devname, master->name); - spin_lock_bh(&dlci_dev_lock); list_add(&dlp->list, &dlci_devs); - spin_unlock_bh(&dlci_dev_lock); + rtnl_unlock(); return(0); + + err2: + rtnl_unlock(); + kfree(master); + err1: + dev_put(slave); + return(err); } static int dlci_del(struct dlci_add *dlci) @@ -433,21 +441,18 @@ slave = dlp->slave; flp = slave->priv; + rtnl_lock(); err = (*flp->deassoc)(slave, master); - if (err) - return(err); - + if (!err) { + list_del(&dlp->list); - spin_lock_bh(&dlci_dev_lock); - list_del(&dlp->list); - spin_unlock_bh(&dlci_dev_lock); + unregister_netdevice(master); - unregister_netdev(master); - - dev_put(slave); - free_netdev(master); + dev_put(slave); + } + rtnl_unlock(); - return(0); + return(err); } static int dlci_ioctl(unsigned int cmd, void *arg) @@ -494,6 +499,7 @@ dev->hard_header = dlci_header; dev->get_stats = dlci_get_stats; dev->change_mtu = dlci_change_mtu; + dev->destructor = free_netdev; dlp->receive = dlci_receive; @@ -518,12 +524,12 @@ dlci_ioctl_set(NULL); + rtnl_lock(); list_for_each_entry_safe(dlp, nxt, &dlci_devs, list) { - unregister_netdev(dlp->master); + unregister_netdevice(dlp->master); dev_put(dlp->slave); - free_netdev(dlp->master); } - + rtnl_unlock(); } module_init(init_dlci); From shemminger@osdl.org Mon Sep 8 14:15:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 14:15:23 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88LFIx4027215 for ; Mon, 8 Sep 2003 14:15:18 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88LFAo09419; Mon, 8 Sep 2003 14:15:10 -0700 Date: Mon, 8 Sep 2003 14:09:22 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (2/4) get rid of register_frad Message-Id: <20030908140922.21f8faec.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5698 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 Content-Length: 3979 Lines: 162 The sdla and dlci drivers have a callback interface which only stores a name in a table, but doesn't do anything useful. Looks like an interface which has lost it's usefulness and can be safely removed. Tested on 2.6.0-test5 by exercising the higher layer (dlci) without real hardware. diff -Nru a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c --- a/drivers/net/wan/dlci.c Mon Sep 8 14:01:46 2003 +++ b/drivers/net/wan/dlci.c Mon Sep 8 14:01:46 2003 @@ -59,63 +59,9 @@ static LIST_HEAD(dlci_devs); static spinlock_t dlci_dev_lock = SPIN_LOCK_UNLOCKED; -static char *basename[16]; static void dlci_setup(struct net_device *); -/* allow FRAD's to register their name as a valid FRAD */ -int register_frad(const char *name) -{ - int i; - - if (!name) - return(-EINVAL); - - for (i=0;idevname, basename[i], strlen(basename[i])) == 0) && - (strlen(dlci->devname) > strlen(basename[i]))) - break; - - if (i == sizeof(basename) / sizeof(char *)) { - dev_put(slave); - return(-EINVAL); - } - /* create device name */ master = alloc_netdev( sizeof(struct dlci_local), "dlci%d", dlci_setup); @@ -571,13 +505,9 @@ int __init init_dlci(void) { - int i; dlci_ioctl_set(dlci_ioctl); printk("%s.\n", version); - - for(i=0;ipriv; del_timer_sync(&flp->timer); free_netdev(sdla); - - unregister_frad(devname); } MODULE_LICENSE("GPL"); diff -Nru a/include/linux/if_frad.h b/include/linux/if_frad.h --- a/include/linux/if_frad.h Mon Sep 8 14:01:46 2003 +++ b/include/linux/if_frad.h Mon Sep 8 14:01:46 2003 @@ -191,9 +191,6 @@ int buffer; /* current buffer for S508 firmware */ }; -int register_frad(const char *name); -int unregister_frad(const char *name); - extern void dlci_ioctl_set(int (*hook)(unsigned int, void *)); #endif /* __KERNEL__ */ From shemminger@osdl.org Mon Sep 8 14:15:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 14:15:20 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88LF2x4027195 for ; Mon, 8 Sep 2003 14:15:15 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88LEto09230; Mon, 8 Sep 2003 14:14:55 -0700 Date: Mon, 8 Sep 2003 14:14:39 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (1/4) sdla - move out of Space.c Message-Id: <20030908141439.2e41b516.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5696 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 Content-Length: 3246 Lines: 148 Patch against 2.60-test5 to move sdla driver out of Space.c for initialization in non-module case. Since this driver doesn't come up until the device has been configured with an ioctl (set_config); there is no way it can have startup order problems. diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c --- a/drivers/net/Space.c Mon Sep 8 14:01:25 2003 +++ b/drivers/net/Space.c Mon Sep 8 14:01:25 2003 @@ -97,7 +97,6 @@ extern int mac8390_probe(struct net_device *dev); extern int mac89x0_probe(struct net_device *dev); extern int mc32_probe(struct net_device *dev); -extern struct net_device *sdla_init(void); extern struct net_device *cops_probe(int unit); extern struct net_device *ltpc_probe(void); @@ -470,10 +469,6 @@ #ifdef CONFIG_LTPC ltpc_probe(); #endif -#ifdef CONFIG_SDLA - sdla_init(); -#endif - } /* diff -Nru a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c --- a/drivers/net/wan/sdla.c Mon Sep 8 14:01:25 2003 +++ b/drivers/net/wan/sdla.c Mon Sep 8 14:01:25 2003 @@ -1626,41 +1626,16 @@ static void setup_sdla(struct net_device *dev) { + struct frad_local *flp = dev->priv; + + netdev_boot_setup_check(dev); + + SET_MODULE_OWNER(dev); dev->flags = 0; dev->type = 0xFFFF; dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = SDLA_MAX_MTU; -} - -static int frad_registered; - -struct net_device * __init sdla_init(void) -{ - struct net_device *dev; - struct frad_local *flp; - int err = -ENOMEM; - - if (!frad_registered) { - err = register_frad(devname); - if (err) { - printk(KERN_ERR "%s: frad registration failed %d\n", - devname, err); - return ERR_PTR(err); - } - frad_registered = 1; - printk("%s.\n", version); - } - - - dev = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla); - if (!dev) - goto out; - - SET_MODULE_OWNER(dev); - netdev_boot_setup_check(dev); - - flp = dev->priv; dev->open = sdla_open; dev->stop = sdla_close; @@ -1680,42 +1655,44 @@ flp->timer.expires = 1; flp->timer.data = (unsigned long) dev; flp->timer.function = sdla_poll; - - err = register_netdev(dev); - if (err) - goto out1; - return dev; -out1: - kfree(dev); -out: - return ERR_PTR(err); } -#ifdef MODULE -static struct net_device *sdla0; +static struct net_device *sdla; static int __init init_sdla(void) { - int result = 0; + int err; + + printk("%s.\n", version); + err = register_frad(devname); + if (err) { + printk(KERN_ERR "%s: frad registration failed %d\n", + devname, err); + return err; + } - sdla0 = sdla_init(); - if (IS_ERR(sdla0)) - result = PTR_ERR(sdla0); + sdla = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla); + if (!sdla) + return -ENOMEM; + + err = register_netdev(sdla); + if (err) + kfree(sdla); - return result; + return err; } static void __exit exit_sdla(void) { struct frad_local *flp; - unregister_netdev(sdla0); - if (sdla0->irq) - free_irq(sdla0->irq, sdla0); + unregister_netdev(sdla); + if (sdla->irq) + free_irq(sdla->irq, sdla); - flp = sdla0->priv; + flp = sdla->priv; del_timer_sync(&flp->timer); - free_netdev(sdla0); + free_netdev(sdla); unregister_frad(devname); } @@ -1724,4 +1701,3 @@ module_init(init_sdla); module_exit(exit_sdla); -#endif From shemminger@osdl.org Mon Sep 8 14:15:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 14:15:20 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88LF9x4027207 for ; Mon, 8 Sep 2003 14:15:15 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88LF1o09276; Mon, 8 Sep 2003 14:15:01 -0700 Date: Mon, 8 Sep 2003 14:14:45 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (4/4) dlci netdevice event handling Message-Id: <20030908141445.5a5c0d42.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5695 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 Content-Length: 1316 Lines: 55 Since dlci device is a pseudo device built on top of sdla, change it to handle unregister events and delete itself. diff -Nru a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c --- a/drivers/net/wan/dlci.c Mon Sep 8 14:03:04 2003 +++ b/drivers/net/wan/dlci.c Mon Sep 8 14:03:04 2003 @@ -509,20 +509,46 @@ } -int __init init_dlci(void) +/* if slave is unregistering, then cleanup master */ +static int dlci_dev_event(struct notifier_block *unused, + unsigned long event, void *ptr) +{ + struct net_device *dev = (struct net_device *) ptr; + + if (event == NETDEV_UNREGISTER) { + struct dlci_local *dlp; + + list_for_each_entry(dlp, &dlci_devs, list) { + if (dlp->slave == dev) { + unregister_netdevice(dlp->master); + dev_put(dlp->slave); + break; + } + } + } + return NOTIFY_DONE; +} + +static struct notifier_block dlci_notifier = { + .notifier_call = dlci_dev_event, +}; + +static int __init init_dlci(void) { dlci_ioctl_set(dlci_ioctl); + register_netdevice_notifier(&dlci_notifier); printk("%s.\n", version); return 0; } -void __exit dlci_exit(void) +static void __exit dlci_exit(void) { struct dlci_local *dlp, *nxt; dlci_ioctl_set(NULL); + unregister_netdevice_notifier(&dlci_notifier); rtnl_lock(); list_for_each_entry_safe(dlp, nxt, &dlci_devs, list) { From shemminger@osdl.org Mon Sep 8 14:40:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 14:40:28 -0700 (PDT) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88Le6x4030960 for ; Mon, 8 Sep 2003 14:40:08 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h88Ldko14415; Mon, 8 Sep 2003 14:39:46 -0700 Date: Mon, 8 Sep 2003 14:39:29 -0700 From: Stephen Hemminger To: Jeff Garzik Cc: netdev@oss.sgi.com Subject: [PATCH] (5/4) dlci netdevice event handling Message-Id: <20030908143929.4a52fdee.shemminger@osdl.org> In-Reply-To: <20030908141445.5a5c0d42.shemminger@osdl.org> References: <20030908141445.5a5c0d42.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.4claws (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: 5699 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 Content-Length: 486 Lines: 15 One more patch, found this in testing -- need to delete device from list when unregistered because of callback. diff -Nru a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c --- a/drivers/net/wan/dlci.c Mon Sep 8 14:39:14 2003 +++ b/drivers/net/wan/dlci.c Mon Sep 8 14:39:14 2003 @@ -520,6 +520,7 @@ list_for_each_entry(dlp, &dlci_devs, list) { if (dlp->slave == dev) { + list_del(&dlp->list); unregister_netdevice(dlp->master); dev_put(dlp->slave); break; From haegar@sdinet.de Mon Sep 8 15:08:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 15:08:50 -0700 (PDT) Received: from imap.comunit.de (imap.comunit.de [193.103.160.193]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88M8Ex4002558 for ; Mon, 8 Sep 2003 15:08:15 -0700 Received: by imap.comunit.de (bofa-smtpd, from userid 4712) id E0074247E03; Tue, 9 Sep 2003 00:08:07 +0200 (CEST) Received: from space.comunit.de (comunit.de [193.103.160.129]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client did not present a certificate) by imap.comunit.de (bofa-smtpd) with ESMTP id D445A247DDF for ; Tue, 9 Sep 2003 00:08:06 +0200 (CEST) Date: Tue, 9 Sep 2003 00:08:06 +0200 (CEST) From: Sven-Haegar Koch X-X-Sender: haegar@space.comunit.de To: netdev@oss.sgi.com Subject: ifconfig up/down problem Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5700 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: haegar@sdinet.de Precedence: bulk X-list: netdev Content-Length: 2844 Lines: 76 hi... Short: ifconfig ethX down locks Kernel: 2.4.22-bk12 (same problem with 2.4.23-pre3) eth0: eepro100 eth1: orinoco_cs (orinoco mini-pci) System: Toshiba Satellite Pro 4600 Laptop, P3 700Mhz Just after booting, no X startet yet, interface not yet initialized: aurora:~# ifconfig eth1 down aurora:~# ifconfig eth1 up aurora:~# ifconfig eth1 down aurora:~# ifconfig eth1 up aurora:~# ifconfig eth1 down <--lock here, shell does not return, even ctrl-c does not help haegar@aurora:~$ ps axl|grep ifconfig 4 0 1041 1035 9 0 1448 404 dev_cl S pts/0 0:00 ifconfig eth1 top shows ifconfig consuming 100% cpu, 100% system The same happens with eth0, there it takes only two up/down cycles, perhaps because it is already configured with ipv4+ipv6 addresses, and the same happens using '/sbin/ip link set eth0 up/down' too. Kernel 2.4.20-pre2-ac3 is ok (my last kernel, running for month') c'ya sven ps: kernel config available under http://sdinet.de/tmp/config-2.4.22-bk12 ps2: loaded modules: Module Size Used by Not tainted input 3328 0 (autoclean) ipt_limit 888 10 (autoclean) ipt_REJECT 3480 2 ipt_LOG 3416 10 ipt_state 568 12 ip_conntrack_ftp 4176 0 (unused) ip_conntrack 18116 3 [ipt_state ip_conntrack_ftp] iptable_filter 1740 1 ip_tables 12448 5 [ipt_limit ipt_REJECT ipt_LOG ipt_state iptable_filter] orinoco_cs 4596 1 orinoco 36116 0 [orinoco_cs] hermes 7044 0 [orinoco_cs orinoco] ds 6996 3 [orinoco_cs] acm 6464 0 (unused) pwc 44432 0 (unused) videodev 6048 0 [pwc] audio 43256 0 (unused) soundcore 3652 0 [audio] usb-uhci 23696 0 (unused) ide-scsi 10320 0 i810_rng 3200 0 (unused) serial 48228 0 (autoclean) isa-pnp 32560 0 (autoclean) [serial] parport_pc 23784 1 (autoclean) lp 7040 0 (autoclean) parport 25512 1 (autoclean) [parport_pc lp] sd_mod 11180 0 (unused) scsi_mod 87216 2 [ide-scsi sd_mod] usbcore 62956 1 [acm pwc audio usb-uhci] yenta_socket 12928 3 pcmcia_core 43520 0 [orinoco_cs ds yenta_socket] agpgart 25320 0 (unused) ipv6 174100 -1 eepro100 21972 1 mii 2432 0 [eepro100] rtc 6792 0 (autoclean) -- The Internet treats censorship as a routing problem, and routes around it. (John Gilmore on http://www.cygnus.com/~gnu/) From jgarzik@pobox.com Mon Sep 8 15:15:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 15:15:46 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88MFgx4005554 for ; Mon, 8 Sep 2003 15:15:43 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:38633 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19wUIL-0007yC-E6; Mon, 08 Sep 2003 23:15:37 +0100 Message-ID: <3F5CFF7E.1090005@pobox.com> Date: Mon, 08 Sep 2003 18:15:26 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Sven-Haegar Koch CC: netdev@oss.sgi.com, "David S. Miller" , Andrew Morton , LKML Subject: [PATCH] Re: ifconfig up/down problem References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------030300040602060006010804" X-archive-position: 5701 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 Content-Length: 1923 Lines: 69 This is a multi-part message in MIME format. --------------030300040602060006010804 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sven-Haegar Koch wrote: > hi... > > Short: ifconfig ethX down locks > > Kernel: 2.4.22-bk12 (same problem with 2.4.23-pre3) > eth0: eepro100 > eth1: orinoco_cs (orinoco mini-pci) > System: Toshiba Satellite Pro 4600 Laptop, P3 700Mhz > > Just after booting, no X startet yet, interface not yet initialized: > > aurora:~# ifconfig eth1 down > aurora:~# ifconfig eth1 up > aurora:~# ifconfig eth1 down > aurora:~# ifconfig eth1 up > aurora:~# ifconfig eth1 down > <--lock here, shell does not return, even ctrl-c does not help > > haegar@aurora:~$ ps axl|grep ifconfig > 4 0 1041 1035 9 0 1448 404 dev_cl S pts/0 0:00 ifconfig eth1 > > top shows ifconfig consuming 100% cpu, 100% system > > The same happens with eth0, there it takes only two up/down cycles, > perhaps because it is already configured with ipv4+ipv6 addresses, and the > same happens using '/sbin/ip link set eth0 up/down' too. > > Kernel 2.4.20-pre2-ac3 is ok (my last kernel, running for month') Does the attached patch fix it? Jeff --------------030300040602060006010804 Content-Type: text/plain; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" diff -Nru a/net/core/dev.c b/net/core/dev.c --- a/net/core/dev.c Mon Sep 8 18:14:36 2003 +++ b/net/core/dev.c Mon Sep 8 18:14:36 2003 @@ -851,7 +851,11 @@ * engine, but this requires more changes in devices. */ smp_mb__after_clear_bit(); /* Commit netif_running(). */ - netif_poll_disable(dev); + while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) { + /* No hurry. */ + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } /* * Call the device specific close. This cannot fail. --------------030300040602060006010804-- From jgarzik@pobox.com Mon Sep 8 15:17:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 15:17:10 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88MH7x4005918 for ; Mon, 8 Sep 2003 15:17:08 -0700 Received: from rdu74-153-143.nc.rr.com ([24.74.153.143]:38635 helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.22) id 19wUJg-000846-Lp; Mon, 08 Sep 2003 23:17:00 +0100 Message-ID: <3F5CFFD1.6050702@pobox.com> Date: Mon, 08 Sep 2003 18:16:49 -0400 From: Jeff Garzik Organization: none User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en MIME-Version: 1.0 To: Andrew Morton CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: netif_poll_disable() hangs References: <20030907232145.6ec197fd.akpm@osdl.org> In-Reply-To: <20030907232145.6ec197fd.akpm@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 5702 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 Content-Length: 264 Lines: 15 Andrew Morton wrote: > Very simple: > > ifup eth0 > ifdown eth0 > ifup eth0 > ifdown eth0 <- hangs in dev_close -> netif_poll_disable() > > > Because the first close sets __LINK_STATE_RX_SCHED and nothing ever clears > it. Thanks, fix patch just sent. From haegar@sdinet.de Mon Sep 8 15:40:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 15:41:23 -0700 (PDT) Received: from imap.comunit.de (imap.comunit.de [193.103.160.193]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h88Memx4008714 for ; Mon, 8 Sep 2003 15:40:49 -0700 Received: by imap.comunit.de (bofa-smtpd, from userid 4712) id C3F8D247E32; Tue, 9 Sep 2003 00:40:42 +0200 (CEST) Received: from space.comunit.de (comunit.de [193.103.160.129]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client did not present a certificate) by imap.comunit.de (bofa-smtpd) with ESMTP id A10F3247E28; Tue, 9 Sep 2003 00:40:41 +0200 (CEST) Date: Tue, 9 Sep 2003 00:40:41 +0200 (CEST) From: Sven-Haegar Koch X-X-Sender: haegar@space.comunit.de To: Jeff Garzik Cc: netdev@oss.sgi.com, "David S. Miller" , Andrew Morton , LKML Subject: Re: [PATCH] Re: ifconfig up/down problem In-Reply-To: <3F5CFF7E.1090005@pobox.com> Message-ID: References: <3F5CFF7E.1090005@pobox.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5703 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: haegar@sdinet.de Precedence: bulk X-list: netdev Content-Length: 304 Lines: 15 On Mon, 8 Sep 2003, Jeff Garzik wrote: > Sven-Haegar Koch wrote: > > Short: ifconfig ethX down locks > Does the attached patch fix it? Yes, it does - thanks a lot! c'ya sven -- The Internet treats censorship as a routing problem, and routes around it. (John Gilmore on http://www.cygnus.com/~gnu/) From carlos@fisica.ufpr.br Mon Sep 8 17:03:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 17:04:20 -0700 (PDT) Received: from fisica.ufpr.br (fisica.ufpr.br [200.17.209.129]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h8903ex4020021 for ; Mon, 8 Sep 2003 17:03:41 -0700 Received: by fisica.ufpr.br (Postfix) id 022E336B865; Mon, 8 Sep 2003 21:03:38 -0300 (BRT) From: Carlos Carvalho MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <16221.6346.577173.525623@fisica.ufpr.br> Date: Mon, 8 Sep 2003 21:03:22 -0300 To: netdev@oss.sgi.com Subject: 2.4: "kernel: hw tcp v4 csum failed" with e100 X-Mailer: VM 7.07 under Emacs 19.34.1 X-archive-position: 5704 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: carlos@fisica.ufpr.br Precedence: bulk X-list: netdev Content-Length: 507 Lines: 9 I've switched from the eepro100 driver to the e100 in 2.4.22-rc2 and started getting "kernel: hw tcp v4 csum failed" in the logs. Going back to the eepro100 makes these messages disappear. The machine is a dual-pentium with the Supermicro DE6 motherboard, which comes with the Intel ethernet chip on board. ifconfig shows no ethernet errors. What's the meaning of this warning? I grepped the kernel sources and found nothing. I'm not even sure it's net-related; I apologize if this isn't the correct list. From chas@cmf.nrl.navy.mil Mon Sep 8 17:18:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 17:18:25 -0700 (PDT) Received: from ginger.cmf.nrl.navy.mil (ginger.cmf.nrl.navy.mil [134.207.10.161]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h890IEx4023988 for ; Mon, 8 Sep 2003 17:18:15 -0700 Received: from cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.10.180]) by ginger.cmf.nrl.navy.mil (8.12.7/8.12.7) with ESMTP id h88LWRSa004358; Mon, 8 Sep 2003 17:32:28 -0400 (EDT) Message-Id: <200309082132.h88LWRSa004358@ginger.cmf.nrl.navy.mil> To: davem@redhat.com cc: netdev@oss.sgi.com Subject: [PATCH][ATM][2.4] lane/mpoa locking cleanup Reply-To: chas3@users.sourceforge.net Date: Mon, 08 Sep 2003 17:32:28 -0400 From: chas williams X-Spam-Score: () hits=0.5 X-Virus-Scanned: NAI Completed X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-archive-position: 5705 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: chas@cmf.nrl.navy.mil Precedence: bulk X-list: netdev Content-Length: 30480 Lines: 930 this is a backport of the 2.6 lane/mpoa locking cleanup. please apply to 2.4 -- thanks [ATM]: lane/mpoa module locking cleanup # 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.1119.3.2 -> 1.1119.3.3 # net/atm/lec.c 1.17 -> 1.18 # net/atm/mpc.h 1.1 -> 1.2 # net/atm/proc.c 1.9 -> 1.10 # net/atm/lec.h 1.5 -> 1.6 # net/atm/mpc.c 1.8 -> 1.9 # net/atm/common.c 1.17 -> 1.18 # # -------------------------------------------- # 03/09/05 chas@relax.cmf.nrl.navy.mil 1.1119.3.3 # [ATM]: lane/mpoa module locking cleanup # -------------------------------------------- # diff -Nru a/net/atm/common.c b/net/atm/common.c --- a/net/atm/common.c Mon Sep 8 17:29:52 2003 +++ b/net/atm/common.c Mon Sep 8 17:29:52 2003 @@ -33,21 +33,61 @@ #include #include "lec.h" #include "lec_arpc.h" -struct atm_lane_ops atm_lane_ops; -#endif -#ifdef CONFIG_ATM_LANE_MODULE +struct atm_lane_ops *atm_lane_ops; +static DECLARE_MUTEX(atm_lane_ops_mutex); + +void atm_lane_ops_set(struct atm_lane_ops *hook) +{ + down(&atm_lane_ops_mutex); + atm_lane_ops = hook; + up(&atm_lane_ops_mutex); +} + +int try_atm_lane_ops(void) +{ + down(&atm_lane_ops_mutex); + if (atm_lane_ops && try_inc_mod_count(atm_lane_ops->owner)) { + up(&atm_lane_ops_mutex); + return 1; + } + up(&atm_lane_ops_mutex); + return 0; +} + +#if defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_ATM_MPOA_MODULE) EXPORT_SYMBOL(atm_lane_ops); +EXPORT_SYMBOL(try_atm_lane_ops); +EXPORT_SYMBOL(atm_lane_ops_set); +#endif #endif #if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE) #include #include "mpc.h" -struct atm_mpoa_ops atm_mpoa_ops; -#endif +struct atm_mpoa_ops *atm_mpoa_ops; +static DECLARE_MUTEX(atm_mpoa_ops_mutex); + +void atm_mpoa_ops_set(struct atm_mpoa_ops *hook) +{ + down(&atm_mpoa_ops_mutex); + atm_mpoa_ops = hook; + up(&atm_mpoa_ops_mutex); +} + +int try_atm_mpoa_ops(void) +{ + down(&atm_mpoa_ops_mutex); + if (atm_mpoa_ops && try_inc_mod_count(atm_mpoa_ops->owner)) { + up(&atm_mpoa_ops_mutex); + return 1; + } + up(&atm_mpoa_ops_mutex); + return 0; +} #ifdef CONFIG_ATM_MPOA_MODULE EXPORT_SYMBOL(atm_mpoa_ops); -#ifndef CONFIG_ATM_LANE_MODULE -EXPORT_SYMBOL(atm_lane_ops); +EXPORT_SYMBOL(try_atm_mpoa_ops); +EXPORT_SYMBOL(atm_mpoa_ops_set); #endif #endif @@ -739,27 +779,43 @@ ret_val = -EPERM; goto done; } - if (atm_lane_ops.lecd_attach == NULL) - atm_lane_init(); - if (atm_lane_ops.lecd_attach == NULL) { /* try again */ +#if defined(CONFIG_ATM_LANE_MODULE) + if (!atm_lane_ops) + request_module("lec"); +#endif + if (try_atm_lane_ops()) { + error = atm_lane_ops->lecd_attach(vcc, (int) arg); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); + if (error >= 0) + sock->state = SS_CONNECTED; + ret_val = error; + } else ret_val = -ENOSYS; - goto done; - } - error = atm_lane_ops.lecd_attach(vcc, (int)arg); - if (error >= 0) sock->state = SS_CONNECTED; - ret_val = error; goto done; case ATMLEC_MCAST: - if (!capable(CAP_NET_ADMIN)) + if (!capable(CAP_NET_ADMIN)) { ret_val = -EPERM; - else - ret_val = atm_lane_ops.mcast_attach(vcc, (int)arg); + goto done; + } + if (try_atm_lane_ops()) { + ret_val = atm_lane_ops->mcast_attach(vcc, (int) arg); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); + } else + ret_val = -ENOSYS; goto done; case ATMLEC_DATA: - if (!capable(CAP_NET_ADMIN)) + if (!capable(CAP_NET_ADMIN)) { ret_val = -EPERM; - else - ret_val = atm_lane_ops.vcc_attach(vcc, (void*)arg); + goto done; + } + if (try_atm_lane_ops()) { + ret_val = atm_lane_ops->vcc_attach(vcc, (void *) arg); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); + } else + ret_val = -ENOSYS; goto done; #endif #if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE) @@ -768,21 +824,31 @@ ret_val = -EPERM; goto done; } - if (atm_mpoa_ops.mpoad_attach == NULL) - atm_mpoa_init(); - if (atm_mpoa_ops.mpoad_attach == NULL) { /* try again */ +#if defined(CONFIG_ATM_MPOA_MODULE) + if (!atm_mpoa_ops) + request_module("mpoa"); +#endif + if (try_atm_mpoa_ops()) { + error = atm_mpoa_ops->mpoad_attach(vcc, (int) arg); + if (atm_mpoa_ops->owner) + __MOD_DEC_USE_COUNT(atm_mpoa_ops->owner); + if (error >= 0) + sock->state = SS_CONNECTED; + ret_val = error; + } else ret_val = -ENOSYS; - goto done; - } - error = atm_mpoa_ops.mpoad_attach(vcc, (int)arg); - if (error >= 0) sock->state = SS_CONNECTED; - ret_val = error; goto done; case ATMMPC_DATA: - if (!capable(CAP_NET_ADMIN)) + if (!capable(CAP_NET_ADMIN)) { ret_val = -EPERM; - else - ret_val = atm_mpoa_ops.vcc_attach(vcc, arg); + goto done; + } + if (try_atm_mpoa_ops()) { + ret_val = atm_mpoa_ops->vcc_attach(vcc, arg); + if (atm_mpoa_ops->owner) + __MOD_DEC_USE_COUNT(atm_mpoa_ops->owner); + } else + ret_val = -ENOSYS; goto done; #endif #if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE) @@ -1167,40 +1233,6 @@ } -/* - * lane_mpoa_init.c: A couple of helper functions - * to make modular LANE and MPOA client easier to implement - */ - -/* - * This is how it goes: - * - * if xxxx is not compiled as module, call atm_xxxx_init_ops() - * from here - * else call atm_mpoa_init_ops() from init_module() within - * the kernel when xxxx module is loaded - * - * In either case function pointers in struct atm_xxxx_ops - * are initialized to their correct values. Either they - * point to functions in the module or in the kernel - */ - -extern struct atm_mpoa_ops atm_mpoa_ops; /* in common.c */ -extern struct atm_lane_ops atm_lane_ops; /* in common.c */ - -#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE) -void atm_mpoa_init(void) -{ -#ifndef CONFIG_ATM_MPOA_MODULE /* not module */ - atm_mpoa_init_ops(&atm_mpoa_ops); -#else - request_module("mpoa"); -#endif - - return; -} -#endif - #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, @@ -1211,18 +1243,8 @@ EXPORT_SYMBOL(br_fdb_put_hook); #endif /* defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_BRIDGE_MODULE) */ #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */ +#endif /* defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) */ -void atm_lane_init(void) -{ -#ifndef CONFIG_ATM_LANE_MODULE /* not module */ - atm_lane_init_ops(&atm_lane_ops); -#else - request_module("lec"); -#endif - - return; -} -#endif static int __init atm_init(void) { diff -Nru a/net/atm/lec.c b/net/atm/lec.c --- a/net/atm/lec.c Mon Sep 8 17:29:52 2003 +++ b/net/atm/lec.c Mon Sep 8 17:29:52 2003 @@ -11,6 +11,7 @@ /* We are ethernet device */ #include #include +#include #include #include #include @@ -57,8 +58,6 @@ unsigned char *addr); extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); -static spinlock_t lec_arp_spinlock = SPIN_LOCK_UNLOCKED; - #define DUMP_PACKETS 0 /* 0 = None, * 1 = 30 first bytes * 2 = Whole packet @@ -72,9 +71,9 @@ static int lec_close(struct net_device *dev); static struct net_device_stats *lec_get_stats(struct net_device *dev); static void lec_init(struct net_device *dev); -static __inline__ struct lec_arp_table* lec_arp_find(struct lec_priv *priv, +static inline struct lec_arp_table* lec_arp_find(struct lec_priv *priv, unsigned char *mac_addr); -static __inline__ int lec_arp_remove(struct lec_arp_table **lec_arp_tables, +static inline int lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove); /* LANE2 functions */ static void lane2_associate_ind (struct net_device *dev, u8 *mac_address, @@ -96,8 +95,18 @@ static struct net_device *dev_lec[MAX_LEC_ITF]; /* This will be called from proc.c via function pointer */ -struct net_device **get_dev_lec (void) { - return &dev_lec[0]; +struct net_device *get_dev_lec(int itf) +{ + struct net_device *dev; + + if (itf >= MAX_LEC_ITF) + return NULL; + rtnl_lock(); + dev = dev_lec[itf]; + if (dev) + dev_hold(dev); + rtnl_unlock(); + return dev; } #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) @@ -433,7 +442,7 @@ break; case l_narp_req: /* LANE2: see 7.1.35 in the lane2 spec */ entry = lec_arp_find(priv, mesg->content.normal.mac_addr); - lec_arp_remove(priv->lec_arp_tables, entry); + lec_arp_remove(priv, entry); if (mesg->content.normal.no_source_le_narp) break; @@ -834,37 +843,28 @@ return i; } -void atm_lane_init_ops(struct atm_lane_ops *ops) +static struct atm_lane_ops __atm_lane_ops = { - ops->lecd_attach = lecd_attach; - ops->mcast_attach = lec_mcast_attach; - ops->vcc_attach = lec_vcc_attach; - ops->get_lecs = get_dev_lec; - - printk("lec.c: " __DATE__ " " __TIME__ " initialized\n"); - - return; -} + .lecd_attach = lecd_attach, + .mcast_attach = lec_mcast_attach, + .vcc_attach = lec_vcc_attach, + .get_lec = get_dev_lec, + .owner = THIS_MODULE +}; static int __init lane_module_init(void) { - extern struct atm_lane_ops atm_lane_ops; - - atm_lane_init_ops(&atm_lane_ops); - + atm_lane_ops_set(&__atm_lane_ops); + printk("lec.c: " __DATE__ " " __TIME__ " initialized\n"); return 0; } static void __exit lane_module_cleanup(void) { int i; - extern struct atm_lane_ops atm_lane_ops; struct lec_priv *priv; - atm_lane_ops.lecd_attach = NULL; - atm_lane_ops.mcast_attach = NULL; - atm_lane_ops.vcc_attach = NULL; - atm_lane_ops.get_lecs = NULL; + atm_lane_ops_set(NULL); for (i = 0; i < MAX_LEC_ITF; i++) { if (dev_lec[i] != NULL) { @@ -874,7 +874,7 @@ unregister_trdev(dev_lec[i]); else #endif - unregister_netdev(dev_lec[i]); + unregister_netdev(dev_lec[i]); kfree(dev_lec[i]); dev_lec[i] = NULL; } @@ -1074,6 +1074,7 @@ for (i=0;ilec_arp_tables[i] = NULL; } + spin_lock_init(&priv->lec_arp_lock); init_timer(&priv->lec_arp_timer); priv->lec_arp_timer.expires = jiffies+LEC_ARP_REFRESH_INTERVAL; priv->lec_arp_timer.data = (unsigned long)priv; @@ -1110,21 +1111,20 @@ * Insert entry to lec_arp_table * LANE2: Add to the end of the list to satisfy 8.1.13 */ -static __inline__ void -lec_arp_add(struct lec_arp_table **lec_arp_tables, - struct lec_arp_table *to_add) +static inline void +lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add) { unsigned long flags; unsigned short place; struct lec_arp_table *tmp; - spin_lock_irqsave(&lec_arp_spinlock, flags); + spin_lock_irqsave(&priv->lec_arp_lock, flags); place = HASH(to_add->mac_addr[ETH_ALEN-1]); - tmp = lec_arp_tables[place]; + tmp = priv->lec_arp_tables[place]; to_add->next = NULL; if (tmp == NULL) - lec_arp_tables[place] = to_add; + priv->lec_arp_tables[place] = to_add; else { /* add to the end */ while (tmp->next) @@ -1132,7 +1132,7 @@ tmp->next = to_add; } - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); DPRINTK("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 0xff&to_add->mac_addr[0], 0xff&to_add->mac_addr[1], @@ -1143,8 +1143,8 @@ /* * Remove entry from lec_arp_table */ -static __inline__ int -lec_arp_remove(struct lec_arp_table **lec_arp_tables, +static inline int +lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove) { unsigned long flags; @@ -1152,22 +1152,22 @@ struct lec_arp_table *tmp; int remove_vcc=1; - spin_lock_irqsave(&lec_arp_spinlock, flags); + spin_lock_irqsave(&priv->lec_arp_lock, flags); if (!to_remove) { - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); return -1; } place = HASH(to_remove->mac_addr[ETH_ALEN-1]); - tmp = lec_arp_tables[place]; + tmp = priv->lec_arp_tables[place]; if (tmp == to_remove) { - lec_arp_tables[place] = tmp->next; + priv->lec_arp_tables[place] = tmp->next; } else { while(tmp && tmp->next != to_remove) { tmp = tmp->next; } if (!tmp) {/* Entry was not found */ - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); return -1; } } @@ -1181,7 +1181,7 @@ * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT */ for(place=0;placenext){ + for(tmp = priv->lec_arp_tables[place]; tmp != NULL; tmp = tmp->next) { if (memcmp(tmp->atm_addr, to_remove->atm_addr, ATM_ESA_LEN)==0) { remove_vcc=0; @@ -1194,7 +1194,7 @@ } skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */ - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); DPRINTK("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 0xff&to_remove->mac_addr[0], 0xff&to_remove->mac_addr[1], @@ -1390,7 +1390,7 @@ for (i=0;ilec_arp_tables[i];entry != NULL; entry=next) { next = entry->next; - lec_arp_remove(priv->lec_arp_tables, entry); + lec_arp_remove(priv, entry); kfree(entry); } } @@ -1430,7 +1430,7 @@ /* * Find entry by mac_address */ -static __inline__ struct lec_arp_table* +static inline struct lec_arp_table* lec_arp_find(struct lec_priv *priv, unsigned char *mac_addr) { @@ -1568,8 +1568,6 @@ lec_arp_check_expire(unsigned long data) { struct lec_priv *priv = (struct lec_priv *)data; - struct lec_arp_table **lec_arp_tables = - (struct lec_arp_table **)priv->lec_arp_tables; struct lec_arp_table *entry, *next; unsigned long now; unsigned long time_to_check; @@ -1585,7 +1583,7 @@ lec_arp_get(priv); now = jiffies; for(i=0;ilec_arp_tables[i]; entry != NULL; ) { if ((entry->flags) & LEC_REMOTE_FLAG && priv->topology_change) time_to_check=priv->forward_delay_time; @@ -1601,7 +1599,7 @@ /* Remove entry */ DPRINTK("LEC:Entry timed out\n"); next = entry->next; - lec_arp_remove(lec_arp_tables, entry); + lec_arp_remove(priv, entry); kfree(entry); entry = next; } else { @@ -1690,7 +1688,7 @@ if (!entry) { return priv->mcast_vcc; } - lec_arp_add(priv->lec_arp_tables, entry); + lec_arp_add(priv, entry); /* We want arp-request(s) to be sent */ entry->packets_flooded =1; entry->status = ESI_ARP_PENDING; @@ -1723,7 +1721,7 @@ if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) && (permanent || !(entry->flags & LEC_PERMANENT_FLAG))) { - lec_arp_remove(priv->lec_arp_tables, entry); + lec_arp_remove(priv, entry); kfree(entry); } lec_arp_put(priv); @@ -1789,7 +1787,7 @@ entry->status = ESI_FORWARD_DIRECT; memcpy(entry->mac_addr, mac_addr, ETH_ALEN); entry->last_used = jiffies; - lec_arp_add(priv->lec_arp_tables, entry); + lec_arp_add(priv, entry); } if (remoteflag) entry->flags|=LEC_REMOTE_FLAG; @@ -1809,7 +1807,7 @@ return; } entry->status = ESI_UNKNOWN; - lec_arp_add(priv->lec_arp_tables, entry); + lec_arp_add(priv, entry); /* Temporary, changes before end of function */ } memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); @@ -2056,7 +2054,7 @@ to_add->old_push = vcc->push; vcc->push = lec_push; priv->mcast_vcc = vcc; - lec_arp_add(priv->lec_arp_tables, to_add); + lec_arp_add(priv, to_add); lec_arp_put(priv); return 0; } @@ -2074,7 +2072,7 @@ for(entry = priv->lec_arp_tables[i];entry; entry=next) { next = entry->next; if (vcc == entry->vcc) { - lec_arp_remove(priv->lec_arp_tables,entry); + lec_arp_remove(priv, entry); kfree(entry); if (priv->mcast_vcc == vcc) { priv->mcast_vcc = NULL; @@ -2154,23 +2152,23 @@ lec_arp_get(priv); entry = priv->lec_arp_empty_ones; if (vcc == entry->vcc) { - spin_lock_irqsave(&lec_arp_spinlock, flags); + spin_lock_irqsave(&priv->lec_arp_lock, flags); del_timer(&entry->timer); memcpy(entry->mac_addr, src, ETH_ALEN); entry->status = ESI_FORWARD_DIRECT; entry->last_used = jiffies; priv->lec_arp_empty_ones = entry->next; - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); /* We might have got an entry */ if ((prev=lec_arp_find(priv,src))) { - lec_arp_remove(priv->lec_arp_tables, prev); + lec_arp_remove(priv, prev); kfree(prev); } - lec_arp_add(priv->lec_arp_tables, entry); + lec_arp_add(priv, entry); lec_arp_put(priv); return; } - spin_lock_irqsave(&lec_arp_spinlock, flags); + spin_lock_irqsave(&priv->lec_arp_lock, flags); prev = entry; entry = entry->next; while (entry && entry->vcc != vcc) { @@ -2180,7 +2178,7 @@ if (!entry) { DPRINTK("LEC_ARP: Arp_check_empties: entry not found!\n"); lec_arp_put(priv); - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); return; } del_timer(&entry->timer); @@ -2188,12 +2186,12 @@ entry->status = ESI_FORWARD_DIRECT; entry->last_used = jiffies; prev->next = entry->next; - spin_unlock_irqrestore(&lec_arp_spinlock, flags); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); if ((prev = lec_arp_find(priv, src))) { - lec_arp_remove(priv->lec_arp_tables,prev); + lec_arp_remove(priv, prev); kfree(prev); } - lec_arp_add(priv->lec_arp_tables,entry); + lec_arp_add(priv, entry); lec_arp_put(priv); } MODULE_LICENSE("GPL"); diff -Nru a/net/atm/lec.h b/net/atm/lec.h --- a/net/atm/lec.h Mon Sep 8 17:29:52 2003 +++ b/net/atm/lec.h Mon Sep 8 17:29:52 2003 @@ -64,7 +64,8 @@ int (*lecd_attach)(struct atm_vcc *vcc, int arg); int (*mcast_attach)(struct atm_vcc *vcc, int arg); int (*vcc_attach)(struct atm_vcc *vcc, void *arg); - struct net_device **(*get_lecs)(void); + struct net_device * (*get_lec)(int itf); + struct module *owner; }; /* @@ -102,6 +103,7 @@ collects all those VCCs. LANEv1 client has only one item in this list. These entries are not aged out. */ atomic_t lec_arp_users; + spinlock_t lec_arp_lock; struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */ struct atm_vcc *lecd; struct timer_list lec_arp_timer; @@ -148,14 +150,16 @@ int lecd_attach(struct atm_vcc *vcc, int arg); int lec_vcc_attach(struct atm_vcc *vcc, void *arg); int lec_mcast_attach(struct atm_vcc *vcc, int arg); -struct net_device **get_dev_lec(void); +struct net_device *get_dev_lec(int itf); int make_lec(struct atm_vcc *vcc); int send_to_lecd(struct lec_priv *priv, atmlec_msg_type type, unsigned char *mac_addr, unsigned char *atm_addr, struct sk_buff *data); void lec_push(struct atm_vcc *vcc, struct sk_buff *skb); -void atm_lane_init(void); -void atm_lane_init_ops(struct atm_lane_ops *ops); +extern struct atm_lane_ops *atm_lane_ops; +void atm_lane_ops_set(struct atm_lane_ops *hook); +int try_atm_lane_ops(void); + #endif /* _LEC_H_ */ diff -Nru a/net/atm/mpc.c b/net/atm/mpc.c --- a/net/atm/mpc.c Mon Sep 8 17:29:52 2003 +++ b/net/atm/mpc.c Mon Sep 8 17:29:52 2003 @@ -251,12 +251,14 @@ static struct net_device *find_lec_by_itfnum(int itf) { - extern struct atm_lane_ops atm_lane_ops; /* in common.c */ - - if (atm_lane_ops.get_lecs == NULL) + struct net_device *dev; + if (!try_atm_lane_ops()) return NULL; - return atm_lane_ops.get_lecs()[itf]; /* FIXME: something better */ + dev = atm_lane_ops->get_lec(itf); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); + return dev; } static struct mpoa_client *alloc_mpc(void) @@ -777,9 +779,10 @@ if (mpc->dev) { /* check if the lec is LANE2 capable */ priv = (struct lec_priv *)mpc->dev->priv; - if (priv->lane_version < 2) + if (priv->lane_version < 2) { + dev_put(mpc->dev); mpc->dev = NULL; - else + } else priv->lane2_ops->associate_indicator = lane2_assoc_ind; } @@ -837,6 +840,7 @@ struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; priv->lane2_ops->associate_indicator = NULL; stop_mpc(mpc); + dev_put(mpc->dev); } mpc->in_ops->destroy_cache(mpc); @@ -973,6 +977,7 @@ } mpc->dev_num = priv->itfnum; mpc->dev = dev; + dev_hold(dev); dprintk("mpoa: (%s) was initialized\n", dev->name); break; case NETDEV_UNREGISTER: @@ -982,6 +987,7 @@ break; dprintk("mpoa: device (%s) was deallocated\n", dev->name); stop_mpc(mpc); + dev_put(mpc->dev); mpc->dev = NULL; break; case NETDEV_UP: @@ -1391,13 +1397,18 @@ return; } -void atm_mpoa_init_ops(struct atm_mpoa_ops *ops) +static struct atm_mpoa_ops __atm_mpoa_ops = { + .mpoad_attach = atm_mpoa_mpoad_attach, + .vcc_attach = atm_mpoa_vcc_attach, + .owner = THIS_MODULE +}; + +static __init int atm_mpoa_init(void) { - ops->mpoad_attach = atm_mpoa_mpoad_attach; - ops->vcc_attach = atm_mpoa_vcc_attach; + atm_mpoa_ops_set(&__atm_mpoa_ops); #ifdef CONFIG_PROC_FS - if(mpc_proc_init() != 0) + if (mpc_proc_init() != 0) printk(KERN_INFO "mpoa: failed to initialize /proc/mpoa\n"); else printk(KERN_INFO "mpoa: /proc/mpoa initialized\n"); @@ -1405,22 +1416,11 @@ printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); - return; -} - -#ifdef MODULE -int init_module(void) -{ - extern struct atm_mpoa_ops atm_mpoa_ops; - - atm_mpoa_init_ops(&atm_mpoa_ops); - return 0; } -void cleanup_module(void) +void __exit atm_mpoa_cleanup(void) { - extern struct atm_mpoa_ops atm_mpoa_ops; struct mpoa_client *mpc, *tmp; struct atm_mpoa_qos *qos, *nextqos; struct lec_priv *priv; @@ -1435,8 +1435,7 @@ del_timer(&mpc_timer); unregister_netdevice_notifier(&mpoa_notifier); - atm_mpoa_ops.mpoad_attach = NULL; - atm_mpoa_ops.vcc_attach = NULL; + atm_mpoa_ops_set(NULL); mpc = mpcs; mpcs = NULL; @@ -1471,5 +1470,8 @@ return; } -#endif /* MODULE */ + +module_init(atm_mpoa_init); +module_exit(atm_mpoa_cleanup); + MODULE_LICENSE("GPL"); diff -Nru a/net/atm/mpc.h b/net/atm/mpc.h --- a/net/atm/mpc.h Mon Sep 8 17:29:52 2003 +++ b/net/atm/mpc.h Mon Sep 8 17:29:52 2003 @@ -48,11 +48,13 @@ struct atm_mpoa_ops { int (*mpoad_attach)(struct atm_vcc *vcc, int arg); /* attach mpoa daemon */ int (*vcc_attach)(struct atm_vcc *vcc, long arg); /* attach shortcut vcc */ + struct module *owner; }; /* Boot/module initialization function */ -void atm_mpoa_init(void); -void atm_mpoa_init_ops(struct atm_mpoa_ops *ops); +extern struct atm_mpoa_ops *atm_mpoa_ops; +int try_atm_mpoa_ops(void); +void atm_mpoa_ops_set(struct atm_mpoa_ops *hook); /* MPOA QoS operations */ struct atm_mpoa_qos *atm_mpoa_add_qos(uint32_t dst_ip, struct atm_qos *qos); diff -Nru a/net/atm/proc.c b/net/atm/proc.c --- a/net/atm/proc.c Mon Sep 8 17:29:52 2003 +++ b/net/atm/proc.c Mon Sep 8 17:29:52 2003 @@ -47,7 +47,6 @@ #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) #include "lec.h" #include "lec_arpc.h" -extern struct atm_lane_ops atm_lane_ops; /* in common.c */ #endif static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, @@ -482,57 +481,77 @@ #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) static int atm_lec_info(loff_t pos,char *buf) { + unsigned long flags; struct lec_priv *priv; struct lec_arp_table *entry; int i, count, d, e; - struct net_device **dev_lec; + struct net_device *dev; if (!pos) { return sprintf(buf,"Itf MAC ATM destination" " Status Flags " "VPI/VCI Recv VPI/VCI\n"); } - if (atm_lane_ops.get_lecs == NULL) + if (!try_atm_lane_ops()) return 0; /* the lane module is not there yet */ - else - dev_lec = atm_lane_ops.get_lecs(); count = pos; - for(d=0;dpriv)) continue; - for(i=0;ilec_arp_tables[i]; - for(;entry;entry=entry->next) { - if (--count) continue; - e=sprintf(buf,"%s ", - dev_lec[d]->name); - lec_info(entry,buf+e); + for(d = 0; d < MAX_LEC_ITF; d++) { + dev = atm_lane_ops->get_lec(d); + if (!dev || !(priv = (struct lec_priv *) dev->priv)) + continue; + spin_lock_irqsave(&priv->lec_arp_lock, flags); + for(i = 0; i < LEC_ARP_TABLE_SIZE; i++) { + for(entry = priv->lec_arp_tables[i]; entry; entry = entry->next) { + if (--count) + continue; + e = sprintf(buf,"%s ", dev->name); + lec_info(entry, buf+e); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dev_put(dev); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); return strlen(buf); } } - for(entry=priv->lec_arp_empty_ones; entry; - entry=entry->next) { - if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); + for(entry = priv->lec_arp_empty_ones; entry; entry = entry->next) { + if (--count) + continue; + e = sprintf(buf,"%s ", dev->name); lec_info(entry, buf+e); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dev_put(dev); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); return strlen(buf); } - for(entry=priv->lec_no_forward; entry; - entry=entry->next) { - if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); + for(entry = priv->lec_no_forward; entry; entry=entry->next) { + if (--count) + continue; + e = sprintf(buf,"%s ", dev->name); lec_info(entry, buf+e); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dev_put(dev); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); return strlen(buf); } - for(entry=priv->mcast_fwds; entry; - entry=entry->next) { - if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); + for(entry = priv->mcast_fwds; entry; entry = entry->next) { + if (--count) + continue; + e = sprintf(buf,"%s ", dev->name); lec_info(entry, buf+e); + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dev_put(dev); + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); return strlen(buf); } + spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dev_put(dev); } + if (atm_lane_ops->owner) + __MOD_DEC_USE_COUNT(atm_lane_ops->owner); return 0; } #endif From davem@pizda.ninka.net Mon Sep 8 19:24:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:25:11 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892Oax4009193 for ; Mon, 8 Sep 2003 19:24:37 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id TAA05456; Mon, 8 Sep 2003 19:14:00 -0700 Date: Mon, 8 Sep 2003 19:14:00 -0700 From: "David S. Miller" To: Harald Welte Cc: bdschuym@pandora.be, acme@conectiva.com.br, netfilter-devel@lists.netfilter.org, netdev@oss.sgi.com Subject: Re: ipt_physdev.c alignment problems on parisc64 Message-Id: <20030908191400.5ef59ab6.davem@redhat.com> In-Reply-To: <20030905153152.GA3623@obroa-skai.de.gnumonks.org> References: <200309022116.41697.bdschuym@pandora.be> <20030903200426.59d0af4a.davem@redhat.com> <20030905153152.GA3623@obroa-skai.de.gnumonks.org> X-Mailer: Sylpheed version 0.9.2 (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: 5706 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 Content-Length: 262 Lines: 8 On Fri, 5 Sep 2003 17:31:52 +0200 Harald Welte wrote: > The problem is that it is _not_ a simple reimplementation of memcmp(), > but a mask-compare. Ok. It still should be fixed by not using the "unsigned long *" cast-and-op tricks... From davem@pizda.ninka.net Mon Sep 8 19:31:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:32:17 -0700 (PDT) Received: from pizda.ninka.net (IDENT:root@pizda.ninka.net [216.101.162.242]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892Vfx4009891 for ; Mon, 8 Sep 2003 19:31:41 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id TAA05485; Mon, 8 Sep 2003 19:21:15 -0700 Date: Mon, 8 Sep 2003 19:21:15 -0700 From: "David S. Miller" To: Michael Rozhavsky Cc: netdev@oss.sgi.com Subject: Re: [PATCH] fix locking Message-Id: <20030908192115.2f0263f3.davem@redhat.com> In-Reply-To: <20030906002649.GA32369@server-mrozhavsky.dyndns.org> References: <20030906002649.GA32369@server-mrozhavsky.dyndns.org> X-Mailer: Sylpheed version 0.9.2 (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: 5707 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 Content-Length: 519 Lines: 15 On Fri, 5 Sep 2003 17:26:49 -0700 Michael Rozhavsky wrote: > I've found two problems with locking in networking code. The tcp_ipv4.c part is not a bug. We hold the socket lock on 'sk' and therefore nobody else can add any entries to lopt->syn_table[] entries. We only need to hold the lock during the table update because _readers_ of the hash table do not take the 'sk' lock when do traverse the hash. The sit.c change does look correct, and therefore I'll apply it after some more review... From scott.feldman@intel.com Mon Sep 8 19:49:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:12 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892nbx4017028 for ; Mon, 8 Sep 2003 19:49:37 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892iou01533 for ; Tue, 9 Sep 2003 02:44:50 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892nFC27296 for ; Tue, 9 Sep 2003 02:49:16 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819492717022 ; Mon, 08 Sep 2003 19:49:27 -0700 Date: Mon, 8 Sep 2003 20:14:06 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 1/11] new 82541/5/6/7 hardware support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5709 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 Content-Length: 101967 Lines: 2631 * Added 82545 (rev3), 82546 (rev3), and 82541/7 (rev2) support - new device IDs - internal SERDES support for 82545/6 (rev3) - don't apply MMRBC workaround for 82545/6 (rev3) - don't use IO mapping for reset for 82545/6 (rev3) ------------ diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c 2003-08-22 16:55:33.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c 2003-09-08 09:13:10.000000000 -0700 @@ -958,9 +958,13 @@ e1000_set_phy_loopback(struct e1000_adap case e1000_82544: case e1000_82540: case e1000_82545: + case e1000_82545_rev_3: case e1000_82546: + case e1000_82546_rev_3: case e1000_82541: + case e1000_82541_rev_2: case e1000_82547: + case e1000_82547_rev_2: return e1000_integrated_phy_loopback(adapter); break; @@ -983,9 +987,12 @@ e1000_setup_loopback_test(struct e1000_a { uint32_t rctl; - if(adapter->hw.media_type == e1000_media_type_fiber) { + if(adapter->hw.media_type == e1000_media_type_fiber || + adapter->hw.media_type == e1000_media_type_internal_serdes) { if(adapter->hw.mac_type == e1000_82545 || - adapter->hw.mac_type == e1000_82546) + adapter->hw.mac_type == e1000_82546 || + adapter->hw.mac_type == e1000_82545_rev_3 || + adapter->hw.mac_type == e1000_82546_rev_3) return e1000_set_phy_loopback(adapter); else { rctl = E1000_READ_REG(&adapter->hw, RCTL); @@ -1010,9 +1017,12 @@ e1000_loopback_cleanup(struct e1000_adap E1000_WRITE_REG(&adapter->hw, RCTL, rctl); if(adapter->hw.media_type == e1000_media_type_copper || - (adapter->hw.media_type == e1000_media_type_fiber && + ((adapter->hw.media_type == e1000_media_type_fiber || + adapter->hw.media_type == e1000_media_type_internal_serdes) && (adapter->hw.mac_type == e1000_82545 || - adapter->hw.mac_type == e1000_82546))) { + adapter->hw.mac_type == e1000_82546 || + adapter->hw.mac_type == e1000_82545_rev_3 || + adapter->hw.mac_type == e1000_82546_rev_3))) { adapter->hw.autoneg = TRUE; e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); if(phy_reg & MII_CR_LOOPBACK) { @@ -1162,6 +1172,7 @@ e1000_ethtool_gwol(struct e1000_adapter return; case E1000_DEV_ID_82546EB_FIBER: + case E1000_DEV_ID_82546GB_FIBER: /* Wake events only supported on port A for dual fiber */ if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { wol->supported = 0; @@ -1200,6 +1211,7 @@ e1000_ethtool_swol(struct e1000_adapter return wol->wolopts ? -EOPNOTSUPP : 0; case E1000_DEV_ID_82546EB_FIBER: + case E1000_DEV_ID_82546GB_FIBER: /* Wake events only supported on port A for dual fiber */ if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) return wol->wolopts ? -EOPNOTSUPP : 0; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -34,8 +34,9 @@ static int32_t e1000_set_phy_type(struct e1000_hw *hw); static void e1000_phy_init_script(struct e1000_hw *hw); -static int32_t e1000_setup_fiber_link(struct e1000_hw *hw); static int32_t e1000_setup_copper_link(struct e1000_hw *hw); +static int32_t e1000_setup_fiber_serdes_link(struct e1000_hw *hw); +static int32_t e1000_adjust_serdes_amplitude(struct e1000_hw *hw); static int32_t e1000_phy_force_speed_duplex(struct e1000_hw *hw); static int32_t e1000_config_mac_to_phy(struct e1000_hw *hw); static int32_t e1000_force_mac_fc(struct e1000_hw *hw); @@ -53,11 +53,16 @@ static int32_t e1000_write_eeprom_microw static void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd); static void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd); static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, uint16_t count); +static int32_t e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, + uint16_t phy_data); +static int32_t e1000_read_phy_reg_ex(struct e1000_hw *hw,uint32_t reg_addr, + uint16_t *phy_data); static uint16_t e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count); static int32_t e1000_acquire_eeprom(struct e1000_hw *hw); static void e1000_release_eeprom(struct e1000_hw *hw); static void e1000_standby_eeprom(struct e1000_hw *hw); static int32_t e1000_id_led_init(struct e1000_hw * hw); +static int32_t e1000_set_vco_speed(struct e1000_hw *hw); @@ -100,50 +100,41 @@ e1000_phy_init_script(struct e1000_hw *h DEBUGFUNC("e1000_phy_init_script"); if(hw->phy_init_script) { - msec_delay(10); + msec_delay(20); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x0000); e1000_write_phy_reg(hw,0x0000,0x0140); msec_delay(5); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F95); - e1000_write_phy_reg(hw,0x0015,0x0001); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F71); - e1000_write_phy_reg(hw,0x0011,0xBD21); + if(hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547) { + e1000_write_phy_reg(hw, 0x1F95, 0x0001); + + e1000_write_phy_reg(hw, 0x1F71, 0xBD21); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F79); - e1000_write_phy_reg(hw,0x0019,0x0018); + e1000_write_phy_reg(hw, 0x1F79, 0x0018); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F30); - e1000_write_phy_reg(hw,0x0010,0x1600); + e1000_write_phy_reg(hw, 0x1F30, 0x1600); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F31); - e1000_write_phy_reg(hw,0x0011,0x0014); + e1000_write_phy_reg(hw, 0x1F31, 0x0014); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F32); - e1000_write_phy_reg(hw,0x0012,0x161C); + e1000_write_phy_reg(hw, 0x1F32, 0x161C); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F94); - e1000_write_phy_reg(hw,0x0014,0x0003); + e1000_write_phy_reg(hw, 0x1F94, 0x0003); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x1F96); - e1000_write_phy_reg(hw,0x0016,0x003F); + e1000_write_phy_reg(hw, 0x1F96, 0x003F); - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x2010); - e1000_write_phy_reg(hw,0x0010,0x0008); + e1000_write_phy_reg(hw, 0x2010, 0x0008); + } else { + e1000_write_phy_reg(hw, 0x1F73, 0x0099); + } - e1000_write_phy_reg(hw,IGP01E1000_PHY_PAGE_SELECT,0x0000); - e1000_write_phy_reg(hw,0x0000,0x3300); + e1000_write_phy_reg(hw, 0x0000, 0x3300); if(hw->mac_type == e1000_82547) { uint16_t fused, fine, coarse; /* Move to analog registers page */ - e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, - IGP01E1000_ANALOG_REGS_PAGE); - e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { @@ -158,17 +155,14 @@ e1000_phy_init_script(struct e1000_hw *h } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) fine -= IGP01E1000_ANALOG_FUSE_FINE_10; - fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | - (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | + fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | + (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | (coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK); e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused); - e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, + e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); } - /* Return to first page of registers */ - e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, - IGP01E1000_IEEE_REGS_PAGE); } } } @@ -218,18 +224,36 @@ e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82545EM_FIBER: hw->mac_type = e1000_82545; break; + case E1000_DEV_ID_82545GM_COPPER: + case E1000_DEV_ID_82545GM_FIBER: + case E1000_DEV_ID_82545GM_SERDES: + hw->mac_type = e1000_82545_rev_3; + break; case E1000_DEV_ID_82546EB_COPPER: case E1000_DEV_ID_82546EB_FIBER: case E1000_DEV_ID_82546EB_QUAD_COPPER: hw->mac_type = e1000_82546; break; + case E1000_DEV_ID_82546GB_COPPER: + case E1000_DEV_ID_82546GB_FIBER: + case E1000_DEV_ID_82546GB_SERDES: + hw->mac_type = e1000_82546_rev_3; + break; case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EP: + case E1000_DEV_ID_82541EI_MOBILE: hw->mac_type = e1000_82541; break; + case E1000_DEV_ID_82541ER: + case E1000_DEV_ID_82541GI: + case E1000_DEV_ID_82541GI_MOBILE: + hw->mac_type = e1000_82541_rev_2; + break; case E1000_DEV_ID_82547EI: hw->mac_type = e1000_82547; break; + case E1000_DEV_ID_82547GI: + hw->mac_type = e1000_82547_rev_2; + break; default: /* Should never have loaded on this device */ return -E1000_ERR_MAC_TYPE; @@ -243,7 +224,7 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void +int32_t e1000_reset_hw(struct e1000_hw *hw) { uint32_t ctrl; @@ -300,29 +343,54 @@ e1000_reset_hw(struct e1000_hw *hw) case e1000_82545: case e1000_82546: case e1000_82541: + case e1000_82541_rev_2: /* These controllers can't ack the 64-bit write when issuing the * reset, so use IO-mapping as a workaround to issue the reset */ E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); break; + case e1000_82545_rev_3: + case e1000_82546_rev_3: + /* Reset is performed on a shadow of the control register */ + E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); + break; default: E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); break; } - /* Force a reload from the EEPROM if necessary */ - if(hw->mac_type < e1000_82540) { - /* Wait for reset to complete */ - udelay(10); - ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); - ctrl_ext |= E1000_CTRL_EXT_EE_RST; - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); - E1000_WRITE_FLUSH(hw); - /* Wait for EEPROM reload */ - msec_delay(2); - } else { - /* Wait for EEPROM reload (it happens automatically) */ - msec_delay(5); - /* Dissable HW ARPs on ASF enabled adapters */ + /* After MAC reset, force reload of EEPROM to restore power-on settings to + * device. Later controllers reload the EEPROM automatically, so just wait + * for reload to complete. + */ + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + case e1000_82544: + /* Wait for reset to complete */ + udelay(10); + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_EE_RST; + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); + /* Wait for EEPROM reload */ + msec_delay(2); + break; + case e1000_82541: + case e1000_82541_rev_2: + case e1000_82547: + case e1000_82547_rev_2: + /* Wait for EEPROM reload */ + msec_delay(20); + break; + default: + /* Wait for EEPROM reload (it happens automatically) */ + msec_delay(5); + break; + } + + /* Disable HW ARPs on ASF enabled adapters */ + if(hw->mac_type >= e1000_82540) { manc = E1000_READ_REG(hw, MANC); manc &= ~(E1000_MANC_ARP_EN); E1000_WRITE_REG(hw, MANC, manc); @@ -350,6 +387,8 @@ e1000_reset_hw(struct e1000_hw *hw) if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) e1000_pci_set_mwi(hw); } + + return E1000_SUCCESS; } /****************************************************************************** @@ -446,21 +485,30 @@ e1000_init_hw(struct e1000_hw *hw) E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); } - /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ - if(hw->bus_type == e1000_bus_type_pcix) { - e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); - e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); - cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >> - PCIX_COMMAND_MMRBC_SHIFT; - stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> - PCIX_STATUS_HI_MMRBC_SHIFT; - if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) - stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; - if(cmd_mmrbc > stat_mmrbc) { - pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; - pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; - e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); + switch(hw->mac_type) { + case e1000_82545_rev_3: + case e1000_82546_rev_3: + break; + default: + /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ + if(hw->bus_type == e1000_bus_type_pcix) { + e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); + e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, + &pcix_stat_hi_word); + cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >> + PCIX_COMMAND_MMRBC_SHIFT; + stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> + PCIX_STATUS_HI_MMRBC_SHIFT; + if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) + stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; + if(cmd_mmrbc > stat_mmrbc) { + pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; + pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; + e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, + &pcix_cmd_word); + } } + break; } /* Call a subroutine to configure the link and setup flow control. */ @@ -484,6 +532,46 @@ e1000_init_hw(struct e1000_hw *hw) } /****************************************************************************** + * Adjust SERDES output amplitude based on EEPROM setting. + * + * hw - Struct containing variables accessed by shared code. + *****************************************************************************/ +static int32_t +e1000_adjust_serdes_amplitude(struct e1000_hw *hw) +{ + uint16_t eeprom_data; + int32_t ret_val; + + DEBUGFUNC("e1000_adjust_serdes_amplitude"); + + if(hw->media_type != e1000_media_type_internal_serdes) + return E1000_SUCCESS; + + switch(hw->mac_type) { + case e1000_82545_rev_3: + case e1000_82546_rev_3: + break; + default: + return E1000_SUCCESS; + } + + if ((ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, + &eeprom_data))) { + return ret_val; + } + + if(eeprom_data != EEPROM_RESERVED_WORD) { + /* Adjust SERDES output amplitude only. */ + eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, + eeprom_data))) + return ret_val; + } + + return E1000_SUCCESS; +} + +/****************************************************************************** * Configures flow control and link settings. * * hw - Struct containing variables accessed by shared code @@ -554,9 +642,9 @@ e1000_setup_link(struct e1000_hw *hw) } /* Call the necessary subroutine to configure the link. */ - ret_val = (hw->media_type == e1000_media_type_fiber) ? - e1000_setup_fiber_link(hw) : - e1000_setup_copper_link(hw); + ret_val = (hw->media_type == e1000_media_type_copper) ? + e1000_setup_copper_link(hw) : + e1000_setup_fiber_serdes_link(hw); /* Initialize the flow control address, type, and PAUSE timer * registers to their default values. This is done even if flow @@ -595,7 +683,7 @@ e1000_setup_link(struct e1000_hw *hw) } /****************************************************************************** - * Sets up link for a fiber based adapter + * Sets up link for a fiber based or serdes based adapter * * hw - Struct containing variables accessed by shared code * @@ -604,28 +692,37 @@ e1000_setup_link(struct e1000_hw *hw) * and receiver are not enabled. *****************************************************************************/ static int32_t -e1000_setup_fiber_link(struct e1000_hw *hw) +e1000_setup_fiber_serdes_link(struct e1000_hw *hw) { uint32_t ctrl; uint32_t status; uint32_t txcw = 0; uint32_t i; - uint32_t signal; + uint32_t signal = 0; int32_t ret_val; - DEBUGFUNC("e1000_setup_fiber_link"); + DEBUGFUNC("e1000_setup_fiber_serdes_link"); - /* On adapters with a MAC newer that 82544, SW Defineable pin 1 will be + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be * set when the optics detect a signal. On older adapters, it will be - * cleared when there is a signal + * cleared when there is a signal. This applies to fiber media only. + * If we're on serdes media, adjust the output amplitude to value set in + * the EEPROM. */ ctrl = E1000_READ_REG(hw, CTRL); - if(hw->mac_type > e1000_82544) signal = E1000_CTRL_SWDPIN1; - else signal = 0; + if(hw->media_type == e1000_media_type_fiber) + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; + + if((ret_val = e1000_adjust_serdes_amplitude(hw))) + return ret_val; /* Take the link out of reset */ ctrl &= ~(E1000_CTRL_LRST); + /* Adjust VCO speed to improve BER performance */ + if((ret_val = e1000_set_vco_speed(hw))) + return ret_val; + e1000_config_collision_dist(hw); /* Check for a software override of the flow control settings, and setup @@ -692,8 +789,10 @@ e1000_setup_fiber_link(struct e1000_hw * * indication in the Device Status Register. Time-out if a link isn't * seen in 500 milliseconds seconds (Auto-negotiation should complete in * less than 500 milliseconds even if the other end is doing it in SW). + * For internal serdes, we just assume a signal is present, then poll. */ - if((E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { + if(hw->media_type == e1000_media_type_internal_serdes || + (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { DEBUGOUT("Looking for Link\n"); for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { msec_delay(10); @@ -701,19 +800,20 @@ e1000_setup_fiber_link(struct e1000_hw * if(status & E1000_STATUS_LU) break; } if(i == (LINK_UP_TIMEOUT / 10)) { - /* AutoNeg failed to achieve a link, so we'll call - * e1000_check_for_link. This routine will force the link up if we - * detect a signal. This will allow us to communicate with - * non-autonegotiating link partners. - */ DEBUGOUT("Never got a valid link from auto-neg!!!\n"); hw->autoneg_failed = 1; - ret_val = e1000_check_for_link(hw); - if(ret_val < 0) { - DEBUGOUT("Error while checking for link\n"); - return ret_val; + if(hw->media_type == e1000_media_type_fiber) { + /* AutoNeg failed to achieve a link, so we'll call + * e1000_check_for_link. This routine will force the link up if + * we detect a signal. This will allow us to communicate with + * non-autonegotiating link partners. + */ + if((ret_val = e1000_check_for_link(hw))) { + DEBUGOUT("Error while checking for link\n"); + return ret_val; + } + hw->autoneg_failed = 0; } - hw->autoneg_failed = 0; } else { hw->autoneg_failed = 0; DEBUGOUT("Valid Link Found\n"); @@ -721,7 +821,7 @@ e1000_setup_fiber_link(struct e1000_hw * } else { DEBUGOUT("No Signal Detected\n"); } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -756,233 +856,281 @@ e1000_setup_copper_link(struct e1000_hw } /* Make sure we have a valid PHY */ - ret_val = e1000_detect_gig_phy(hw); - if(ret_val < 0) { + if((ret_val = e1000_detect_gig_phy(hw))) { DEBUGOUT("Error, did not detect valid phy.\n"); return ret_val; } DEBUGOUT1("Phy ID = %x \n", hw->phy_id); - if (hw->phy_type == e1000_phy_igp) { - - ret_val = e1000_phy_reset(hw); - if(ret_val < 0) { - DEBUGOUT("Error Resetting the PHY\n"); - return ret_val; - } + if(hw->mac_type <= e1000_82543 || + hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || + hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) + hw->phy_reset_disable = FALSE; - /* Wait 10ms for MAC to configure PHY from eeprom settings */ - msec_delay(15); + if(!hw->phy_reset_disable) { + if (hw->phy_type == e1000_phy_igp) { - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0000) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_phy_reset(hw))) { + DEBUGOUT("Error Resetting the PHY\n"); + return ret_val; + } - /* Configure activity LED after PHY reset */ - led_ctrl = E1000_READ_REG(hw, LEDCTL); - led_ctrl &= IGP_ACTIVITY_LED_MASK; - led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); - E1000_WRITE_REG(hw, LEDCTL, led_ctrl); + /* Wait 10ms for MAC to configure PHY from eeprom settings */ + msec_delay(15); - if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { - /* Disable SmartSpeed */ - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } - /* Set auto Master/Slave resolution process */ - if(e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; + /* Configure activity LED after PHY reset */ + led_ctrl = E1000_READ_REG(hw, LEDCTL); + led_ctrl &= IGP_ACTIVITY_LED_MASK; + led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); + E1000_WRITE_REG(hw, LEDCTL, led_ctrl); + + /* disable lplu d3 during driver init */ + if((ret_val = e1000_set_d3_lplu_state(hw, FALSE))) { + DEBUGOUT("Error Disabling LPLU D3\n"); + return ret_val; } - phy_data &= ~CR_1000T_MS_ENABLE; - if(e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; + + /* Configure mdi-mdix settings */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + &phy_data))) + return ret_val; + + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { + hw->dsp_config_state = e1000_dsp_config_disabled; + /* Force MDI for IGP B-0 PHY */ + phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | + IGP01E1000_PSCR_FORCE_MDI_MDIX); + hw->mdix = 1; + + } else { + hw->dsp_config_state = e1000_dsp_config_enabled; + phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; + + switch (hw->mdix) { + case 1: + phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; + break; + case 2: + phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; + break; + case 0: + default: + phy_data |= IGP01E1000_PSCR_AUTO_MDIX; + break; + } } - } + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + phy_data))) + return ret_val; - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + /* set auto-master slave resolution settings */ + if(hw->autoneg) { + e1000_ms_type phy_ms_setting = hw->master_slave; + + if(hw->ffe_config_state == e1000_ffe_config_active) + hw->ffe_config_state = e1000_ffe_config_enabled; + + if(hw->dsp_config_state == e1000_dsp_config_activated) + hw->dsp_config_state = e1000_dsp_config_enabled; + + /* when autonegotiation advertisment is only 1000Mbps then we + * should disable SmartSpeed and enable Auto MasterSlave + * resolution as hardware default. */ + if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { + /* Disable SmartSpeed */ + if((ret_val = e1000_read_phy_reg(hw, + IGP01E1000_PHY_PORT_CONFIG, + &phy_data))) + return ret_val; + phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; + if((ret_val = e1000_write_phy_reg(hw, + IGP01E1000_PHY_PORT_CONFIG, + phy_data))) + return ret_val; + /* Set auto Master/Slave resolution process */ + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, + &phy_data))) + return ret_val; + phy_data &= ~CR_1000T_MS_ENABLE; + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, + phy_data))) + return ret_val; + } - /* Force MDI for IGP PHY */ - phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | - IGP01E1000_PSCR_FORCE_MDI_MDIX); + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, + &phy_data))) + return ret_val; - hw->mdix = 1; + /* load defaults for future use */ + hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? + ((phy_data & CR_1000T_MS_VALUE) ? + e1000_ms_force_master : + e1000_ms_force_slave) : + e1000_ms_auto; + + switch (phy_ms_setting) { + case e1000_ms_force_master: + phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); + break; + case e1000_ms_force_slave: + phy_data |= CR_1000T_MS_ENABLE; + phy_data &= ~(CR_1000T_MS_VALUE); + break; + case e1000_ms_auto: + phy_data &= ~CR_1000T_MS_ENABLE; + default: + break; + } + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, + phy_data))) + return ret_val; + } + } else { + /* Enable CRS on TX. This must be set for half-duplex operation. */ + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; - } else { - /* Enable CRS on TX. This must be set for half-duplex operation. */ - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; + /* Options: + * MDI/MDI-X = 0 (default) + * 0 - Auto for all speeds + * 1 - MDI mode + * 2 - MDI-X mode + * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) + */ + phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; - /* Options: - * MDI/MDI-X = 0 (default) - * 0 - Auto for all speeds - * 1 - MDI mode - * 2 - MDI-X mode - * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) - */ - phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; + switch (hw->mdix) { + case 1: + phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; + break; + case 2: + phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; + break; + case 3: + phy_data |= M88E1000_PSCR_AUTO_X_1000T; + break; + case 0: + default: + phy_data |= M88E1000_PSCR_AUTO_X_MODE; + break; + } - switch (hw->mdix) { - case 1: - phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; - break; - case 2: - phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; - break; - case 3: - phy_data |= M88E1000_PSCR_AUTO_X_1000T; - break; - case 0: - default: - phy_data |= M88E1000_PSCR_AUTO_X_MODE; - break; - } + /* Options: + * disable_polarity_correction = 0 (default) + * Automatic Correction for Reversed Cable Polarity + * 0 - Disabled + * 1 - Enabled + */ + phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; + if(hw->disable_polarity_correction == 1) + phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + phy_data))) + return ret_val; - /* Options: - * disable_polarity_correction = 0 (default) - * Automatic Correction for Reversed Cable Polarity - * 0 - Disabled - * 1 - Enabled - */ - phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; - if(hw->disable_polarity_correction == 1) - phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; - if(e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + /* Force TX_CLK in the Extended PHY Specific Control Register + * to 25MHz clock. + */ + if((ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; - /* Force TX_CLK in the Extended PHY Specific Control Register - * to 25MHz clock. - */ - if(e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - phy_data |= M88E1000_EPSCR_TX_CLK_25; + phy_data |= M88E1000_EPSCR_TX_CLK_25; - if (hw->phy_revision < M88E1011_I_REV_4) { - /* Configure Master and Slave downshift values */ - phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); - phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); - if(e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; + if (hw->phy_revision < M88E1011_I_REV_4) { + /* Configure Master and Slave downshift values */ + phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | + M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); + phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | + M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); + if((ret_val = e1000_write_phy_reg(hw, + M88E1000_EXT_PHY_SPEC_CTRL, + phy_data))) + return ret_val; } - } - /* SW Reset the PHY so all changes take effect */ - ret_val = e1000_phy_reset(hw); - if(ret_val < 0) { - DEBUGOUT("Error Resetting the PHY\n"); - return ret_val; + /* SW Reset the PHY so all changes take effect */ + if((ret_val = e1000_phy_reset(hw))) { + DEBUGOUT("Error Resetting the PHY\n"); + return ret_val; + } } - } - /* Options: - * autoneg = 1 (default) - * PHY will advertise value(s) parsed from - * autoneg_advertised and fc - * autoneg = 0 - * PHY will be set to 10H, 10F, 100H, or 100F - * depending on value parsed from forced_speed_duplex. - */ + /* Options: + * autoneg = 1 (default) + * PHY will advertise value(s) parsed from + * autoneg_advertised and fc + * autoneg = 0 + * PHY will be set to 10H, 10F, 100H, or 100F + * depending on value parsed from forced_speed_duplex. + */ + + /* Is autoneg enabled? This is enabled by default or by software + * override. If so, call e1000_phy_setup_autoneg routine to parse the + * autoneg_advertised and fc options. If autoneg is NOT enabled, then + * the user should have provided a speed/duplex override. If so, then + * call e1000_phy_force_speed_duplex to parse and set this up. + */ + if(hw->autoneg) { + /* Perform some bounds checking on the hw->autoneg_advertised + * parameter. If this variable is zero, then set it to the default. + */ + hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; - /* Is autoneg enabled? This is enabled by default or by software override. - * If so, call e1000_phy_setup_autoneg routine to parse the - * autoneg_advertised and fc options. If autoneg is NOT enabled, then the - * user should have provided a speed/duplex override. If so, then call - * e1000_phy_force_speed_duplex to parse and set this up. - */ - if(hw->autoneg) { - /* Perform some bounds checking on the hw->autoneg_advertised - * parameter. If this variable is zero, then set it to the default. - */ - hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; + /* If autoneg_advertised is zero, we assume it was not defaulted + * by the calling code so we set to advertise full capability. + */ + if(hw->autoneg_advertised == 0) + hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; - /* If autoneg_advertised is zero, we assume it was not defaulted - * by the calling code so we set to advertise full capability. - */ - if(hw->autoneg_advertised == 0) - hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; + DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); + if((ret_val = e1000_phy_setup_autoneg(hw))) { + DEBUGOUT("Error Setting up Auto-Negotiation\n"); + return ret_val; + } + DEBUGOUT("Restarting Auto-Neg\n"); - DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); - ret_val = e1000_phy_setup_autoneg(hw); - if(ret_val < 0) { - DEBUGOUT("Error Setting up Auto-Negotiation\n"); - return ret_val; - } - DEBUGOUT("Restarting Auto-Neg\n"); + /* Restart auto-negotiation by setting the Auto Neg Enable bit and + * the Auto Neg Restart bit in the PHY control register. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) + return ret_val; - /* Restart auto-negotiation by setting the Auto Neg Enable bit and - * the Auto Neg Restart bit in the PHY control register. - */ - if(e1000_read_phy_reg(hw, PHY_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); - if(e1000_write_phy_reg(hw, PHY_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) + return ret_val; - /* Does the user want to wait for Auto-Neg to complete here, or - * check at a later time (for example, callback routine). - */ - if(hw->wait_autoneg_complete) { - ret_val = e1000_wait_autoneg(hw); - if(ret_val < 0) { - DEBUGOUT("Error while waiting for autoneg to complete\n"); + /* Does the user want to wait for Auto-Neg to complete here, or + * check at a later time (for example, callback routine). + */ + if(hw->wait_autoneg_complete) { + if((ret_val = e1000_wait_autoneg(hw))) { + DEBUGOUT("Error while waiting for autoneg to complete\n"); + return ret_val; + } + } + hw->get_link_status = TRUE; + } else { + DEBUGOUT("Forcing speed and duplex\n"); + if((ret_val = e1000_phy_force_speed_duplex(hw))) { + DEBUGOUT("Error Forcing Speed and Duplex\n"); return ret_val; } } - hw->get_link_status = TRUE; - } else { - DEBUGOUT("Forcing speed and duplex\n"); - ret_val = e1000_phy_force_speed_duplex(hw); - if(ret_val < 0) { - DEBUGOUT("Error Forcing Speed and Duplex\n"); - return ret_val; - } - } + } /* !hw->phy_reset_disable */ /* Check link status. Wait up to 100 microseconds for link to become * valid. */ for(i = 0; i < 10; i++) { - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if(phy_data & MII_SR_LINK_STATUS) { /* We have link, so we need to finish the config process: * 1) Set up the MAC to the current PHY speed/duplex @@ -1007,13 +1177,21 @@ e1000_setup_copper_link(struct e1000_hw return ret_val; } DEBUGOUT("Valid link established!!!\n"); - return 0; + + if(hw->phy_type == e1000_phy_igp) { + if((ret_val = e1000_config_dsp_after_link_change(hw, TRUE))) { + DEBUGOUT("Error Configuring DSP after link up\n"); + return ret_val; + } + } + DEBUGOUT("Valid link established!!!\n"); + return E1000_SUCCESS; } udelay(10); } DEBUGOUT("Unable to establish link!!!\n"); - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -1557,6 +1728,7 @@ e1000_config_fc_after_link_up(struct e10 * configuration of the MAC to match the "fc" parameter. */ if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || + ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed)) || ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { ret_val = e1000_force_mac_fc(hw); if(ret_val < 0) { @@ -1704,7 +1861,7 @@ e1000_config_fc_after_link_up(struct e10 hw->original_fc == e1000_fc_tx_pause) { hw->fc = e1000_fc_none; DEBUGOUT("Flow Control = NONE.\r\n"); - } else { + } else if(!hw->fc_strict_ieee) { hw->fc = e1000_fc_rx_pause; DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); } @@ -1747,19 +1904,19 @@ e1000_check_for_link(struct e1000_hw *hw uint32_t ctrl; uint32_t status; uint32_t rctl; - uint32_t signal; + uint32_t signal = 0; int32_t ret_val; uint16_t phy_data; uint16_t lp_capability; DEBUGFUNC("e1000_check_for_link"); - /* On adapters with a MAC newer that 82544, SW Defineable pin 1 will be + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be * set when the optics detect a signal. On older adapters, it will be - * cleared when there is a signal + * cleared when there is a signal. This applies to fiber media only. */ - if(hw->mac_type > e1000_82544) signal = E1000_CTRL_SWDPIN1; - else signal = 0; + if(hw->media_type == e1000_media_type_fiber) + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; ctrl = E1000_READ_REG(hw, CTRL); status = E1000_READ_REG(hw, STATUS); @@ -1794,6 +1951,7 @@ e1000_check_for_link(struct e1000_hw *hw } else { /* No link detected */ + e1000_config_dsp_after_link_change(hw, FALSE); return 0; } @@ -1802,6 +1960,9 @@ e1000_check_for_link(struct e1000_hw *hw */ if(!hw->autoneg) return -E1000_ERR_CONFIG; + /* optimize the dsp settings for the igp phy */ + e1000_config_dsp_after_link_change(hw, TRUE); + /* We have a M88E1000 PHY and Auto-Neg is enabled. If we * have Si on board that is 82544 or newer, Auto * Speed Detection takes care of MAC speed/duplex @@ -1928,12 +2089,14 @@ e1000_check_for_link(struct e1000_hw *hw * speed - Speed of the connection * duplex - Duplex setting of the connection *****************************************************************************/ -void +int32_t e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t *speed, uint16_t *duplex) { uint32_t status; + int32_t ret_val; + uint16_t phy_data; DEBUGFUNC("e1000_get_speed_and_duplex"); @@ -1962,6 +2125,27 @@ e1000_get_speed_and_duplex(struct e1000_ *speed = SPEED_1000; *duplex = FULL_DUPLEX; } + + /* IGP01 PHY may advertise full duplex operation after speed downgrade even + * if it is operating at half duplex. Here we set the duplex settings to + * match the duplex in the link partner's capabilities. + */ + if(hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data))) + return ret_val; + + if(!(phy_data & NWAY_ER_LP_NWAY_CAPS)) + *duplex = HALF_DUPLEX; + else { + if((ret_val == e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data))) + return ret_val; + if((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) || + (*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS))) + *duplex = HALF_DUPLEX; + } + } + + return E1000_SUCCESS; } /****************************************************************************** @@ -2010,11 +2194,11 @@ e1000_raise_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl) { /* Raise the clock input to the Management Data Clock (by setting the MDC - * bit), and then delay 2 microseconds. + * bit), and then delay 10 microseconds. */ E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); E1000_WRITE_FLUSH(hw); - udelay(2); + udelay(10); } /****************************************************************************** @@ -2028,11 +2212,11 @@ e1000_lower_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl) { /* Lower the clock input to the Management Data Clock (by clearing the MDC - * bit), and then delay 2 microseconds. + * bit), and then delay 10 microseconds. */ E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); E1000_WRITE_FLUSH(hw); - udelay(2); + udelay(10); } /****************************************************************************** @@ -2076,7 +2260,7 @@ e1000_shift_out_mdi_bits(struct e1000_hw E1000_WRITE_REG(hw, CTRL, ctrl); E1000_WRITE_FLUSH(hw); - udelay(2); + udelay(10); e1000_raise_mdi_clk(hw, &ctrl); e1000_lower_mdi_clk(hw, &ctrl); @@ -2138,8 +2322,8 @@ e1000_shift_in_mdi_bits(struct e1000_hw } /***************************************************************************** -* Reads the value from a PHY register -* +* Reads the value from a PHY register, if the value is on a specific non zero +* page, sets the page first. * hw - Struct containing variables accessed by shared code * reg_addr - address of the PHY register to read ******************************************************************************/ @@ -2148,11 +2332,33 @@ e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data) { + uint32_t ret_val; + + DEBUGFUNC("e1000_read_phy_reg"); + + if(hw->phy_type == e1000_phy_igp && + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, + (uint16_t)reg_addr))) + return ret_val; + } + + ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, + phy_data); + + return ret_val; +} + +int32_t +e1000_read_phy_reg_ex(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t *phy_data) +{ uint32_t i; uint32_t mdic = 0; const uint32_t phy_addr = 1; - DEBUGFUNC("e1000_read_phy_reg"); + DEBUGFUNC("e1000_read_phy_reg_ex"); if(reg_addr > MAX_PHY_REG_ADDRESS) { DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); @@ -2172,7 +2378,7 @@ e1000_read_phy_reg(struct e1000_hw *hw, /* Poll the ready bit to see if the MDI read completed */ for(i = 0; i < 64; i++) { - udelay(10); + udelay(50); mdic = E1000_READ_REG(hw, MDIC); if(mdic & E1000_MDIC_READY) break; } @@ -2214,7 +2420,7 @@ e1000_read_phy_reg(struct e1000_hw *hw, */ *phy_data = e1000_shift_in_mdi_bits(hw); } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -2229,11 +2435,33 @@ e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data) { + uint32_t ret_val; + + DEBUGFUNC("e1000_write_phy_reg"); + + if(hw->phy_type == e1000_phy_igp && + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, + (uint16_t)reg_addr))) + return ret_val; + } + + ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, + phy_data); + + return ret_val; +} + +int32_t +e1000_write_phy_reg_ex(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t phy_data) +{ uint32_t i; uint32_t mdic = 0; const uint32_t phy_addr = 1; - DEBUGFUNC("e1000_write_phy_reg"); + DEBUGFUNC("e1000_write_phy_reg_ex"); if(reg_addr > MAX_PHY_REG_ADDRESS) { DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); @@ -2254,7 +2482,7 @@ e1000_write_phy_reg(struct e1000_hw *hw, /* Poll the ready bit to see if the MDI read completed */ for(i = 0; i < 64; i++) { - udelay(10); + udelay(50); mdic = E1000_READ_REG(hw, MDIC); if(mdic & E1000_MDIC_READY) break; } @@ -2284,7 +2512,7 @@ e1000_write_phy_reg(struct e1000_hw *hw, e1000_shift_out_mdi_bits(hw, mdic, 32); } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -2329,11 +2553,6 @@ e1000_phy_hw_reset(struct e1000_hw *hw) udelay(150); if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0000) < 0) { - DEBUGOUT("PHY Write Error\n"); - return; - } - /* Configure activity LED after PHY reset */ led_ctrl = E1000_READ_REG(hw, LEDCTL); led_ctrl &= IGP_ACTIVITY_LED_MASK; @@ -2352,24 +2575,26 @@ e1000_phy_hw_reset(struct e1000_hw *hw) int32_t e1000_phy_reset(struct e1000_hw *hw) { + int32_t ret_val; uint16_t phy_data; DEBUGFUNC("e1000_phy_reset"); - if(e1000_read_phy_reg(hw, PHY_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - phy_data |= MII_CR_RESET; - if(e1000_write_phy_reg(hw, PHY_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } - udelay(1); - if (hw->phy_type == e1000_phy_igp) { + if(hw->mac_type != e1000_82541_rev_2) { + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) + return ret_val; + + phy_data |= MII_CR_RESET; + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) + return ret_val; + + udelay(1); + } else e1000_phy_hw_reset(hw); + + if(hw->phy_type == e1000_phy_igp) e1000_phy_init_script(hw); - } - return 0; + + return E1000_SUCCESS; } /****************************************************************************** @@ -2409,11 +2634,15 @@ e1000_detect_gig_phy(struct e1000_hw *hw break; case e1000_82540: case e1000_82545: + case e1000_82545_rev_3: case e1000_82546: + case e1000_82546_rev_3: if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; break; case e1000_82541: + case e1000_82541_rev_2: case e1000_82547: + case e1000_82547_rev_2: if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; break; default: @@ -2438,17 +2667,16 @@ e1000_detect_gig_phy(struct e1000_hw *hw static int32_t e1000_phy_reset_dsp(struct e1000_hw *hw) { - int32_t ret_val = -E1000_ERR_PHY; + int32_t ret_val; DEBUGFUNC("e1000_phy_reset_dsp"); do { - if(e1000_write_phy_reg(hw, 29, 0x001d) < 0) break; - if(e1000_write_phy_reg(hw, 30, 0x00c1) < 0) break; - if(e1000_write_phy_reg(hw, 30, 0x0000) < 0) break; - ret_val = 0; + if((ret_val = e1000_write_phy_reg(hw, 29, 0x001d))) break; + if((ret_val = e1000_write_phy_reg(hw, 30, 0x00c1))) break; + if((ret_val = e1000_write_phy_reg(hw, 30, 0x0000))) break; + ret_val = E1000_SUCCESS; } while(0); - if(ret_val < 0) DEBUGOUT("PHY Write Error\n"); return ret_val; } @@ -2459,8 +2687,10 @@ e1000_phy_reset_dsp(struct e1000_hw *hw) * phy_info - PHY information structure ******************************************************************************/ int32_t -e1000_phy_igp_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) +e1000_phy_igp_get_info(struct e1000_hw *hw, + struct e1000_phy_info *phy_info) { + int32_t ret_val; uint16_t phy_data, polarity, min_length, max_length, average; DEBUGFUNC("e1000_phy_igp_get_info"); @@ -2668,7 +2898,9 @@ e1000_init_eeprom_params(struct e1000_hw break; case e1000_82540: case e1000_82545: + case e1000_82545_rev_3: case e1000_82546: + case e1000_82546_rev_3: eeprom->type = e1000_eeprom_microwire; eeprom->opcode_bits = 3; eeprom->delay_usec = 50; @@ -2681,8 +2913,9 @@ e1000_init_eeprom_params(struct e1000_hw } break; case e1000_82541: + case e1000_82541_rev_2: case e1000_82547: - default: + case e1000_82547_rev_2: if (eecd & E1000_EECD_TYPE) { eeprom->type = e1000_eeprom_spi; eeprom->opcode_bits = 8; @@ -2707,6 +2940,18 @@ e1000_init_eeprom_params(struct e1000_hw } } break; + default: + eeprom->type = e1000_eeprom_spi; + eeprom->opcode_bits = 8; + eeprom->delay_usec = 1; + if (eecd & E1000_EECD_ADDR_BITS) { + eeprom->page_size = 32; + eeprom->address_bits = 16; + } else { + eeprom->page_size = 8; + eeprom->address_bits = 8; + } + break; } if (eeprom->type == e1000_eeprom_spi) { @@ -2715,28 +2960,28 @@ e1000_init_eeprom_params(struct e1000_hw eeprom_size &= EEPROM_SIZE_MASK; switch (eeprom_size) { - case EEPROM_SIZE_16KB: - eeprom->word_size = 8192; - break; - case EEPROM_SIZE_8KB: - eeprom->word_size = 4096; - break; - case EEPROM_SIZE_4KB: - eeprom->word_size = 2048; - break; - case EEPROM_SIZE_2KB: - eeprom->word_size = 1024; - break; - case EEPROM_SIZE_1KB: - eeprom->word_size = 512; - break; - case EEPROM_SIZE_512B: - eeprom->word_size = 256; - break; - case EEPROM_SIZE_128B: - default: - eeprom->word_size = 64; - break; + case EEPROM_SIZE_16KB: + eeprom->word_size = 8192; + break; + case EEPROM_SIZE_8KB: + eeprom->word_size = 4096; + break; + case EEPROM_SIZE_4KB: + eeprom->word_size = 2048; + break; + case EEPROM_SIZE_2KB: + eeprom->word_size = 1024; + break; + case EEPROM_SIZE_1KB: + eeprom->word_size = 512; + break; + case EEPROM_SIZE_512B: + eeprom->word_size = 256; + break; + case EEPROM_SIZE_128B: + default: + eeprom->word_size = 64; + break; } } } @@ -3101,13 +3346,17 @@ e1000_read_eeprom(struct e1000_hw *hw, } /* Prepare the EEPROM for reading */ - if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) + if(e1000_acquire_eeprom(hw) != E1000_SUCCESS) return -E1000_ERR_EEPROM; if(eeprom->type == e1000_eeprom_spi) { + uint16_t word_in; uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; - if(e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM; + if(e1000_spi_eeprom_ready(hw)) { + e1000_release_eeprom(hw); + return -E1000_ERR_EEPROM; + } e1000_standby_eeprom(hw); @@ -3118,30 +3367,35 @@ e1000_read_eeprom(struct e1000_hw *hw, /* Send the READ command (opcode + addr) */ e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), eeprom->address_bits); - } - else if(eeprom->type == e1000_eeprom_microwire) { - /* Send the READ command (opcode + addr) */ - e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, - eeprom->opcode_bits); - e1000_shift_out_ee_bits(hw, offset, eeprom->address_bits); - } - /* Read the data. The address of the eeprom internally increments with - * each word (microwire) or byte (spi) being read, saving on the overhead - * of eeprom setup and tear-down. The address counter will roll over if - * reading beyond the size of the eeprom, thus allowing the entire memory - * to be read starting from any offset. */ - for (i = 0; i < words; i++) { - uint16_t word_in = e1000_shift_in_ee_bits(hw, 16); - if (eeprom->type == e1000_eeprom_spi) - word_in = (word_in >> 8) | (word_in << 8); - data[i] = word_in; + /* Read the data. The address of the eeprom internally increments with + * each byte (spi) being read, saving on the overhead of eeprom setup + * and tear-down. The address counter will roll over if reading beyond + * the size of the eeprom, thus allowing the entire memory to be read + * starting from any offset. */ + for (i = 0; i < words; i++) { + word_in = e1000_shift_in_ee_bits(hw, 16); + data[i] = (word_in >> 8) | (word_in << 8); + } + } else if(eeprom->type == e1000_eeprom_microwire) { + for (i = 0; i < words; i++) { + /* Send the READ command (opcode + addr) */ + e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, + eeprom->opcode_bits); + e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i), + eeprom->address_bits); + + /* Read the data. For microwire, each word requires the overhead + * of eeprom setup and tear-down. */ + data[i] = e1000_shift_in_ee_bits(hw, 16); + e1000_standby_eeprom(hw); + } } /* End this read operation */ e1000_release_eeprom(hw); - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -3463,7 +3717,7 @@ e1000_read_mac_addr(struct e1000_hw * hw hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); } - if((hw->mac_type == e1000_82546) && + if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { if(hw->perm_mac_addr[5] & 0x01) hw->perm_mac_addr[5] &= ~(0x01); @@ -3811,49 +4065,48 @@ int32_t e1000_setup_led(struct e1000_hw *hw) { uint32_t ledctl; + int32_t ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_setup_led"); - switch(hw->device_id) { - case E1000_DEV_ID_82542: - case E1000_DEV_ID_82543GC_FIBER: - case E1000_DEV_ID_82543GC_COPPER: - case E1000_DEV_ID_82544EI_COPPER: - case E1000_DEV_ID_82544EI_FIBER: - case E1000_DEV_ID_82544GC_COPPER: - case E1000_DEV_ID_82544GC_LOM: + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + case e1000_82544: /* No setup necessary */ break; - case E1000_DEV_ID_82545EM_FIBER: - case E1000_DEV_ID_82546EB_FIBER: - ledctl = E1000_READ_REG(hw, LEDCTL); - /* Save current LEDCTL settings */ - hw->ledctl_default = ledctl; - /* Turn off LED0 */ - ledctl &= ~(E1000_LEDCTL_LED0_IVRT | - E1000_LEDCTL_LED0_BLINK | - E1000_LEDCTL_LED0_MODE_MASK); - ledctl |= (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT); - E1000_WRITE_REG(hw, LEDCTL, ledctl); + case e1000_82541: + case e1000_82547: + case e1000_82541_rev_2: + case e1000_82547_rev_2: + /* Turn off PHY Smart Power Down (if enabled) */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, + &hw->phy_spd_default))) + return ret_val; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, + (uint16_t)(hw->phy_spd_default & + ~IGP01E1000_GMII_SPD)))) + return ret_val; + /* Fall Through */ + default: + if(hw->media_type == e1000_media_type_fiber) { + ledctl = E1000_READ_REG(hw, LEDCTL); + /* Save current LEDCTL settings */ + hw->ledctl_default = ledctl; + /* Turn off LED0 */ + ledctl &= ~(E1000_LEDCTL_LED0_IVRT | + E1000_LEDCTL_LED0_BLINK | + E1000_LEDCTL_LED0_MODE_MASK); + ledctl |= (E1000_LEDCTL_MODE_LED_OFF << + E1000_LEDCTL_LED0_MODE_SHIFT); + E1000_WRITE_REG(hw, LEDCTL, ledctl); + } else if(hw->media_type == e1000_media_type_copper) + E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); break; - case E1000_DEV_ID_82540EP: - case E1000_DEV_ID_82540EP_LOM: - case E1000_DEV_ID_82540EP_LP: - case E1000_DEV_ID_82540EM: - case E1000_DEV_ID_82540EM_LOM: - case E1000_DEV_ID_82545EM_COPPER: - case E1000_DEV_ID_82546EB_COPPER: - case E1000_DEV_ID_82546EB_QUAD_COPPER: - case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EP: - case E1000_DEV_ID_82547EI: - E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); - break; - default: - DEBUGOUT("Invalid device ID\n"); - return -E1000_ERR_CONFIG; } - return 0; + + return E1000_SUCCESS; } /****************************************************************************** @@ -3864,39 +4117,33 @@ e1000_setup_led(struct e1000_hw *hw) int32_t e1000_cleanup_led(struct e1000_hw *hw) { + int32_t ret_val = E1000_SUCCESS; + DEBUGFUNC("e1000_cleanup_led"); - switch(hw->device_id) { - case E1000_DEV_ID_82542: - case E1000_DEV_ID_82543GC_FIBER: - case E1000_DEV_ID_82543GC_COPPER: - case E1000_DEV_ID_82544EI_COPPER: - case E1000_DEV_ID_82544EI_FIBER: - case E1000_DEV_ID_82544GC_COPPER: - case E1000_DEV_ID_82544GC_LOM: + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + case e1000_82544: /* No cleanup necessary */ break; - case E1000_DEV_ID_82540EP: - case E1000_DEV_ID_82540EP_LOM: - case E1000_DEV_ID_82540EP_LP: - case E1000_DEV_ID_82540EM: - case E1000_DEV_ID_82540EM_LOM: - case E1000_DEV_ID_82545EM_COPPER: - case E1000_DEV_ID_82545EM_FIBER: - case E1000_DEV_ID_82546EB_COPPER: - case E1000_DEV_ID_82546EB_FIBER: - case E1000_DEV_ID_82546EB_QUAD_COPPER: - case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EP: - case E1000_DEV_ID_82547EI: + case e1000_82541: + case e1000_82547: + case e1000_82541_rev_2: + case e1000_82547_rev_2: + /* Turn on PHY Smart Power Down (if previously enabled) */ + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, + hw->phy_spd_default))) + return ret_val; + /* Fall Through */ + default: /* Restore LEDCTL settings */ E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default); break; - default: - DEBUGOUT("Invalid device ID\n"); - return -E1000_ERR_CONFIG; } - return 0; + + return E1000_SUCCESS; } /****************************************************************************** @@ -3907,50 +4154,44 @@ e1000_cleanup_led(struct e1000_hw *hw) int32_t e1000_led_on(struct e1000_hw *hw) { - uint32_t ctrl; + uint32_t ctrl = E1000_READ_REG(hw, CTRL); DEBUGFUNC("e1000_led_on"); - switch(hw->device_id) { - case E1000_DEV_ID_82542: - case E1000_DEV_ID_82543GC_FIBER: - case E1000_DEV_ID_82543GC_COPPER: - case E1000_DEV_ID_82544EI_FIBER: - ctrl = E1000_READ_REG(hw, CTRL); + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: /* Set SW Defineable Pin 0 to turn on the LED */ ctrl |= E1000_CTRL_SWDPIN0; ctrl |= E1000_CTRL_SWDPIO0; - E1000_WRITE_REG(hw, CTRL, ctrl); - break; - case E1000_DEV_ID_82544EI_COPPER: - case E1000_DEV_ID_82544GC_COPPER: - case E1000_DEV_ID_82544GC_LOM: - case E1000_DEV_ID_82545EM_FIBER: - case E1000_DEV_ID_82546EB_FIBER: - ctrl = E1000_READ_REG(hw, CTRL); - /* Clear SW Defineable Pin 0 to turn on the LED */ - ctrl &= ~E1000_CTRL_SWDPIN0; - ctrl |= E1000_CTRL_SWDPIO0; - E1000_WRITE_REG(hw, CTRL, ctrl); break; - case E1000_DEV_ID_82540EP: - case E1000_DEV_ID_82540EP_LOM: - case E1000_DEV_ID_82540EP_LP: - case E1000_DEV_ID_82540EM: - case E1000_DEV_ID_82540EM_LOM: - case E1000_DEV_ID_82545EM_COPPER: - case E1000_DEV_ID_82546EB_COPPER: - case E1000_DEV_ID_82546EB_QUAD_COPPER: - case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EP: - case E1000_DEV_ID_82547EI: - E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); + case e1000_82544: + if(hw->media_type == e1000_media_type_fiber) { + /* Set SW Defineable Pin 0 to turn on the LED */ + ctrl |= E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } else { + /* Clear SW Defineable Pin 0 to turn on the LED */ + ctrl &= ~E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } break; default: - DEBUGOUT("Invalid device ID\n"); - return -E1000_ERR_CONFIG; + if(hw->media_type == e1000_media_type_fiber) { + /* Clear SW Defineable Pin 0 to turn on the LED */ + ctrl &= ~E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } else if(hw->media_type == e1000_media_type_copper) { + E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); + return E1000_SUCCESS; + } + break; } - return 0; + + E1000_WRITE_REG(hw, CTRL, ctrl); + + return E1000_SUCCESS; } /****************************************************************************** @@ -3961,50 +4202,44 @@ e1000_led_on(struct e1000_hw *hw) int32_t e1000_led_off(struct e1000_hw *hw) { - uint32_t ctrl; + uint32_t ctrl = E1000_READ_REG(hw, CTRL); DEBUGFUNC("e1000_led_off"); - switch(hw->device_id) { - case E1000_DEV_ID_82542: - case E1000_DEV_ID_82543GC_FIBER: - case E1000_DEV_ID_82543GC_COPPER: - case E1000_DEV_ID_82544EI_FIBER: - ctrl = E1000_READ_REG(hw, CTRL); + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: /* Clear SW Defineable Pin 0 to turn off the LED */ ctrl &= ~E1000_CTRL_SWDPIN0; ctrl |= E1000_CTRL_SWDPIO0; - E1000_WRITE_REG(hw, CTRL, ctrl); - break; - case E1000_DEV_ID_82544EI_COPPER: - case E1000_DEV_ID_82544GC_COPPER: - case E1000_DEV_ID_82544GC_LOM: - case E1000_DEV_ID_82545EM_FIBER: - case E1000_DEV_ID_82546EB_FIBER: - ctrl = E1000_READ_REG(hw, CTRL); - /* Set SW Defineable Pin 0 to turn off the LED */ - ctrl |= E1000_CTRL_SWDPIN0; - ctrl |= E1000_CTRL_SWDPIO0; - E1000_WRITE_REG(hw, CTRL, ctrl); break; - case E1000_DEV_ID_82540EP: - case E1000_DEV_ID_82540EP_LOM: - case E1000_DEV_ID_82540EP_LP: - case E1000_DEV_ID_82540EM: - case E1000_DEV_ID_82540EM_LOM: - case E1000_DEV_ID_82545EM_COPPER: - case E1000_DEV_ID_82546EB_COPPER: - case E1000_DEV_ID_82546EB_QUAD_COPPER: - case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EP: - case E1000_DEV_ID_82547EI: - E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); + case e1000_82544: + if(hw->media_type == e1000_media_type_fiber) { + /* Clear SW Defineable Pin 0 to turn off the LED */ + ctrl &= ~E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } else { + /* Set SW Defineable Pin 0 to turn off the LED */ + ctrl |= E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } break; default: - DEBUGOUT("Invalid device ID\n"); - return -E1000_ERR_CONFIG; + if(hw->media_type == e1000_media_type_fiber) { + /* Set SW Defineable Pin 0 to turn off the LED */ + ctrl |= E1000_CTRL_SWDPIN0; + ctrl |= E1000_CTRL_SWDPIO0; + } else if(hw->media_type == e1000_media_type_copper) { + E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); + return E1000_SUCCESS; + } + break; } - return 0; + + E1000_WRITE_REG(hw, CTRL, ctrl); + + return E1000_SUCCESS; } /****************************************************************************** @@ -4324,7 +4559,8 @@ e1000_write_reg_io(struct e1000_hw *hw, * min_length - The estimated minimum length * max_length - The estimated maximum length * - * returns: E1000_SUCCESS / -E1000_ERR_XXX + * returns: - E1000_ERR_XXX + * E1000_SUCCESS * * This function always returns a ranged length (minimum & maximum). * So for M88 phy's, this function interprets the one value returned from the @@ -4439,7 +4675,8 @@ e1000_get_cable_length(struct e1000_hw * * polarity - output parameter : 0 - Polarity is not reversed * 1 - Polarity is reversed. * - * returns: E1000_SUCCESS / -E1000_ERR_XXX + * returns: - E1000_ERR_XXX + * E1000_SUCCESS * * For phy's older then IGP, this function simply reads the polarity bit in the * Phy Status register. For IGP phy's, this bit is valid only if link speed is @@ -4471,18 +4708,9 @@ e1000_check_polarity(struct e1000_hw *hw IGP01E1000_PSSR_SPEED_1000MBPS) { /* Read the GIG initialization PCS register (0x00B4) */ - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, - IGP01E1000_PHY_PCS_INIT_REG) < 0) - return -E1000_ERR_PHY; - - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG & - IGP01E1000_PHY_PAGE_SELECT, &phy_data) < 0) - return -E1000_ERR_PHY; - - /* Return to page 0 */ - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0) != - E1000_SUCCESS) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, + &phy_data))) + return ret_val; /* Check the polarity bits */ *polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? 1 : 0; @@ -4502,7 +4730,8 @@ e1000_check_polarity(struct e1000_hw *hw * downshift - output parameter : 0 - No Downshift ocured. * 1 - Downshift ocured. * - * returns: E1000_SUCCESS / -E1000_ERR_XXX + * returns: - E1000_ERR_XXX + * E1000_SUCCESS * * For phy's older then IGP, this function reads the Downshift bit in the Phy * Specific Status register. For IGP phy's, it reads the Downgrade bit in the @@ -4512,25 +4738,287 @@ e1000_check_polarity(struct e1000_hw *hw int32_t e1000_check_downshift(struct e1000_hw *hw) { + int32_t ret_val; uint16_t phy_data; DEBUGFUNC("e1000_check_downshift"); if(hw->phy_type == e1000_phy_igp) { - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, + &phy_data))) + return ret_val; + hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; } else if(hw->phy_type == e1000_phy_m88) { - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, + &phy_data))) + return ret_val; + hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> - M88E1000_PSSR_DOWNSHIFT_SHIFT; + M88E1000_PSSR_DOWNSHIFT_SHIFT; + } + return E1000_SUCCESS; +} + +/***************************************************************************** + * + * 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a + * gigabit link is achieved to improve link quality. + * + * hw: Struct containing variables accessed by shared code + * + * returns: - E1000_ERR_PHY if fail to read/write the PHY + * E1000_SUCCESS at any other case. + * + ****************************************************************************/ + +int32_t +e1000_config_dsp_after_link_change(struct e1000_hw *hw, + boolean_t link_up) +{ + int32_t ret_val; + uint16_t phy_data, speed, duplex, i; + uint16_t dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = + {IGP01E1000_PHY_AGC_PARAM_A, + IGP01E1000_PHY_AGC_PARAM_B, + IGP01E1000_PHY_AGC_PARAM_C, + IGP01E1000_PHY_AGC_PARAM_D}; + uint16_t min_length, max_length; + + DEBUGFUNC("e1000_config_dsp_after_link_change"); + + if(hw->phy_type != e1000_phy_igp) + return E1000_SUCCESS; + + if(link_up) { + if((ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex))) { + DEBUGOUT("Error getting link speed and duplex\n"); + return ret_val; + } + + if(speed == SPEED_1000) { + + e1000_get_cable_length(hw, &min_length, &max_length); + + if((hw->dsp_config_state == e1000_dsp_config_enabled) && + min_length >= e1000_igp_cable_length_50) { + + for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { + if((ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], + &phy_data))) + return ret_val; + + phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; + + if((ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], + phy_data))) + return ret_val; + } + hw->dsp_config_state = e1000_dsp_config_activated; + } + + if((hw->ffe_config_state == e1000_ffe_config_enabled) && + (min_length < e1000_igp_cable_length_50)) { + + uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; + uint32_t idle_errs = 0; + + /* clear previous idle error counts */ + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, + &phy_data))) + return ret_val; + + for(i = 0; i < ffe_idle_err_timeout; i++) { + udelay(1000); + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, + &phy_data))) + return ret_val; + + idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); + if(idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { + hw->ffe_config_state = e1000_ffe_config_active; + + if((ret_val = e1000_write_phy_reg(hw, + IGP01E1000_PHY_DSP_FFE, + IGP01E1000_PHY_DSP_FFE_CM_CP))) + return ret_val; + break; + } + + if(idle_errs) + ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100; + } + } + } + } else { + if(hw->dsp_config_state == e1000_dsp_config_activated) { + if((ret_val = e1000_write_phy_reg(hw, 0x0000, + IGP01E1000_IEEE_FORCE_GIGA))) + return ret_val; + for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { + if((ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], + &phy_data))) + return ret_val; + + phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; + phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; + + if((ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], + phy_data))) + return ret_val; + } + + if((ret_val = e1000_write_phy_reg(hw, 0x0000, + IGP01E1000_IEEE_RESTART_AUTONEG))) + return ret_val; + + hw->dsp_config_state = e1000_dsp_config_enabled; + } + + if(hw->ffe_config_state == e1000_ffe_config_active) { + if((ret_val = e1000_write_phy_reg(hw, 0x0000, + IGP01E1000_IEEE_FORCE_GIGA))) + return ret_val; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, + IGP01E1000_PHY_DSP_FFE_DEFAULT))) + return ret_val; + + if((ret_val = e1000_write_phy_reg(hw, 0x0000, + IGP01E1000_IEEE_RESTART_AUTONEG))) + return ret_val; + hw->ffe_config_state = e1000_ffe_config_enabled; + } + } + return E1000_SUCCESS; +} + +/***************************************************************************** + * + * This function sets the lplu state according to the active flag. When + * activating lplu this function also disables smart speed and vise versa. + * lplu will not be activated unless the device autonegotiation advertisment + * meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. + * hw: Struct containing variables accessed by shared code + * active - true to enable lplu false to disable lplu. + * + * returns: - E1000_ERR_PHY if fail to read/write the PHY + * E1000_SUCCESS at any other case. + * + ****************************************************************************/ + +int32_t +e1000_set_d3_lplu_state(struct e1000_hw *hw, + boolean_t active) +{ + int32_t ret_val; + uint16_t phy_data; + DEBUGFUNC("e1000_set_d3_lplu_state"); + + if(!((hw->mac_type == e1000_82541_rev_2) || + (hw->mac_type == e1000_82547_rev_2))) + return E1000_SUCCESS; + + /* During driver activity LPLU should not be used or it will attain link + * from the lowest speeds starting from 10Mbps. The capability is used for + * Dx transitions and states */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data))) + return ret_val; + + if(!active) { + phy_data &= ~IGP01E1000_GMII_FLEX_SPD; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data))) + return ret_val; + + /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during + * Dx states where the power conservation is most important. During + * driver activity we should enable SmartSpeed, so performance is + * maintained. */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, + &phy_data))) + return ret_val; + + phy_data |= IGP01E1000_PSCFR_SMART_SPEED; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, + phy_data))) + return ret_val; + + } else if((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || + (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) || + (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { + + phy_data |= IGP01E1000_GMII_FLEX_SPD; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data))) + return ret_val; + + /* When LPLU is enabled we should disable SmartSpeed */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, + &phy_data))) + return ret_val; + + phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, + phy_data))) + return ret_val; + } return E1000_SUCCESS; } +/****************************************************************************** + * Change VCO speed register to improve Bit Error Rate performance of SERDES. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static int32_t +e1000_set_vco_speed(struct e1000_hw *hw) +{ + int32_t ret_val; + uint16_t default_page = 0; + uint16_t phy_data; + + DEBUGFUNC("e1000_set_vco_speed"); + + switch(hw->mac_type) { + case e1000_82545_rev_3: + case e1000_82546_rev_3: + break; + default: + return E1000_SUCCESS; + } + + /* Set PHY register 30, page 5, bit 8 to 0 */ + + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, + &default_page))) + return ret_val; + + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005))) + return ret_val; + + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data))) + return ret_val; + + phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data))) + return ret_val; + + /* Set PHY register 30, page 4, bit 11 to 1 */ + + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004))) + return ret_val; + + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data))) + return ret_val; + + phy_data |= M88E1000_PHY_VCO_REG_BIT11; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data))) + return ret_val; + + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, + default_page))) + return ret_val; + + return E1000_SUCCESS; +} + diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h 2003-08-22 16:58:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h 2003-09-08 09:13:16.000000000 -0700 @@ -50,9 +50,13 @@ typedef enum { e1000_82544, e1000_82540, e1000_82545, + e1000_82545_rev_3, e1000_82546, + e1000_82546_rev_3, e1000_82541, + e1000_82541_rev_2, e1000_82547, + e1000_82547_rev_2, e1000_num_macs } e1000_mac_type; @@ -67,6 +71,7 @@ typedef enum { typedef enum { e1000_media_type_copper = 0, e1000_media_type_fiber = 1, + e1000_media_type_internal_serdes = 2, e1000_num_media_types } e1000_media_type; @@ -90,7 +95,8 @@ typedef enum { typedef enum { e1000_bus_type_unknown = 0, e1000_bus_type_pci, - e1000_bus_type_pcix + e1000_bus_type_pcix, + e1000_bus_type_reserved } e1000_bus_type; /* PCI bus speeds */ @@ -108,7 +114,8 @@ typedef enum { typedef enum { e1000_bus_width_unknown = 0, e1000_bus_width_32, - e1000_bus_width_64 + e1000_bus_width_64, + e1000_bus_width_reserved } e1000_bus_width; /* PHY status info structure and supporting enums */ @@ -186,6 +193,26 @@ typedef enum { e1000_phy_undefined = 0xFF } e1000_phy_type; +typedef enum { + e1000_ms_hw_default = 0, + e1000_ms_force_master, + e1000_ms_force_slave, + e1000_ms_auto +} e1000_ms_type; + +typedef enum { + e1000_ffe_config_enabled = 0, + e1000_ffe_config_active, + e1000_ffe_config_blocked +} e1000_ffe_config; + +typedef enum { + e1000_dsp_config_disabled = 0, + e1000_dsp_config_enabled, + e1000_dsp_config_activated, + e1000_dsp_config_undefined = 0xFF +} e1000_dsp_config; + struct e1000_phy_info { e1000_cable_length cable_length; e1000_10bt_ext_dist_enable extended_10bt_distance; @@ -224,9 +251,10 @@ struct e1000_eeprom_info { /* Function prototypes */ /* Initialization */ -void e1000_reset_hw(struct e1000_hw *hw); +int32_t e1000_reset_hw(struct e1000_hw *hw); int32_t e1000_init_hw(struct e1000_hw *hw); int32_t e1000_set_mac_type(struct e1000_hw *hw); +void e1000_set_media_type(struct e1000_hw *hw); /* Link Configuration */ int32_t e1000_setup_link(struct e1000_hw *hw); @@ -234,7 +262,7 @@ int32_t e1000_phy_setup_autoneg(struct e void e1000_config_collision_dist(struct e1000_hw *hw); int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw); int32_t e1000_check_for_link(struct e1000_hw *hw); -void e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex); +int32_t e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex); int32_t e1000_wait_autoneg(struct e1000_hw *hw); /* PHY */ @@ -292,6 +321,8 @@ uint32_t e1000_io_read(struct e1000_hw * uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset); void e1000_io_write(struct e1000_hw *hw, uint32_t port, uint32_t value); void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value); +int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw, boolean_t link_up); +int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active); #define E1000_READ_REG_IO(a, reg) \ e1000_read_reg_io((a), E1000_##reg) @@ -313,13 +343,22 @@ void e1000_write_reg_io(struct e1000_hw #define E1000_DEV_ID_82540EP_LP 0x101E #define E1000_DEV_ID_82545EM_COPPER 0x100F #define E1000_DEV_ID_82545EM_FIBER 0x1011 +#define E1000_DEV_ID_82545GM_COPPER 0x1026 +#define E1000_DEV_ID_82545GM_FIBER 0x1027 +#define E1000_DEV_ID_82545GM_SERDES 0x1028 #define E1000_DEV_ID_82546EB_COPPER 0x1010 #define E1000_DEV_ID_82546EB_FIBER 0x1012 #define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D #define E1000_DEV_ID_82541EI 0x1013 -#define E1000_DEV_ID_82541EP 0x1018 +#define E1000_DEV_ID_82541EI_MOBILE 0x1018 +#define E1000_DEV_ID_82541ER 0x1078 +#define E1000_DEV_ID_82547GI 0x1075 +#define E1000_DEV_ID_82541GI 0x1076 +#define E1000_DEV_ID_82541GI_MOBILE 0x1077 +#define E1000_DEV_ID_82546GB_COPPER 0x1079 +#define E1000_DEV_ID_82546GB_FIBER 0x107A +#define E1000_DEV_ID_82546GB_SERDES 0x107B #define E1000_DEV_ID_82547EI 0x1019 -#define NUM_DEV_IDS 20 #define NODE_ADDRESS_SIZE 6 #define ETH_LENGTH_OF_ADDRESS 6 @@ -599,6 +638,7 @@ struct e1000_ffvt_entry { * A - register array */ #define E1000_CTRL 0x00000 /* Device Control - RW */ +#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */ #define E1000_STATUS 0x00008 /* Device Status - RO */ #define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */ #define E1000_EERD 0x00014 /* EEPROM Read - RW */ @@ -934,6 +974,9 @@ struct e1000_hw { e1000_bus_width bus_width; e1000_bus_type bus_type; struct e1000_eeprom_info eeprom; + e1000_ms_type master_slave; + e1000_ms_type original_master_slave; + e1000_ffe_config ffe_config_state; uint32_t io_base; uint32_t phy_id; uint32_t phy_revision; @@ -950,6 +993,8 @@ struct e1000_hw { uint32_t ledctl_default; uint32_t ledctl_mode1; uint32_t ledctl_mode2; + uint16_t phy_spd_default; + uint16_t dsp_reset_counter; uint16_t autoneg_advertised; uint16_t pci_cmd_word; uint16_t fc_high_water; @@ -974,10 +1021,13 @@ struct e1000_hw { uint8_t perm_mac_addr[NODE_ADDRESS_SIZE]; boolean_t disable_polarity_correction; boolean_t speed_downgraded; + e1000_dsp_config dsp_config_state; boolean_t get_link_status; boolean_t tbi_compatibility_en; boolean_t tbi_compatibility_on; + boolean_t phy_reset_disable; boolean_t fc_send_xon; + boolean_t fc_strict_ieee; boolean_t report_tx_early; boolean_t adaptive_ifs; boolean_t ifs_params_forced; @@ -1426,15 +1474,17 @@ struct e1000_hw { #define EEPROM_SIZE_128B 0x0000 #define EEPROM_SIZE_MASK 0x1C00 - /* EEPROM Word Offsets */ -#define EEPROM_COMPAT 0x0003 -#define EEPROM_ID_LED_SETTINGS 0x0004 -#define EEPROM_INIT_CONTROL1_REG 0x000A -#define EEPROM_INIT_CONTROL2_REG 0x000F -#define EEPROM_CFG 0x0012 -#define EEPROM_FLASH_VERSION 0x0032 -#define EEPROM_CHECKSUM_REG 0x003F +#define EEPROM_COMPAT 0x0003 +#define EEPROM_ID_LED_SETTINGS 0x0004 +#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ +#define EEPROM_INIT_CONTROL1_REG 0x000A +#define EEPROM_INIT_CONTROL2_REG 0x000F +#define EEPROM_INIT_CONTROL3_PORT_B 0x0014 +#define EEPROM_INIT_CONTROL3_PORT_A 0x0024 +#define EEPROM_CFG 0x0012 +#define EEPROM_FLASH_VERSION 0x0032 +#define EEPROM_CHECKSUM_REG 0x003F /* Word definitions for ID LED Settings */ #define ID_LED_RESERVED_0000 0x0000 @@ -1458,6 +1508,9 @@ struct e1000_hw { #define IGP_LED3_MODE 0x07000000 +/* Mask bits for SERDES amplitude adjustment in Word 6 of the EEPROM */ +#define EEPROM_SERDES_AMPLITUDE_MASK 0x000F + /* Mask bits for fields in Word 0x0a of the EEPROM */ #define EEPROM_WORD0A_ILOS 0x0010 #define EEPROM_WORD0A_SWDPIO 0x01E0 @@ -1479,6 +1532,8 @@ struct e1000_hw { #define EEPROM_NODE_ADDRESS_BYTE_0 0 #define EEPROM_PBA_BYTE_1 8 +#define EEPROM_RESERVED_WORD 0xFFFF + /* EEPROM Map Sizes (Byte Counts) */ #define PBA_SIZE 4 @@ -1668,7 +1723,16 @@ struct e1000_hw { #define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */ #define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */ +#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */ +#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */ +#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */ +#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */ +#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */ + #define IGP01E1000_IEEE_REGS_PAGE 0x0000 +#define IGP01E1000_IEEE_RESTART_AUTONEG 0x3300 +#define IGP01E1000_IEEE_FORCE_GIGA 0x0140 + /* IGP01E1000 Specific Registers */ #define IGP01E1000_PHY_PORT_CONFIG 0x10 /* PHY Specific Port Config Register */ #define IGP01E1000_PHY_PORT_STATUS 0x11 /* PHY Specific Status Register */ @@ -1684,17 +1748,35 @@ struct e1000_hw { #define IGP01E1000_PHY_AGC_C 0x1472 #define IGP01E1000_PHY_AGC_D 0x1872 -/* Number of AGC registers */ -#define IGP01E1000_PHY_AGC_NUM 4 +/* IGP01E1000 DSP Reset Register */ +#define IGP01E1000_PHY_DSP_RESET 0x1F33 +#define IGP01E1000_PHY_DSP_SET 0x1F71 +#define IGP01E1000_PHY_DSP_FFE 0x1F35 + +#define IGP01E1000_PHY_CHANNEL_NUM 4 +#define IGP01E1000_PHY_AGC_PARAM_A 0x1171 +#define IGP01E1000_PHY_AGC_PARAM_B 0x1271 +#define IGP01E1000_PHY_AGC_PARAM_C 0x1471 +#define IGP01E1000_PHY_AGC_PARAM_D 0x1871 + +#define IGP01E1000_PHY_EDAC_MU_INDEX 0xC000 +#define IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS 0x8000 + +#define IGP01E1000_PHY_ANALOG_TX_STATE 0x2890 +#define IGP01E1000_PHY_ANALOG_CLASS_A 0x2000 +#define IGP01E1000_PHY_FORCE_ANALOG_ENABLE 0x0004 +#define IGP01E1000_PHY_DSP_FFE_CM_CP 0x0069 +#define IGP01E1000_PHY_DSP_FFE_DEFAULT 0x002A /* IGP01E1000 PCS Initialization register - stores the polarity status when * speed = 1000 Mbps. */ #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 +#define IGP01E1000_PHY_PCS_CTRL_REG 0x00B5 #define IGP01E1000_ANALOG_REGS_PAGE 0x20C0 #define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ - +#define MAX_PHY_MULTI_PAGE_REG 0xF /*Registers that are equal on all pages*/ /* PHY Control Register */ #define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ #define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ @@ -1808,8 +1890,11 @@ struct e1000_hw { #define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ #define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */ #define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ -#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12 -#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13 +#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12 +#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13 +#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 +#define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20 +#define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100 /* Extended Status Register */ #define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ @@ -1952,6 +2037,11 @@ struct e1000_hw { #define IGP01E1000_MSE_CHANNEL_B 0x0F00 #define IGP01E1000_MSE_CHANNEL_A 0xF000 +/* IGP01E1000 DSP reset macros */ +#define DSP_RESET_ENABLE 0x0 +#define DSP_RESET_DISABLE 0x2 +#define E1000_MAX_DSP_RESETS 10 + /* IGP01E1000 AGC Registers */ #define IGP01E1000_AGC_LENGTH_SHIFT 7 /* Coarse - 13:11, Fine - 10:7 */ @@ -1983,10 +2057,10 @@ uint16_t e1000_igp_cable_length_table[IG * on Link-Up */ #define IGP01E1000_GMII_SPD 0x20 /* Enable SPD */ /* IGP01E1000 Analog Register */ -#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x0011 -#define IGP01E1000_ANALOG_FUSE_STATUS 0x0010 -#define IGP01E1000_ANALOG_FUSE_CONTROL 0x001C -#define IGP01E1000_ANALOG_FUSE_BYPASS 0x001E +#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x20D1 +#define IGP01E1000_ANALOG_FUSE_STATUS 0x20D0 +#define IGP01E1000_ANALOG_FUSE_CONTROL 0x20DC +#define IGP01E1000_ANALOG_FUSE_BYPASS 0x20DE #define IGP01E1000_ANALOG_FUSE_POLY_MASK 0xF000 #define IGP01E1000_ANALOG_FUSE_FINE_MASK 0x0F80 @@ -2032,5 +2108,8 @@ uint16_t e1000_igp_cable_length_table[IG #define ADVERTISE_1000_HALF 0x0010 #define ADVERTISE_1000_FULL 0x0020 #define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x002F /* Everything but 1000-Half */ +#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds*/ +#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds*/ + #endif /* _E1000_HW_H_ */ diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -71,15 +71,28 @@ static struct pci_device_id e1000_pci_tb {0x8086, 0x100D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x100E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x100F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x8086, 0x1011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x1010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x1012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1014, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1015, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x1016, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x1017, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x8086, 0x101E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x8086, 0x101D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x8086, 0x1013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1018, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x8086, 0x1019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x101D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x101E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1026, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1027, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1028, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1075, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1076, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1077, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1078, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x1079, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x107A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0x8086, 0x107B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* required last entry */ {0,} }; @@ -426,6 +439,11 @@ e1000_probe(struct pci_dev *pdev, if(pci_using_dac) netdev->features |= NETIF_F_HIGHDMA; + /* before reading the EEPROM, reset the controller to + * put the device in a known good starting state */ + + e1000_reset_hw(&adapter->hw); + /* make sure the EEPROM is good */ if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) { @@ -584,7 +628,10 @@ e1000_sw_init(struct e1000_adapter *adap hw->fc_pause_time = E1000_FC_PAUSE_TIME; hw->fc_send_xon = 1; - if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) + if((hw->mac_type == e1000_82541) || + (hw->mac_type == e1000_82547) || + (hw->mac_type == e1000_82541_rev_2) || + (hw->mac_type == e1000_82547_rev_2)) hw->phy_init_script = 1; /* Media type - copper or fiber */ @@ -763,7 +784,8 @@ e1000_configure_tx(struct e1000_adapter tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; break; default: - if(adapter->hw.media_type == e1000_media_type_fiber) + if(adapter->hw.media_type == e1000_media_type_fiber || + adapter->hw.media_type == e1000_media_type_internal_serdes) tipg = DEFAULT_82543_TIPG_IPGT_FIBER; else tipg = DEFAULT_82543_TIPG_IPGT_COPPER; @@ -2387,7 +2409,7 @@ e1000_mii_ioctl(struct net_device *netde uint16_t mii_reg; uint16_t spddplx; - if(adapter->hw.media_type == e1000_media_type_fiber) + if(adapter->hw.media_type != e1000_media_type_copper) return -EOPNOTSUPP; switch (cmd) { @@ -2706,7 +2728,8 @@ e1000_suspend(struct pci_dev *pdev, uint E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); } - if(adapter->hw.media_type == e1000_media_type_fiber) { + if(adapter->hw.media_type == e1000_media_type_fiber || + adapter->hw.media_type == e1000_media_type_internal_serdes) { /* keep the laser running in D3 */ ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_param.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_param.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_param.c 2003-08-22 16:57:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_param.c 2003-09-08 09:13:12.000000000 -0700 @@ -458,6 +458,7 @@ e1000_check_options(struct e1000_adapter switch(adapter->hw.media_type) { case e1000_media_type_fiber: + case e1000_media_type_internal_serdes: e1000_check_fiber_options(adapter); break; case e1000_media_type_copper: From scott.feldman@intel.com Mon Sep 8 19:49:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:01 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892nPx4016926 for ; Mon, 8 Sep 2003 19:49:26 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892ibu01478 for ; Tue, 9 Sep 2003 02:44:37 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892n4C27232 for ; Tue, 9 Sep 2003 02:49:04 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819491703884 ; Mon, 08 Sep 2003 19:49:17 -0700 Date: Mon, 8 Sep 2003 20:13:55 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 0/11] huge patch bomb Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5708 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 Content-Length: 444 Lines: 16 Jeff, new device support held this patch set up. :-( The new 82541/5/6/7 devices fix some hardware bugs, including handling PCI-X MMRBC correctly, and not requiring IO-mapping to issue reset. Also adds new internal SERDES device support for backplane applications. Other bugs fixes for legacy 82544x controllers included. See patches for details. These are for 2.6.0-test4. I'll send 2.4.x sync patches under separate cover. -scott From scott.feldman@intel.com Mon Sep 8 19:49:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:16 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892nex4017053 for ; Mon, 8 Sep 2003 19:49:41 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892lGD20762 for ; Tue, 9 Sep 2003 02:47:16 GMT Received: from fmsmsxvs043.fm.intel.com (fmsmsxvs043.fm.intel.com [132.233.42.129]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892iLU06113 for ; Tue, 9 Sep 2003 02:44:21 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs043.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819493331290 ; Mon, 08 Sep 2003 19:49:33 -0700 Date: Mon, 8 Sep 2003 20:14:12 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 2/11] 82544 PCI-X hang fix + TSO updates Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5710 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 Content-Length: 6980 Lines: 205 * Bug fix: 82544 hang with PCI-X: if outgoing Tx buffers terminate within evenly-aligned dwords, and the device is sharing the bus segment with another PCI-X device, 82544 can hang the bus on a split-completion transaction. Fix is to split buffer into two buffers with the first one not terminating within evenly-aligned dword address, and the second one being 4-bytes, which goes as a non-split-conpletion PCI-X transaction. * 8254x controllers that support TSO do an internal calculation to make sure there is enough FIFO space to handle the overhead of each TSO segment before DMA'ing TSO data from host memory. The internal calculation is dependent on the mss of the TSO (defines the number of segments), but the reserved space is a constant, so we need to adjust the maximum size of each buffer queued to the hardware to hold the equation and not overrun the FIFO. This is per TSO because the mss can change from one send to the next. --------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000.h linux-2.6.0-test4/drivers/net/e1000.new/e1000.h --- linux-2.6.0-test4/drivers/net/e1000/e1000.h 2003-08-22 16:50:56.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000.h 2003-09-08 09:13:16.000000000 -0700 @@ -194,6 +194,7 @@ struct e1000_adapter { uint32_t tx_head_addr; uint32_t tx_fifo_size; atomic_t tx_fifo_stall; + boolean_t pcix_82544; /* RX */ struct e1000_desc_ring rx_ring; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -820,6 +820,12 @@ e1000_configure_tx(struct e1000_adapter adapter->txd_cmd |= E1000_TXD_CMD_RS; else adapter->txd_cmd |= E1000_TXD_CMD_RPS; + + /* Cache if we're 82544 running in PCI-X because we'll + * need this to apply a workaround later in the send path. */ + if(adapter->hw.mac_type == e1000_82544 && + adapter->hw.bus_type == e1000_bus_type_pcix) + adapter->pcix_82544 = 1; } /** @@ -1512,11 +1518,18 @@ e1000_tx_map(struct e1000_adapter *adapt { struct e1000_desc_ring *tx_ring = &adapter->tx_ring; struct e1000_buffer *buffer_info; - int len = skb->len; + unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD; unsigned int offset = 0, size, count = 0, i; #ifdef NETIF_F_TSO - unsigned int tso = skb_shinfo(skb)->tso_size; + unsigned int mss = skb_shinfo(skb)->tso_size; + /* The controller does a simple calculation to + * make sure there is enough room in the FIFO before + * initiating the DMA for each buffer. The calc is: + * 4 = ceil(buffer len/mss). To make sure we don't + * overrun the FIFO, adjust the max buffer len if mss + * drops. */ + if(mss) max_per_txd = min(mss << 2, max_per_txd); #endif unsigned int nr_frags = skb_shinfo(skb)->nr_frags; unsigned int f; @@ -1526,13 +1520,20 @@ e1000_tx_map(struct e1000_adapter *adapt while(len) { buffer_info = &tx_ring->buffer_info[i]; - size = min(len, E1000_MAX_DATA_PER_TXD); + size = min(len, max_per_txd); #ifdef NETIF_F_TSO /* Workaround for premature desc write-backs * in TSO mode. Append 4-byte sentinel desc */ - if(tso && !nr_frags && size == len && size > 4) + if(mss && !nr_frags && size == len && size > 8) size -= 4; #endif + /* Workaround for potential 82544 hang in PCI-X. Avoid + * terminating buffers within evenly-aligned dwords. */ + if(adapter->pcix_82544 && + !((unsigned long)(skb->data + offset + size - 1) & 4) && + size > 4) + size -= 4; + buffer_info->length = size; buffer_info->dma = pci_map_single(adapter->pdev, @@ -1552,22 +1546,30 @@ e1000_tx_map(struct e1000_adapter *adapt frag = &skb_shinfo(skb)->frags[f]; len = frag->size; - offset = 0; + offset = frag->page_offset; while(len) { buffer_info = &tx_ring->buffer_info[i]; - size = min(len, E1000_MAX_DATA_PER_TXD); + size = min(len, max_per_txd); #ifdef NETIF_F_TSO /* Workaround for premature desc write-backs * in TSO mode. Append 4-byte sentinel desc */ - if(tso && f == (nr_frags-1) && size == len && size > 4) + if(mss && f == (nr_frags-1) && size == len && size > 8) size -= 4; #endif + /* Workaround for potential 82544 hang in PCI-X. + * Avoid terminating buffers within evenly-aligned + * dwords. */ + if(adapter->pcix_82544 && + !((unsigned long)(frag->page+offset+size-1) & 4) && + size > 4) + size -= 4; + buffer_info->length = size; buffer_info->dma = pci_map_page(adapter->pdev, frag->page, - frag->page_offset + offset, + offset, size, PCI_DMA_TODEVICE); buffer_info->time_stamp = jiffies; @@ -1578,6 +1606,31 @@ e1000_tx_map(struct e1000_adapter *adapt if(++i == tx_ring->count) i = 0; } } + + if(E1000_DESC_UNUSED(&adapter->tx_ring) < count) { + + /* There aren't enough descriptors available to queue up + * this send, so undo the mapping and abort the send. + * We could have done the check before we mapped the skb, + * but because of all the workarounds (above), it's too + * difficult to predict how many we're going to need.*/ + i = first; + + while(count--) { + buffer_info = &tx_ring->buffer_info[i]; + if(buffer_info->dma) { + pci_unmap_page(adapter->pdev, + buffer_info->dma, + buffer_info->length, + PCI_DMA_TODEVICE); + buffer_info->dma = 0; + } + if(++i == tx_ring->count) i = 0; + } + + return 0; + } + i = (i == 0) ? tx_ring->count - 1 : i - 1; tx_ring->buffer_info[i].skb = skb; tx_ring->buffer_info[first].next_to_watch = i; @@ -1672,29 +1725,19 @@ no_fifo_stall_required: return 0; } -/* Tx Descriptors needed, worst case */ -#define TXD_USE_COUNT(S) (((S) >> E1000_MAX_TXD_PWR) + \ - (((S) & (E1000_MAX_DATA_PER_TXD - 1)) ? 1 : 0)) -#define DESC_NEEDED TXD_USE_COUNT(MAX_JUMBO_FRAME_SIZE) + \ - MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 - static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) { struct e1000_adapter *adapter = netdev->priv; unsigned int first; unsigned int tx_flags = 0; + int count; if(skb->len <= 0) { dev_kfree_skb_any(skb); return 0; } - if(E1000_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED) { - netif_stop_queue(netdev); - return 1; - } - if(adapter->hw.mac_type == e1000_82547) { if(e1000_82547_fifo_workaround(adapter, skb)) { netif_stop_queue(netdev); @@ -1715,7 +1758,12 @@ e1000_xmit_frame(struct sk_buff *skb, st else if(e1000_tx_csum(adapter, skb)) tx_flags |= E1000_TX_FLAGS_CSUM; - e1000_tx_queue(adapter, e1000_tx_map(adapter, skb, first), tx_flags); + if((count = e1000_tx_map(adapter, skb, first))) + e1000_tx_queue(adapter, count, tx_flags); + else { + netif_stop_queue(netdev); + return 1; + } netdev->trans_start = jiffies; From scott.feldman@intel.com Mon Sep 8 19:49:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:18 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892njx4017085 for ; Mon, 8 Sep 2003 19:49:45 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892iwu01567 for ; Tue, 9 Sep 2003 02:44:58 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892nPC27355 for ; Tue, 9 Sep 2003 02:49:25 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819493800337 ; Mon, 08 Sep 2003 19:49:38 -0700 Date: Mon, 8 Sep 2003 20:14:17 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 3/11] Turn off ASF support on Fiber nics Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5711 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 Content-Length: 1557 Lines: 42 * Turn off ASF support on fiber nics. Wasn't tested and isn't known to work, so disable before someone hurts themselves. ---------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -534,7 +534,8 @@ e1000_remove(struct pci_dev *pdev) struct e1000_adapter *adapter = netdev->priv; uint32_t manc; - if(adapter->hw.mac_type >= e1000_82540) { + if(adapter->hw.mac_type >= e1000_82540 && + adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); if(manc & E1000_MANC_SMBUS_EN) { manc |= E1000_MANC_ARP_EN; @@ -2797,7 +2798,8 @@ e1000_suspend(struct pci_dev *pdev, uint pci_save_state(pdev, adapter->pci_state); - if(adapter->hw.mac_type >= e1000_82540) { + if(adapter->hw.mac_type >= e1000_82540 && + adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); if(manc & E1000_MANC_SMBUS_EN) { manc |= E1000_MANC_ARP_EN; @@ -2835,7 +2837,8 @@ e1000_resume(struct pci_dev *pdev) netif_device_attach(netdev); - if(adapter->hw.mac_type >= e1000_82540) { + if(adapter->hw.mac_type >= e1000_82540 && + adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); manc &= ~(E1000_MANC_ARP_EN); E1000_WRITE_REG(&adapter->hw, MANC, manc); From scott.feldman@intel.com Mon Sep 8 19:49:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:25 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892nnx4017111 for ; Mon, 8 Sep 2003 19:49:52 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892lPD20790 for ; Tue, 9 Sep 2003 02:47:25 GMT Received: from fmsmsxvs043.fm.intel.com (fmsmsxvs043.fm.intel.com [132.233.42.129]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892iUU06158 for ; Tue, 9 Sep 2003 02:44:31 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs043.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819494232502 ; Mon, 08 Sep 2003 19:49:42 -0700 Date: Mon, 8 Sep 2003 20:14:21 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 4/11] read correct bit from EEPROM for getting WoL settings Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5712 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 Content-Length: 1984 Lines: 57 * Bug fix: read the correct bit from the EEPROM that controls the initial setting for WoL after a reset. --------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000.h linux-2.6.0-test4/drivers/net/e1000.new/e1000.h --- linux-2.6.0-test4/drivers/net/e1000/e1000.h 2003-08-22 16:50:56.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000.h 2003-09-08 09:13:16.000000000 -0700 @@ -122,7 +122,7 @@ struct e1000_adapter; #define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */ #define AUTO_ALL_MODES 0 -#define E1000_EEPROM_APME 4 +#define E1000_EEPROM_APME 0x0400 /* only works for sizes that are powers of 2 */ #define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1))) diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -494,12 +494,28 @@ e1000_probe(struct pci_dev *pdev, * enable the ACPI Magic Packet filter */ - e1000_read_eeprom(&adapter->hw, EEPROM_INIT_CONTROL2_REG,1, &eeprom_data); - if((adapter->hw.mac_type >= e1000_82544) && - (eeprom_data & E1000_EEPROM_APME)) + switch(adapter->hw.mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + break; + case e1000_82546: + case e1000_82546_rev_3: + if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1) + && (adapter->hw.media_type == e1000_media_type_copper)) { + e1000_read_eeprom(&adapter->hw, + EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); + break; + } + /* Fall Through */ + default: + e1000_read_eeprom(&adapter->hw, + EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + break; + } + if(eeprom_data & E1000_EEPROM_APME) adapter->wol |= E1000_WUFC_MAG; - /* reset the hardware with the new settings */ e1000_reset(adapter); From scott.feldman@intel.com Mon Sep 8 19:49:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:28 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892ntx4017138 for ; Mon, 8 Sep 2003 19:49:55 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892lUD20821 for ; Tue, 9 Sep 2003 02:47:30 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892iaU06190 for ; Tue, 9 Sep 2003 02:44:36 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819494706453 ; Mon, 08 Sep 2003 19:49:47 -0700 Date: Mon, 8 Sep 2003 20:14:26 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 5/11] add ethtool flow control support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5713 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 Content-Length: 9506 Lines: 245 * Add ethtool flow control support --------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c 2003-08-22 16:55:33.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c 2003-09-08 09:13:10.000000000 -0700 @@ -190,6 +190,55 @@ e1000_ethtool_sset(struct e1000_adapter return 0; } +static int +e1000_ethtool_gpause(struct e1000_adapter *adapter, + struct ethtool_pauseparam *epause) +{ + struct e1000_hw *hw = &adapter->hw; + + epause->autoneg = + (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); + + if(hw->fc == e1000_fc_rx_pause) + epause->rx_pause = 1; + else if(hw->fc == e1000_fc_tx_pause) + epause->tx_pause = 1; + else if(hw->fc == e1000_fc_full) { + epause->rx_pause = 1; + epause->tx_pause = 1; + } + + return 0; +} + +static int +e1000_ethtool_spause(struct e1000_adapter *adapter, + struct ethtool_pauseparam *epause) +{ + struct e1000_hw *hw = &adapter->hw; + + adapter->fc_autoneg = epause->autoneg; + + if(epause->rx_pause && epause->tx_pause) + hw->fc = e1000_fc_full; + else if(epause->rx_pause && !epause->tx_pause) + hw->fc = e1000_fc_rx_pause; + else if(!epause->rx_pause && epause->tx_pause) + hw->fc = e1000_fc_tx_pause; + else if(!epause->rx_pause && !epause->tx_pause) + hw->fc = e1000_fc_none; + + hw->original_fc = hw->fc; + + if(netif_running(adapter->netdev)) { + e1000_down(adapter); + e1000_up(adapter); + } else + e1000_reset(adapter); + + return 0; +} + static void e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter, struct ethtool_drvinfo *drvinfo) @@ -1449,6 +1498,19 @@ err_geeprom_ioctl: addr += offsetof(struct ethtool_eeprom, data); return e1000_ethtool_seeprom(adapter, &eeprom, addr); } + case ETHTOOL_GPAUSEPARAM: { + struct ethtool_pauseparam epause = {ETHTOOL_GPAUSEPARAM}; + e1000_ethtool_gpause(adapter, &epause); + if(copy_to_user(addr, &epause, sizeof(epause))) + return -EFAULT; + return 0; + } + case ETHTOOL_SPAUSEPARAM: { + struct ethtool_pauseparam epause; + if(copy_from_user(&epause, addr, sizeof(epause))) + return -EFAULT; + return e1000_ethtool_spause(adapter, &epause); + } case ETHTOOL_GSTATS: { struct { struct ethtool_stats eth_stats; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000.h linux-2.6.0-test4/drivers/net/e1000.new/e1000.h --- linux-2.6.0-test4/drivers/net/e1000/e1000.h 2003-08-22 16:50:56.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000.h 2003-09-08 09:13:16.000000000 -0700 @@ -180,6 +180,7 @@ struct e1000_adapter { spinlock_t stats_lock; atomic_t irq_sem; struct work_struct tx_timeout_task; + uint8_t fc_autoneg; struct timer_list blink_timer; unsigned long led_status; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -39,7 +39,6 @@ static int32_t e1000_adjust_serdes_amplitude(struct e1000_hw *hw); static int32_t e1000_phy_force_speed_duplex(struct e1000_hw *hw); static int32_t e1000_config_mac_to_phy(struct e1000_hw *hw); -static int32_t e1000_force_mac_fc(struct e1000_hw *hw); static void e1000_raise_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); static void e1000_lower_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, uint32_t data, uint16_t count); @@ -1629,7 +1629,7 @@ e1000_config_mac_to_phy(struct e1000_hw * by the PHY rather than the MAC. Software must also configure these * bits when link is forced on a fiber connection. *****************************************************************************/ -static int32_t +int32_t e1000_force_mac_fc(struct e1000_hw *hw) { uint32_t ctrl; @@ -1682,7 +1681,7 @@ e1000_force_mac_fc(struct e1000_hw *hw) ctrl &= (~E1000_CTRL_TFCE); E1000_WRITE_REG(hw, CTRL, ctrl); - return 0; + return E1000_SUCCESS; } /****************************************************************************** diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h 2003-08-22 16:58:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h 2003-09-08 09:13:16.000000000 -0700 @@ -264,6 +264,7 @@ int32_t e1000_phy_setup_autoneg(struct e int32_t e1000_check_for_link(struct e1000_hw *hw); int32_t e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex); int32_t e1000_wait_autoneg(struct e1000_hw *hw); +int32_t e1000_force_mac_fc(struct e1000_hw *hw); /* PHY */ int32_t e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data); diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_param.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_param.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_param.c 2003-08-22 16:57:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_param.c 2003-09-08 09:13:12.000000000 -0700 @@ -140,7 +140,7 @@ E1000_PARAM(FlowControl, "Flow Control s * Valid Range: 0, 1 * - 0 - disables all checksum offload * - 1 - enables receive IP/TCP/UDP checksum offload - * on 82543 based NICs + * on 82543 and newer -based NICs * * Default Value: 1 */ @@ -602,7 +602,7 @@ e1000_check_copper_options(struct e1000_ switch (speed + dplx) { case 0: - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; if(Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET) printk(KERN_INFO "Speed and duplex autonegotiation enabled\n"); @@ -610,14 +610,14 @@ e1000_check_copper_options(struct e1000_ case HALF_DUPLEX: printk(KERN_INFO "Half Duplex specified without Speed\n"); printk(KERN_INFO "Using Autonegotiation at Half Duplex only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ADVERTISE_100_HALF; break; case FULL_DUPLEX: printk(KERN_INFO "Full Duplex specified without Speed\n"); printk(KERN_INFO "Using Autonegotiation at Full Duplex only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_FULL | ADVERTISE_100_FULL | ADVERTISE_1000_FULL; @@ -625,38 +625,38 @@ e1000_check_copper_options(struct e1000_ case SPEED_10: printk(KERN_INFO "10 Mbps Speed specified without Duplex\n"); printk(KERN_INFO "Using Autonegotiation at 10 Mbps only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ADVERTISE_10_FULL; break; case SPEED_10 + HALF_DUPLEX: printk(KERN_INFO "Forcing to 10 Mbps Half Duplex\n"); - adapter->hw.autoneg = 0; + adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_10_half; adapter->hw.autoneg_advertised = 0; break; case SPEED_10 + FULL_DUPLEX: printk(KERN_INFO "Forcing to 10 Mbps Full Duplex\n"); - adapter->hw.autoneg = 0; + adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_10_full; adapter->hw.autoneg_advertised = 0; break; case SPEED_100: printk(KERN_INFO "100 Mbps Speed specified without Duplex\n"); printk(KERN_INFO "Using Autonegotiation at 100 Mbps only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_100_HALF | ADVERTISE_100_FULL; break; case SPEED_100 + HALF_DUPLEX: printk(KERN_INFO "Forcing to 100 Mbps Half Duplex\n"); - adapter->hw.autoneg = 0; + adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_100_half; adapter->hw.autoneg_advertised = 0; break; case SPEED_100 + FULL_DUPLEX: printk(KERN_INFO "Forcing to 100 Mbps Full Duplex\n"); - adapter->hw.autoneg = 0; + adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_100_full; adapter->hw.autoneg_advertised = 0; break; @@ -664,20 +664,20 @@ e1000_check_copper_options(struct e1000_ printk(KERN_INFO "1000 Mbps Speed specified without Duplex\n"); printk(KERN_INFO "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; case SPEED_1000 + HALF_DUPLEX: printk(KERN_INFO "Half Duplex is not supported at 1000 Mbps\n"); printk(KERN_INFO "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; case SPEED_1000 + FULL_DUPLEX: printk(KERN_INFO "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); - adapter->hw.autoneg = 1; + adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; default: From scott.feldman@intel.com Mon Sep 8 19:50:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:40 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892oFx4017309 for ; Mon, 8 Sep 2003 19:50:15 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892jSu01697 for ; Tue, 9 Sep 2003 02:45:28 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892nsC27479 for ; Tue, 9 Sep 2003 02:49:54 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819500729695 ; Mon, 08 Sep 2003 19:50:07 -0700 Date: Mon, 8 Sep 2003 20:14:46 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 8/11] move static to table from .h to .c Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5715 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 Content-Length: 5059 Lines: 102 * Move static table from hw.h to hw.c to avoid creating a copy of table everytime hw.h is included.in .c. ---------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -64,6 +64,17 @@ static int32_t e1000_write_eeprom_microw static int32_t e1000_id_led_init(struct e1000_hw * hw); static int32_t e1000_set_vco_speed(struct e1000_hw *hw); +/* IGP cable length table */ +static const +uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, + 25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; /****************************************************************************** @@ -4601,19 +4601,16 @@ e1000_get_cable_length(struct e1000_hw * break; } } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ - uint16_t agc_reg_array[IGP01E1000_PHY_AGC_NUM] = {IGP01E1000_PHY_AGC_A, + uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = + {IGP01E1000_PHY_AGC_A, IGP01E1000_PHY_AGC_B, IGP01E1000_PHY_AGC_C, IGP01E1000_PHY_AGC_D}; /* Read the AGC registers for all channels */ - for(i = 0; i < IGP01E1000_PHY_AGC_NUM; i++) { - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, - agc_reg_array[i]) != E1000_SUCCESS) - return -E1000_ERR_PHY; - if(e1000_read_phy_reg(hw, agc_reg_array[i] & - IGP01E1000_PHY_PAGE_SELECT, &phy_data) != - E1000_SUCCESS) - return -E1000_ERR_PHY; + for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { + + if((ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data))) + return ret_val; cur_agc = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; @@ -4629,20 +4637,15 @@ e1000_get_cable_length(struct e1000_hw * min_agc = cur_agc; } - /* Return to page 0 */ - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0) != - E1000_SUCCESS) - return -E1000_ERR_PHY; - /* Remove the minimal AGC result for length < 50m */ - if(agc_value < IGP01E1000_PHY_AGC_NUM * e1000_igp_cable_length_50) { + if(agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { agc_value -= min_agc; /* Get the average length of the remaining 3 channels */ - agc_value /= (IGP01E1000_PHY_AGC_NUM - 1); + agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); } else { /* Get the average length of all the 4 channels. */ - agc_value /= IGP01E1000_PHY_AGC_NUM; + agc_value /= IGP01E1000_PHY_CHANNEL_NUM; } /* Set the range of the calculated length. */ diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h 2003-08-22 16:58:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h 2003-09-08 09:13:16.000000000 -0700 @@ -2053,18 +2053,6 @@ struct e1000_hw { /* The precision of the length is +/- 10 meters */ #define IGP01E1000_AGC_RANGE 10 -/* IGP cable length table */ -static const -uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, - 25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; - /* IGP01E1000 PCS Initialization register */ /* bits 3:6 in the PCS registers stores the channels polarity */ #define IGP01E1000_PHY_POLARITY_MASK 0x0078 From scott.feldman@intel.com Mon Sep 8 19:50:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:41 -0700 (PDT) Received: from hermes.hd.intel.com (fmr09.intel.com [192.52.57.35]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892oKx4017358 for ; Mon, 8 Sep 2003 19:50:21 -0700 Received: from petasus.hd.intel.com (petasus.hd.intel.com [10.127.45.3]) by hermes.hd.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892luD20885 for ; Tue, 9 Sep 2003 02:47:56 GMT Received: from fmsmsxvs042.fm.intel.com (fmsmsxvs042.fm.intel.com [132.233.42.128]) by petasus.hd.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892j1U06289 for ; Tue, 9 Sep 2003 02:45:01 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs042.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819501330378 ; Mon, 08 Sep 2003 19:50:13 -0700 Date: Mon, 8 Sep 2003 20:14:52 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 9/11] Add PHY master/slave #define override Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5717 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 Content-Length: 1431 Lines: 36 * Add PHY master/slave #define override to address link issues with 82541/7 (rev2) against some low-end switches. Forcing master will improve the time-to-link against these switches. ---------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000.h linux-2.6.0-test4/drivers/net/e1000.new/e1000.h --- linux-2.6.0-test4/drivers/net/e1000/e1000.h 2003-08-22 16:50:56.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000.h 2003-09-08 09:13:16.000000000 -0700 @@ -123,6 +123,11 @@ struct e1000_adapter; #define AUTO_ALL_MODES 0 #define E1000_EEPROM_APME 0x0400 + +#ifndef E1000_MASTER_SLAVE +/* Switch to override PHY master/slave setting */ +#define E1000_MASTER_SLAVE e1000_ms_hw_default +#endif /* only works for sizes that are powers of 2 */ #define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1))) diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -641,6 +641,7 @@ e1000_sw_init(struct e1000_adapter *adap if(hw->media_type == e1000_media_type_copper) { hw->mdix = AUTO_ALL_MODES; hw->disable_polarity_correction = FALSE; + hw->master_slave = E1000_MASTER_SLAVE; } atomic_set(&adapter->irq_sem, 1); From scott.feldman@intel.com Mon Sep 8 19:50:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:42 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892oAx4017263 for ; Mon, 8 Sep 2003 19:50:11 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892jNu01667 for ; Tue, 9 Sep 2003 02:45:23 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892nnC27464 for ; Tue, 9 Sep 2003 02:49:49 GMT Received: from [134.134.3.75] ([134.134.3.75]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819500223886 ; Mon, 08 Sep 2003 19:50:02 -0700 Date: Mon, 8 Sep 2003 20:14:41 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 7/11] cleanup error return codes Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5718 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 Content-Length: 31188 Lines: 807 * clean up error return code propagation and eliminate redundant DEBUGOUT statements. ------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -455,8 +455,7 @@ e1000_init_hw(struct e1000_hw *hw) DEBUGFUNC("e1000_init_hw"); /* Initialize Identification LED */ - ret_val = e1000_id_led_init(hw); - if(ret_val < 0) { + if((ret_val = e1000_id_led_init(hw))) { DEBUGOUT("Error Initializing Identification LED\n"); return ret_val; } @@ -1165,14 +1008,12 @@ e1000_setup_copper_link(struct e1000_hw if(hw->mac_type >= e1000_82544) { e1000_config_collision_dist(hw); } else { - ret_val = e1000_config_mac_to_phy(hw); - if(ret_val < 0) { + if((ret_val = e1000_config_mac_to_phy(hw))) { DEBUGOUT("Error configuring MAC to PHY settings\n"); return ret_val; - } + } } - ret_val = e1000_config_fc_after_link_up(hw); - if(ret_val < 0) { + if((ret_val = e1000_config_fc_after_link_up(hw))) { DEBUGOUT("Error Configuring Flow Control\n"); return ret_val; } @@ -1202,22 +1202,20 @@ e1000_setup_copper_link(struct e1000_hw int32_t e1000_phy_setup_autoneg(struct e1000_hw *hw) { + int32_t ret_val; uint16_t mii_autoneg_adv_reg; uint16_t mii_1000t_ctrl_reg; DEBUGFUNC("e1000_phy_setup_autoneg"); /* Read the MII Auto-Neg Advertisement Register (Address 4). */ - if(e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, + &mii_autoneg_adv_reg))) + return ret_val; /* Read the MII 1000Base-T Control Register (Address 9). */ - if(e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg))) + return ret_val; /* Need to parse both autoneg_advertised and fc and set up * the appropriate PHY registers. First we will parse for @@ -1323,18 +1318,16 @@ e1000_phy_setup_autoneg(struct e1000_hw return -E1000_ERR_CONFIG; } - if(e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, + mii_autoneg_adv_reg))) + return ret_val; DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); - if(e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } - return 0; + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg))) + return ret_val; + + return E1000_SUCCESS; } /****************************************************************************** @@ -1370,10 +1363,8 @@ e1000_phy_force_speed_duplex(struct e100 ctrl &= ~E1000_CTRL_ASDE; /* Read the MII Control Register. */ - if(e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg))) + return ret_val; /* We need to disable autoneg in order to force link and duplex. */ @@ -1419,19 +1410,18 @@ e1000_phy_force_speed_duplex(struct e100 E1000_WRITE_REG(hw, CTRL, ctrl); if (hw->phy_type == e1000_phy_m88) { - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI * forced whenever speed are duplex are forced. */ phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; - if(e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + phy_data))) + return ret_val; + DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); /* Need to reset the PHY or these changes will be ignored */ @@ -1440,26 +1275,23 @@ e1000_phy_force_speed_duplex(struct e100 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI * forced whenever speed or duplex are forced. */ - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + &phy_data))) + return ret_val; phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; - if(e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + phy_data))) + return ret_val; } /* Write back the modified PHY MII control register. */ - if(e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } udelay(1); + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg))) + return ret_val; + /* The wait_autoneg_complete flag may be a little misleading here. * Since we are forcing speed and duplex, Auto-Neg is not enabled. @@ -1478,22 +1465,18 @@ e1000_phy_force_speed_duplex(struct e100 /* Read the MII Status Register and wait for Auto-Neg Complete bit * to be set. */ - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + if(mii_status_reg & MII_SR_LINK_STATUS) break; msec_delay(100); } if(i == 0) { /* We didn't get link */ /* Reset the DSP and wait again for link. */ - - ret_val = e1000_phy_reset_dsp(hw); - if(ret_val < 0) { + if((ret_val = e1000_phy_reset_dsp(hw))) { DEBUGOUT("Error Resetting PHY DSP\n"); return ret_val; } @@ -1505,14 +1488,11 @@ e1000_phy_force_speed_duplex(struct e100 /* Read the MII Status Register and wait for Auto-Neg Complete bit * to be set. */ - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; } } @@ -1521,30 +1501,29 @@ e1000_phy_force_speed_duplex(struct e100 * Extended PHY Specific Control Register to 25MHz clock. This value * defaults back to a 2.5MHz clock when the PHY is reset. */ - if(e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; + phy_data |= M88E1000_EPSCR_TX_CLK_25; - if(e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + phy_data))) + return ret_val; /* In addition, because of the s/w reset above, we need to enable CRS on * TX. This must be set for both full and half duplex operation. */ - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; - if(e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data) < 0) { - DEBUGOUT("PHY Write Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + phy_data))) + return ret_val; + } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -1584,6 +1563,7 @@ static int32_t e1000_config_mac_to_phy(struct e1000_hw *hw) { uint32_t ctrl; + int32_t ret_val; uint16_t phy_data; DEBUGFUNC("e1000_config_mac_to_phy"); @@ -1599,10 +1579,10 @@ e1000_config_mac_to_phy(struct e1000_hw * registers depending on negotiated values. */ if (hw->phy_type == e1000_phy_igp) { - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, + &phy_data))) + return ret_val; + if(phy_data & IGP01E1000_PSSR_FULL_DUPLEX) ctrl |= E1000_CTRL_FD; else ctrl &= ~E1000_CTRL_FD; @@ -1618,10 +1598,10 @@ e1000_config_mac_to_phy(struct e1000_hw IGP01E1000_PSSR_SPEED_100MBPS) ctrl |= E1000_CTRL_SPD_100; } else { - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, + &phy_data))) + return ret_val; + if(phy_data & M88E1000_PSSR_DPLX) ctrl |= E1000_CTRL_FD; else ctrl &= ~E1000_CTRL_FD; @@ -1637,7 +1617,7 @@ e1000_config_mac_to_phy(struct e1000_hw } /* Write the configured values back to the Device Control Reg. */ E1000_WRITE_REG(hw, CTRL, ctrl); - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -1737,8 +1570,7 @@ e1000_config_fc_after_link_up(struct e10 if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed)) || ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { - ret_val = e1000_force_mac_fc(hw); - if(ret_val < 0) { + if((ret_val = e1000_force_mac_fc(hw))) { DEBUGOUT("Error forcing flow control settings\n"); return ret_val; } @@ -1754,14 +1588,10 @@ e1000_config_fc_after_link_up(struct e10 * has completed. We read this twice because this reg has * some "sticky" (latched) bits. */ - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error \n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { - DEBUGOUT("PHY Read Error \n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) { /* The AutoNeg process has completed, so we now need to @@ -1770,14 +1745,12 @@ e1000_config_fc_after_link_up(struct e10 * Register (Address 5) to determine how flow control was * negotiated. */ - if(e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_nway_adv_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_LP_ABILITY, &mii_nway_lp_ability_reg) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, + &mii_nway_adv_reg))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, + &mii_nway_lp_ability_reg))) + return ret_val; /* Two bits in the Auto Negotiation Advertisement Register * (Address 4) and two bits in the Auto Negotiation Base @@ -1892,7 +1865,10 @@ e1000_config_fc_after_link_up(struct e10 * negotiated to HALF DUPLEX, flow control should not be * enabled per IEEE 802.3 spec. */ - e1000_get_speed_and_duplex(hw, &speed, &duplex); + if((ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex))) { + DEBUGOUT("Error getting link speed and duplex\n"); + return ret_val; + } if(duplex == HALF_DUPLEX) hw->fc = e1000_fc_none; @@ -1900,16 +1876,15 @@ e1000_config_fc_after_link_up(struct e10 /* Now we call a subroutine to actually force the MAC * controller to use the correct flow control settings. */ - ret_val = e1000_force_mac_fc(hw); - if(ret_val < 0) { + if((ret_val = e1000_force_mac_fc(hw))) { DEBUGOUT("Error forcing flow control settings\n"); return ret_val; - } + } } else { DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); } } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -1956,14 +1931,10 @@ e1000_check_for_link(struct e1000_hw *hw * of the PHY. * Read the register twice since the link bit is sticky. */ - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; if(phy_data & MII_SR_LINK_STATUS) { hw->get_link_status = FALSE; @@ -1996,8 +1967,7 @@ e1000_check_for_link(struct e1000_hw *hw if(hw->mac_type >= e1000_82544) e1000_config_collision_dist(hw); else { - ret_val = e1000_config_mac_to_phy(hw); - if(ret_val < 0) { + if((ret_val = e1000_config_mac_to_phy(hw))) { DEBUGOUT("Error configuring MAC to PHY settings\n"); return ret_val; } @@ -2007,8 +1977,7 @@ e1000_check_for_link(struct e1000_hw *hw * need to restore the desired flow control settings because we may * have had to re-autoneg with a different link partner. */ - ret_val = e1000_config_fc_after_link_up(hw); - if(ret_val < 0) { + if((ret_val = e1000_config_fc_after_link_up(hw))) { DEBUGOUT("Error configuring flow control\n"); return ret_val; } @@ -2023,10 +1992,9 @@ e1000_check_for_link(struct e1000_hw *hw * partner is TBI-based, and we turn on TBI Compatibility. */ if(hw->tbi_compatibility_en) { - if(e1000_read_phy_reg(hw, PHY_LP_ABILITY, &lp_capability) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, + &lp_capability))) + return ret_val; if(lp_capability & (NWAY_LPAR_10T_HD_CAPS | NWAY_LPAR_10T_FD_CAPS | NWAY_LPAR_100TX_HD_CAPS | @@ -2083,8 +2051,7 @@ e1000_check_for_link(struct e1000_hw *hw E1000_WRITE_REG(hw, CTRL, ctrl); /* Configure Flow Control after forcing link up. */ - ret_val = e1000_config_fc_after_link_up(hw); - if(ret_val < 0) { + if((ret_val = e1000_config_fc_after_link_up(hw))) { DEBUGOUT("Error configuring flow control\n"); return ret_val; } @@ -2101,7 +2068,7 @@ e1000_check_for_link(struct e1000_hw *hw E1000_WRITE_REG(hw, TXCW, hw->txcw); E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -2178,6 +2145,7 @@ e1000_get_speed_and_duplex(struct e1000_ int32_t e1000_wait_autoneg(struct e1000_hw *hw) { + int32_t ret_val; uint16_t i; uint16_t phy_data; @@ -2189,20 +2157,16 @@ e1000_wait_autoneg(struct e1000_hw *hw) /* Read the MII Status Register and wait for Auto-Neg * Complete bit to be set. */ - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; if(phy_data & MII_SR_AUTONEG_COMPLETE) { - return 0; + return E1000_SUCCESS; } msec_delay(100); } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -2627,23 +2393,21 @@ e1000_phy_reset(struct e1000_hw *hw) int32_t e1000_detect_gig_phy(struct e1000_hw *hw) { + int32_t phy_init_status, ret_val; uint16_t phy_id_high, phy_id_low; boolean_t match = FALSE; - int32_t phy_init_status; DEBUGFUNC("e1000_detect_gig_phy"); /* Read the PHY ID Registers to identify which PHY is onboard. */ - if(e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high))) + return ret_val; + hw->phy_id = (uint32_t) (phy_id_high << 16); udelay(20); - if(e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low))) + return ret_val; + hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; @@ -2675,7 +2637,7 @@ e1000_detect_gig_phy(struct e1000_hw *hw if ((match) && (phy_init_status == E1000_SUCCESS)) { DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); - return 0; + return E1000_SUCCESS; } DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); return -E1000_ERR_PHY; @@ -2728,13 +2690,14 @@ e1000_phy_igp_get_info(struct e1000_hw * phy_info->polarity_correction = e1000_polarity_reversal_enabled; /* Check polarity status */ - if(e1000_check_polarity(hw, &polarity) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_check_polarity(hw, &polarity))) + return ret_val; phy_info->cable_polarity = polarity; - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, + &phy_data))) + return ret_val; phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >> IGP01E1000_PSSR_MDIX_SHIFT; @@ -2742,8 +2705,8 @@ e1000_phy_igp_get_info(struct e1000_hw * if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == IGP01E1000_PSSR_SPEED_1000MBPS) { /* Local/Remote Receiver Information are only valid at 1000 Mbps */ - if(e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data))) + return ret_val; phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> SR_1000T_LOCAL_RX_STATUS_SHIFT; @@ -2751,8 +2714,8 @@ e1000_phy_igp_get_info(struct e1000_hw * SR_1000T_REMOTE_RX_STATUS_SHIFT; /* Get cable length */ - if(e1000_get_cable_length(hw, &min_length, &max_length) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_get_cable_length(hw, &min_length, &max_length))) + return ret_val; /* transalte to old method */ average = (max_length + min_length) / 2; @@ -2779,8 +2742,10 @@ e1000_phy_igp_get_info(struct e1000_hw * * phy_info - PHY information structure ******************************************************************************/ int32_t -e1000_phy_m88_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) +e1000_phy_m88_get_info(struct e1000_hw *hw, + struct e1000_phy_info *phy_info) { + int32_t ret_val; uint16_t phy_data, polarity; DEBUGFUNC("e1000_phy_m88_get_info"); @@ -2789,8 +2754,8 @@ e1000_phy_m88_get_info(struct e1000_hw * * and it stored in the hw->speed_downgraded parameter. */ phy_info->downshift = hw->speed_downgraded; - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data))) + return ret_val; phy_info->extended_10bt_distance = (phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> @@ -2800,13 +2765,13 @@ e1000_phy_m88_get_info(struct e1000_hw * M88E1000_PSCR_POLARITY_REVERSAL_SHIFT; /* Check polarity status */ - if(e1000_check_polarity(hw, &polarity) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_check_polarity(hw, &polarity))) + return ret_val; phy_info->cable_polarity = polarity; - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data))) + return ret_val; phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> M88E1000_PSSR_MDIX_SHIFT; @@ -2818,8 +2783,8 @@ e1000_phy_m88_get_info(struct e1000_hw * phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> M88E1000_PSSR_CABLE_LENGTH_SHIFT); - if(e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data))) + return ret_val; phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> SR_1000T_LOCAL_RX_STATUS_SHIFT; @@ -2841,6 +2806,7 @@ int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) { + int32_t ret_val; uint16_t phy_data; DEBUGFUNC("e1000_phy_get_info"); @@ -2859,20 +2825,18 @@ e1000_phy_get_info(struct e1000_hw *hw, return -E1000_ERR_CONFIG; } - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } - if(e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { - DEBUGOUT("PHY Read Error\n"); - return -E1000_ERR_PHY; - } + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { DEBUGOUT("PHY info is only valid if link is up\n"); return -E1000_ERR_CONFIG; } - if (hw->phy_type == e1000_phy_igp) + if(hw->phy_type == e1000_phy_igp) return e1000_phy_igp_get_info(hw, phy_info); else return e1000_phy_m88_get_info(hw, phy_info); @@ -2888,7 +2852,7 @@ e1000_validate_mdi_setting(struct e1000_ hw->mdix = 1; return -E1000_ERR_CONFIG; } - return 0; + return E1000_SUCCESS; } @@ -3445,9 +3409,9 @@ e1000_validate_eeprom_checksum(struct e1 checksum += eeprom_data; } - if(checksum == (uint16_t) EEPROM_SUM) { - return 0; - } else { + if(checksum == (uint16_t) EEPROM_SUM) + return E1000_SUCCESS; + else { DEBUGOUT("EEPROM Checksum Invalid\n"); return -E1000_ERR_EEPROM; } @@ -3481,7 +3445,7 @@ e1000_update_eeprom_checksum(struct e100 DEBUGOUT("EEPROM Write Error\n"); return -E1000_ERR_EEPROM; } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -3679,7 +3643,7 @@ e1000_write_eeprom_microwire(struct e100 e1000_shift_out_ee_bits(hw, 0, (uint16_t)(eeprom->address_bits - 2)); - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -3713,7 +3677,7 @@ e1000_read_part_num(struct e1000_hw *hw, /* Save word 1 in lower half of part_num */ *part_num |= eeprom_data; - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -3748,7 +3712,7 @@ e1000_read_mac_addr(struct e1000_hw * hw } for(i = 0; i < NODE_ADDRESS_SIZE; i++) hw->mac_addr[i] = hw->perm_mac_addr[i]; - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -4024,7 +3988,7 @@ e1000_id_led_init(struct e1000_hw * hw) if(hw->mac_type < e1000_82540) { /* Nothing to do */ - return 0; + return E1000_SUCCESS; } ledctl = E1000_READ_REG(hw, LEDCTL); @@ -4075,7 +4039,7 @@ e1000_id_led_init(struct e1000_hw * hw) break; } } - return 0; + return E1000_SUCCESS; } /****************************************************************************** @@ -4590,9 +4554,11 @@ e1000_write_reg_io(struct e1000_hw *hw, * For IGP phy's, the function calculates the range by the AGC registers. *****************************************************************************/ int32_t -e1000_get_cable_length(struct e1000_hw *hw, uint16_t *min_length, +e1000_get_cable_length(struct e1000_hw *hw, + uint16_t *min_length, uint16_t *max_length) { + int32_t ret_val; uint16_t agc_value = 0; uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; uint16_t i, phy_data; @@ -4603,8 +4569,9 @@ e1000_get_cable_length(struct e1000_hw * /* Use old method for Phy older than IGP */ if(hw->phy_type == e1000_phy_m88) { - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, + &phy_data))) + return ret_val; /* Convert the enum value to ranged values */ switch((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> @@ -4707,22 +4674,26 @@ e1000_get_cable_length(struct e1000_hw * * IGP01E1000_PHY_PCS_INIT_REG. *****************************************************************************/ int32_t -e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity) +e1000_check_polarity(struct e1000_hw *hw, + uint16_t *polarity) { + int32_t ret_val; uint16_t phy_data; DEBUGFUNC("e1000_check_polarity"); if(hw->phy_type == e1000_phy_m88) { /* return the Polarity bit in the Status register. */ - if(e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, + &phy_data))) + return ret_val; *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> M88E1000_PSSR_REV_POLARITY_SHIFT; } else if(hw->phy_type == e1000_phy_igp) { /* Read the Status register to check the speed */ - if(e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data) < 0) - return -E1000_ERR_PHY; + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, + &phy_data))) + return ret_val; /* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to * find the polarity status */ From scott.feldman@intel.com Mon Sep 8 19:50:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:38 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892o4x4017201 for ; Mon, 8 Sep 2003 19:50:04 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892jHu01655 for ; Tue, 9 Sep 2003 02:45:17 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892nhC27443 for ; Tue, 9 Sep 2003 02:49:43 GMT Received: from [134.134.3.75] ([134.134.3.75]) by orsmsxvs040.jf.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819495528620 ; Mon, 08 Sep 2003 19:49:55 -0700 Date: Mon, 8 Sep 2003 20:14:35 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 6/11] make function our of setting media type Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5714 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 Content-Length: 3938 Lines: 118 * Consolidate code and make function out of setting media type. -------------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -249,6 +249,46 @@ e1000_set_mac_type(struct e1000_hw *hw) return E1000_SUCCESS; } + +/***************************************************************************** + * Set media type and TBI compatibility. + * + * hw - Struct containing variables accessed by shared code + * **************************************************************************/ +void +e1000_set_media_type(struct e1000_hw *hw) +{ + uint32_t status; + + DEBUGFUNC("e1000_set_media_type"); + + if(hw->mac_type != e1000_82543) { + /* tbi_compatibility is only valid on 82543 */ + hw->tbi_compatibility_en = FALSE; + } + + switch (hw->device_id) { + case E1000_DEV_ID_82545GM_SERDES: + case E1000_DEV_ID_82546GB_SERDES: + hw->media_type = e1000_media_type_internal_serdes; + break; + default: + if(hw->mac_type >= e1000_82543) { + status = E1000_READ_REG(hw, STATUS); + if(status & E1000_STATUS_TBIMODE) { + hw->media_type = e1000_media_type_fiber; + /* tbi_compatibility not valid on fiber */ + hw->tbi_compatibility_en = FALSE; + } else { + hw->media_type = e1000_media_type_copper; + } + } else { + /* This is an 82542 (fiber only) */ + hw->media_type = e1000_media_type_fiber; + } + } +} + /****************************************************************************** * Reset the transmit and receive units; mask and clear all interrupts. * @@ -404,7 +404,7 @@ e1000_reset_hw(struct e1000_hw *hw) int32_t e1000_init_hw(struct e1000_hw *hw) { - uint32_t ctrl, status; + uint32_t ctrl; uint32_t i; int32_t ret_val; uint16_t pcix_cmd_word; @@ -421,25 +390,8 @@ e1000_init_hw(struct e1000_hw *hw) return ret_val; } - /* Set the Media Type and exit with error if it is not valid. */ - if(hw->mac_type != e1000_82543) { - /* tbi_compatibility is only valid on 82543 */ - hw->tbi_compatibility_en = FALSE; - } - - if(hw->mac_type >= e1000_82543) { - status = E1000_READ_REG(hw, STATUS); - if(status & E1000_STATUS_TBIMODE) { - hw->media_type = e1000_media_type_fiber; - /* tbi_compatibility not valid on fiber */ - hw->tbi_compatibility_en = FALSE; - } else { - hw->media_type = e1000_media_type_copper; - } - } else { - /* This is an 82542 (fiber only) */ - hw->media_type = e1000_media_type_fiber; - } + /* Set the media type and TBI compatibility */ + e1000_set_media_type(hw); /* Disabling VLAN filtering. */ DEBUGOUT("Initializing the IEEE VLAN\n"); diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -625,18 +625,7 @@ e1000_sw_init(struct e1000_adapter *adap (hw->mac_type == e1000_82547_rev_2)) hw->phy_init_script = 1; - /* Media type - copper or fiber */ - - if(hw->mac_type >= e1000_82543) { - uint32_t status = E1000_READ_REG(hw, STATUS); - - if(status & E1000_STATUS_TBIMODE) - hw->media_type = e1000_media_type_fiber; - else - hw->media_type = e1000_media_type_copper; - } else { - hw->media_type = e1000_media_type_fiber; - } + e1000_set_media_type(hw); if(hw->mac_type < e1000_82543) hw->report_tx_early = 0; From scott.feldman@intel.com Mon Sep 8 19:50:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 08 Sep 2003 19:50:55 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by oss.sgi.com (8.12.9/8.12.5) with SMTP id h892oYx4017553 for ; Mon, 8 Sep 2003 19:50:34 -0700 Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) by hermes.py.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.83 2003/09/05 14:45:27 rfjohns1 Exp $) with ESMTP id h892jku01768 for ; Tue, 9 Sep 2003 02:45:46 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) by petasus.py.intel.com (8.11.6p2/8.11.6/d: inner.mc,v 1.35 2003/05/22 21:18:01 rfjohns1 Exp $) with SMTP id h892oCC27623 for ; Tue, 9 Sep 2003 02:50:12 GMT Received: from [134.134.3.75] ([134.134.3.75]) by orsmsxvs040.jf.intel.com (NAVGW 2.5.2.11) with SMTP id M2003090819502307210 ; Mon, 08 Sep 2003 19:50:23 -0700 Date: Mon, 8 Sep 2003 20:15:02 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: netdev@oss.sgi.com Subject: [e1000 2.6 11/11] misc whitespace cleanup, changelog Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 5719 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 Content-Length: 28189 Lines: 553 * misc whitespace cleanup, changelog ---------------- diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_ethtool.c 2003-08-22 16:55:33.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_ethtool.c 2003-09-08 09:13:10.000000000 -0700 @@ -1173,7 +1173,7 @@ e1000_ethtool_test(struct e1000_adapter e1000_down(adapter); else e1000_reset(adapter); - + if(e1000_reg_test(adapter, &data[0])) eth_test->flags |= ETH_TEST_FL_FAILED; diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.c 2003-08-22 17:01:40.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.c 2003-09-08 09:13:11.000000000 -0700 @@ -41,7 +41,8 @@ static int32_t e1000_config_mac_to_phy(struct e1000_hw *hw); static void e1000_raise_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); static void e1000_lower_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); -static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, uint32_t data, uint16_t count); +static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, uint32_t data, + uint16_t count); static uint16_t e1000_shift_in_mdi_bits(struct e1000_hw *hw); static int32_t e1000_phy_reset_dsp(struct e1000_hw *hw); static int32_t e1000_write_eeprom_spi(struct e1000_hw *hw, uint16_t offset, @@ -52,7 +52,8 @@ static int32_t e1000_write_eeprom_microw static int32_t e1000_spi_eeprom_ready(struct e1000_hw *hw); static void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd); static void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd); -static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, uint16_t count); +static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, + uint16_t count); static int32_t e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data); static int32_t e1000_read_phy_reg_ex(struct e1000_hw *hw,uint32_t reg_addr, @@ -257,7 +218,6 @@ e1000_set_mac_type(struct e1000_hw *hw) return -E1000_ERR_MAC_TYPE; } - return E1000_SUCCESS; } @@ -342,20 +280,21 @@ e1000_reset_hw(struct e1000_hw *hw) */ msec_delay(10); - /* Issue a global reset to the MAC. This will reset the chip's - * transmit, receive, DMA, and link units. It will not effect - * the current PCI configuration. The global reset bit is self- - * clearing, and should clear within a microsecond. - */ - DEBUGOUT("Issuing a global reset to MAC\n"); ctrl = E1000_READ_REG(hw, CTRL); /* Must reset the PHY before resetting the MAC */ if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); - msec_delay(5); + msec_delay(5); } + /* Issue a global reset to the MAC. This will reset the chip's + * transmit, receive, DMA, and link units. It will not effect + * the current PCI configuration. The global reset bit is self- + * clearing, and should clear within a microsecond. + */ + DEBUGOUT("Issuing a global reset to MAC\n"); + switch(hw->mac_type) { case e1000_82544: case e1000_82540: @@ -3083,7 +3083,8 @@ e1000_shift_out_ee_bits(struct e1000_hw * hw - Struct containing variables accessed by shared code *****************************************************************************/ static uint16_t -e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count) +e1000_shift_in_ee_bits(struct e1000_hw *hw, + uint16_t count) { uint32_t eecd; uint32_t i; @@ -4359,8 +4362,7 @@ e1000_update_adaptive(struct e1000_hw *h DEBUGFUNC("e1000_update_adaptive"); if(hw->adaptive_ifs) { - if((hw->collision_delta * hw->ifs_ratio) > - hw->tx_packet_delta) { + if((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { if(hw->tx_packet_delta > MIN_NUM_XMITS) { hw->in_ifs_mode = TRUE; if(hw->current_ifs_val < hw->ifs_max_val) { @@ -4372,8 +4374,7 @@ e1000_update_adaptive(struct e1000_hw *h } } } else { - if((hw->in_ifs_mode == TRUE) && - (hw->tx_packet_delta <= MIN_NUM_XMITS)) { + if(hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { hw->current_ifs_val = 0; hw->in_ifs_mode = FALSE; E1000_WRITE_REG(hw, AIT, 0); diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h --- linux-2.6.0-test4/drivers/net/e1000/e1000_hw.h 2003-08-22 16:58:59.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_hw.h 2003-09-08 09:13:16.000000000 -0700 @@ -33,9 +33,9 @@ #ifndef _E1000_HW_H_ #define _E1000_HW_H_ - #include "e1000_osdep.h" + /* Forward declarations of structures used by the shared code */ struct e1000_hw; struct e1000_hw_stats; @@ -425,7 +425,7 @@ void e1000_write_reg_io(struct e1000_hw E1000_IMS_RXSEQ | \ E1000_IMS_LSC) -/* The number of high/low register pairs in the RAR. The RAR (Receive Address +/* Number of high/low register pairs in the RAR. The RAR (Receive Address * Registers) holds the directed and multicast addresses that we monitor. We * reserve one of these spots for our directed address, allowing us room for * E1000_RAR_ENTRIES - 1 multicast addresses. @@ -579,7 +579,7 @@ struct e1000_rar { volatile uint32_t high; /* receive address high */ }; -/* The number of entries in the Multicast Table Array (MTA). */ +/* Number of entries in the Multicast Table Array (MTA). */ #define E1000_NUM_MTA_REGISTERS 128 /* IPv4 Address Table Entry */ @@ -1108,7 +1108,7 @@ struct e1000_hw { #define E1000_EECD_PRES 0x00000100 /* EEPROM Present */ #define E1000_EECD_SIZE 0x00000200 /* EEPROM Size (0=64 word 1=256 word) */ #define E1000_EECD_ADDR_BITS 0x00000400 /* EEPROM Addressing bits based on type - * (0-small, 1-large) */ + * (0-small, 1-large) */ #define E1000_EECD_TYPE 0x00002000 /* EEPROM Type (1-SPI, 0-Microwire) */ #ifndef E1000_EEPROM_GRANT_ATTEMPTS #define E1000_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ @@ -1170,22 +1170,22 @@ struct e1000_hw { #define E1000_MDIC_ERROR 0x40000000 /* LED Control */ -#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F -#define E1000_LEDCTL_LED0_MODE_SHIFT 0 -#define E1000_LEDCTL_LED0_IVRT 0x00000040 -#define E1000_LEDCTL_LED0_BLINK 0x00000080 -#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 -#define E1000_LEDCTL_LED1_MODE_SHIFT 8 -#define E1000_LEDCTL_LED1_IVRT 0x00004000 -#define E1000_LEDCTL_LED1_BLINK 0x00008000 -#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 -#define E1000_LEDCTL_LED2_MODE_SHIFT 16 -#define E1000_LEDCTL_LED2_IVRT 0x00400000 -#define E1000_LEDCTL_LED2_BLINK 0x00800000 -#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 -#define E1000_LEDCTL_LED3_MODE_SHIFT 24 -#define E1000_LEDCTL_LED3_IVRT 0x40000000 -#define E1000_LEDCTL_LED3_BLINK 0x80000000 +#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F +#define E1000_LEDCTL_LED0_MODE_SHIFT 0 +#define E1000_LEDCTL_LED0_IVRT 0x00000040 +#define E1000_LEDCTL_LED0_BLINK 0x00000080 +#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 +#define E1000_LEDCTL_LED1_MODE_SHIFT 8 +#define E1000_LEDCTL_LED1_IVRT 0x00004000 +#define E1000_LEDCTL_LED1_BLINK 0x00008000 +#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 +#define E1000_LEDCTL_LED2_MODE_SHIFT 16 +#define E1000_LEDCTL_LED2_IVRT 0x00400000 +#define E1000_LEDCTL_LED2_BLINK 0x00800000 +#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 +#define E1000_LEDCTL_LED3_MODE_SHIFT 24 +#define E1000_LEDCTL_LED3_IVRT 0x40000000 +#define E1000_LEDCTL_LED3_BLINK 0x80000000 #define E1000_LEDCTL_MODE_LINK_10_1000 0x0 #define E1000_LEDCTL_MODE_LINK_100_1000 0x1 @@ -1208,109 +1208,109 @@ struct e1000_hw { #define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ /* Interrupt Cause Read */ -#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ -#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ -#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ -#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */ -#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ -#define E1000_ICR_RXO 0x00000040 /* rx overrun */ -#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ -#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ -#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */ -#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ -#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ -#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ -#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ -#define E1000_ICR_TXD_LOW 0x00008000 -#define E1000_ICR_SRPD 0x00010000 +#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ +#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ +#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ +#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */ +#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ +#define E1000_ICR_RXO 0x00000040 /* rx overrun */ +#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ +#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ +#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */ +#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ +#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ +#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ +#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ +#define E1000_ICR_TXD_LOW 0x00008000 +#define E1000_ICR_SRPD 0x00010000 /* Interrupt Cause Set */ -#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_ICS_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_ICS_SRPD E1000_ICR_SRPD +#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_ICS_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_ICS_SRPD E1000_ICR_SRPD /* Interrupt Mask Set */ -#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_IMS_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_IMS_SRPD E1000_ICR_SRPD +#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_IMS_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMS_SRPD E1000_ICR_SRPD /* Interrupt Mask Clear */ -#define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_IMC_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_IMC_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_IMC_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_IMC_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_IMC_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_IMC_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_IMC_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_IMC_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_IMC_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_IMC_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_IMC_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_IMC_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_IMC_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_IMC_SRPD E1000_ICR_SRPD +#define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_IMC_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_IMC_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_IMC_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_IMC_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_IMC_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_IMC_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_IMC_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_IMC_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_IMC_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_IMC_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_IMC_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_IMC_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_IMC_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMC_SRPD E1000_ICR_SRPD /* Receive Control */ -#define E1000_RCTL_RST 0x00000001 /* Software reset */ -#define E1000_RCTL_EN 0x00000002 /* enable */ -#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ -#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ -#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ -#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ -#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ -#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ -#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ -#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ -#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */ -#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ -#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ -#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ -#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ -#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ -#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ -#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ +#define E1000_RCTL_RST 0x00000001 /* Software reset */ +#define E1000_RCTL_EN 0x00000002 /* enable */ +#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ +#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ +#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ +#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ +#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ +#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ +#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ +#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ +#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ +#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */ +#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */ +#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ +#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ +#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ +#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ +#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ +#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ +#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ -#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */ -#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */ -#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */ -#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */ +#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */ +#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */ +#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */ +#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ -#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */ -#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */ -#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */ -#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ -#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ -#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ -#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ -#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ -#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ +#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */ +#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */ +#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */ +#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ +#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ +#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ +#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ +#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ +#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ /* Receive Descriptor */ #define E1000_RDT_DELAY 0x0000ffff /* Delay timer (1=1024us) */ @@ -1546,7 +1546,7 @@ struct e1000_hw { #define E1000_HDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE #define E1000_COLD_SHIFT 12 -/* The number of Transmit and Receive Descriptors must be a multiple of 8 */ +/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ #define REQ_TX_DESCRIPTOR_MULTIPLE 8 #define REQ_RX_DESCRIPTOR_MULTIPLE 8 @@ -1613,35 +1613,30 @@ struct e1000_hw { #define PCIX_STATUS_HI_MMRBC_2K 0x2 -/* The number of bits that we need to shift right to move the "pause" - * bits from the EEPROM (bits 13:12) to the "pause" (bits 8:7) field - * in the TXCW register +/* Number of bits required to shift right the "pause" bits from the + * EEPROM (bits 13:12) to the "pause" (bits 8:7) field in the TXCW register. */ #define PAUSE_SHIFT 5 -/* The number of bits that we need to shift left to move the "SWDPIO" - * bits from the EEPROM (bits 8:5) to the "SWDPIO" (bits 25:22) field - * in the CTRL register +/* Number of bits required to shift left the "SWDPIO" bits from the + * EEPROM (bits 8:5) to the "SWDPIO" (bits 25:22) field in the CTRL register. */ #define SWDPIO_SHIFT 17 -/* The number of bits that we need to shift left to move the "SWDPIO_EXT" - * bits from the EEPROM word F (bits 7:4) to the bits 11:8 of The - * Extended CTRL register. - * in the CTRL register +/* Number of bits required to shift left the "SWDPIO_EXT" bits from the + * EEPROM word F (bits 7:4) to the bits 11:8 of The Extended CTRL register. */ #define SWDPIO__EXT_SHIFT 4 -/* The number of bits that we need to shift left to move the "ILOS" - * bit from the EEPROM (bit 4) to the "ILOS" (bit 7) field - * in the CTRL register +/* Number of bits required to shift left the "ILOS" bit from the EEPROM + * (bit 4) to the "ILOS" (bit 7) field in the CTRL register. */ #define ILOS_SHIFT 3 #define RECEIVE_BUFFER_ALIGN_SIZE (256) -/* The number of milliseconds we wait for auto-negotiation to complete */ +/* Number of milliseconds we wait for auto-negotiation to complete */ #define LINK_UP_TIMEOUT 500 #define E1000_TX_BUFFER_SIZE ((uint32_t)1514) @@ -1987,7 +1982,6 @@ struct e1000_hw { #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ #define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ - /* IGP01E1000 Specific Port Config Register - R/W */ #define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010 #define IGP01E1000_PSCFR_PRE_EN 0x0020 @@ -2061,6 +1984,7 @@ uint16_t e1000_igp_cable_length_table[IG #define IGP01E1000_GMII_FLEX_SPD 0x10 /* Enable flexible speed * on Link-Up */ #define IGP01E1000_GMII_SPD 0x20 /* Enable SPD */ + /* IGP01E1000 Analog Register */ #define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x20D1 #define IGP01E1000_ANALOG_FUSE_STATUS 0x20D0 diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_main.c linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c --- linux-2.6.0-test4/drivers/net/e1000/e1000_main.c 2003-08-22 16:54:23.000000000 -0700 +++ linux-2.6.0-test4/drivers/net/e1000.new/e1000_main.c 2003-09-08 09:13:11.000000000 -0700 @@ -30,6 +30,22 @@ /* Change Log * + * 5.2.16 8/8/03 + * o Added support for new controllers: 82545GM, 82546GB, 82541/7_B1 + * o Bug fix: reset h/w before first EEPROM read because we don't know + * who may have been messing with the device before we got there. + * [Dave Johnson (ddj -a-t- cascv.brown.edu)] + * o Bug fix: read the correct work from EEPROM to detect programmed + * WoL settings. + * o Bug fix: TSO would hang if space left in FIFO was being miscalculated + * when mss dropped without a correspoding drop in the DMA buffer size. + * o ASF for Fiber nics isn't supported. + * o Bug fix: Workaround added for potential hang with 82544 running in + * PCI-X if send buffer terminates within an evenly-aligned dword. + * o Feature: Add support for ethtool flow control setting. + * o Feature: Add support for ethtool TSO setting. + * o Feature: Increase default Tx Descriptor count to 1024 for >= 82544. + * * 5.1.13 5/28/03 * o Bug fix: request_irq() failure resulted in freeing resources twice! * [Don Fry (brazilnut@us.ibm.com)] @@ -39,18 +55,11 @@ * o Cleanup: s/int/unsigned int/ for descriptor ring indexes. * * 5.1.11 5/6/03 - * o Feature: Added support for 82546EB (Quad-port) hardware. - * o Feature: Added support for Diagnostics through Ethtool. - * o Cleanup: Removed /proc support. - * o Cleanup: Removed proprietary IDIAG interface. - * o Bug fix: TSO bug fixes. - * - * 5.0.42 3/5/03 */ char e1000_driver_name[] = "e1000"; char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; -char e1000_driver_version[] = "5.1.13-k2"; +char e1000_driver_version[] = "5.2.16-k1"; char e1000_copyright[] = "Copyright (c) 1999-2003 Intel Corporation."; /* e1000_pci_tbl - PCI Device ID Table @@ -475,7 +484,7 @@ e1000_probe(struct pci_dev *pdev, adapter->phy_info_timer.function = &e1000_update_phy_info; adapter->phy_info_timer.data = (unsigned long) adapter; - INIT_WORK(&adapter->tx_timeout_task, + INIT_WORK(&adapter->tx_timeout_task, (void (*)(void *))e1000_tx_timeout_task, netdev); register_netdev(netdev); @@ -2078,6 +2087,7 @@ e1000_intr(int irq, void *data, struct p !e1000_clean_tx_irq(adapter)) break; #endif + return IRQ_HANDLED; } @@ -2736,7 +2746,7 @@ e1000_notify_reboot(struct notifier_bloc case SYS_DOWN: case SYS_HALT: case SYS_POWER_OFF: - while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { + while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) { if(pci_dev_driver(pdev) == &e1000_driver) e1000_suspend(pdev, 3); } diff -Nuarp linux-2.6.0-test4/drivers/net/e1000/e1000_osdep.h linux-2.6.0-test4/drivers/net/e1000.new/e1000_osdep.h --- linux-2.6.0