From davem@redhat.com Thu May 1 01:08:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 01:08: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.9) with SMTP id h4188GFu012758 for ; Thu, 1 May 2003 01:08:18 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA32338; Thu, 1 May 2003 00:00:58 -0700 Date: Thu, 01 May 2003 00:00:58 -0700 (PDT) Message-Id: <20030501.000058.39187964.davem@redhat.com> To: kuznet@ms2.inr.ac.ru Cc: shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br, rusty@rustcorp.com.au Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <200305010110.FAA08689@sex.inr.ac.ru> References: <20030429.232631.68131803.davem@redhat.com> <200305010110.FAA08689@sex.inr.ac.ru> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2393 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 From: kuznet@ms2.inr.ac.ru Date: Thu, 1 May 2003 05:10:33 +0400 (MSD) [ Rusty, just skip down to "Ok ok ok!", it's something we've discussed before. Some of these problems are becomming so widespread that we need to implement a fix, I'll probably be the one to end up doing it... ] > 1) dev_get() gets module reference and dev_put() puts is. > Ugly, as this means dev_get() can fail, but this does > cover all the possible cases. Seems, you eventually _really_ understood why I histerically moan about bogosity of modules and maybe ready to recongnize that it is not just histerical moaning in some part. :-) Yes, I know, and we can talk about this until the cows come home... :-) > 2) Make unregister_netdev() wait for refcount to reach 1 > regardless of whether dev->destructor is NULL or not. > > I don't like #1. Do you see some holes in #2? It is deadlock. What exactly is this deadlock? Let me think... None of destructors kill reference to device object, and I mean none of them. It is why I thought the idea works. Also, holding RTNL semaphore does not block potential holders of device reference. Or does it? > As Stephen brought up, this also means we should do something > about that NETDEV_UNREGISTER code in dst_dev_event() :-( It is just one and the simplest subcase of general situation. Module must not be unloaded while device is held, that's all. Ok ok ok!!! Let us depict how it might work in your idealized module scheme ok? Your idea, as I understand it, is to add callback to module that freezes module then at some time in the future makes indication that module is clean and may be unloaded safely. The logic is that module knows about reference, internal attributes, etc. and thus can check for unloadability better than any simple refcounting system can. The best argument for this are things like ipv6 which are enormously complicated to load/unload safely. If we were to use the module refcounting system to make ipv6 unloading work cleanly, every other line of the ipv6 code would be some module get/put. :-) So the unload sequence is something like: /* Shutdown the module, so that no new references may * be created. */ rc = module->shutdown(module); if (rc) goto out_err; wait_event(&module->unload_waitq, module->unloadable); module->exit(); Then, using netdevice as an example, register_netdevice() would do something like: module_add_instance(dev->owner); which is simply: void module_add_instance(struct module *module) { if (module) atomic_inc(&module->instances); } The net device drivers add: module_shutdown(netdev_module_shutdown); And then netdev_module_shutdown() would go: int netdev_module_shutdown(struct module *module) { struct net_device *d, *d_next; rtnl_lock(); d_next = NULL; for (d = dev_base; d != NULL; d = d_next) { d_next = d->next; if (d->owner == module) { if (unregister_netdevice(d)) BUG(); /* Keep traversing, this module may drive * multiple device instances. */ } } rtnl_unlock(); return 0; } And, at final dev_put(), netdev_finish_unregister() is invoked, and we change it to look something like this: int netdev_finish_unregister(struct net_device *dev) { BUG_TRAP(!dev->ip_ptr); BUG_TRAP(!dev->ip6_ptr); BUG_TRAP(!dev->dn_ptr); if (!dev->deadbeaf) { printk(KERN_ERR "Freeing alive device %p, %s\n", dev, dev->name); return 0; } #ifdef NET_REFCNT_DEBUG printk(KERN_DEBUG "netdev_finish_unregister: %s%s.\n", dev->name, (dev->destructor != NULL)?"":", old style"); #endif if (dev->destructor) dev->destructor(dev); module_dec_instance(dev->owner); return 0; } We implement module_dev_instance as: void module_dec_instance(struct module *module) { if (module && atomic_dec_and_test(&module->instances)) module_is_unloadable(module); } Finally, we implement module_is_unloadable() which is simply: void module_is_unloadable(struct module *module) { if (module) { module->unloadable = 1; wake_up(&module->unload_waitq); } } Next, let us make socket example for "simple protocol". static int __init simple_proto_init(void) { int rc; rc = sock_register(&simple_proto_ops); if (rc) return rc; return 0; } static int __exit simple_proto_shutdown(struct module *module) { int rc; rc = sock_unregister(AF_SIMPLE); if (rc) return rc; return 0; } module_init(simple_proto_init); module_shutdown(simple_proto_shutdown); Now, where to place the code to mark module as unloadable? We could maintain state internally using: static atomic_t nr_simple_sockets; And as sockets are created/destroyed, we inc/dec this thing. When it is decreamented to zero, we can say module_is_unloadable(THIS_MODULE); Question is, where to make this? It cannot be in the module itself of course, that would create race condition similar to one which exists today making this exercise quite pointless :-) Alexey and I had some private conversations about this with Rusty, he agreed with our sentiments mostly, but he was concerned about unload semantics and some unfortunate side effects of two-stage unload. Specifically, consider: int example_module_shutdown(struct module *module) { int rc; rc = unregister_foo(&foo); if (rc) return rc; rc = unregister_bar(&bar); if (rc) { register_foo(&foo); return rc; } return 0; } Note the problem. If between the unregister_foo() and re-register of foo in the failure path, someone asks to open a "foo" it will fail. Those semantics absolutely stink. Rusty went on to describe that this is one of the reasons for the current "enable refcounts" scheme with try_module_get(). A single binary state enables all of the interfaces to start to succeed. ie. opening an object created by the module does not succeed until module->init() finishes successfully and thus try_module_get() starts to return success. I think he was trying to hint to us that some analogue needs to occur for shutdown as well. Ie. to rewrite my shutdown logic above: rc = stop_refcounts(mod); if (rc) goto out_err; if (mod->shutdown) { /* Shutdown the module, so that no new references may * be created. */ rc = mod->shutdown(mod); if (rc) { restart_refcounts(mod); goto out_err; } wait_event(&mod->unload_waitq, mod->unloadable); if (module_refcount(mod) != 0) BUG(); } restart_refcounts(mod); /* ... put here all the existing code in sys_delete_module() * ... dealing O_NONBLOCK etc. etc. */ module->exit(); module_free(mod); I am not even sure this is right. It's quite a tricky area and requires real brains to solve. From Robert.Olsson@data.slu.se Thu May 1 01:22:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 01:22:16 -0700 (PDT) Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h418M4Fu013102 for ; Thu, 1 May 2003 01:22:06 -0700 Received: (from robert@localhost) by robur.slu.se (8.9.3p2/8.9.3) id KAA15796; Thu, 1 May 2003 10:21:59 +0200 From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16048.55590.505315.91846@robur.slu.se> Date: Thu, 1 May 2003 10:21:58 +0200 To: "Randy.Dunlap" Cc: Stephen Hemminger , davem@redhat.com, netdev@oss.sgi.com Subject: Re: Favorite network stress tests? In-Reply-To: <20030430165244.4b247318.rddunlap@osdl.org> References: <20030430163542.4e09076f.shemminger@osdl.org> <20030430165244.4b247318.rddunlap@osdl.org> X-Mailer: VM 6.92 under Emacs 19.34.1 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2394 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Randy.Dunlap writes: > ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/ > (is this the same pktgen that is now in 2.5 kernels?) No I've asked for testers but haven't got any response at all so it's not pushed towards 2.5 yet. Cheers. --ro From davem@redhat.com Thu May 1 03:27:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 03:27: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.9) with SMTP id h41ARLFu016848 for ; Thu, 1 May 2003 03:27:21 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA32684; Thu, 1 May 2003 02:20:40 -0700 Date: Thu, 01 May 2003 02:20:40 -0700 (PDT) Message-Id: <20030501.022040.15235711.davem@redhat.com> To: maxk@qualcomm.com Cc: acme@conectiva.com.br, netdev@oss.sgi.com Subject: Re: [PATCH] af_pppox: create module infrastructure for protocol modules From: "David S. Miller" In-Reply-To: <1051726260.13512.59.camel@localhost.localdomain> References: <5.1.0.14.2.20030429123317.10d71178@unixmail.qualcomm.com> <20030429.192931.104061911.davem@redhat.com> <1051726260.13512.59.camel@localhost.localdomain> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2395 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 From: Max Krasnyansky Date: 30 Apr 2003 11:11:37 -0700 And like I said before if protocol wants for some reason to be around until sk is destroyed it will simply do sk_set_owner() right after alloc_sk(). Ok Maxim, thanks for your comments and insight. I believe this whole discussion is going to take a different course towards a solution, different than anything discussed in this thread so far. Please follow the discussion with topic "dev->destructor" on this list (netdev) to see precisely what I am talking about. From fw@deneb.enyo.de Thu May 1 03:38:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 03:39:02 -0700 (PDT) Received: from mail.enyo.de (gw.enyo.de [212.9.189.178]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h41ActFu017517 for ; Thu, 1 May 2003 03:38:57 -0700 Received: from [212.9.189.171] (helo=deneb.enyo.de) by mail.enyo.de with esmtp (Exim 3.34 #2) id 19BBSZ-0004yq-00; Thu, 01 May 2003 12:38:39 +0200 Received: from fw by deneb.enyo.de with local (Exim 3.34 #4) id 19BBSY-00019J-00; Thu, 01 May 2003 12:38:38 +0200 To: Robert Olsson Cc: Christoph Hellwig , davem@redhat.com, netdev@oss.sgi.com Subject: Re: purpose of the skb head pool References: <20030429135506.A22411@lst.de> <16046.30879.738356.495523@robur.slu.se> In-Reply-To: <16046.30879.738356.495523@robur.slu.se> (Robert Olsson's message of "Tue, 29 Apr 2003 15:05:35 +0200") From: Florian Weimer Date: Thu, 01 May 2003 12:38:38 +0200 Message-ID: <877k9bc5ox.fsf@deneb.enyo.de> User-Agent: Gnus/5.09002 (Oort Gnus v0.20) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2396 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: fw@deneb.enyo.de Precedence: bulk X-list: netdev Robert Olsson writes: > 2.6.66 IP. Forwarding of two input simplex flows. eth0->eth1, eth2->eth3 > Fixed affinity CPU0: eth0, eth3. CPU1: eth1, eth2. Which common for routing > and should be "worst case" for other use. The test should give a very high > load on the packet memory system. As seen at least we don't see any > improvement from skb_head_pool code. > > > Vanilla 2.5.66 381 kpps > Magazine 431 kpps > Magazine + no skb_head_pool 435 kpps Can you rerun this test with random source/destination addresses, to get more realistic (for some configurations) numbers? From davem@redhat.com Thu May 1 03:42:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 03:42: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.9) with SMTP id h41Ag6Fu017831 for ; Thu, 1 May 2003 03:42:07 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA32743; Thu, 1 May 2003 02:35:28 -0700 Date: Thu, 01 May 2003 02:35:28 -0700 (PDT) Message-Id: <20030501.023528.116383508.davem@redhat.com> To: fw@deneb.enyo.de Cc: Robert.Olsson@data.slu.se, hch@lst.de, netdev@oss.sgi.com Subject: Re: purpose of the skb head pool From: "David S. Miller" In-Reply-To: <877k9bc5ox.fsf@deneb.enyo.de> References: <20030429135506.A22411@lst.de> <16046.30879.738356.495523@robur.slu.se> <877k9bc5ox.fsf@deneb.enyo.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2397 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 From: Florian Weimer Date: Thu, 01 May 2003 12:38:38 +0200 Robert Olsson writes: > Vanilla 2.5.66 381 kpps > Magazine 431 kpps > Magazine + no skb_head_pool 435 kpps Can you rerun this test with random source/destination addresses, to get more realistic (for some configurations) numbers? He can do this, but the issues we're trying to tackle first have nothing to even do with what kind of routing cache accesses are done. It's all networking buffer overhead we're worried about at this stage. From davem@redhat.com Thu May 1 05:16:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 05:16: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.9) with SMTP id h41CGgFu019668 for ; Thu, 1 May 2003 05:16:42 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id EAA00589; Thu, 1 May 2003 04:09:36 -0700 Date: Thu, 01 May 2003 04:09:35 -0700 (PDT) Message-Id: <20030501.040935.68070653.davem@redhat.com> To: rusty@rustcorp.com.au Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br, wa@almesberger.net Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030501120815.25BE22C155@lists.samba.org> References: <20030501.000058.39187964.davem@redhat.com> <20030501120815.25BE22C155@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2398 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 From: Rusty Russell Date: Thu, 01 May 2003 22:01:19 +1000 There are 70 calls to dev_hold() in the kernel. The vast majority of them already have a reference, they just want another one: dev_hold() can do __module_get(). Rusty, this is precisely the what Alexey and myself want to avoid. On the surface, it looks fine, only 70 dev_get's in the kernel right? But think further... So you propose to add this kind of thing for every ARP entry, every route cache entry, every IPSEC policy, every socket, every struct sock, every networking dynamic object ever created? When we add SKB recycling, will we need to do a module get/put on every SKB alloc/free/clone/copy? I think this way lies insanity :) You may make the decision to eat this kind of overhead inside of netfilter, but Alexey and I do not accept this. I disagreed with Alexey initially, but now I truly see his wisdom. This networking device example is just the tip of the iceberg. We can continue to add bandaids across the kernel, instead of solving the real problem that modules need to manage their own removal. It is at the core of the reason the current module scheme has to be extended to let the module manage unloading. From rusty@samba.org Thu May 1 05:49:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 05:49:40 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h41CnDFu020246 for ; Thu, 1 May 2003 05:49:14 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 25BE22C155; Thu, 1 May 2003 12:08:15 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru Cc: shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br, Werner Almesberger Subject: Re: dev->destructor In-reply-to: Your message of "Thu, 01 May 2003 00:00:58 MST." <20030501.000058.39187964.davem@redhat.com> Date: Thu, 01 May 2003 22:01:19 +1000 Message-Id: <20030501120815.25BE22C155@lists.samba.org> X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2399 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030501.000058.39187964.davem@redhat.com> you write: > From: kuznet@ms2.inr.ac.ru > Date: Thu, 1 May 2003 05:10:33 +0400 (MSD) > > [ Rusty, just skip down to "Ok ok ok!", it's something we've > discussed before. Some of these problems are becomming so > widespread that we need to implement a fix, I'll probably be > the one to end up doing it... ] > > > 1) dev_get() gets module reference and dev_put() puts is. > > Ugly, as this means dev_get() can fail, but this does > > cover all the possible cases. > > Seems, you eventually _really_ understood why I histerically moan > about bogosity of modules and maybe ready to recongnize that it is > not just histerical moaning in some part. :-) > > Yes, I know, and we can talk about this until the cows come > home... :-) I agree with Alexey. Modules are poor-man's microkernel: allowing them to be unloaded has always been a horror. But I failed to convince my collegues of this at the 2002 kernel summit, so I did the best with what we had. If I had my way, we would *never* remove modules (even on failed init: we might re-try init later, but never free the memory). But before we redesign module architecture from scratch, let's look at a solution with what we do have (assuming Linus takes my damn __module_get() patch some day, see below). There are 70 calls to dev_hold() in the kernel. The vast majority of them already have a reference, they just want another one: dev_hold() can do __module_get(). There are a few *sources* of devices: dev_get, dev_get_by*. These should check and fail, using "try_dev_hold()" or something. Unfortunately auditing all the __dev_get_by* is quite a task, since it's used very widely (and I think, sometime erroneously). Completely untested patch below other patch. I need more time to digest your proposal in detail, Dave. Expect reply w/in 24 hours. Thanks. Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. Name: __module_get Author: Rusty Russell Status: Tested on 2.5.68-bk10 D: Introduces __module_get for places where we know we already hold D: a reference and ignoring the fact that the module is being "rmmod --wait"ed D: is simpler. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .5001-linux-2.5.67-bk5/fs/filesystems.c .5001-linux-2.5.67-bk5.updated/fs/filesystems.c --- .5001-linux-2.5.67-bk5/fs/filesystems.c 2003-04-14 13:45:44.000000000 +1000 +++ .5001-linux-2.5.67-bk5.updated/fs/filesystems.c 2003-04-14 15:44:36.000000000 +1000 @@ -32,17 +32,7 @@ static rwlock_t file_systems_lock = RW_L /* WARNING: This can be used only if we _already_ own a reference */ void get_filesystem(struct file_system_type *fs) { - if (!try_module_get(fs->owner)) { -#ifdef CONFIG_MODULE_UNLOAD - unsigned int cpu = get_cpu(); - local_inc(&fs->owner->ref[cpu].count); - put_cpu(); -#else - /* Getting filesystem while it's starting up? We're - already supposed to have a reference. */ - BUG(); -#endif - } + __module_get(fs->owner); } void put_filesystem(struct file_system_type *fs) diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .5001-linux-2.5.67-bk5/include/linux/module.h .5001-linux-2.5.67-bk5.updated/include/linux/module.h --- .5001-linux-2.5.67-bk5/include/linux/module.h 2003-04-08 11:15:01.000000000 +1000 +++ .5001-linux-2.5.67-bk5.updated/include/linux/module.h 2003-04-14 15:45:15.000000000 +1000 @@ -255,6 +255,7 @@ struct module *module_text_address(unsig #ifdef CONFIG_MODULE_UNLOAD +unsigned int module_refcount(struct module *mod); void __symbol_put(const char *symbol); #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) void symbol_put_addr(void *addr); @@ -265,6 +266,17 @@ void symbol_put_addr(void *addr); #define local_dec(x) atomic_dec(x) #endif +/* Sometimes we know we already have a refcount, and it's easier not + to handle the error case (which only happens with rmmod --wait). */ +static inline void __module_get(struct module *module) +{ + if (module) { + BUG_ON(module_refcount(module) == 0); + local_inc(&module->ref[get_cpu()].count); + put_cpu(); + } +} + static inline int try_module_get(struct module *module) { int ret = 1; @@ -300,6 +317,9 @@ static inline int try_module_get(struct static inline void module_put(struct module *module) { } +static inline void __module_get(struct module *module) +{ +} #define symbol_put(x) do { } while(0) #define symbol_put_addr(p) do { } while(0) @@ -357,6 +377,10 @@ static inline struct module *module_text #define symbol_put(x) do { } while(0) #define symbol_put_addr(x) do { } while(0) +static inline void __module_get(struct module *module) +{ +} + static inline int try_module_get(struct module *module) { return 1; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .5001-linux-2.5.67-bk5/kernel/module.c .5001-linux-2.5.67-bk5.updated/kernel/module.c --- .5001-linux-2.5.67-bk5/kernel/module.c 2003-04-14 13:45:46.000000000 +1000 +++ .5001-linux-2.5.67-bk5.updated/kernel/module.c 2003-04-14 15:44:36.000000000 +1000 @@ -431,7 +431,7 @@ static inline void restart_refcounts(voi } #endif -static unsigned int module_refcount(struct module *mod) +unsigned int module_refcount(struct module *mod) { unsigned int i, total = 0; @@ -439,6 +439,7 @@ static unsigned int module_refcount(stru total += atomic_read(&mod->ref[i].count); return total; } +EXPORT_SYMBOL(module_refcount); /* This exists whether we can unload or not */ static void free_module(struct module *mod); ================ Name: try_dev_hold Author: Rusty Russell Status: Experimental Depends: Module/module_dup.patch.gz D: Make dev_hold() actually duplicate the module reference count, and D: introduce try_dev_hold() for where refcount may be zero. Some D: places seemed to use dev_hold() to initialize the device reference D: count to 1. D: D: Lots of fixmes caused by quick audit of __dev_get_by* and D: dev_getbyhwaddr. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/drivers/net/shaper.c working-2.5.68-bk10-netdevice/drivers/net/shaper.c --- linux-2.5.68-bk10/drivers/net/shaper.c 2003-04-08 11:14:26.000000000 +1000 +++ working-2.5.68-bk10-netdevice/drivers/net/shaper.c 2003-05-01 21:21:46.000000000 +1000 @@ -526,6 +526,7 @@ static int shaper_neigh_setup_dev(struct static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net_device *dev) { + /* FIXME: No reference to dev --RR */ sh->dev = dev; sh->hard_start_xmit=dev->hard_start_xmit; sh->get_stats=dev->get_stats; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/drivers/net/wan/dlci.c working-2.5.68-bk10-netdevice/drivers/net/wan/dlci.c --- linux-2.5.68-bk10/drivers/net/wan/dlci.c 2003-03-18 05:01:46.000000000 +1100 +++ working-2.5.68-bk10-netdevice/drivers/net/wan/dlci.c 2003-05-01 21:20:31.000000000 +1000 @@ -457,6 +457,7 @@ int dlci_add(struct dlci_add *dlci) *(short *)(master->dev_addr) = dlci->dlci; dlp = (struct dlci_local *) master->priv; + /* FIXME: We have no reference to slave here. --RR */ dlp->slave = slave; flp = slave->priv; @@ -484,6 +485,7 @@ int dlci_del(struct dlci_add *dlci) /* validate slave device */ master = __dev_get_by_name(dlci->devname); + /* FIXME: No lock, no reference held to master. --RR */ if (!master) return(-ENODEV); diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/include/linux/netdevice.h working-2.5.68-bk10-netdevice/include/linux/netdevice.h --- linux-2.5.68-bk10/include/linux/netdevice.h 2003-04-08 11:15:01.000000000 +1000 +++ working-2.5.68-bk10-netdevice/include/linux/netdevice.h 2003-05-01 20:03:27.000000000 +1000 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -634,7 +635,25 @@ static inline void dev_put(struct net_de } #define __dev_put(dev) atomic_dec(&(dev)->refcnt) -#define dev_hold(dev) atomic_inc(&(dev)->refcnt) + +/* If you already have a reference, and are duplicating it. */ +#define dev_hold(dev) \ +do { \ + atomic_inc(&(dev)->refcnt); \ + __module_get((dev)->owner); \ +} while(0) + +/* If you need a new reference, or will be holding it for a long time. + If this returns 0, pretend dev doesn't exist (it's being removed now). */ +#define try_dev_hold(dev) \ +({ \ + int __ret = 1; \ + if (try_module_get((dev)->owner)) \ + atomic_inc(&(dev)->refcnt); \ + else \ + __ret = 0; \ + __ret; \ +}) /* Carrier loss detection, dial on demand. The functions netif_carrier_on * and _off may be called from IRQ context, but it is caller diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/802/tr.c working-2.5.68-bk10-netdevice/net/802/tr.c --- linux-2.5.68-bk10/net/802/tr.c 2003-02-07 19:21:54.000000000 +1100 +++ working-2.5.68-bk10-netdevice/net/802/tr.c 2003-05-01 21:24:46.000000000 +1000 @@ -479,6 +479,7 @@ static int rif_get_info(char *buffer,cha for(i=0;i < RIF_TABLE_SIZE;i++) { for(entry=rif_table[i];entry;entry=entry->next) { + /* FIXME: No lock, and no reference to dev. --RR */ struct net_device *dev = __dev_get_by_index(entry->iface); size=sprintf(buffer+len,"%s %02X:%02X:%02X:%02X:%02X:%02X %7li ", diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/appletalk/ddp.c working-2.5.68-bk10-netdevice/net/appletalk/ddp.c --- linux-2.5.68-bk10/net/appletalk/ddp.c 2003-05-01 09:29:34.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/appletalk/ddp.c 2003-05-01 21:28:03.000000000 +1000 @@ -920,6 +920,7 @@ static int atrtr_ioctl(unsigned int cmd, * space, isn't it? */ if (rt.rt_dev) { + /* FIXME: No lock, and no reference to dev --RR */ dev = __dev_get_by_name(rt.rt_dev); if (!dev) return -ENODEV; @@ -1217,6 +1218,7 @@ static __inline__ int is_ip_over_ddp(str static int handle_ip_over_ddp(struct sk_buff *skb) { + /* FIXME: No lock, and no reference held to dev. --RR */ struct net_device *dev = __dev_get_by_name("ipddp0"); struct net_device_stats *stats; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/core/dev.c working-2.5.68-bk10-netdevice/net/core/dev.c --- linux-2.5.68-bk10/net/core/dev.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/core/dev.c 2003-05-01 20:19:24.000000000 +1000 @@ -440,8 +440,8 @@ struct net_device *dev_get_by_name(const read_lock(&dev_base_lock); dev = __dev_get_by_name(name); - if (dev) - dev_hold(dev); + if (dev && !try_dev_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -513,8 +513,8 @@ struct net_device *dev_get_by_index(int read_lock(&dev_base_lock); dev = __dev_get_by_index(ifindex); - if (dev) - dev_hold(dev); + if (dev && !try_dev_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -563,8 +563,8 @@ struct net_device * dev_get_by_flags(uns read_lock(&dev_base_lock); dev = __dev_get_by_flags(if_flags, mask); - if (dev) - dev_hold(dev); + if (dev && !try_dev_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -2611,7 +2611,7 @@ int register_netdevice(struct net_device dev_init_scheduler(dev); write_lock_bh(&dev_base_lock); *dp = dev; - dev_hold(dev); + atomic_set(&dev->refcnt, 1); dev->deadbeaf = 0; write_unlock_bh(&dev_base_lock); @@ -2899,7 +2899,7 @@ static int __init net_dev_init(void) #endif dev->xmit_lock_owner = -1; dev->iflink = -1; - dev_hold(dev); + atomic_set(&dev->refcnt, 1); /* * Allocate name. If the init() fails diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/core/pktgen.c working-2.5.68-bk10-netdevice/net/core/pktgen.c --- linux-2.5.68-bk10/net/core/pktgen.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/core/pktgen.c 2003-05-01 21:31:45.000000000 +1000 @@ -226,21 +226,20 @@ static struct net_device *setup_inject(s { struct net_device *odev; - rtnl_lock(); - odev = __dev_get_by_name(info->outdev); + odev = dev_get(info->outdev); if (!odev) { sprintf(info->result, "No such netdevice: \"%s\"", info->outdev); - goto out_unlock; + return NULL; } if (odev->type != ARPHRD_ETHER) { sprintf(info->result, "Not ethernet device: \"%s\"", info->outdev); - goto out_unlock; + goto out_put; } if (!netif_running(odev)) { sprintf(info->result, "Device is down: \"%s\"", info->outdev); - goto out_unlock; + goto out_put; } /* Default to the interface's mac if not explicitly set. */ @@ -281,14 +280,11 @@ static struct net_device *setup_inject(s info->cur_daddr = info->daddr_min; info->cur_udp_dst = info->udp_dst_min; info->cur_udp_src = info->udp_src_min; - - atomic_inc(&odev->refcnt); - rtnl_unlock(); return odev; -out_unlock: - rtnl_unlock(); +out_put: + dev_put(odev); return NULL; } diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/decnet/dn_dev.c working-2.5.68-bk10-netdevice/net/decnet/dn_dev.c --- linux-2.5.68-bk10/net/decnet/dn_dev.c 2003-04-20 18:05:16.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/decnet/dn_dev.c 2003-05-01 21:35:29.000000000 +1000 @@ -312,9 +312,7 @@ struct net_device *dn_dev_get_default(vo read_lock(&dndev_lock); dev = decnet_default_device; if (dev) { - if (dev->dn_ptr) - dev_hold(dev); - else + if (!dev->dn_ptr || !try_dev_hold(dev)) dev = NULL; } read_unlock(&dndev_lock); @@ -584,6 +582,8 @@ int dn_dev_ioctl(unsigned int cmd, void goto done; } + /* FIXME: if cmd == SIOCGIFADDR, don't hold lock, and don't + have reference to dev. --RR */ if ((dn_db = dev->dn_ptr) != NULL) { for (ifap = &dn_db->ifa_list; (ifa=*ifap) != NULL; ifap = &ifa->ifa_next) if (strcmp(ifr->ifr_name, ifa->ifa_label) == 0) @@ -677,6 +677,7 @@ static int dn_dev_rtm_newaddr(struct sk_ if (rta[IFA_LOCAL-1] == NULL) return -EINVAL; + /* FIXME: Don't have lock, and don't hold reference to dev. --RR */ if ((dev = __dev_get_by_index(ifm->ifa_index)) == NULL) return -ENODEV; @@ -1189,9 +1190,10 @@ void dn_dev_up(struct net_device *dev) * configured ethernet card in the system. */ if (maybe_default) { - dev_hold(dev); - if (dn_dev_set_default(dev, 0)) - dev_put(dev); + if (try_dev_hold(dev)) { + if (dn_dev_set_default(dev, 0)) + dev_put(dev); + } } } diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/decnet/dn_fib.c working-2.5.68-bk10-netdevice/net/decnet/dn_fib.c --- linux-2.5.68-bk10/net/decnet/dn_fib.c 2003-04-20 18:05:16.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/decnet/dn_fib.c 2003-05-01 21:43:34.000000000 +1000 @@ -218,7 +218,9 @@ static int dn_fib_check_nh(const struct if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&dev->refcnt); + /* FIXME: Must hold lock, or use dev_get_by_index. + --RR */ + dev_hold(dev); nh->nh_scope = RT_SCOPE_LINK; return 0; } @@ -262,7 +264,7 @@ out: if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(&nh->nh_dev); nh->nh_scope = RT_SCOPE_HOST; } diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/decnet/dn_route.c working-2.5.68-bk10-netdevice/net/decnet/dn_route.c --- linux-2.5.68-bk10/net/decnet/dn_route.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/decnet/dn_route.c 2003-05-01 20:58:08.000000000 +1000 @@ -891,7 +891,9 @@ static int dn_route_output_slow(struct d read_unlock(&dev_base_lock); if (dev_out == NULL) goto out; - dev_hold(dev_out); + /* FIXME: Shouldn't this be inside the lock? --RR */ + if (!try_dev_hold(dev_out)) + goto out; source_ok: ; } @@ -960,8 +962,10 @@ source_ok: } else { dev_out = neigh->dev; } - dev_hold(dev_out); - goto select_source; + if (try_dev_hold(dev_out)) + goto select_source; + else + dev_out = NULL; } } } @@ -1035,7 +1039,10 @@ select_source: if (dev_out) dev_put(dev_out); dev_out = DN_FIB_RES_DEV(res); - dev_hold(dev_out); + if (!try_dev_hold(dev_out)) { + dev_out = NULL; + goto e_addr; + } fl.oif = dev_out->ifindex; gateway = DN_FIB_RES_GW(res); @@ -1231,7 +1238,8 @@ static int dn_route_input_slow(struct sk "No output device\n"); goto e_inval; } - dev_hold(out_dev); + if (!try_dev_hold(out_dev)) + goto e_inval; if (res.r) src_map = dn_fib_rules_policy(fl.fld_src, &res, &flags); @@ -1349,8 +1357,12 @@ make_route: rt->u.dst.input = dn_blackhole; } rt->rt_flags = flags; - if (rt->u.dst.dev) - dev_hold(rt->u.dst.dev); + if (rt->u.dst.dev) { + if (!try_dev_hold(rt->u.dst.dev)) { + dst_free(&rt->u.dst); + goto e_inval; + } + } if (dn_rt_set_next_hop(rt, &res)) goto e_neighbour; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/decnet/dn_rules.c working-2.5.68-bk10-netdevice/net/decnet/dn_rules.c --- linux-2.5.68-bk10/net/decnet/dn_rules.c 2003-04-20 18:05:16.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/decnet/dn_rules.c 2003-05-01 21:37:58.000000000 +1000 @@ -173,6 +173,7 @@ int dn_fib_rtm_newrule(struct sk_buff *s memcpy(new_r->r_ifname, RTA_DATA(rta[RTA_IIF-1]), IFNAMSIZ); new_r->r_ifname[IFNAMSIZ-1] = 0; new_r->r_ifindex = -1; + /* FIXME: Don't hold lock, and don't get reference. --RR */ dev = __dev_get_by_name(new_r->r_ifname); if (dev) new_r->r_ifindex = dev->ifindex; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/fib_frontend.c working-2.5.68-bk10-netdevice/net/ipv4/fib_frontend.c --- linux-2.5.68-bk10/net/ipv4/fib_frontend.c 2003-05-01 20:36:37.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv4/fib_frontend.c 2003-01-02 12:30:47.000000000 +1100 @@ -115,8 +115,8 @@ struct net_device * ip_dev_find(u32 addr if (res.type != RTN_LOCAL) goto out; dev = FIB_RES_DEV(res); - if (dev && !try_dev_get(dev)) - dev = NULL; + if (dev) + atomic_inc(&dev->refcnt); out: fib_res_put(&res); diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/fib_semantics.c working-2.5.68-bk10-netdevice/net/ipv4/fib_semantics.c --- linux-2.5.68-bk10/net/ipv4/fib_semantics.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv4/fib_semantics.c 2003-05-01 21:39:20.000000000 +1000 @@ -405,6 +405,8 @@ static int fib_check_nh(const struct rtm return -ENODEV; if (!(dev->flags&IFF_UP)) return -ENETDOWN; + /* FIXME: Must hold lock, or use dev_get_by_index. + --RR */ nh->nh_dev = dev; atomic_inc(&dev->refcnt); nh->nh_scope = RT_SCOPE_LINK; diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/ip_gre.c working-2.5.68-bk10-netdevice/net/ipv4/ip_gre.c --- linux-2.5.68-bk10/net/ipv4/ip_gre.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv4/ip_gre.c 2003-05-01 21:50:07.000000000 +1000 @@ -289,7 +289,7 @@ static struct ip_tunnel * ipgre_tunnel_l if (register_netdevice(dev) < 0) goto failed; - dev_hold(dev); + atomic_set(&dev->refcnt, 1); ipgre_tunnel_link(nt); /* Do not decrement MOD_USE_COUNT here. */ return nt; @@ -1205,6 +1205,7 @@ static int ipgre_tunnel_init(struct net_ } if (!tdev && tunnel->parms.link) + /* FIXME: Don't hold lock, don't grab reference. --RR */ tdev = __dev_get_by_index(tunnel->parms.link); if (tdev) { diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/ipip.c working-2.5.68-bk10-netdevice/net/ipv4/ipip.c --- linux-2.5.68-bk10/net/ipv4/ipip.c 2003-04-20 18:05:16.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv4/ipip.c 2003-05-01 21:51:47.000000000 +1000 @@ -259,7 +259,7 @@ static struct ip_tunnel * ipip_tunnel_lo if (register_netdevice(dev) < 0) goto failed; - dev_hold(dev); + atomic_set(&dev->refcnt, 1); ipip_tunnel_link(nt); /* Do not decrement MOD_USE_COUNT here. */ return nt; @@ -841,6 +841,7 @@ static int ipip_tunnel_init(struct net_d } if (!tdev && tunnel->parms.link) + /* FIXME: Don't hold lock, don't grab reference. --RR */ tdev = __dev_get_by_index(tunnel->parms.link); if (tdev) { diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/ipmr.c working-2.5.68-bk10-netdevice/net/ipv4/ipmr.c --- linux-2.5.68-bk10/net/ipv4/ipmr.c 2003-03-25 12:17:32.000000000 +1100 +++ working-2.5.68-bk10-netdevice/net/ipv4/ipmr.c 2003-05-01 20:39:29.000000000 +1000 @@ -443,7 +443,6 @@ static int vif_add(struct vifctl *vifc, /* And finish update writing critical data */ write_lock_bh(&mrt_lock); - dev_hold(dev); v->dev=dev; #ifdef CONFIG_IP_PIMSM if (v->flags&VIFF_REGISTER) @@ -1441,8 +1440,8 @@ int pim_rcv_v1(struct sk_buff * skb) read_lock(&mrt_lock); if (reg_vif_num >= 0) reg_dev = vif_table[reg_vif_num].dev; - if (reg_dev) - dev_hold(reg_dev); + if (reg_dev && !try_dev_hold(reg_dev)) + reg_dev = NULL; read_unlock(&mrt_lock); if (reg_dev == NULL) { @@ -1508,8 +1507,8 @@ int pim_rcv(struct sk_buff * skb) read_lock(&mrt_lock); if (reg_vif_num >= 0) reg_dev = vif_table[reg_vif_num].dev; - if (reg_dev) - dev_hold(reg_dev); + if (reg_dev && !try_dev_hold(reg_dev)) + reg_dev = NULL; read_unlock(&mrt_lock); if (reg_dev == NULL) { diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv4/route.c working-2.5.68-bk10-netdevice/net/ipv4/route.c --- linux-2.5.68-bk10/net/ipv4/route.c 2003-05-01 09:29:35.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv4/route.c 2003-05-01 20:41:28.000000000 +1000 @@ -1992,7 +1992,8 @@ int ip_route_output_slow(struct rtable * if (dev_out) dev_put(dev_out); dev_out = FIB_RES_DEV(res); - dev_hold(dev_out); + if (!try_dev_hold(dev_out)) + goto e_inval; fl.oif = dev_out->ifindex; make_route: diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/ipv6/sit.c working-2.5.68-bk10-netdevice/net/ipv6/sit.c --- linux-2.5.68-bk10/net/ipv6/sit.c 2003-04-20 18:05:17.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/ipv6/sit.c 2003-05-01 21:55:21.000000000 +1000 @@ -197,7 +197,7 @@ static struct ip_tunnel * ipip6_tunnel_l if (register_netdevice(dev) < 0) goto failed; - dev_hold(dev); + atomic_set(&dev->refcount, 1); ipip6_tunnel_link(nt); /* Do not decrement MOD_USE_COUNT here. */ return nt; @@ -778,6 +778,7 @@ static int ipip6_tunnel_init(struct net_ } if (!tdev && tunnel->parms.link) + /* FIXME: Don't hold lock, don't grab reference. --RR */ tdev = __dev_get_by_index(tunnel->parms.link); if (tdev) { diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/llc/af_llc.c working-2.5.68-bk10-netdevice/net/llc/af_llc.c --- linux-2.5.68-bk10/net/llc/af_llc.c 2003-05-01 09:29:36.000000000 +1000 +++ working-2.5.68-bk10-netdevice/net/llc/af_llc.c 2003-05-01 21:13:49.000000000 +1000 @@ -256,6 +256,7 @@ static int llc_ui_autobind(struct socket rc = -ENETUNREACH; if (!dev) goto out; + /* FIXME: We don't hold a reference to dev --RR */ llc->dev = dev; } /* bind to a specific sap, optional. */ @@ -419,6 +420,7 @@ static int llc_ui_connect(struct socket rtnl_unlock(); if (!dev) goto out; + /* FIXME: We don't hold a reference to dev --RR */ llc->dev = dev; } else dev = llc->dev; @@ -764,6 +766,7 @@ static int llc_ui_sendmsg(struct kiocb * dev = dev_getbyhwaddr(addr->sllc_arphrd, addr->sllc_smac); rtnl_unlock(); rc = -ENETUNREACH; + /* FIXME: We don't hold a reference to dev --RR */ if (!dev) goto release; } else diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/netrom/nr_route.c working-2.5.68-bk10-netdevice/net/netrom/nr_route.c --- linux-2.5.68-bk10/net/netrom/nr_route.c 2003-01-02 12:27:51.000000000 +1100 +++ working-2.5.68-bk10-netdevice/net/netrom/nr_route.c 2003-05-01 20:51:51.000000000 +1000 @@ -567,8 +567,8 @@ struct net_device *nr_dev_get(ax25_addre read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0) { - dev_hold(dev); - goto out; + if (try_dev_hold(dev)) + goto out; } } out: diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.68-bk10/net/rose/rose_route.c working-2.5.68-bk10-netdevice/net/rose/rose_route.c --- linux-2.5.68-bk10/net/rose/rose_route.c 2003-03-18 12:21:41.000000000 +1100 +++ working-2.5.68-bk10-netdevice/net/rose/rose_route.c 2003-05-01 20:51:59.000000000 +1000 @@ -629,8 +629,8 @@ struct net_device *rose_dev_get(rose_add read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) { - dev_hold(dev); - goto out; + if (try_dev_hold(dev)) + goto out; } } out: From Eric.Lemoine@Sun.COM Thu May 1 10:29:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 10:29:25 -0700 (PDT) Received: from patan.sun.com (patan.Sun.COM [192.18.98.43]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h41HTLFu025897 for ; Thu, 1 May 2003 10:29:22 -0700 Received: from esunmail ([129.147.58.198]) by patan.sun.com (8.9.3p2+Sun/8.9.3) with ESMTP id LAA04945 for ; Thu, 1 May 2003 11:29:21 -0600 (MDT) Received: from xpa-fe2 (esunmail [129.147.58.120]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HE7001HYXV0X8@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Thu, 01 May 2003 11:28:13 -0600 (MDT) Received: from udine ([140.77.13.122]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HE700AA2XUZRJ@mail.sun.net> for netdev@oss.sgi.com; Thu, 01 May 2003 11:28:12 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Thu, 01 May 2003 19:28:05 +0200 Date: Thu, 01 May 2003 19:28:05 +0200 From: Eric Lemoine Subject: sendfile() & unlink() To: netdev@oss.sgi.com Message-id: <20030501172805.GB4580@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2401 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev Hi What happens when unlink()ing a file that has just been sendfile()d? Is there any guarantee that the file remains in the buffer cache while TCP completes the xmit? Thx. -- Eric From acme@conectiva.com.br Thu May 1 10:28:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 10:28: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.9) with SMTP id h41HSMFu025815 for ; Thu, 1 May 2003 10:28:24 -0700 Received: from [200.181.169.6] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19BHxD-0003zH-00; Thu, 01 May 2003 14:34:43 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id AE6B01966C; Thu, 1 May 2003 17:28:22 +0000 (UTC) Date: Thu, 1 May 2003 14:28:22 -0300 From: Arnaldo Carvalho de Melo To: Rusty Russell Cc: "David S. Miller" , kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, Werner Almesberger Subject: Re: dev->destructor Message-ID: <20030501172822.GE3387@conectiva.com.br> References: <20030501.000058.39187964.davem@redhat.com> <20030501120815.25BE22C155@lists.samba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030501120815.25BE22C155@lists.samba.org> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2400 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 Thu, May 01, 2003 at 10:01:19PM +1000, Rusty Russell escreveu: > But before we redesign module architecture from scratch, let's look at > a solution with what we do have (assuming Linus takes my damn > __module_get() patch some day, see below). Linus took the __module_get patch, I even used it in redesigning the way struct sock and struct socket are handled in response to Max Krasnyansky alternative patches > There are 70 calls to dev_hold() in the kernel. The vast majority of > them already have a reference, they just want another one: dev_hold() > can do __module_get(). yes > There are a few *sources* of devices: dev_get, dev_get_by*. These > should check and fail, using "try_dev_hold()" or something. > Unfortunately auditing all the __dev_get_by* is quite a task, since > it's used very widely (and I think, sometime erroneously). > > Completely untested patch below other patch. > > I need more time to digest your proposal in detail, Dave. Expect > reply w/in 24 hours. I'm digesting it as well 8) - Arnaldo From modica@sgi.com Thu May 1 10:33:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 10:33:53 -0700 (PDT) Received: from zok.sgi.com (zok.SGI.COM [204.94.215.101]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h41HXaFu026460 for ; Thu, 1 May 2003 10:33:36 -0700 Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by zok.sgi.com (8.12.9/8.12.2/linux-outbound_gateway-1.2) with ESMTP id h41HXVVV025119 for ; Thu, 1 May 2003 10:33:31 -0700 Received: from sgi.com (eagdhcp-232-154.americas.sgi.com [128.162.232.154]) by cthulhu.engr.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id h41HXT4O5978526; Thu, 1 May 2003 10:33:30 -0700 (PDT) Message-ID: <3EB15A69.1000706@sgi.com> Date: Thu, 01 May 2003 12:33:29 -0500 From: Steve Modica Organization: SGI User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Eric Lemoine CC: netdev@oss.sgi.com Subject: Re: sendfile() & unlink() References: <20030501172805.GB4580@udine> In-Reply-To: <20030501172805.GB4580@udine> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2402 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: modica@sgi.com Precedence: bulk X-list: netdev Unlinking an open tmp file (so it doesn't show up in a directory listing ) is a pretty common thing to do on Irix. I sure hope one can do that on linux :) Eric Lemoine wrote: > Hi > > What happens when unlink()ing a file that has just been sendfile()d? Is > there any guarantee that the file remains in the buffer cache while TCP > completes the xmit? > > Thx. > -- Steve Modica work: 651-683-3224 mobile: 651-261-3201 Manager - Networking Drivers Group "Give a man a fish, and he will eat for a day, hit him with a fish and he leaves you alone" - me From acme@conectiva.com.br Thu May 1 10:51:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 10:51:28 -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.9) with SMTP id h41Hp8Fu027122 for ; Thu, 1 May 2003 10:51:09 -0700 Received: from [200.181.169.6] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19BIJL-00040v-00; Thu, 01 May 2003 14:57:36 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 8B17E1966C; Thu, 1 May 2003 17:51:12 +0000 (UTC) Date: Thu, 1 May 2003 14:51:11 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, wa@almesberger.net Subject: Re: dev->destructor Message-ID: <20030501175111.GF3387@conectiva.com.br> References: <20030501.000058.39187964.davem@redhat.com> <20030501120815.25BE22C155@lists.samba.org> <20030501.040935.68070653.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030501.040935.68070653.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2403 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 Thu, May 01, 2003 at 04:09:35AM -0700, David S. Miller escreveu: > From: Rusty Russell > Date: Thu, 01 May 2003 22:01:19 +1000 > > There are 70 calls to dev_hold() in the kernel. The vast majority of > them already have a reference, they just want another one: dev_hold() > can do __module_get(). > > Rusty, this is precisely the what Alexey and myself want to avoid. On > the surface, it looks fine, only 70 dev_get's in the kernel right? > But think further... > > So you propose to add this kind of thing for every ARP entry, every > route cache entry, every IPSEC policy, every socket, every struct > sock, every networking dynamic object ever created? ALERT: brainstorming and expecting for comments from the people who knows this better. Well, I think that because there are a graph of relationships here we perhaps can be safe by protecting just some of the higher level objects (e.g. struct sock, struct socket, struct net_device) while leaving some other lower level objects managed by those higher level ones, e.g. struct sk_buff managed by struct sock. This came to me while discussing the struct socket and struct sock module infrastructure with Max, specifically when net family modules (e.g. AF_INET) doesn't requires protecting for each and every struct socket created, as the protocol modules (e.g.: udp, raw, tcp) have to somehow register with the net family module and by just using one exported function (register_protocol type functions: register_pppox_proto, bt_sock_register, register_8022_client, register_snap_client, llc_sap_open, etc) makes the net family module/lower level protocol protected. So we need to have a graph of these relationships to see what we have to protect at a higher level, reducing the overhead of otherwise having to call try_module_get/__module_get & module_put on _all_ objects creation/use. - Arnaldo From davem@redhat.com Thu May 1 11:02:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 11:02: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.9) with SMTP id h41I2YFu027508 for ; Thu, 1 May 2003 11:02:35 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA01734; Thu, 1 May 2003 09:55:21 -0700 Date: Thu, 01 May 2003 09:55:20 -0700 (PDT) Message-Id: <20030501.095520.63025177.davem@redhat.com> To: acme@conectiva.com.br Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, wa@almesberger.net Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030501175111.GF3387@conectiva.com.br> References: <20030501120815.25BE22C155@lists.samba.org> <20030501.040935.68070653.davem@redhat.com> <20030501175111.GF3387@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2404 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 From: Arnaldo Carvalho de Melo Date: Thu, 1 May 2003 14:51:11 -0300 Well, I think that because there are a graph of relationships here we perhaps can be safe by protecting just some of the higher level objects (e.g. struct sock, struct socket, struct net_device) while leaving some other lower level objects managed by those higher level ones, e.g. struct sk_buff managed by struct sock. The graphs are unfortunately not completely connected. For example, sk_buff's can be sent not assosciated with any socket. Routing cache entries are not attached to any particular client, similar with ARP/neighbour entires, and sk_buff's in turn hold references to these things. See, long ago we used to not do proper reference counting on struct sock's. We used to rely on graphs of relationships and certain sock states to control destruction of these objects. The networking was riddled with obscure bugs because of this. From kuznet@ms2.inr.ac.ru Thu May 1 21:07:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 21:07:35 -0700 (PDT) Received: from sex.inr.ac.ru (sex.inr.ac.ru [193.233.7.165]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4247OFu010887 for ; Thu, 1 May 2003 21:07:27 -0700 Received: (from kuznet@localhost) by sex.inr.ac.ru (8.6.13/ANK) id IAA10719; Fri, 2 May 2003 08:06:51 +0400 From: kuznet@ms2.inr.ac.ru Message-Id: <200305020406.IAA10719@sex.inr.ac.ru> Subject: Re: dev->destructor To: davem@redhat.com (David S. Miller) Date: Fri, 2 May 2003 08:06:51 +0400 (MSD) Cc: shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br, rusty@rustcorp.com.au In-Reply-To: <20030501.000058.39187964.davem@redhat.com> from "David S. Miller" at May 1, 3 00:00:58 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2405 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > None of destructors kill reference to device object, and I mean none > of them. It is why I thought the idea works. When you call unregister_something() you hold a reference to this something, and you have no idea how much of the references you hold. This is invisible when unregister_something() is called from a single place sort of cleanup_module(). > Also, holding RTNL semaphore does not block potential holders > of device reference. Or does it? When that branch with waiting inside unregister() exists you can't hold any reference when grabbing this semaphore. That's why dev_ioctl() takes the semaphore first. It is damnly inconvenient, fragile, et cetera and such bugs do exist. That's why unregister_netdev() is logically wrong function: it takes dev as argument, so any sane programmer would assume caller holds a reference. But he can't. So, call of the function is allowed only from contexts where device is presumed to be held, i.e. from cleanup_module() and from no other places. > Your idea, as I understand it, is to add callback to module that > freezes module then at some time in the future makes indication > that module is clean and may be unloaded safely. Yes, the description is mostly right. > Question is, where to make this? It cannot be in the module > itself of course, that would create race condition similar to > one which exists today making this exercise quite pointless :-) Probably, you should look at the most first module implementation. :-) Desite of it was horrible (like almost everything in kernel that days) it was logically correct. rmmod deleted module not depending on refcnt and module body was destroyed later, when refcnt reached zero. See? So, that cleanup_module() is replaced with shutdown() and a destructor is added to allow to cleanup something but memory, if it is necessary. And to handle the situation when we do not want to use module refcnt, a predicate to ask module for readiness to kill is added. I think it can be combined to destructor, so that for such modules destructor can return -EAGAIN. Well, when refcnt is zero you can try to destroy module and it might disagree. > Note the problem. If between the unregister_foo() and re-register of > foo in the failure path, someone asks to open a "foo" it will fail. > Those semantics absolutely stink. It is not a problem at all comparing to real ones. :-) > Rusty went on to describe that this is one of the reasons for the > current "enable refcounts" scheme with try_module_get(). Rusty forgot that crippling xxx_get() is million times more painful. :-) He also forgot that in 99% of cases there is a single registry and this registry must be self-consistent, so all the work is already done and module.c just invades area out of its competence. Anyway, this approach is legal and the simplest one, I understand this. It can be used optionally. Only, frankly speaking, I do not see any applications for this, because when more than one registry exists, module is surely so complicated that tracking references is painful enough to forget about this. Anyway, we always know number of sockets et al., so why to count them in more than one place? netdevices is the simplest example, but it shows the most didctively that all the ocurences of module_** there are illegal. We want to register/unregister them dynamically, we have to do all the job not depending on modules. We have to do our own refcounting. And incorrect design of modules only prevents to make final small step to make this right. Well, the key moment is that while device is registered, its module refcnt is not zero logically, but we can't unload the module in this case, so we have to do funny try_* each lookup. Alexey From rusty@samba.org Thu May 1 23:57:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 01 May 2003 23:58:00 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h426vqFu012592 for ; Thu, 1 May 2003 23:57:53 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 516742C04C; Fri, 2 May 2003 06:57:52 +0000 (GMT) From: Rusty Russell To: kuznet@ms2.inr.ac.ru Cc: davem@redhat.com (David S. Miller), shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor In-reply-to: Your message of "Fri, 02 May 2003 08:06:51 +0400." <200305020406.IAA10719@sex.inr.ac.ru> Date: Fri, 02 May 2003 15:25:15 +1000 Message-Id: <20030502065752.516742C04C@lists.samba.org> X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2406 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <200305020406.IAA10719@sex.inr.ac.ru> you write: > Hello! Hi Alexey! > It is damnly inconvenient, fragile, et cetera and such bugs do exist. > That's why unregister_netdev() is logically wrong function: it takes > dev as argument, so any sane programmer would assume caller holds > a reference. But he can't. So, call of the function is allowed > only from contexts where device is presumed to be held, i.e. from > cleanup_module() and from no other places. If this is true, I think you can use the module reference count only, and your code will be faster, too. I can prepare the patch for you later tonight, to see how it looks. > netdevices is the simplest example, but it shows the most didctively > that all the ocurences of module_** there are illegal. We want > to register/unregister them dynamically, we have to do all the job not > depending on modules. We have to do our own refcounting. And incorrect > design of modules only prevents to make final small step to make this > right. Well, the key moment is that while device is registered, its > module refcnt is not zero logically, but we can't unload the module > in this case, so we have to do funny try_* each lookup. Alexey, you are using a module but don't want to reference count it. I made module reference counts very cheap so you don't have to worry, but you still are trying to cheat 8) You want to be very tricky and count all ways into the module, instead. Clearly this is mathematically possible, but in practice very tricky. And all solutions I have seen which do this are ugly, and leave us with "remove may not succeed, it may hang forever, and you won't know, and you can't replace the module and need to reboot if it happens". 8( Better, I think, to make CONFIG_MODULE_UNLOAD=n, and make CONFIG_MODULE_FORCE_UNLOAD work even if CONFIG_MODULE_UNLOAD=n. Hope that clarifies? Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From wichert@wiggy.net Fri May 2 02:12:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 02:12:14 -0700 (PDT) Received: from mx1.wiggy.net (IDENT:gMOMBDElYml4SDnNaNrQrQkvHDONC3w6@home.wiggy.net [213.84.101.140]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h429C4Fu014860 for ; Fri, 2 May 2003 02:12:06 -0700 Received: from wichert by mx1.wiggy.net with local (Exim 3.35 #1 (Debian)) id 19BWaJ-0003pQ-00 for ; Fri, 02 May 2003 11:12:03 +0200 Date: Fri, 2 May 2003 11:12:03 +0200 From: Wichert Akkerman To: netdev@oss.sgi.com Subject: Minor error in debugging message Message-ID: <20030502091203.GN22848@wiggy.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2407 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: wichert@wiggy.net Precedence: bulk X-list: netdev I just noticed this in the 2.5.68 kernel boot sequence: Freeing alive device d7e6a000, eth%d It seems to be printed from netdev_finish_unregister (at least grep doesn't find that message elsewhere) and dev->name contains eth%d instead of eth0. Wichert. -- Wichert Akkerman It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. From andre@tomt.net Fri May 2 11:25:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 11:25:19 -0700 (PDT) Received: from mail.skjellin.no (mail.skjellin.no [80.239.42.67]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h42IPCFu028113 for ; Fri, 2 May 2003 11:25:13 -0700 Received: (qmail 31509 invoked by uid 1006); 2 May 2003 18:33:46 -0000 Received: from andre@tomt.net by ns1 by uid 1003 with qmail-scanner-1.15 (sophie: 2.14/3.67. spamassassin: 2.50. Clear:. Processed in 0.16935 secs); 02 May 2003 18:33:46 -0000 Received: from slask.tomt.net (HELO slurv) (andre@tomt.net@217.8.136.222) by mail.skjellin.no with SMTP; 2 May 2003 18:33:45 -0000 From: "Andre Tomt" To: Subject: unable to add ipv6 default route in 2.4.21-rc1 + latest bkbits.net pieces Date: Fri, 2 May 2003 20:25:11 +0200 Message-ID: <002001c310d8$2bb57b00$0a01ff0a@slurv> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h42IPCFu028113 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2410 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: andre@tomt.net Precedence: bulk X-list: netdev Hi, I noticed a problem on one of our semi-production systems today, it suddenly lacked a working ipv6 default route. After further investigation, even the raw iproute commands failed (I had it all set up in /etc/network/interfaces, a debian network configuration file). It seems to me something changed in 2.4.21? It certainly broke my iproute. 2.4.20 works fine (well, with many fixes not related to ipv6). iproute is debian version 20010824-9 (from unstable/sid). kvass:~# ip -6 route add default via 2003:730:f:3:: dev eth0 RTNETLINK answers: Invalid argument and for good measure: kvass:~# ip -6 route add 2000::/3 via 2003:730:f:3:: dev eth0 RTNETLINK answers: Invalid argument 2001:730:f:3::/64 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 fe80::/64 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 ff00::/8 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 unreachable default dev lo proto none metric -1 error -101 kvass:~# ip -6 route 2001:730:f:3::/64 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 fe80::/64 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 ff00::/8 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 default dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 unreachable default dev lo proto none metric -1 error -101 Theres a defaultroute there pointing to eth0 with noe gw set, that seems to be some kind of, err, default. Removing it and (trying, in this case) adding a proper default route has no effect. I even tried to recompile iproute, but that gave the same symptoms. Not sure if dpkg-buildpackage actually buildt it against /usr/include/linux or /usr/src/linux/include/linux though. Any ideas? I know there have been some deal of ipv6 fixes and additions going into 2.4.21, did this break something? -- Cheers, André Tomt andre@tomt.net From andre@tomt.net Fri May 2 14:38:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 14:38:56 -0700 (PDT) Received: from mail.skjellin.no (mail.skjellin.no [80.239.42.67]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h42LcjFu030368 for ; Fri, 2 May 2003 14:38:48 -0700 Received: (qmail 30426 invoked by uid 1006); 2 May 2003 21:47:20 -0000 Received: from andre@tomt.net by ns1 by uid 1003 with qmail-scanner-1.15 (sophie: 2.14/3.67. spamassassin: 2.50. Clear:. Processed in 0.017965 secs); 02 May 2003 21:47:20 -0000 Received: from slask.tomt.net (HELO slurv) (andre@tomt.net@217.8.136.222) by mail.skjellin.no with SMTP; 2 May 2003 21:47:20 -0000 From: "Andre Tomt" To: Subject: RE: unable to add ipv6 default route in 2.4.21-rc1 + latest bkbits.net pieces Date: Fri, 2 May 2003 23:38:38 +0200 Message-ID: <009301c310f3$319bd760$0a01ff0a@slurv> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h42LcjFu030368 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2411 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: andre@tomt.net Precedence: bulk X-list: netdev Replying to myself here. > 2001:730:f:3::/64 dev eth0 proto kernel metric 256 mtu > 1500 advmss 1440 fe80::/64 dev eth0 proto kernel metric 256 > mtu 1500 advmss 1440 ff00::/8 dev eth0 proto kernel metric > 256 mtu 1500 advmss 1440 unreachable default dev lo proto > none metric -1 error -101 Oops, this was'nt supposed to be pasted here. > kvass:~# ip -6 route > 2001:730:f:3::/64 dev eth0 proto kernel metric 256 mtu > 1500 advmss 1440 fe80::/64 dev eth0 proto kernel metric 256 > mtu 1500 advmss 1440 ff00::/8 dev eth0 proto kernel metric > 256 mtu 1500 advmss 1440 default dev eth0 proto kernel > metric 256 mtu 1500 advmss 1440 unreachable default dev lo > proto none metric -1 error -101 This however, is still the right one. :-) -- Cheers, André Tomt andre@tomt.net From davem@redhat.com Fri May 2 14:55:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 14:55: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.9) with SMTP id h42LtTFu031255 for ; Fri, 2 May 2003 14:55:30 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id NAA04181; Fri, 2 May 2003 13:48:04 -0700 Date: Fri, 02 May 2003 13:48:04 -0700 (PDT) Message-Id: <20030502.134804.78707298.davem@redhat.com> To: rusty@rustcorp.com.au Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030502065752.516742C04C@lists.samba.org> References: <200305020406.IAA10719@sex.inr.ac.ru> <20030502065752.516742C04C@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2412 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 From: Rusty Russell Date: Fri, 02 May 2003 15:25:15 +1000 If this is true, I think you can use the module reference count only, and your code will be faster, too. I can prepare the patch for you later tonight, to see how it looks. And where do we get the counter from when dev->owner is NULL (ie. non-modular)? We need the reference counting regardless of whether the device is implemented statically in the kernel or modular. Do you propose to attach dummy struct module to non-modular case? I am curious... Alexey, you are using a module but don't want to reference count it. I made module reference counts very cheap so you don't have to worry, but you still are trying to cheat 8) Understood. I think even stronger part of Alexey's argument is that all of this "if (x->owner)" all over the place takes away some of the gains of compiling things statically into the kernel. Why extra branches all over the place? You want to be very tricky and count all ways into the module, instead. Clearly this is mathematically possible, but in practice very tricky. And all solutions I have seen which do this are ugly, and leave us with "remove may not succeed, it may hang forever, and you won't know, and you can't replace the module and need to reboot if it happens". 8( As long as I can Control-C rmmod when it waits like this, which would be the case, what is the problem? Also, not only is this mathematically possible it is DONE already. Hmmm, there seems to be massive disconnect here between what we understand here and what you appear to. Let me try to describe it in detail. All reasonable protocol code must do exactly this. Any module which does not properly keep track of the objects it is creating has problems bigger than proper module handling. It is not "very tricky", but rather "required". Look at it this way, when module kmalloc's something does it immediately forget about this? This seems to be what you suggest, and it is a dangerous way to think! No, rather, it remembers that it did this, either by setting '1' to refcount of this object, or attaching it to some hash table, list, tree, or other global data structure it maintains. Any time this object is attached somewhere else, reference count is incremented. Anytime it is detached or destroyed, refcount is decremented and final decrement to zero makes final killing of this object. It is ABCs of programming. :-) Apply this to every dynamic object created by a module, and the end result is that it makes the work of counting all internal references. Ergo, module refcounting is superfluous. Look, once external view into module (ie. socket operations, superblock ops, netdev registry) is removed, all that remains to reference object is exactly these objects. It is the only different part about modules vs. non-modules. After threading the networking and adding true refcounting to sockets I will never forget these rules. :-) Better, I think, to make CONFIG_MODULE_UNLOAD=n, and make CONFIG_MODULE_FORCE_UNLOAD work even if CONFIG_MODULE_UNLOAD=n. As much as I'd like to be able to accept that behavior, it's too much breakage. So many people periodically make rmmod attempts to unload unused modules, distributions even make this by default (or at least used to). Let's look at this aspect of behavior: 1) Some people think that -EBUSY return is unexpected. I fall into this category. 2) It is argued that some other people think the "wait until unloadable" behavior is unexpected. But nobody would be surprised if rmmod told them: ==================== Trying to unload %s, waiting for all references to go away. Perhaps you have programs running which still reference this module? (Hit Ctrl-C to interrupt unload to go and remove those references) ==================== nobody would ask what does this mean. :-) In fact, what IF rmmod was able to know it was unloading a filesystem and therefore could walk the mount list to find mounted instances of this filesystem and print that to the user in the rmmod message? Or for network protocols to print the socket list of sockets/routes/devices open to that module and even making 'lsof' to print process name/pid holding open such sockets? I bet even Linus himself would exclaim "wow, that's nice." Compare this to "-EBUSY". :-))))))))) And I want to mention that in some cases you have to "wait". The best example are TCP_TIME_WAIT sockets. Even after users downs all the interfaces, and closes all the sockets, these remnants must remain for their full life of 60 seconds. I really am concerned at both sides, both user observed behavior and kernel side correctness. From niv@us.ibm.com Fri May 2 15:41:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 15:41:29 -0700 (PDT) Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.133]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h42MfEFu032384 for ; Fri, 2 May 2003 15:41:23 -0700 Received: from westrelay05.boulder.ibm.com (westrelay05.boulder.ibm.com [9.17.193.33]) by e35.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h42Mf8uT269628; Fri, 2 May 2003 18:41:08 -0400 Received: from w-nivedita.beaverton.ibm.com (d03av01.boulder.ibm.com [9.17.193.81]) by westrelay05.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h42Mf7nU062418; Fri, 2 May 2003 16:41:07 -0600 Date: Fri, 2 May 2003 15:41:06 -0700 (PDT) From: Nivedita Singhvi X-X-Sender: nivedita@w-nivedita.beaverton.ibm.com To: David Miller cc: netdev@oss.sgi.com Subject: [PATCH 2.5.68] sysctl max_dgram_qlen permissions Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2413 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev Currently the sysctl var net.unix.max_dgram_qlen has 0600 permissions..Need users to be able to read it.. Dont see any reason not to(?). thanks, Nivedita --- sysctl_net_unix.c Sat Apr 19 19:49:10 2003 +++ sysctl_net_unix.c.new Fri May 2 13:48:11 2003 @@ -20,7 +20,7 @@ .procname = "max_dgram_qlen", .data = &sysctl_unix_max_dgram_qlen, .maxlen = sizeof(int), - .mode = 0600, + .mode = 0644, .proc_handler = &proc_dointvec }, { .ctl_name = 0 } From rusty@samba.org Fri May 2 21:09:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 21:09:58 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4349nFu003711 for ; Fri, 2 May 2003 21:09:50 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 804182C003; Sat, 3 May 2003 04:09:49 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor In-reply-to: Your message of "Fri, 02 May 2003 13:48:04 MST." <20030502.134804.78707298.davem@redhat.com> Date: Sat, 03 May 2003 14:07:41 +1000 Message-Id: <20030503040949.804182C003@lists.samba.org> X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2414 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030502.134804.78707298.davem@redhat.com> you write: > From: Rusty Russell > Date: Fri, 02 May 2003 15:25:15 +1000 > > If this is true, I think you can use the module reference count only, > and your code will be faster, too. I can prepare the patch for you > later tonight, to see how it looks. > > And where do we get the counter from when dev->owner is NULL > (ie. non-modular)? We need the reference counting regardless of > whether the device is implemented statically in the kernel or modular. But Alexey said you can only call unregister_netdev from module unload, ie. if not a module, it can't be unloaded, hence no refcount needed. I wrote the above paragraph because I'm not sure if I understood Alexey correctly? > Alexey, you are using a module but don't want to reference count it. > I made module reference counts very cheap so you don't have to worry, > but you still are trying to cheat 8) > > Understood. > > I think even stronger part of Alexey's argument is that all of > this "if (x->owner)" all over the place takes away some of the > gains of compiling things statically into the kernel. Why extra > branches all over the place? Agreed. I have considered removing that, and making THIS_MODULE equal a dummy module struct for the core kernel. I think that would be a win (we've already established that the actual refcount is cheap, possibly cheaper than the branch in practice). BTW, we should look at making local_inc() etc. a first-class citizen: it has uses outside modules. > As long as I can Control-C rmmod when it waits like this, which would > be the case, what is the problem? If you can, and the device is still usable afterwards, it would be nirvana 8) [ Refcounting tutorial skipped: I went through the same pain with early conntrack code, and learned to refcount everything now 8) ] > Look, once external view into module (ie. socket operations, > superblock ops, netdev registry) is removed, all that remains to > reference object is exactly these objects. It is the only different > part about modules vs. non-modules. This argument applies to all objects. If you reference count everything which holds a reference to an object, you can infer the reference count of the object from the sum of reference counts of its referees. In practice, as you pointed out in an earlier mail (I think sockets were your example), doing this proves to be extremely painful. And we're feeling the pain now. The module functions, and all its data, are objects. For convenience, size, and speed, we don't reference count them separately. OK, so why doesn't, say, struct netdevice grab the module refcount on registration (as is logical), and drop it on unregistration? Because the module holds a reference to the struct device, so now you have a classic circular reference count problem: the module reference count will never fall to zero. That's why we grab a reference just before use. You can, of course, do two-stage module cleanup (ie. first stage with refcounts non-zero), but the user wants clean "remove or fail to remove" semantics, so half-way through the cleanup you realize it's still in use, and restore things: now you have the spurious failure problem where it was half-unregistered for a while, and AFAICT you have to rewrite 1400 modules's cleanup routines. I imagined schemes where the kernel would be basically stopped during module remove, so the half-remove and unremove would appear atomic. I shied away from implementing such a monster without deadlock, but it might be possible. Then we would truly have nirvana 8) > Trying to unload %s, waiting for all references to go away. > Perhaps you have programs running which still reference this > module? (Hit Ctrl-C to interrupt unload to go and remove > those references) > ==================== > > nobody would ask what does this mean. :-) Please, implement such a thing. I was unable to, without introducing spurious failure in the components, *and* rewriting every module_cleanup function 8( Hence rmmod does not wait by default, but says "module is busy". > And I want to mention that in some cases you have to "wait". The best > example are TCP_TIME_WAIT sockets. Even after users downs all the > interfaces, and closes all the sockets, these remnants must remain for > their full life of 60 seconds. Yes, certainly. The two-stage unload provided by rmmod --wait ensures that the reference count decreases to zero (it makes try_module_get fail). This was my desire if unloading security modules or some netfilter modules was going to be reasonable. > I really am concerned at both sides, both user observed behavior and > kernel side correctness. There are shades of correctness, too. Not jumping into a module which has gone away is probably the most important. Having finite unload time is also nice. Not having spurious failures because someone tried to unload a module is nice too. Roman Zippel suggested (among other things) that every unregister fail when busy, and that modules the reinitialize. This gives the spurious failure problem, and means rewriting every unregister interface in the kernel, every module cleanup function, and dealing with the case where you're cleaning up a failed initialization and your unregister failed. Adam Richter suggested the module or interface register with a central repository to say "this modules uses this interface", then you can atomically freeze all the module interfaces (say they all share a single lock) and see if it's in use, but you can't really call the module's cleanup routine, so you have to atomically deactivate all these registrations before dropping the lock, and that's the same as try_module_get(). As you know, I love radical change. But I want be make sure we're going to end up somewhere we like at the end of it, which is why I didn't do it. Anyway, putting the module loader in the kernel was enough to sate my appetite for change 8) Thanks! Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From davem@redhat.com Fri May 2 21:53:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 21:54:01 -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.9) with SMTP id h434rqFu004221 for ; Fri, 2 May 2003 21:53:53 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA04968; Fri, 2 May 2003 20:46:29 -0700 Date: Fri, 02 May 2003 20:46:28 -0700 (PDT) Message-Id: <20030502.204628.35664814.davem@redhat.com> To: rusty@rustcorp.com.au Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030503040949.804182C003@lists.samba.org> References: <20030502.134804.78707298.davem@redhat.com> <20030503040949.804182C003@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2415 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 From: Rusty Russell Date: Sat, 03 May 2003 14:07:41 +1000 I imagined schemes where the kernel would be basically stopped during module remove, so the half-remove and unremove would appear atomic. I shied away from implementing such a monster without deadlock, but it might be possible. Then we would truly have nirvana 8) I think this is an interesting area for exploration. This isn't a unique requirement BTW Rusty. IP conntrack rehashing in the presence of RCU would want something just like this now wouldn't it? Consider other applications, such as hot plug memory. I'm sure tons of other interesting examples could be imagined. So indeed, the key to nirvana would indeed be here :-) I think it can work Rusty, in short you create 1 freeze thread per cpu. You wake up all the freeze threads on non-local cpus, and they indicate their presence via some bitmask. Once the master cpu sees all non-local-cpu bits set in the bitmask, it begins the unload sequence, after the unload the cpu mask is cleared and this signals the freeze threads to break from their spin loops and schedule(). This means the local master cpu executes the unload sequence. It may sleep in order to yield to, for example, semaphore holders, it may also sleep to yield to kswapd and friends for the sake of memory allocation. I mean... consider all the situations and please try to find some hole in this. We can make all try_to_*() sleep at this time too... this in particular needs more thought. To make these freeze threads globally useful, we allow them to run atomicity commands. The two defined commands are "local_irq_*()" and "local_bh_*()", two bitmasks control this and the freeze threads check the bits in their spin loops. Do you see? Maybe... it is nearly Nirvana! :-))))) Our ability to implement this changes the rest of the conversation, so let us resolve this first. From davem@redhat.com Fri May 2 22:07:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 02 May 2003 22:07: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.9) with SMTP id h4357PFu004642 for ; Fri, 2 May 2003 22:07:25 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id VAA04998; Fri, 2 May 2003 21:00:00 -0700 Date: Fri, 02 May 2003 21:00:00 -0700 (PDT) Message-Id: <20030502.210000.35018302.davem@redhat.com> To: rusty@rustcorp.com.au Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030503040949.804182C003@lists.samba.org> References: <20030502.134804.78707298.davem@redhat.com> <20030503040949.804182C003@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2416 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 From: Rusty Russell Date: Sat, 03 May 2003 14:07:41 +1000 This argument applies to all objects. If you reference count everything which holds a reference to an object, you can infer the reference count of the object from the sum of reference counts of its referees. In practice, as you pointed out in an earlier mail (I think sockets were your example), doing this proves to be extremely painful. And we're feeling the pain now. Please ignore the example code I wrote in that email. Most of it is inconsistent and frankly garbage. :-) The "->can_unload()" check is actually simpler than we might initially suspect. Something like ipv6 might check: if (atomic_read(&inet6_sock_nr) == 0 && atomic_read(&inet6_dev_nr) == 0 && rt6_cache_empty()) return 1; return 0; Now, here is the important part! When this thing returns "1" the module.c code does this: call_rcu(&mod->rcu_head, mod->cleanup, NULL); This makes sure the guy who killed the last object has indeed left the module code. From davem@redhat.com Sat May 3 01:35:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 03 May 2003 01:35:27 -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.9) with SMTP id h438ZFFu006093 for ; Sat, 3 May 2003 01:35:16 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA05331; Sat, 3 May 2003 00:28:22 -0700 Date: Sat, 03 May 2003 00:28:22 -0700 (PDT) Message-Id: <20030503.002822.34760030.davem@redhat.com> To: niv@us.ibm.com Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.68] sysctl max_dgram_qlen permissions From: "David S. Miller" In-Reply-To: References: X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2417 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 From: Nivedita Singhvi Date: Fri, 2 May 2003 15:41:06 -0700 (PDT) Currently the sysctl var net.unix.max_dgram_qlen has 0600 permissions..Need users to be able to read it.. Dont see any reason not to(?). Applied, thanks. --- sysctl_net_unix.c Sat Apr 19 19:49:10 2003 +++ sysctl_net_unix.c.new Fri May 2 13:48:11 2003 Please use properly rooted patches in the future. Ie. soemthing like: --- a/linux/net/unix/sysctl_net_unix.c.orig Sat Apr 19 19:49:10 2003 +++ b/linux/net/unix/sysctl_net_unix.c Fri May 2 13:48:11 2003 Patches like yours don't work at all with the automated patch scripts lots of us use to ease the burdon of applying lots of patches. In fact, even if I had changed into net/unix/ before applying your patch, it would fail because there patch tries to patch a file named sysctl_net_unix.c.new which of course does not exist. Please, this is very lazy and causes me to waste a lot of time fixing up your patch which I should not have to do. :( From niv@us.ibm.com Sat May 3 10:07:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 03 May 2003 10:07:14 -0700 (PDT) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.104]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h43H70Fu012926 for ; Sat, 3 May 2003 10:07:07 -0700 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e4.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h43H6ssZ093400; Sat, 3 May 2003 13:06:54 -0400 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h43H6q6h184178; Sat, 3 May 2003 13:06:52 -0400 Message-ID: <3EB3F5BD.5070202@us.ibm.com> Date: Sat, 03 May 2003 10:00:45 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David S. Miller" CC: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.68] sysctl max_dgram_qlen permissions References: <20030503.002822.34760030.davem@redhat.com> In-Reply-To: <20030503.002822.34760030.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2418 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev David S. Miller wrote: > Please, this is very lazy and causes me to waste a lot of time fixing > up your patch which I should not have to do. :( Eeep! A thousand pardons Dave! Didnt send you the right file. Much flamage deserved and redirected to my sloppiness and utter inability to correctly recall the name of a file generated moments earlier... Much thanks for the cleanup.. Nivedita From vinay-rc@naturesoft.net Sun May 4 02:20:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 02:20:48 -0700 (PDT) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h449KcFu020649 for ; Sun, 4 May 2003 02:20:42 -0700 Received: from [192.168.0.15] (helo=lima.royalchallenge.com) by naturesoft.net with esmtp (Exim 3.35 #1) id 19CFXy-00085y-00 for netdev@oss.sgi.com; Sun, 04 May 2003 14:42:38 +0530 Subject: [PATCH 2.{4,x5}.x] mod_timer cleanups for dst.c From: Vinay K Nallamothu To: netdev@oss.sgi.com Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 04 May 2003 14:55:34 +0530 Message-Id: <1052040334.1119.71.camel@lima.royalchallenge.com> Mime-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2420 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 Hi, Just reposting what I earlier posted to the linux-kernel mailing list. These are trivial patches converting {del,add}_timer to mod_timer. Also kindly let me know whether this is the right platform to post the PPP & FR related fixes or to linux-x25 mailing list. vinay PS: I am not subscribed to this mailing list --- linux-2.5.68/net/core/dst.c 2003-03-25 10:08:35.000000000 +0530 +++ linux-2.5.68-mod/net/core/dst.c 2003-05-03 13:42:12.000000000 +0530 @@ -154,11 +154,9 @@ dst->next = dst_garbage_list; dst_garbage_list = dst; if (dst_gc_timer_inc > DST_GC_INC) { - del_timer(&dst_gc_timer); dst_gc_timer_inc = DST_GC_INC; dst_gc_timer_expires = DST_GC_MIN; - dst_gc_timer.expires = jiffies + dst_gc_timer_expires; - add_timer(&dst_gc_timer); + mod_timer(&dst_gc_timer, jiffies + dst_gc_timer_expires); } spin_unlock_bh(&dst_lock); } From andre@tomt.net Sun May 4 02:19:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 02:19:24 -0700 (PDT) Received: from mail.skjellin.no (mail.skjellin.no [80.239.42.67]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h449J8Fu019256 for ; Sun, 4 May 2003 02:19:15 -0700 Received: (qmail 5586 invoked by uid 1006); 4 May 2003 09:27:51 -0000 Received: from andre@tomt.net by ns1 by uid 1003 with qmail-scanner-1.15 (sophie: 2.14/3.67. spamassassin: 2.50. Clear:. Processed in 0.017195 secs); 04 May 2003 09:27:51 -0000 Received: from slask.tomt.net (HELO slurv) (andre@tomt.net@217.8.136.222) by mail.skjellin.no with SMTP; 4 May 2003 09:27:51 -0000 From: "Andre Tomt" To: Subject: RE: unable to add ipv6 default route in 2.4.21-rc1 + latest bkbits.net pieces Date: Sun, 4 May 2003 11:21:04 +0200 Message-ID: <005701c3121e$7cc46370$0a01ff0a@slurv> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h449J8Fu019256 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2419 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: andre@tomt.net Precedence: bulk X-list: netdev > Replying to myself here. And again. Have some more information now. It seems, I cannot use 2001:730:f:3:: as an ordinary unicast global address anymore? At least not as a default gateway. Adding a default route pointing to 2001:730:f:3::1 works just fine, but why did :0000 break? PS! I'm not subscribed to this list, so CC's would be nice. I forgot to mention this earlier too. -- Cheers, André Tomt andre@tomt.net From vinay-rc@naturesoft.net Sun May 4 02:26:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 02:26:16 -0700 (PDT) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h449Q8Fu021220 for ; Sun, 4 May 2003 02:26:11 -0700 Received: from [192.168.0.15] (helo=lima.royalchallenge.com) by naturesoft.net with esmtp (Exim 3.35 #1) id 19CFdJ-00088C-00 for netdev@oss.sgi.com; Sun, 04 May 2003 14:48:09 +0530 Subject: [PATCH 2.{4,5}.x] mod_timer cleanups for sch_cbq.c From: Vinay K Nallamothu To: netdev@oss.sgi.com Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 04 May 2003 15:01:05 +0530 Message-Id: <1052040665.1119.76.camel@lima.royalchallenge.com> Mime-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2421 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 sch_cbq.c: Trivial {del,add}_timer to mod_timer conversion. --- linux-2.5.68/net/sched/sch_cbq.c 2003-03-25 10:08:36.000000000 +0530 +++ linux-2.5.68-nvk/net/sched/sch_cbq.c 2003-05-03 19:29:08.000000000 +0530 @@ -1056,11 +1056,9 @@ sch->stats.overlimits++; if (q->wd_expires && !netif_queue_stopped(sch->dev)) { long delay = PSCHED_US2JIFFIE(q->wd_expires); - del_timer(&q->wd_timer); if (delay <= 0) delay = 1; - q->wd_timer.expires = jiffies + delay; - add_timer(&q->wd_timer); + mod_timer(&q->wd_timer, jiffies + delay); sch->flags |= TCQ_F_THROTTLED; } } From vinay-rc@naturesoft.net Sun May 4 02:34:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 02:34:17 -0700 (PDT) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h449YAFu021604 for ; Sun, 4 May 2003 02:34:13 -0700 Received: from [192.168.0.15] (helo=lima.royalchallenge.com) by naturesoft.net with esmtp (Exim 3.35 #1) id 19CFl3-0008Aq-00 for netdev@oss.sgi.com; Sun, 04 May 2003 14:56:09 +0530 Subject: [PATCH 2.{4,5}.x] mod_timer fix for sch_csz.c From: Vinay K Nallamothu To: netdev@oss.sgi.com Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 04 May 2003 15:09:05 +0530 Message-Id: <1052041145.1119.83.camel@lima.royalchallenge.com> Mime-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2422 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 --- linux-2.5.68/net/sched/sch_csz.c 2003-04-21 10:14:44.000000000 +0530 +++ linux-2.5.68-nvk/net/sched/sch_csz.c 2003-05-03 14:40:11.000000000 +0530 @@ -708,11 +708,9 @@ */ if (q->wd_expires) { unsigned long delay = PSCHED_US2JIFFIE(q->wd_expires); - del_timer(&q->wd_timer); if (delay == 0) delay = 1; - q->wd_timer.expires = jiffies + delay; - add_timer(&q->wd_timer); + mod_timer(&q->wd_timer, jiffies + delay); sch->stats.overlimits++; } #endif From vinay-rc@naturesoft.net Sun May 4 02:35:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 02:35:52 -0700 (PDT) Received: from naturesoft.net ([203.145.184.221]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h449ZiFu021919 for ; Sun, 4 May 2003 02:35:47 -0700 Received: from [192.168.0.15] (helo=lima.royalchallenge.com) by naturesoft.net with esmtp (Exim 3.35 #1) id 19CFmb-0008C0-00 for netdev@oss.sgi.com; Sun, 04 May 2003 14:57:46 +0530 Subject: [PATCH 2.{4,5}.x] mod_timer fix for sch_htb.c From: Vinay K Nallamothu To: netdev@oss.sgi.com Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 04 May 2003 15:10:42 +0530 Message-Id: <1052041242.1245.86.camel@lima.royalchallenge.com> Mime-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2423 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 sch_htb.c: Trivial {del,add}_timer to mod_timer conversion. --- linux-2.5.68/net/sched/sch_htb.c 2003-04-21 10:14:44.000000000 +0530 +++ linux-2.5.68-nvk/net/sched/sch_htb.c 2003-05-03 14:41:36.000000000 +0530 @@ -975,9 +975,7 @@ printk(KERN_INFO "HTB delay %ld > 5sec\n", delay); delay = 5*HZ; } - del_timer(&q->timer); - q->timer.expires = jiffies + delay; - add_timer(&q->timer); + mod_timer(&q->timer, jiffies + delay); sch->flags |= TCQ_F_THROTTLED; sch->stats.overlimits++; HTB_DBG(3,1,"htb_deq t_delay=%ld\n",delay); From davem@redhat.com Sun May 4 05:33:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 05:33: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.9) with SMTP id h44CXQFu029630 for ; Sun, 4 May 2003 05:33:27 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id EAA13572; Sun, 4 May 2003 04:26:13 -0700 Date: Sun, 04 May 2003 04:26:12 -0700 (PDT) Message-Id: <20030504.042612.104038287.davem@redhat.com> To: vinay-rc@naturesoft.net Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.{4,x5}.x] mod_timer cleanups for dst.c From: "David S. Miller" In-Reply-To: <1052040334.1119.71.camel@lima.royalchallenge.com> References: <1052040334.1119.71.camel@lima.royalchallenge.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2424 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 From: Vinay K Nallamothu Date: 04 May 2003 14:55:34 +0530 Just reposting what I earlier posted to the linux-kernel mailing list. These are trivial patches converting {del,add}_timer to mod_timer. Thanks, this is actually a bug fix. The old code could add_timer() while the timer was active. From rusty@samba.org Sun May 4 22:18:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 04 May 2003 22:19:04 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h455IsFu005320 for ; Sun, 4 May 2003 22:18:56 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 5C31F2C05E; Mon, 5 May 2003 05:18:54 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, shemminger@osdl.org, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor In-reply-to: Your message of "Fri, 02 May 2003 20:46:28 MST." <20030502.204628.35664814.davem@redhat.com> Date: Mon, 05 May 2003 15:18:29 +1000 Message-Id: <20030505051854.5C31F2C05E@lists.samba.org> X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-archive-position: 2425 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030502.204628.35664814.davem@redhat.com> you write: > I think it can work Rusty, in short you create 1 freeze thread > per cpu. You wake up all the freeze threads on non-local cpus, > and they indicate their presence via some bitmask. This code is already in module.c. I'm glad you like it though 8). But we disable local irqs as well: this is what I call a "bogolock" (the read-side of a bogolock is prempt_disable()/preempt_enable(): you could temporarily disable preemption and force the scheduler to run every preempted thread, and remove this). > This means the local master cpu executes the unload sequence. It may > sleep in order to yield to, for example, semaphore holders, it may > also sleep to yield to kswapd and friends for the sake of memory > allocation. I mean... consider all the situations and please try to > find some hole in this. We can make all try_to_*() sleep at this > time too... this in particular needs more thought. Well, it's a big task. Holding interrupts disabled for unbounded time on CPUs needs to be thought about, but I think can be fixed. try_xxx can be called from interrupt context: you really want to get rid of interrupts, too... During previous discussions, I called this "return to primordial soup": back to like during init. Ideally, only userspace context (no interrupts, timers, bottom halves), and life is easy. > To make these freeze threads globally useful, we allow them to > run atomicity commands. The two defined commands are "local_irq_*()" > and "local_bh_*()", two bitmasks control this and the freeze threads > check the bits in their spin loops. Something like this? /* Tell all freeze threads to disable bottom halves. */ void global_bh_disable(void); void global_bh_enable(void); /* Tell all freeze threads to disable interrupts halves. */ void global_irq_disable(void); void global_irq_enable(void); > Do you see? Maybe... it is nearly Nirvana! :-))))) Yes, but I worry it might be an illusion 8) > Our ability to implement this changes the rest of the conversation, > so let us resolve this first. Yes, but it's a big IF. I think it might be easier to make all unregistrations runnable in interrupt context 8( Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From sriram.chintalapati@wipro.com Mon May 5 06:04:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 May 2003 06:24:24 -0700 (PDT) Received: from localhost [127.0.0.1] by oss.sgi.com with SpamAssassin (2.50 1.173-2003-02-20-exp); Mon, 05 May 2003 06:05:01 -0700 From: "Chintalapati,Sriram" To: "'netdev@oss.sgi.com'" Cc: "'sriramc@wipro.tcpn.com'" Subject: Help needed: Find Net4 related differences between 2.4.20 and 2.5 .68 kernel versions Date: Mon, 5 May 2003 18:21:21 +0530 Message-Id: <2B4B4D30E18DD31180CA00508B0F3002A71D85@wipro-exmbx1.wipro.tcpn.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_3EB6617D.2FD31CBE" X-archive-position: 2426 X-Approved-By: ralf@linux-mips.org X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Sriram.Chintalapati@wipro.com Precedence: bulk X-list: netdev This is a multi-part message in MIME format. ------------=_3EB6617D.2FD31CBE Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit This mail is probably spam. The original message has been attached along with this report, so you can recognize or block similar unwanted mail in future. See http://spamassassin.org/tag/ for more details. Content preview: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C31305.074BD3C0 Content-Type: text/plain [...] Content analysis details: (10.40 points, 5 required) HTML_MESSAGE (3.0 points) BODY: HTML included in message HTML_40_50 (0.4 points) BODY: Message is 40% to 50% HTML MSG_ID_ADDED_BY_MTA_3 (3.0 points) 'Message-Id' was added by a relay (3) MIME_BOUND_NEXTPART (4.0 points) Spam tool pattern in MIME boundary The original message did not contain plain text, and may be unsafe to open with some email clients; in particular, it may contain a virus, or confirm that your address can receive spam. If you wish to view it, it may be safer to save it to a file and open it with an editor. ------------=_3EB6617D.2FD31CBE Content-Type: message/rfc822 Content-Description: original message before SpamAssassin Content-Disposition: attachment Content-Transfer-Encoding: 8bit Received: from wiprom2mx1.wipro.com (wiprom2mx1.wipro.com [203.197.164.41]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h45D4mFu015591 for ; Mon, 5 May 2003 06:04:51 -0700 Received: from m2vwall5.wipro.com (m2vwall5.wipro.com [10.115.50.5]) by wiprom2mx1.wipro.com (8.11.3/8.11.3) with SMTP id h45D4dN21841 for ; Mon, 5 May 2003 18:34:39 +0530 (IST) Received: from blr-m2-msg.wipro.com ([10.116.50.99]) by blr-m1-bh2.wipro.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 5 May 2003 18:34:34 +0530 Received: from wipro.tcpn.com ([172.31.41.11]) by blr-m2-msg.wipro.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 5 May 2003 18:34:34 +0530 Received: from wipro-exconn1.wipro.tcpn.com (wipro-exconn1.wipro.tcpn.com [172.31.41.55]) by wipro.tcpn.com (8.9.3/8.9.3) with ESMTP id SAA04495; Mon, 5 May 2003 18:37:19 +0530 (IST) Received: by wipro-exconn1.wipro.tcpn.com with Internet Mail Service (5.5.2650.21) id ; Mon, 5 May 2003 18:15:34 +0530 Message-ID: <2B4B4D30E18DD31180CA00508B0F3002A71D85@wipro-exmbx1.wipro.tcpn.com> From: "Chintalapati,Sriram" To: "'netdev@oss.sgi.com'" Cc: "'sriramc@wipro.tcpn.com'" Subject: Help needed: Find Net4 related differences between 2.4.20 and 2.5 .68 kernel versions Date: Mon, 5 May 2003 18:21:21 +0530 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/mixed; boundary="----=_NextPartTM-000-36df13d1-7afa-11d7-ba7f-006067005148" X-OriginalArrivalTime: 05 May 2003 13:04:34.0379 (UTC) FILETIME=[DFE871B0:01C31306] This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------=_NextPartTM-000-36df13d1-7afa-11d7-ba7f-006067005148 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C31305.074BD3C0" ------_=_NextPart_001_01C31305.074BD3C0 Content-Type: text/plain Hi, I need some guidance regarding finding differences related to Net4 between 2.4.20 and 2.5.68 kernel versions. Aim is to make a list of code changes that might be needed to use SOCK_STREAM option for SCTP protocol and any dependent changes. Can you please let me know how these differences can be found? Do I need to look for a list patches present for 2.5 kernel that need to be migrated back? If so, where can I get list of patches that are needed? Can you please let me know the best way to proceed for this task? Please let me know if this is not the right place for this question. Please let me know if I need to provide any additional information. Thanks, Sriram ------_=_NextPart_001_01C31305.074BD3C0 Content-Type: text/html Message
Hi,
 
I need some guidance regarding finding differences related to Net4 between 2.4.20 and 2.5.68 kernel versions.
Aim is to make a list of code changes that might be needed to use SOCK_STREAM option for SCTP protocol and any dependent changes.
Can you please let me know how these differences can be found? Do I need to look for a list patches present for 2.5 kernel that need to be migrated back? If so, where can I get list of patches that are needed?
Can you please let me know the best way to proceed for this task?
 
Please let me know if this is not the right place for this question.
 
Please let me know if I need to provide any additional information.
 
Thanks,
Sriram
 
------_=_NextPart_001_01C31305.074BD3C0-- ------=_NextPartTM-000-36df13d1-7afa-11d7-ba7f-006067005148-- ------------=_3EB6617D.2FD31CBE-- From shemminger@osdl.org Mon May 5 09:08:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 May 2003 09:08:34 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h45G8RFu019453 for ; Mon, 5 May 2003 09:08: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 h45G8KW12794; Mon, 5 May 2003 09:08:20 -0700 Date: Mon, 5 May 2003 09:08:20 -0700 From: Stephen Hemminger To: Rusty Russell Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor Message-Id: <20030505090820.50cd5a13.shemminger@osdl.org> In-Reply-To: <20030503040949.804182C003@lists.samba.org> References: <20030502.134804.78707298.davem@redhat.com> <20030503040949.804182C003@lists.samba.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2427 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, 03 May 2003 14:07:41 +1000 Rusty Russell wrote: > In message <20030502.134804.78707298.davem@redhat.com> you write: > > From: Rusty Russell > > Date: Fri, 02 May 2003 15:25:15 +1000 > > > > If this is true, I think you can use the module reference count only, > > and your code will be faster, too. I can prepare the patch for you > > later tonight, to see how it looks. > > > > And where do we get the counter from when dev->owner is NULL > > (ie. non-modular)? We need the reference counting regardless of > > whether the device is implemented statically in the kernel or modular. > > But Alexey said you can only call unregister_netdev from module > unload, ie. if not a module, it can't be unloaded, hence no refcount > needed. I wrote the above paragraph because I'm not sure if I > understood Alexey correctly? There are several flavors of pseudo-network devices like bridging and VLAN that dynamically create/destroy netdev's even when they are not modules. From shemminger@osdl.org Mon May 5 13:01:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 05 May 2003 13:01:06 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h45K0xFu023266 for ; Mon, 5 May 2003 13:00:59 -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 h45K0oW25590; Mon, 5 May 2003 13:00:50 -0700 Date: Mon, 5 May 2003 13:00:50 -0700 From: Stephen Hemminger To: Rusty Russell Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor Message-Id: <20030505130050.4b9868bb.shemminger@osdl.org> In-Reply-To: <20030503040949.804182C003@lists.samba.org> References: <20030502.134804.78707298.davem@redhat.com> <20030503040949.804182C003@lists.samba.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: multipart/mixed; boundary="Multipart_Mon__5_May_2003_13:00:50_-0700_086866c8" X-archive-position: 2428 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --Multipart_Mon__5_May_2003_13:00:50_-0700_086866c8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit As an experiment, tried acquiring module ref count every time network device is ref counted. The result is discovering that there are cases in the Ethernet module init path where there is a call to dev_hold() without a previous explicit ref count. kernel BUG at include/linux/module.h:284! invalid operand: 0000 [#1] CPU: 0 EIP: 0060:[] Not tainted EFLAGS: 00010246 EIP is at linkwatch_fire_event+0x170/0x1a3 eax: 00000000 ebx: c047fad0 ecx: 00000020 edx: f88c8100 esi: f88c7100 edi: f6fa7000 ebp: f6f15de4 esp: f6f15dc8 ds: 007b es: 007b ss: 0068 Process modprobe (pid: 408, threadinfo=f6f14000 task=f78f46a0) Stack: f88c7100 c03f7008 00000246 f6f14000 f6fa7000 00000000 fffc829b f6f15df8 f88c0ab9 f6fa7000 f6fa71e0 033002a8 f6f15e24 f88c00e0 f6fa71e0 00007148 c03e2e80 f6fa7320 c011eb46 ffffffef f6f15e3e f6fa71e0 fffc829b f6f15e50 Call Trace: [] +0x0/0x1180 [e100] [] e100_update_link_state+0x97/0xa2 [e100] [] e100_find_speed_duplex+0x20/0x26a [e100] [] sys_sched_yield+0xc0/0xfe [] e100_auto_neg+0x114/0x11c [e100] [] __delay+0x14/0x18 [] e100_phy_set_speed_duplex+0x37/0xa4 [e100] [] e100_phy_init+0x69/0x78 [e100] [] e100_hw_init+0x14/0x11e [e100] [] e100_rd_pwa_no+0x32/0x40 [e100] [] e100_init+0xf6/0x126 [e100] [] e100_found1+0x1a9/0x42e [e100] [] e100_driver_version+0x0/0xb [e100] [] e100_driver+0x0/0xa0 [e100] [] pci_device_probe+0x5a/0x68 [] e100_id_table+0x0/0x2e0 [e100] [] e100_driver+0x28/0xa0 [e100] [] bus_match+0x43/0x6e [] e100_driver+0x28/0xa0 [e100] [] e100_driver+0x28/0xa0 [e100] [] driver_attach+0x5c/0x60 [] e100_driver+0x28/0xa0 [e100] [] e100_driver+0x28/0xa0 [e100] [] bus_add_driver+0xb2/0xc8 [] e100_driver+0x28/0xa0 [e100] [] +0x0/0x1180 [e100] [] pci_register_driver+0x46/0x56 [] e100_driver+0x28/0xa0 [e100] [] +0x15/0x3e [e100] [] e100_driver+0x0/0xa0 [e100] [] sys_init_module+0x1b0/0x292 all_call+0x7/0xb Code: 0f 0b 1c 01 97 5a 32 c0 e9 d9 fe ff ff c7 04 24 0c 00 00 00 ./ifup: line 91: 408 Segmentation fault modprobe $1 >/dev/null 2>&1 --Multipart_Mon__5_May_2003_13:00:50_-0700_086866c8 Content-Type: application/octet-stream; name="netdev-module.diff" Content-Disposition: attachment; filename="netdev-module.diff" Content-Transfer-Encoding: base64 ZGlmZiAtdXJOcCAtWCBkb250ZGlmZiBsaW51eC0yLjUvaW5jbHVkZS9hc20taTM4Ni9hc21fb2Zm c2V0cy5oIGxpbnV4LTIuNS1kZXYvaW5jbHVkZS9hc20taTM4Ni9hc21fb2Zmc2V0cy5oCi0tLSBs aW51eC0yLjUvaW5jbHVkZS9hc20taTM4Ni9hc21fb2Zmc2V0cy5oCTE5NjktMTItMzEgMTY6MDA6 MDAuMDAwMDAwMDAwIC0wODAwCisrKyBsaW51eC0yLjUtZGV2L2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yeV9ob2xkKGRldikpCisJICAgIGRldiA9 IE5VTEw7CiAJcmVhZF91bmxvY2soJmRldl9iYXNlX2xvY2spOwogCXJldHVybiBkZXY7CiB9CkBA IC0yNjA5LDEwICsyNjEwLDExIEBAIGludCByZWdpc3Rlcl9uZXRkZXZpY2Uoc3RydWN0IG5ldF9k ZXZpY2UKIAlzZXRfYml0KF9fTElOS19TVEFURV9QUkVTRU5ULCAmZGV2LT5zdGF0ZSk7CiAKIAlk ZXYtPm5leHQgPSBOVUxMOworCWF0b21pY19pbmMoJmRldi0+cmVmY250KTsKIAlkZXZfaW5pdF9z Y2hlZHVsZXIoZGV2KTsKIAl3cml0ZV9sb2NrX2JoKCZkZXZfYmFzZV9sb2NrKTsKIAkqZHAgPSBk ZXY7Ci0JZGV2X2hvbGQoZGV2KTsKKwogCWRldi0+ZGVhZGJlYWYgPSAwOwogCXdyaXRlX3VubG9j a19iaCgmZGV2X2Jhc2VfbG9jayk7CiAK --Multipart_Mon__5_May_2003_13:00:50_-0700_086866c8-- From rusty@samba.org Tue May 6 00:58:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 00:58:20 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h467w8Fu030565 for ; Tue, 6 May 2003 00:58:09 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 388332C07F; Tue, 6 May 2003 07:58:08 +0000 (GMT) From: Rusty Russell To: Stephen Hemminger Subject: Re: dev->destructor Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br In-reply-to: Your message of "Mon, 05 May 2003 13:00:50 MST." <20030505130050.4b9868bb.shemminger@osdl.org> Date: Tue, 06 May 2003 14:18:36 +1000 Message-Id: <20030506075808.388332C07F@lists.samba.org> X-archive-position: 2429 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030505130050.4b9868bb.shemminger@osdl.org> you write: > As an experiment, tried acquiring module ref count every time network > device is ref counted. Brave man 8) > The result is discovering that there are cases in the Ethernet > module init path where there is a call to dev_hold() without a > previous explicit ref count. Well caught: this is in fact a false alarm. Coming, as we do, out of module_init(), we actually hold an implicit reference. It's logically consistent to make it implicit, and cuts out some code in the unload path. How's this? Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. Name: Hold Initial Reference To Module Author: Rusty Russell Status: Tested on 2.5.69 D: __module_get is theoretically allowed on module inside init, since D: we already hold an implicit reference. Currently this BUG()s: make D: the reference count explicit, which also simplifies delete path. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.69/kernel/module.c working-2.5.69-module-init-ref/kernel/module.c --- linux-2.5.69/kernel/module.c 2003-05-05 12:37:13.000000000 +1000 +++ working-2.5.69-module-init-ref/kernel/module.c 2003-05-06 12:11:18.000000000 +1000 @@ -214,6 +214,8 @@ static void module_unload_init(struct mo INIT_LIST_HEAD(&mod->modules_which_use_me); for (i = 0; i < NR_CPUS; i++) atomic_set(&mod->ref[i].count, 0); + /* Hold reference count during initialization. */ + atomic_set(&mod->ref[smp_processor_id()].count, 1); /* Backwards compatibility macros put refcount during init. */ mod->waiter = current; } @@ -500,16 +502,6 @@ sys_delete_module(const char __user *nam goto out; } - /* Coming up? Allow force on stuck modules. */ - if (mod->state == MODULE_STATE_COMING) { - forced = try_force(flags); - if (!forced) { - /* This module can't be removed */ - ret = -EBUSY; - goto out; - } - } - /* If it has an init func, it must have an exit func to unload */ if ((mod->init != init_module && mod->exit == cleanup_module) || mod->unsafe) { @@ -1448,6 +1440,7 @@ sys_init_module(void __user *umod, printk(KERN_ERR "%s: module is now stuck!\n", mod->name); else { + module_put(mod); down(&module_mutex); free_module(mod); up(&module_mutex); @@ -1463,6 +1456,9 @@ sys_init_module(void __user *umod, mod->init_size = 0; up(&module_mutex); + /* Drop initial reference. */ + module_put(mod); + return 0; } From seong@etri.re.kr Tue May 6 03:16:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 03:17:10 -0700 (PDT) Received: from cms1.etri.re.kr ([129.254.16.11]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46AGWFu003282 for ; Tue, 6 May 2003 03:16:33 -0700 Received: from SEONG ([129.254.172.40]) by cms1.etri.re.kr with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id KB4YXCPY; Tue, 6 May 2003 19:14:51 +0900 Message-ID: <003e01c313b8$e55db620$28acfe81@seong> From: "Seong Moon" To: Subject: IPv6 : ICMPV6_DEST_UNREACH type with ICMPV6_NOROUTE code Date: Tue, 6 May 2003 19:18:47 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4920.2300 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4920.2300 X-archive-position: 2430 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: seong@etri.re.kr Precedence: bulk X-list: netdev Hi, there. I'm recently analyzing the kernel source for IPv6 router. I found that when the kernel has no forwarding entry of a packet, the kernel sends an ICMPV6_DEST_UNREACH icmp message with ICMPV6_ADDR_UNREACH code to the source of the packet. But According to RFC 2463, If the kerenl has no forwarding entry of a packet, the kernel must send an ICMPV6_DEST_UNREACH icmp message with ICMPV6_NOROUTE code. In my opinion, ip6_pkt_discard() should be modified as follows : int ip6_pkt_discard(struct sk_buff *skb) { IP6_INC_STATS(Ip6OutNoRoutes); /* icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev); */ icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); kfree_skb(skb); return 0; } How about you ? Am I right ? And I found another doubtable thing, ipv6_routing_header() sends an ICMPv6 Parameter Problem message if the extention header's length is odd value. Then ICMPv6 Parameter Problem Message includes the pointer that indicates the byte offset of errorneous field in a packet. ipv6_routing_header() calculates the byte offset from the beginning of the extention header. In my opinion, ipv6_routing_header() must calculates the byte offset from the beginning of the IPv6 packet. Is this right ? bye. From akumar@omnesysindia.com Tue May 6 05:53:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 05:53:34 -0700 (PDT) Received: from omnesysindia.com ([202.140.148.138]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46CrPFu006679 for ; Tue, 6 May 2003 05:53:27 -0700 Received: from clnt36 [192.5.50.36] by omnesysindia.com [202.140.148.138] with SMTP (MDaemon.v2.83.R) for ; Tue, 06 May 2003 18:05:54 +0530 Message-ID: <01f301c313cc$4e6cb8b0$243205c0@otp.com> From: "arun" To: Subject: SIOCETHTOOL history ? Date: Tue, 6 May 2003 18:07:48 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-MDaemon-Deliver-To: netdev@oss.sgi.com X-Return-Path: akumar@omnesysindia.com X-archive-position: 2431 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akumar@omnesysindia.com Precedence: bulk X-list: netdev Hi, Can anyone of the veterans please help me out with a small code curiosity Why does the SIOCETHTOOL ioctl need CAP_NET_ADMIN even for harmless commands like GSET ? Some sample drivers that I managed to download over the net that supports SIOCETHTOOL has comments like "no need to check for CAP_NET_ADMIN since that is already present in net/core/dev.c". (And sure enough it was there) Why would such a blanket checking be present when this ioctl is only an entry point for many sub commands ? I have used SIOCGMIIPHY before and it seemed not to require any su rights or capabilities. What's then the difference between these 2 ioctls that require more capabilities for SIOCETHTOOL ? arun From davem@redhat.com Tue May 6 05:56:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 05:57:00 -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.9) with SMTP id h46CuuFu007070 for ; Tue, 6 May 2003 05:56:56 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id EAA18601; Tue, 6 May 2003 04:49:27 -0700 Date: Tue, 06 May 2003 04:49:26 -0700 (PDT) Message-Id: <20030506.044926.132916721.davem@redhat.com> To: akumar@omnesysindia.com Cc: netdev@oss.sgi.com Subject: Re: SIOCETHTOOL history ? From: "David S. Miller" In-Reply-To: <01f301c313cc$4e6cb8b0$243205c0@otp.com> References: <01f301c313cc$4e6cb8b0$243205c0@otp.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2432 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 From: "arun" Date: Tue, 6 May 2003 18:07:48 +0530 I have used SIOCGMIIPHY before and it seemed not to require any su rights or capabilities. Yes it does: /* * These ioctl calls: * - require superuser power. * - require strict serialization. * - return a value */ case SIOCETHTOOL: case SIOCGMIIPHY: case SIOCGMIIREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; From akumar@omnesysindia.com Tue May 6 06:30:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 06:30:46 -0700 (PDT) Received: from omnesysindia.com ([202.140.148.138]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46DUGFu008010 for ; Tue, 6 May 2003 06:30:19 -0700 Received: from clnt36 [192.5.50.36] by omnesysindia.com [202.140.148.138] with SMTP (MDaemon.v2.83.R) for ; Tue, 06 May 2003 18:52:46 +0530 Message-ID: <009901c313d2$db6b0630$243205c0@otp.com> From: "arun" To: Subject: Re: SIOCETHTOOL history ? Date: Tue, 6 May 2003 18:54:43 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-MDaemon-Deliver-To: netdev@oss.sgi.com X-Return-Path: akumar@omnesysindia.com X-archive-position: 2433 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: akumar@omnesysindia.com Precedence: bulk X-list: netdev ----- Original Message ----- From: "arun" To: "David S. Miller" Sent: Tuesday, May 06, 2003 6:53 PM Subject: Re: SIOCETHTOOL history ? > ----- Original Message ----- > From: "David S. Miller" > To: > Cc: > Sent: Tuesday, May 06, 2003 5:19 PM > Subject: Re: SIOCETHTOOL history ? > > Yes it does: Iam really stumped in that case since, mii-diag tool based on Donald Beckers code, ftp://ftp.scyld.com/pub/diag/mii-diag.c seems to work ok without CAP_NET_ADMIN on RH 7.1 and RH8.0 distros. (I dont set any capabilities just tried to read speed / card id and it never returned EPERM for me) I chanced on the ethtool since mii failed to report anything on newer Gigabit cards (specifically a Broadcom Corporation NetXtreme BCM5701 card) However ethtool required running with su root even for reading the capabilities (I recompiled ethtool code with only a GSET command to confirm this) and that is why i have this doubt on the reason of the behavioural differnces between the 2 ioctl's arun From davem@redhat.com Tue May 6 08:31:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 08:31: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.9) with SMTP id h46FVcFu009352 for ; Tue, 6 May 2003 08:31:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id HAA19351; Tue, 6 May 2003 07:23:38 -0700 Date: Tue, 06 May 2003 07:23:38 -0700 (PDT) Message-Id: <20030506.072338.39479306.davem@redhat.com> To: rusty@rustcorp.com.au Cc: shemminger@osdl.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030506075808.388332C07F@lists.samba.org> References: <20030505130050.4b9868bb.shemminger@osdl.org> <20030506075808.388332C07F@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2434 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 From: Rusty Russell Date: Tue, 06 May 2003 14:18:36 +1000 It's logically consistent to make it implicit, and cuts out some code in the unload path. How's this? This looks fine to me. How hard would it be to make this completely consistent in that no module code is ever invoked with modcount == 0? By this I mean keeping the implicit reference after modload succeeds, and then calling ->cleanup() is valid once the count drops to '1'. From davem@redhat.com Tue May 6 08:33:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 08:33:34 -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.9) with SMTP id h46FXTFu009565 for ; Tue, 6 May 2003 08:33:30 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id HAA19374; Tue, 6 May 2003 07:25:29 -0700 Date: Tue, 06 May 2003 07:25:29 -0700 (PDT) Message-Id: <20030506.072529.52888036.davem@redhat.com> To: shemminger@osdl.org Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030505090820.50cd5a13.shemminger@osdl.org> References: <20030502.134804.78707298.davem@redhat.com> <20030503040949.804182C003@lists.samba.org> <20030505090820.50cd5a13.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2435 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 From: Stephen Hemminger Date: Mon, 5 May 2003 09:08:20 -0700 On Sat, 03 May 2003 14:07:41 +1000 Rusty Russell wrote: > But Alexey said you can only call unregister_netdev from module > unload, ie. if not a module, it can't be unloaded, hence no refcount > needed. I wrote the above paragraph because I'm not sure if I > understood Alexey correctly? There are several flavors of pseudo-network devices like bridging and VLAN that dynamically create/destroy netdev's even when they are not modules. I think you'll understand what Alexey/Rusty are saying better if you consider statically compiled kernel code as a module with an implicit non-zero reference count :-) From sri@us.ibm.com Tue May 6 12:31:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 12:31:18 -0700 (PDT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.105]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46JV3Fu013323 for ; Tue, 6 May 2003 12:31:10 -0700 Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150]) by e5.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h46JTjOm171776; Tue, 6 May 2003 15:29:45 -0400 Received: from dyn9-47-18-140.beaverton.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay02.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h46JTgw2241608; Tue, 6 May 2003 15:29:43 -0400 Date: Tue, 6 May 2003 12:28:41 -0700 (PDT) From: Sridhar Samudrala X-X-Sender: sridhar@dyn9-47-18-140.beaverton.ibm.com To: davem@redhat.com, cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69] Bug in sys_accept() module ref counts Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2436 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 I think there is a bug in the recent changes to sys_accept() to implement module ref counts. module_put() gets called twice on error. Once via the explicit module_put and the second via sock_release(). Also i think we should do a __module_get() with newsock's owner(although same as the original listening sock). The following patch against 2.5.69 should fix the problem. Thanks Sridhar ------------------------------------------------------------------------------- diff -Nru a/net/socket.c b/net/socket.c --- a/net/socket.c Tue May 6 12:14:35 2003 +++ b/net/socket.c Tue May 6 12:14:35 2003 @@ -1280,26 +1280,26 @@ * We don't need try_module_get here, as the listening socket (sock) * has the protocol module (sock->ops->owner) held. */ - __module_get(sock->ops->owner); + __module_get(newsock->ops->owner); err = sock->ops->accept(sock, newsock, sock->file->f_flags); if (err < 0) - goto out_module_put; + goto out_release; if (upeer_sockaddr) { if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { err = -ECONNABORTED; - goto out_module_put; + goto out_release; } err = move_addr_to_user(address, len, upeer_sockaddr, upeer_addrlen); if (err < 0) - goto out_module_put; + goto out_release; } /* File flags are not inherited via accept() unlike another OSes. */ if ((err = sock_map_fd(newsock)) < 0) - goto out_module_put; + goto out_release; security_socket_post_accept(sock, newsock); @@ -1307,8 +1307,6 @@ sockfd_put(sock); out: return err; -out_module_put: - module_put(sock->ops->owner); out_release: sock_release(newsock); goto out_put; From shemminger@osdl.org Tue May 6 15:32:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 15:32:53 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46MWiFu024398 for ; Tue, 6 May 2003 15:32:45 -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 h46MWYW04418; Tue, 6 May 2003 15:32:34 -0700 Date: Tue, 6 May 2003 15:32:34 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: [PATCH 2.5.69] IPV4 should use dev_hold Message-Id: <20030506153234.4907001f.shemminger@osdl.org> In-Reply-To: <20030506.072338.39479306.davem@redhat.com> References: <20030505130050.4b9868bb.shemminger@osdl.org> <20030506075808.388332C07F@lists.samba.org> <20030506.072338.39479306.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2437 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 David, While debugging possible changes to dev refcounting, discovered a couple of places in IPV4 that were directly incrementing rather than using the inline dev_hold. Let's hide the implementation of net device ref counting so future module ref count fixes will be easier. diff -urN -X dontdiff linux-2.5/net/ipv4/fib_frontend.c linux-2.5-dev/net/ipv4/fib_frontend.c --- linux-2.5/net/ipv4/fib_frontend.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-dev/net/ipv4/fib_frontend.c 2003-05-06 15:16:03.000000000 -0700 @@ -115,9 +115,9 @@ if (res.type != RTN_LOCAL) goto out; dev = FIB_RES_DEV(res); - if (dev) - atomic_inc(&dev->refcnt); + if (dev) + dev_hold(dev); out: fib_res_put(&res); return dev; diff -urN -X dontdiff linux-2.5/net/ipv4/fib_semantics.c linux-2.5-dev/net/ipv4/fib_semantics.c --- linux-2.5/net/ipv4/fib_semantics.c 2003-04-29 09:57:41.000000000 -0700 +++ linux-2.5-dev/net/ipv4/fib_semantics.c 2003-05-06 15:10:40.000000000 -0700 @@ -406,7 +406,7 @@ if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&dev->refcnt); + dev_hold(dev); nh->nh_scope = RT_SCOPE_LINK; return 0; } @@ -429,7 +429,7 @@ nh->nh_oif = FIB_RES_OIF(res); if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL) goto out; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); err = -ENETDOWN; if (!(nh->nh_dev->flags & IFF_UP)) goto out; @@ -451,7 +451,7 @@ return -ENETDOWN; } nh->nh_dev = in_dev->dev; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); nh->nh_scope = RT_SCOPE_HOST; in_dev_put(in_dev); } From shemminger@osdl.org Tue May 6 15:36:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 15:36:08 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46Ma2Fu025436 for ; Tue, 6 May 2003 15:36:02 -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 h46MZtW05046; Tue, 6 May 2003 15:35:55 -0700 Date: Tue, 6 May 2003 15:35:55 -0700 From: Stephen Hemminger To: Rusty Russell Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor Message-Id: <20030506153555.4e82bc4b.shemminger@osdl.org> In-Reply-To: <20030506075808.388332C07F@lists.samba.org> References: <20030505130050.4b9868bb.shemminger@osdl.org> <20030506075808.388332C07F@lists.samba.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2438 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 Tue, 06 May 2003 14:18:36 +1000 Rusty Russell wrote: > In message <20030505130050.4b9868bb.shemminger@osdl.org> you write: > > As an experiment, tried acquiring module ref count every time network > > device is ref counted. > > Brave man 8) > > > The result is discovering that there are cases in the Ethernet > > module init path where there is a call to dev_hold() without a > > previous explicit ref count. > > Well caught: this is in fact a false alarm. Coming, as we do, out of > module_init(), we actually hold an implicit reference. > > It's logically consistent to make it implicit, and cuts out some code > in the unload path. > > How's this? > Rusty. Thanks, with that change and the following patches, the system does boot and correctly ref counts the modules. Still have problems on unregister and shutdown, but it is a start. diff -urN -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-dev/include/linux/netdevice.h --- linux-2.5/include/linux/netdevice.h 2003-04-14 13:32:21.000000000 -0700 +++ linux-2.5-dev/include/linux/netdevice.h 2003-05-06 15:11:25.000000000 -0700 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -629,12 +630,32 @@ static inline void dev_put(struct net_device *dev) { + module_put(dev->owner); if (atomic_dec_and_test(&dev->refcnt)) netdev_finish_unregister(dev); } -#define __dev_put(dev) atomic_dec(&(dev)->refcnt) -#define dev_hold(dev) atomic_inc(&(dev)->refcnt) +static inline void __dev_put(struct net_device *dev) +{ + module_put(dev->owner); + atomic_dec(&dev->refcnt); +} + +static inline void dev_hold(struct net_device *dev) +{ + __module_get(dev->owner); + atomic_inc(&dev->refcnt); +} + +static inline int dev_try_hold(struct net_device *dev) +{ + int ret = 0; + if (try_module_get(dev->owner)){ + atomic_inc(&dev->refcnt); + ret = 1; + } + return ret; +} /* Carrier loss detection, dial on demand. The functions netif_carrier_on * and _off may be called from IRQ context, but it is caller diff -urN -X dontdiff linux-2.5/net/core/dev.c linux-2.5-dev/net/core/dev.c --- linux-2.5/net/core/dev.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-dev/net/core/dev.c 2003-05-06 15:12:24.000000000 -0700 @@ -1,3 +1,4 @@ +#define NET_REFCNT_DEBUG 1 /* * NET3 Protocol independent device support routines. * @@ -440,8 +441,8 @@ read_lock(&dev_base_lock); dev = __dev_get_by_name(name); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -513,8 +514,8 @@ read_lock(&dev_base_lock); dev = __dev_get_by_index(ifindex); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -563,8 +564,8 @@ read_lock(&dev_base_lock); dev = __dev_get_by_flags(if_flags, mask); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -1312,7 +1313,9 @@ goto drop; enqueue: - dev_hold(skb->dev); + if (!dev_try_hold(skb->dev)) + goto drop; + __skb_queue_tail(&queue->input_pkt_queue, skb); #ifndef OFFLINE_SAMPLE get_sample_stats(this_cpu); @@ -1990,9 +1993,8 @@ ASSERT_RTNL(); if (master) { - if (old) + if (old || !dev_try_hold(master)) return -EBUSY; - dev_hold(master); } br_write_lock_bh(BR_NETPROTO_LOCK); @@ -2609,10 +2611,11 @@ set_bit(__LINK_STATE_PRESENT, &dev->state); dev->next = NULL; + atomic_inc(&dev->refcnt); dev_init_scheduler(dev); write_lock_bh(&dev_base_lock); *dp = dev; - dev_hold(dev); + dev->deadbeaf = 0; write_unlock_bh(&dev_base_lock); @@ -2900,7 +2903,11 @@ #endif dev->xmit_lock_owner = -1; dev->iflink = -1; - dev_hold(dev); + + if (!dev_try_hold(dev)) { + dev->deadbeaf = 1; + dp = &dev->next; + } /* * Allocate name. If the init() fails diff -urN -X dontdiff linux-2.5/net/ipv4/devinet.c linux-2.5-dev/net/ipv4/devinet.c --- linux-2.5/net/ipv4/devinet.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-dev/net/ipv4/devinet.c 2003-05-06 15:16:03.000000000 -0700 @@ -559,6 +559,9 @@ if ((dev = __dev_get_by_name(ifr.ifr_name)) == NULL) goto done; + if (!dev_try_hold(dev)) + goto done; + if (colon) *colon = ':'; @@ -591,7 +594,7 @@ ret = -EADDRNOTAVAIL; if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS) - goto done; + goto put; switch(cmd) { case SIOCGIFADDR: /* Get interface address */ @@ -700,12 +703,15 @@ } break; } +put: + dev_put(dev); done: rtnl_unlock(); dev_probe_unlock(); out: return ret; rarok: + dev_put(dev); rtnl_unlock(); dev_probe_unlock(); ret = copy_to_user(arg, &ifr, sizeof(struct ifreq)) ? -EFAULT : 0; From lenehan@twibble.org Tue May 6 16:21:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 16:22:02 -0700 (PDT) Received: from egwene.twibble.org (charon.twibble.org [203.217.29.134]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46NLqFu030992 for ; Tue, 6 May 2003 16:21:56 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by egwene.twibble.org (Postfix) with ESMTP id 1137320F289 for ; Wed, 7 May 2003 09:21:47 +1000 (EST) Received: from egwene.twibble.org ([127.0.0.1]) by localhost (egwene.twibble.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04810-03 for ; Wed, 7 May 2003 09:21:11 +1000 (EST) Received: from nynaeve.twibble.org (nynaeve.twibble.org [203.217.29.154]) by egwene.twibble.org (Postfix) with ESMTP id CF8CC20F171 for ; Wed, 7 May 2003 09:20:41 +1000 (EST) Received: by nynaeve.twibble.org (Postfix, from userid 500) id 8F5B7200082; Tue, 6 May 2003 19:20:37 -0400 (EDT) Date: Wed, 7 May 2003 09:20:37 +1000 From: Jamie Lenehan To: netdev@oss.sgi.com Subject: 2.5.69 IPv6 (modular) crash on boot Message-ID: <20030506232037.GA5576@twibble.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at twibble.org X-archive-position: 2439 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: lenehan@twibble.org Precedence: bulk X-list: netdev IPv6 worked fine in 2.5.68, but I get a crash in 2.5.69 on boot. I haven't seen anyone else mention this though. This is a RedHat 8 systems with the new modutils added and pretty much everything built modular: May 5 18:46:50 nynaeve kernel: IPv6 v0.8 for NET4.0 May 5 18:46:50 nynaeve kernel: ------------[ cut here ]------------ May 5 18:46:50 nynaeve kernel: kernel BUG at include/linux/module.h:284! May 5 18:46:50 nynaeve kernel: invalid operand: 0000 [#1] May 5 18:46:50 nynaeve kernel: CPU: 0 May 5 18:46:50 nynaeve kernel: EIP: 0060:[] Not tainted May 5 18:46:50 nynaeve kernel: EFLAGS: 00010246 May 5 18:46:50 nynaeve kernel: EIP is at inet6_create+0x38b/0x430 [ipv6] May 5 18:46:50 nynaeve kernel: eax: 00000000 ebx: ee6e4000 ecx: 00000001 edx: f09a7100 May 5 18:46:50 nynaeve kernel: esi: 0000003a edi: f09a53c0 ebp: ee585c00 esp: ee6e5f08 May 5 18:46:50 nynaeve kernel: ds: 007b es: 007b ss: 0068 May 5 18:46:50 nynaeve kernel: Process modprobe (pid: 602, threadinfo=ee6e4000 task=ef336780) May 5 18:46:50 nynaeve kernel: Stack: f09a7080 ee585c00 0000039c efd354f0 00000001 0000000a ffffff9f eff9c800 May 5 18:46:50 nynaeve kernel: c0218b50 eff9c800 0000003a effa2400 00000003 c01202a5 f09a6820 effa2400 May 5 18:46:50 nynaeve kernel: effa2400 0000416d ef2ca720 f09a6880 00000000 c02b72b8 f09a7080 c02b72b8 May 5 18:46:50 nynaeve kernel: Call Trace: May 5 18:46:50 nynaeve kernel: [] +0x0/0x200 [ipv6] May 5 18:46:50 nynaeve kernel: [] sock_create+0xf0/0x280 May 5 18:46:50 nynaeve kernel: [] register_proc_table+0x95/0x130 May 5 18:46:50 nynaeve kernel: [] ipv6_net_table+0x0/0x60 [ipv6] May 5 18:46:50 nynaeve kernel: [] ipv6_root_table+0x0/0x60 [ipv6] May 5 18:46:50 nynaeve kernel: [] +0x0/0x200 [ipv6] May 5 18:46:50 nynaeve kernel: [] icmpv6_init+0x2b/0xc0 [ipv6] May 5 18:46:50 nynaeve kernel: [] __icmpv6_socket+0x0/0x4 [ipv6] May 5 18:46:50 nynaeve kernel: [] inet6_init+0x14a/0x320 [ipv6] May 5 18:46:50 nynaeve kernel: [] inet6_family_ops+0x0/0x18 [ipv6] May 5 18:46:50 nynaeve kernel: [] sys_init_module+0x12f/0x1e0 May 5 18:46:50 nynaeve kernel: [] +0x0/0x200 [ipv6] May 5 18:46:50 nynaeve kernel: [] syscall_call+0x7/0xb May 5 18:46:50 nynaeve kernel: May 5 18:46:50 nynaeve kernel: Code: 0f 0b 1c 01 b8 ae 99 f0 e9 d4 fd ff ff 0f 0b 1e 01 cf ae 99 Full boot messages at: http://twibble.org/dist/2.5.69-ipv6/log.txt And .config at: http://twibble.org/dist/2.5.69-ipv6/config.txt -- Jamie Lenehan Work Phone: +61 3 9843 8817 lenehan@twibble.org Work Email: jamie.lenehan@activcard.com.au From shemminger@osdl.org Tue May 6 16:52:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 16:52:09 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h46Nq3Fu031457 for ; Tue, 6 May 2003 16:52:03 -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 h46NpmW23457; Tue, 6 May 2003 16:51:48 -0700 Date: Tue, 6 May 2003 16:51:48 -0700 From: Stephen Hemminger To: rusty@rustcorp.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru, acme@conectiva.com.br Cc: netdev@oss.sgi.com Subject: [RFC] Experiment with dev and module ref counts Message-Id: <20030506165148.7d40b1f3.shemminger@osdl.org> In-Reply-To: <20030506153555.4e82bc4b.shemminger@osdl.org> References: <20030505130050.4b9868bb.shemminger@osdl.org> <20030506075808.388332C07F@lists.samba.org> <20030506153555.4e82bc4b.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2440 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 ties network device refcounts and module ref counts together. It works for IPV4 and the dev->destructor problem is fixed, at least for the Ethernet bridge device. Unregister and shutdown work correctly, and modules can be removed when expected. BUT: lots of dev_hold usage would need more auditing. No idea what the performance impact is yet. diff -urNp -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-dev/include/linux/netdevice.h --- linux-2.5/include/linux/netdevice.h 2003-04-14 13:32:21.000000000 -0700 +++ linux-2.5-dev/include/linux/netdevice.h 2003-05-06 15:11:25.000000000 -0700 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -629,12 +630,32 @@ extern int netdev_finish_unregister(stru static inline void dev_put(struct net_device *dev) { + module_put(dev->owner); if (atomic_dec_and_test(&dev->refcnt)) netdev_finish_unregister(dev); } -#define __dev_put(dev) atomic_dec(&(dev)->refcnt) -#define dev_hold(dev) atomic_inc(&(dev)->refcnt) +static inline void __dev_put(struct net_device *dev) +{ + module_put(dev->owner); + atomic_dec(&dev->refcnt); +} + +static inline void dev_hold(struct net_device *dev) +{ + __module_get(dev->owner); + atomic_inc(&dev->refcnt); +} + +static inline int dev_try_hold(struct net_device *dev) +{ + int ret = 0; + if (try_module_get(dev->owner)){ + atomic_inc(&dev->refcnt); + ret = 1; + } + return ret; +} /* Carrier loss detection, dial on demand. The functions netif_carrier_on * and _off may be called from IRQ context, but it is caller diff -urNp -X dontdiff linux-2.5/kernel/module.c linux-2.5-dev/kernel/module.c --- linux-2.5/kernel/module.c 2003-04-30 11:19:23.000000000 -0700 +++ linux-2.5-dev/kernel/module.c 2003-05-06 13:13:20.000000000 -0700 @@ -214,6 +214,8 @@ static void module_unload_init(struct mo INIT_LIST_HEAD(&mod->modules_which_use_me); for (i = 0; i < NR_CPUS; i++) atomic_set(&mod->ref[i].count, 0); + /* Hold reference count during initialization. */ + atomic_set(&mod->ref[smp_processor_id()].count, 1); /* Backwards compatibility macros put refcount during init. */ mod->waiter = current; } @@ -500,16 +502,6 @@ sys_delete_module(const char __user *nam goto out; } - /* Coming up? Allow force on stuck modules. */ - if (mod->state == MODULE_STATE_COMING) { - forced = try_force(flags); - if (!forced) { - /* This module can't be removed */ - ret = -EBUSY; - goto out; - } - } - /* If it has an init func, it must have an exit func to unload */ if ((mod->init != init_module && mod->exit == cleanup_module) || mod->unsafe) { @@ -1448,6 +1440,7 @@ sys_init_module(void __user *umod, printk(KERN_ERR "%s: module is now stuck!\n", mod->name); else { + module_put(mod); down(&module_mutex); free_module(mod); up(&module_mutex); @@ -1463,6 +1456,9 @@ sys_init_module(void __user *umod, mod->init_size = 0; up(&module_mutex); + /* Drop initial reference. */ + module_put(mod); + return 0; } diff -urNp -X dontdiff linux-2.5/net/core/dev.c linux-2.5-dev/net/core/dev.c --- linux-2.5/net/core/dev.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-dev/net/core/dev.c 2003-05-06 16:07:15.000000000 -0700 @@ -1,3 +1,4 @@ +#define NET_REFCNT_DEBUG 1 /* * NET3 Protocol independent device support routines. * @@ -440,8 +441,8 @@ struct net_device *dev_get_by_name(const read_lock(&dev_base_lock); dev = __dev_get_by_name(name); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -513,8 +514,8 @@ struct net_device *dev_get_by_index(int read_lock(&dev_base_lock); dev = __dev_get_by_index(ifindex); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -563,8 +564,8 @@ struct net_device * dev_get_by_flags(uns read_lock(&dev_base_lock); dev = __dev_get_by_flags(if_flags, mask); - if (dev) - dev_hold(dev); + if (dev && !dev_try_hold(dev)) + dev = NULL; read_unlock(&dev_base_lock); return dev; } @@ -1312,7 +1313,9 @@ int netif_rx(struct sk_buff *skb) goto drop; enqueue: - dev_hold(skb->dev); + if (!dev_try_hold(skb->dev)) + goto drop; + __skb_queue_tail(&queue->input_pkt_queue, skb); #ifndef OFFLINE_SAMPLE get_sample_stats(this_cpu); @@ -1990,9 +1993,8 @@ int netdev_set_master(struct net_device ASSERT_RTNL(); if (master) { - if (old) + if (old || !dev_try_hold(master)) return -EBUSY; - dev_hold(master); } br_write_lock_bh(BR_NETPROTO_LOCK); @@ -2609,10 +2611,11 @@ int register_netdevice(struct net_device set_bit(__LINK_STATE_PRESENT, &dev->state); dev->next = NULL; + atomic_inc(&dev->refcnt); dev_init_scheduler(dev); write_lock_bh(&dev_base_lock); *dp = dev; - dev_hold(dev); + dev->deadbeaf = 0; write_unlock_bh(&dev_base_lock); @@ -2809,7 +2812,9 @@ int unregister_netdevice(struct net_devi } out: kobject_unregister(&dev->kobj); - dev_put(dev); + + atomic_dec(&dev->refcnt); + return 0; } @@ -2900,7 +2905,11 @@ static int __init net_dev_init(void) #endif dev->xmit_lock_owner = -1; dev->iflink = -1; - dev_hold(dev); + + if (!dev_try_hold(dev)) { + dev->deadbeaf = 1; + dp = &dev->next; + } /* * Allocate name. If the init() fails diff -urNp -X dontdiff linux-2.5/net/ipv4/devinet.c linux-2.5-dev/net/ipv4/devinet.c --- linux-2.5/net/ipv4/devinet.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-dev/net/ipv4/devinet.c 2003-05-06 15:16:03.000000000 -0700 @@ -559,6 +559,9 @@ int devinet_ioctl(unsigned int cmd, void if ((dev = __dev_get_by_name(ifr.ifr_name)) == NULL) goto done; + if (!dev_try_hold(dev)) + goto done; + if (colon) *colon = ':'; @@ -591,7 +594,7 @@ int devinet_ioctl(unsigned int cmd, void ret = -EADDRNOTAVAIL; if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS) - goto done; + goto put; switch(cmd) { case SIOCGIFADDR: /* Get interface address */ @@ -700,12 +703,15 @@ int devinet_ioctl(unsigned int cmd, void } break; } +put: + dev_put(dev); done: rtnl_unlock(); dev_probe_unlock(); out: return ret; rarok: + dev_put(dev); rtnl_unlock(); dev_probe_unlock(); ret = copy_to_user(arg, &ifr, sizeof(struct ifreq)) ? -EFAULT : 0; diff -urNp -X dontdiff linux-2.5/net/ipv4/fib_frontend.c linux-2.5-dev/net/ipv4/fib_frontend.c --- linux-2.5/net/ipv4/fib_frontend.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-dev/net/ipv4/fib_frontend.c 2003-05-06 15:16:03.000000000 -0700 @@ -115,9 +115,9 @@ struct net_device * ip_dev_find(u32 addr if (res.type != RTN_LOCAL) goto out; dev = FIB_RES_DEV(res); - if (dev) - atomic_inc(&dev->refcnt); + if (dev) + dev_hold(dev); out: fib_res_put(&res); return dev; diff -urNp -X dontdiff linux-2.5/net/ipv4/fib_semantics.c linux-2.5-dev/net/ipv4/fib_semantics.c --- linux-2.5/net/ipv4/fib_semantics.c 2003-04-29 09:57:41.000000000 -0700 +++ linux-2.5-dev/net/ipv4/fib_semantics.c 2003-05-06 15:10:40.000000000 -0700 @@ -406,7 +406,7 @@ static int fib_check_nh(const struct rtm if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&dev->refcnt); + dev_hold(dev); nh->nh_scope = RT_SCOPE_LINK; return 0; } @@ -429,7 +429,7 @@ static int fib_check_nh(const struct rtm nh->nh_oif = FIB_RES_OIF(res); if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL) goto out; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); err = -ENETDOWN; if (!(nh->nh_dev->flags & IFF_UP)) goto out; @@ -451,7 +451,7 @@ out: return -ENETDOWN; } nh->nh_dev = in_dev->dev; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); nh->nh_scope = RT_SCOPE_HOST; in_dev_put(in_dev); } From acme@conectiva.com.br Tue May 6 17:13:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 17:13:53 -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.9) with SMTP id h470DfFu031922 for ; Tue, 6 May 2003 17:13:43 -0700 Received: from [200.181.169.6] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19DCfk-0001w6-00; Tue, 06 May 2003 21:20:36 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 2B5641966C; Wed, 7 May 2003 00:14:19 +0000 (UTC) Date: Tue, 6 May 2003 21:14:19 -0300 From: Arnaldo Carvalho de Melo To: Sridhar Samudrala Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Bug in sys_accept() module ref counts Message-ID: <20030507001418.GA27162@conectiva.com.br> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2441 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, May 06, 2003 at 12:28:41PM -0700, Sridhar Samudrala escreveu: > > I think there is a bug in the recent changes to sys_accept() to implement > module ref counts. Yes, well spotted, small comment below, I'll be sending this patch to DaveM, thanks a lot! > module_put() gets called twice on error. Once via the explicit module_put and > the second via sock_release(). Also i think we should do a __module_get() with > newsock's owner(although same as the original listening sock). > > The following patch against 2.5.69 should fix the problem. > > Thanks > Sridhar > ------------------------------------------------------------------------------- > diff -Nru a/net/socket.c b/net/socket.c > --- a/net/socket.c Tue May 6 12:14:35 2003 > +++ b/net/socket.c Tue May 6 12:14:35 2003 > @@ -1280,26 +1280,26 @@ > * We don't need try_module_get here, as the listening socket (sock) > * has the protocol module (sock->ops->owner) held. > */ > - __module_get(sock->ops->owner); > + __module_get(newsock->ops->owner); This one is OK, but the two operations are the same, so the effect, as well, is the same, but for correctness, better have it with newsock. > err = sock->ops->accept(sock, newsock, sock->file->f_flags); > if (err < 0) > - goto out_module_put; > + goto out_release; > > if (upeer_sockaddr) { > if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { > err = -ECONNABORTED; > - goto out_module_put; > + goto out_release; > } > err = move_addr_to_user(address, len, upeer_sockaddr, upeer_addrlen); > if (err < 0) > - goto out_module_put; > + goto out_release; > } > > /* File flags are not inherited via accept() unlike another OSes. */ > > if ((err = sock_map_fd(newsock)) < 0) > - goto out_module_put; > + goto out_release; > > security_socket_post_accept(sock, newsock); > > @@ -1307,8 +1307,6 @@ > sockfd_put(sock); > out: > return err; > -out_module_put: > - module_put(sock->ops->owner); > out_release: > sock_release(newsock); > goto out_put; > From acme@conectiva.com.br Tue May 6 17:43:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 17:43:22 -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.9) with SMTP id h470hAFu032448 for ; Tue, 6 May 2003 17:43:12 -0700 Received: from [200.181.169.6] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19DD8J-00020R-00; Tue, 06 May 2003 21:50:07 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 32DB11966C; Wed, 7 May 2003 00:43:49 +0000 (UTC) Date: Tue, 6 May 2003 21:43:49 -0300 From: Arnaldo Carvalho de Melo To: Sridhar Samudrala Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Bug in sys_accept() module ref counts Message-ID: <20030507004348.GC27162@conectiva.com.br> References: <20030507001418.GA27162@conectiva.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030507001418.GA27162@conectiva.com.br> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2442 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, May 06, 2003 at 09:14:19PM -0300, Arnaldo C. Melo escreveu: > Em Tue, May 06, 2003 at 12:28:41PM -0700, Sridhar Samudrala escreveu: > > Also i think we should do a __module_get() with newsock's owner(although > > same as the original listening sock). Forget about the comment, its what you said above, sorry for answering too fast 8) - Arnaldo From acme@conectiva.com.br Tue May 6 18:12:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 18:12:42 -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.9) with SMTP id h471BxFu000479 for ; Tue, 6 May 2003 18:12:00 -0700 Received: from [200.181.169.6] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19DDa3-00028m-00; Tue, 06 May 2003 22:18:47 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id CEE8F1966C; Wed, 7 May 2003 01:12:30 +0000 (UTC) Date: Tue, 6 May 2003 22:12:29 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Sridhar Samudrala , Roger Luethi , netdev@oss.sgi.com, Linux Kernel Mailing List Subject: [PATCH] net/socket: fix bug in sys_accept Message-ID: <20030507011229.GD27162@conectiva.com.br> Mail-Followup-To: Arnaldo Carvalho de Melo , "David S. Miller" , Sridhar Samudrala , Roger Luethi , netdev@oss.sgi.com, Linux Kernel Mailing List 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: 2443 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 Hi David, Please pull from: bk://kernel.bkbits.net/acme/unix-2.5 Sridhar, thanks, this indeed fixed the problems that Roger was having, I tested this in vmware using unix sockets as modules and running a full gnome2 installation + gkrellm. - Arnaldo 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.1081, 2003-05-06 21:50:40-03:00, sri@us.ibm.com o net/socket: fix bug in sys_accept module_put() gets called twice on error. Once via the explicit module_put and the second via sock_release(). Also i think we should do a __module_get() with newsock's owner(although same as the original listening sock). socket.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff -Nru a/net/socket.c b/net/socket.c --- a/net/socket.c Tue May 6 21:57:15 2003 +++ b/net/socket.c Tue May 6 21:57:15 2003 @@ -1280,26 +1280,26 @@ * We don't need try_module_get here, as the listening socket (sock) * has the protocol module (sock->ops->owner) held. */ - __module_get(sock->ops->owner); + __module_get(newsock->ops->owner); err = sock->ops->accept(sock, newsock, sock->file->f_flags); if (err < 0) - goto out_module_put; + goto out_release; if (upeer_sockaddr) { if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { err = -ECONNABORTED; - goto out_module_put; + goto out_release; } err = move_addr_to_user(address, len, upeer_sockaddr, upeer_addrlen); if (err < 0) - goto out_module_put; + goto out_release; } /* File flags are not inherited via accept() unlike another OSes. */ if ((err = sock_map_fd(newsock)) < 0) - goto out_module_put; + goto out_release; security_socket_post_accept(sock, newsock); @@ -1307,8 +1307,6 @@ sockfd_put(sock); out: return err; -out_module_put: - module_put(sock->ops->owner); out_release: sock_release(newsock); goto out_put; =================================================================== This BitKeeper patch contains the following changesets: 1.1081 ## Wrapped with gzip_uu ## M'XL( .M9N#X ^V576^;,!2&K_&O.%(OUF@*L0%#PI0J_9BZJ9-:=>IUY!@G M6 4[LDW22OSX.21KVG51U6F[&QB.,.\Y?G7\(([@S@J3!]9(= 1?M'5YT-A0 MSNJ0Z]I/W6KMIP:EKL7@[&K0*/G0CT**_*L;YG@)*V%L'I P?IIQCTN1![>? M+^^^G=XB-![#>\3<1KAF,:TC>,LP>@" M2$CPD ".!Y@.< H1R2G.$]S'<8XQ^$9,]@V CP3Z&)W!WS5]CCAH4,(-K.;W MPN4PEP\P:Q8@%=A'.V6 ;Y>MMWEK!M2HZ\<;!U(A*,"N.>R&<5E:# M]"JI[F'MI:5NJ@(*#0RFTUTU;\.;64M7^H)*K#=%/EC0:R7,,:N1>AFCPGJO_- "#.,3M[8IGW#0_Y\ MIT8T:],DRVC+\3R+4C:G-)O/HA'_!8=7%3: 91@G*<9M@M/1L,/]N>IMXM_O M"C%>BXG?0<&=7'55PIGYK3E_44I(FZ0D(1W]-'O!?I)ZZ@^P3Z&?_6?_W[*_ MI>8:^F;=#<_RS0N _N!;N"#1, :"ONYB\,+[SG+_1"^MOVUL]SYU.=DN9Q.# M8*&=!MVXGPWJ-*-HJ^EB<$B4[D3I85&,MY6V\8"&8(CV?QI>"GYOFWJ,&; Tue, 6 May 2003 20:51:49 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 2C97F2C0C4; Wed, 7 May 2003 03:51:48 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: shemminger@osdl.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor In-reply-to: Your message of "Tue, 06 May 2003 07:23:38 MST." <20030506.072338.39479306.davem@redhat.com> Date: Wed, 07 May 2003 12:50:07 +1000 Message-Id: <20030507035148.2C97F2C0C4@lists.samba.org> X-archive-position: 2444 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030506.072338.39479306.davem@redhat.com> you write: > From: Rusty Russell > Date: Tue, 06 May 2003 14:18:36 +1000 > > It's logically consistent to make it implicit, and cuts out some > code in the unload path. > > How's this? > > This looks fine to me. > > How hard would it be to make this completely consistent in that > no module code is ever invoked with modcount == 0? By this I mean > keeping the implicit reference after modload succeeds, and then > calling ->cleanup() is valid once the count drops to '1'. I had to think hard about this 8). There's nothing *wrong* with leaving the refcount at 1: it's just a matter of adjusting various checks for 0 to 1 (including the BUG() Stephen hit), and subbing 1 in /proc/modules... But that's a sideshow: you'd *still* want an extra refcount around the call to module_init(). Because it's the module state being MODULE_STATE_COMING which stops the module from being unloaded, ie. holds the extra reference count. Once init is finished, module state goes to MODULE_STATE_LIVE, and the reference must be dropped. Now, grabbing a similar reference when deleting a module might make sense, but it's actually kinda pointless when you look at the code. Hope that clarifies, Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From davem@redhat.com Tue May 6 21:23:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 21:24:26 -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.9) with SMTP id h474NsFu002129 for ; Tue, 6 May 2003 21:23:54 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA20825; Tue, 6 May 2003 20:16:18 -0700 Date: Tue, 06 May 2003 20:16:18 -0700 (PDT) Message-Id: <20030506.201618.39175334.davem@redhat.com> To: lenehan@twibble.org Cc: netdev@oss.sgi.com Subject: Re: 2.5.69 IPv6 (modular) crash on boot From: "David S. Miller" In-Reply-To: <20030506232037.GA5576@twibble.org> References: <20030506232037.GA5576@twibble.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2445 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 From: Jamie Lenehan Date: Wed, 7 May 2003 09:20:37 +1000 IPv6 worked fine in 2.5.68, but I get a crash in 2.5.69 on boot. I haven't seen anyone else mention this though. This is a RedHat 8 systems with the new modutils added and pretty much everything built modular: Yes, we know it's broken and we're thinking about how to fix it... From rusty@samba.org Tue May 6 21:27:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 21:27:52 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h474RWFu002483 for ; Tue, 6 May 2003 21:27:32 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 270B32C053; Wed, 7 May 2003 03:51:48 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: shemminger@osdl.org Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor In-reply-to: Your message of "Tue, 06 May 2003 07:25:29 MST." <20030506.072529.52888036.davem@redhat.com> Date: Wed, 07 May 2003 12:54:22 +1000 Message-Id: <20030507035148.270B32C053@lists.samba.org> X-archive-position: 2446 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030506.072529.52888036.davem@redhat.com> you write: > From: Stephen Hemminger > Date: Mon, 5 May 2003 09:08:20 -0700 > > On Sat, 03 May 2003 14:07:41 +1000 > Rusty Russell wrote: > > > But Alexey said you can only call unregister_netdev from module > > unload, ie. if not a module, it can't be unloaded, hence no refcount > > needed. I wrote the above paragraph because I'm not sure if I > > understood Alexey correctly? > > There are several flavors of pseudo-network devices like bridging > and VLAN that dynamically create/destroy netdev's even when they > are not modules. > > I think you'll understand what Alexey/Rusty are saying better > if you consider statically compiled kernel code as a module with > an implicit non-zero reference count :-) Yes, but his point is valid. We *do* want to destroy netdev's at random times, not just from module cleanup code. Hotplug, for example. So me saying "just rely on the owner refcnt" was wrong. Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From davem@redhat.com Tue May 6 22:06:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 22:06: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.9) with SMTP id h4756TFu002990 for ; Tue, 6 May 2003 22:06:29 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA20932; Tue, 6 May 2003 20:58:19 -0700 Date: Tue, 06 May 2003 20:58:18 -0700 (PDT) Message-Id: <20030506.205818.88490065.davem@redhat.com> To: rusty@rustcorp.com.au Cc: shemminger@osdl.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: dev->destructor From: "David S. Miller" In-Reply-To: <20030507035148.2C97F2C0C4@lists.samba.org> References: <20030506.072338.39479306.davem@redhat.com> <20030507035148.2C97F2C0C4@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2447 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 From: Rusty Russell Date: Wed, 07 May 2003 12:50:07 +1000 But that's a sideshow: you'd *still* want an extra refcount around the call to module_init(). ... Now, grabbing a similar reference when deleting a module might make sense, but it's actually kinda pointless when you look at the code. Indeed, forget my idea ;-) From davem@redhat.com Tue May 6 22:12:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 06 May 2003 22:12: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.9) with SMTP id h475CIFu003337 for ; Tue, 6 May 2003 22:12:19 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id VAA20977; Tue, 6 May 2003 21:04:41 -0700 Date: Tue, 06 May 2003 21:04:40 -0700 (PDT) Message-Id: <20030506.210440.70204488.davem@redhat.com> To: acme@conectiva.com.br Cc: sri@us.ibm.com, rl@hellgate.ch, netdev@oss.sgi.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/socket: fix bug in sys_accept From: "David S. Miller" In-Reply-To: <20030507011229.GD27162@conectiva.com.br> References: <20030507011229.GD27162@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2448 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 From: Arnaldo Carvalho de Melo Date: Tue, 6 May 2003 22:12:29 -0300 Please pull from: bk://kernel.bkbits.net/acme/unix-2.5 Pulled, thanks a lot. From anton@samba.org Wed May 7 00:47:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 00:47:52 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h477lVFu006233 for ; Wed, 7 May 2003 00:47:31 -0700 Received: by lists.samba.org (Postfix, from userid 504) id 9F2262C053; Wed, 7 May 2003 07:09:56 +0000 (GMT) Date: Wed, 7 May 2003 17:06:57 +1000 From: Anton Blanchard To: jes@trained-monkey.org Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: acenic lockup Message-ID: <20030507070657.GC30976@krispykreme> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i X-archive-position: 2449 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: anton@samba.org Precedence: bulk X-list: netdev Hi, Ive got a bucketload of acenic adapters in a ppc64 box. I get random tx timeouts, I suspect there is a missing memory barrier (power4 is good at catching those). Still looking. I did manage to lock a card up in ace_start_xmit: restart: ... if (tx_ring_full(ap, ap->tx_ret_csm, idx)) goto overflow; ... overflow: /* * This race condition is unavoidable with lock-free drivers. * We wake up the queue _before_ tx_prd is advanced, so that we * can * enter hard_start_xmit too early, while tx ring still looks * closed. * This happens ~1-4 times per 100000 packets, so that we can * allow * to loop syncing to other CPU. Probably, we need an additional * wmb() in ace_tx_intr as well. * * Note that this race is relieved by reserving one more entry * in tx ring than it is necessary (see original non-SG driver). * However, with SG we need to reserve 2*MAX_SKB_FRAGS+1, which * is already overkill. * * Alternative is to return with 1 not throttling queue. In this * case loop becomes longer, no more useful effects. */ barrier(); goto restart; Its stuck there and never coming out. Alexey: I have a feeling you wrote this code, is that correct? :) Anton From davem@redhat.com Wed May 7 00:51:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 00:51: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.9) with SMTP id h477pRFu006525 for ; Wed, 7 May 2003 00:51:28 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA21391; Tue, 6 May 2003 23:43:16 -0700 Date: Tue, 06 May 2003 23:43:16 -0700 (PDT) Message-Id: <20030506.234316.68138442.davem@redhat.com> To: anton@samba.org Cc: jes@trained-monkey.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: acenic lockup From: "David S. Miller" In-Reply-To: <20030507070657.GC30976@krispykreme> References: <20030507070657.GC30976@krispykreme> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2450 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 From: Anton Blanchard Date: Wed, 7 May 2003 17:06:57 +1000 Its stuck there and never coming out. Alexey: I have a feeling you wrote this code, is that correct? :) It is well understood failure of this driver, actually. If Acenic hangs in any way at all, driver hangs in this loop. From davem@redhat.com Wed May 7 01:40:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 01:40: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.9) with SMTP id h478epFu008553 for ; Wed, 7 May 2003 01:40:52 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA21574; Wed, 7 May 2003 00:32:42 -0700 Date: Wed, 07 May 2003 00:32:42 -0700 (PDT) Message-Id: <20030507.003242.104053566.davem@redhat.com> To: shemminger@osdl.org Cc: rusty@rustcorp.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, acme@conectiva.com.br Subject: Re: [PATCH 2.5.69] IPV4 should use dev_hold From: "David S. Miller" In-Reply-To: <20030506153234.4907001f.shemminger@osdl.org> References: <20030506075808.388332C07F@lists.samba.org> <20030506.072338.39479306.davem@redhat.com> <20030506153234.4907001f.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2451 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 From: Stephen Hemminger Date: Tue, 6 May 2003 15:32:34 -0700 While debugging possible changes to dev refcounting, discovered a couple of places in IPV4 that were directly incrementing rather than using the inline dev_hold. Let's hide the implementation of net device ref counting so future module ref count fixes will be easier. Applied, thanks. If you find any more, just send along another patch :-) From lucas75it@yahoo.it Wed May 7 02:05:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 02:05:34 -0700 (PDT) Received: from web9703.mail.yahoo.com (web9703.mail.yahoo.com [216.136.129.139]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4795UFu009153 for ; Wed, 7 May 2003 02:05:30 -0700 Message-ID: <20030507090530.91065.qmail@web9703.mail.yahoo.com> Received: from [81.73.224.177] by web9703.mail.yahoo.com via HTTP; Wed, 07 May 2003 11:05:30 CEST Date: Wed, 7 May 2003 11:05:30 +0200 (CEST) From: =?iso-8859-1?q?Gianluca=20Masone?= Subject: Linux and Wake-On-Lan To: davem@redhat.com, netdev@oss.sgi.com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 2452 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: lucas75it@yahoo.it Precedence: bulk X-list: netdev I have a little question ? Suppose i put a net device in wake-on-lan status. There is some kernel function that notifies presence of a wake packet ? Help me. Please, Gianluca Masone ______________________________________________________________________ Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html From davem@redhat.com Wed May 7 02:14:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 02:14:09 -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.9) with SMTP id h479E3Fu009522 for ; Wed, 7 May 2003 02:14:04 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA21706; Wed, 7 May 2003 01:06:30 -0700 Date: Wed, 07 May 2003 01:06:30 -0700 (PDT) Message-Id: <20030507.010630.48509535.davem@redhat.com> To: lucas75it@yahoo.it Cc: netdev@oss.sgi.com Subject: Re: Linux and Wake-On-Lan From: "David S. Miller" In-Reply-To: <20030507090530.91065.qmail@web9703.mail.yahoo.com> References: <20030507090530.91065.qmail@web9703.mail.yahoo.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2453 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 From: Gianluca Masone Date: Wed, 7 May 2003 11:05:30 +0200 (CEST) Suppose i put a net device in wake-on-lan status. There is some kernel function that notifies presence of a wake packet ? This is not how wake-on-lan works. When your computer is put to sleep (via APM or ACPI), the network card can listen for the wake packets. If it is listening and a wakeup packet is received, your computer wakes up from sleep state. All of this happens in the hardware, all Linux can do is enable/disable the feature. From 76306.1226@compuserve.com Wed May 7 04:08:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 04:08:59 -0700 (PDT) Received: from siaab2ab.compuserve.com (siaab2ab.compuserve.com [149.174.40.130]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47B8gFu014709 for ; Wed, 7 May 2003 04:08:43 -0700 Received: (from mailgate@localhost) by siaab2ab.compuserve.com (8.12.9/8.12.7/SUN-2.7) id h47B8av9007031 for netdev@oss.sgi.com; Wed, 7 May 2003 07:08:36 -0400 (EDT) Date: Wed, 7 May 2003 07:06:31 -0400 From: Chuck Ebbert <76306.1226@compuserve.com> Subject: e100: Freeing alive device? To: netdev Message-ID: <200305070708_MC3-1-37C1-F91C@compuserve.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-archive-position: 2454 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: 76306.1226@compuserve.com Precedence: bulk X-list: netdev Every time I boot 2.5.69 I get this in the log: Intel(R) PRO/100 Network Driver - version 2.2.21-k1 Copyright (c) 2003 Intel Corporation e100: selftest OK. Freeing alive device c3f34000, eth%d <========= eth%d ??? e100: eth0: Intel(R) PRO/100 Network Connection e100: selftest OK. e100: eth1: Intel(R) PRO/100 Network Connection (Output from lspci for these adapters is at the end of this message.) I added a stack dump in net/core/dev.c where the message is printed and caught this: [] netdev_finish_unregister+0x8d/0xb0 [] linkwatch_run_queue+0xc1/0xe0 [] __wake_up+0x1d/0x30 [] linkwatch_event+0x23/0x30 [] worker_thread+0x1cb/0x280 [] linkwatch_event+0x0/0x30 [] default_wake_function+0x0/0x20 [] ret_from_fork+0x6/0x14 [] default_wake_function+0x0/0x20 [] worker_thread+0x0/0x280 [] kernel_thread_helper+0x5/0x10 Both of these adapters have PXE enabled: 01:09.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 05) Subsystem: Compaq Computer Corporation NC3121 Fast Ethernet NIC (WOL) Flags: bus master, medium devsel, latency 120, IRQ 19 Memory at f9fff000 (32-bit, prefetchable) [size=4K] I/O ports at ece0 [size=32] Memory at fcf00000 (32-bit, non-prefetchable) [size=1M] Expansion ROM at fd000000 [disabled] [size=1M] Capabilities: [dc] Power Management version 1 01:0a.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 05) Subsystem: Compaq Computer Corporation NC3121 Fast Ethernet NIC (WOL) Flags: bus master, medium devsel, latency 120, IRQ 18 Memory at f9ffe000 (32-bit, prefetchable) [size=4K] I/O ports at ecc0 [size=32] Memory at fce00000 (32-bit, non-prefetchable) [size=1M] Expansion ROM at fd000000 [disabled] [size=1M] Capabilities: [dc] Power Management version 1 From axboe@suse.de Wed May 7 05:14:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 05:14:26 -0700 (PDT) Received: from virtualhost.dk (mail@ns.virtualhost.dk [195.184.98.160]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47CEGFu015601 for ; Wed, 7 May 2003 05:14:18 -0700 Received: from brick.kernel.dk ([80.160.188.86] helo=smithers.home.kernel.dk) by virtualhost.dk with esmtp (Exim 3.35 #1) id 19DNoP-0007mQ-00; Wed, 07 May 2003 14:14:17 +0200 Received: from axboe by smithers.home.kernel.dk with local (Exim 4.12) id 19DNoK-0005tz-00; Wed, 07 May 2003 14:14:12 +0200 Date: Wed, 7 May 2003 14:14:12 +0200 From: Jens Axboe To: Linux Kernel Cc: netdev@oss.sgi.com, "David S. Miller" Subject: kernel BUG at net/core/skbuff.c:1028! Message-ID: <20030507121412.GI823@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-archive-position: 2455 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: axboe@suse.de Precedence: bulk X-list: netdev Hi, Booting 2.5-BK on my little router BUG's out before the login is reached. 100% reproduceable. Let me know if you want more detail. kernel BUG at net/core/skbuff.c:1028! invalid operand: 0000 [#1] CPU: 0 EIP: 0060:[] Not tainted EFLAGS: 00010206 EIP is at skb_checksum+0x244/0x260 eax: 00000000 ebx: 00000035 ecx: cee3a980 edx: cdbcfa80 esi: 00000014 edi: 00000049 ebp: c036dc9c esp: c036dc78 ds: 007b es: 007b ss: 0068 Process swapper (pid: 0, threadinfo=c036c000 task=c0326ca0) Stack: cee3a8c0 00000206 cec76444 c036dc90 00000035 00000000 cdbcfa10 00000003 c036dda0 c036dcc8 c02ba71e cee3a980 00000049 00000049 b02e4fd1 cec764c0 cdbcfa24 cec76420 00000003 c036dda0 c036dd00 c02b9240 c036dda0 cec76420 Call Trace: [] icmp_reply_translation+0x7e/0x220 [] ip_nat_fn+0x1e0/0x230 [] ip_nat_local_fn+0x5f/0xb0 [] dst_output+0x0/0x30 [] nf_iterate+0x5c/0xb0 [] dst_output+0x0/0x30 [] nf_hook_slow+0x69/0x100 [] dst_output+0x0/0x30 [] ip_push_pending_frames+0x329/0x3b0 [] dst_output+0x0/0x30 [] icmp_send+0x2bf/0x3b0 [] __ide_dma_read+0xc5/0xe0 [] do_rw_disk+0x6e8/0x800 [] start_request+0x11f/0x180 [] ipv4_link_failure+0x13/0x50 [] arp_error_report+0x63/0x70 [] neigh_timer_handler+0x96/0x180 [] neigh_timer_handler+0x0/0x180 [] run_timer_softirq+0x9b/0x150 [] handle_IRQ_event+0x31/0xf0 [] do_softirq+0x6f/0xd0 [] do_IRQ+0xc5/0xe0 [] default_idle+0x0/0x50 [] common_interrupt+0x18/0x20 [] default_idle+0x0/0x50 [] default_idle+0x26/0x50 [] cpu_idle+0x32/0x50 [] _stext+0x0/0x20 [] start_kernel+0x12a/0x130 Code: 0f 0b 04 04 99 f4 30 c0 8b 45 14 8d 65 f4 5b 5e 5f 5d c3 89 <0>Kernel panic: Fatal exception in interrupt In interrupt handler - not syncing -- Jens Axboe From davem@redhat.com Wed May 7 05:28:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 05:28:19 -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.9) with SMTP id h47CSCFu016062 for ; Wed, 7 May 2003 05:28:13 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id EAA22477; Wed, 7 May 2003 04:20:35 -0700 Date: Wed, 07 May 2003 04:20:35 -0700 (PDT) Message-Id: <20030507.042035.13750321.davem@redhat.com> To: axboe@suse.de Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: kernel BUG at net/core/skbuff.c:1028! From: "David S. Miller" In-Reply-To: <20030507121412.GI823@suse.de> References: <20030507121412.GI823@suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2456 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 From: Jens Axboe Date: Wed, 7 May 2003 14:14:12 +0200 Booting 2.5-BK on my little router BUG's out before the login is reached. 100% reproduceable. Let me know if you want more detail. I forwarded this to Rusty, I think netfilter changes he made recently have caused this. From mk@karaba.org Wed May 7 10:52:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 10:52:59 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47HqmFu023614 for ; Wed, 7 May 2003 10:52:49 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19DT5P-0008Vu-00; Thu, 08 May 2003 02:52:11 +0900 Date: Thu, 08 May 2003 02:52:05 +0900 Message-ID: <87znlymypm.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: jmorris@intercode.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi-core@linux-ipv6.org Subject: [PATCH] IPv4 IPComp MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2457 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, In ipcomp_input(): The original IP header(iph) is stored(copied) in tmp_iph. But after skb_pull(), tmp_iph is copied back to same place where the original IP header exists in skb->nh.raw. I believe the attached diff is to fix it for correct behavior which you intend. Could you check it? Regards, -mk ===== ipcomp.c 1.4 vs edited ===== --- 1.4/net/ipv4/ipcomp.c Sun May 4 22:26:55 2003 +++ edited/ipcomp.c Thu May 8 02:41:47 2003 @@ -94,7 +94,9 @@ memcpy(&tmp_iph, iph, iph->ihl * 4); nexthdr = *(u8 *)skb->data; skb_pull(skb, sizeof(struct ipcomp_hdr)); + skb->nh.raw += sizeof(struct ipcomp_hdr); memcpy(skb->nh.raw, &tmp_iph, tmp_iph.iph.ihl * 4); + iph = skb->nh.iph; iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ipcomp_hdr)); iph->protocol = nexthdr; skb->h.raw = skb->data; From kuznet@ms2.inr.ac.ru Wed May 7 13:03:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 13:03:30 -0700 (PDT) Received: from mops.inr.ac.ru ([212.44.140.59]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47K3EFu024839 for ; Wed, 7 May 2003 13:03:21 -0700 Received: (from kuznet@localhost) by mops.inr.ac.ru (8.6.13/ANK) id VAA00295; Wed, 7 May 2003 21:06:32 +0400 Message-Id: <200305071706.VAA00295@mops.inr.ac.ru> Subject: Re: acenic lockup To: davem@redhat.com (David S. Miller) Date: Wed, 7 May 2003 21:06:32 +0400 (MSD) Cc: anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com In-Reply-To: <20030506.234316.68138442.davem@redhat.com> from "David S. Miller" at May 6, 3 11:43:16 pm From: Alexey Kuznetsov X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 X-archive-position: 2458 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > Its stuck there and never coming out. Alexey: I have a feeling you > wrote this code, is that correct? :) Yes, I did. I am not sure about barriers, I stopped attempts to understand this long ago. Anyway, intel does not have anything to put here, mb() at side updating pointer looks enough. There is a real ugly BUG in the driver, ace_watchdog(): } else { printk(KERN_DEBUG "%s: BUG... transmitter died. Kicking it.\n", dev->name); #if 0 netif_wake_queue(dev); #endif } (#if is from my local tree). I remember we discussed this with Dave and he was very angry about this flaw shared by most of drivers and, seems, did not eat this fix. So, if you see the message, it is surely this bug. Alexey From shemminger@osdl.org Wed May 7 13:23:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 13:23:40 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47KNWFu025280 for ; Wed, 7 May 2003 13:23:32 -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 h47KNQW18356; Wed, 7 May 2003 13:23:26 -0700 Date: Wed, 7 May 2003 13:23:26 -0700 From: Stephen Hemminger To: "David S. Miller" , philb@gnu.org, SteveW@ACM.org Cc: netdev@oss.sgi.com Subject: [PATCH] more direct access of dev->refcnt Message-Id: <20030507132326.0864b07f.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2459 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev The following places directly increment dev refcount rather than using the inline dev_hold. Also, Econet keeps pointers to devices without holding refcount which is wrong. diff -Nru a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c --- a/net/decnet/dn_fib.c Wed May 7 13:22:27 2003 +++ b/net/decnet/dn_fib.c Wed May 7 13:22:27 2003 @@ -218,7 +218,7 @@ if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&dev->refcnt); + dev_hold(dev); nh->nh_scope = RT_SCOPE_LINK; return 0; } @@ -242,7 +242,7 @@ nh->nh_dev = DN_FIB_RES_DEV(res); if (nh->nh_dev == NULL) goto out; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); err = -ENETDOWN; if (!(nh->nh_dev->flags & IFF_UP)) goto out; @@ -262,7 +262,7 @@ if (!(dev->flags&IFF_UP)) return -ENETDOWN; nh->nh_dev = dev; - atomic_inc(&nh->nh_dev->refcnt); + dev_hold(nh->nh_dev); nh->nh_scope = RT_SCOPE_HOST; } diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c --- a/net/econet/af_econet.c Wed May 7 13:22:27 2003 +++ b/net/econet/af_econet.c Wed May 7 13:22:27 2003 @@ -325,7 +325,7 @@ { /* Real hardware Econet. We're not worthy etc. */ #ifdef CONFIG_ECONET_NATIVE - atomic_inc(&dev->refcnt); + dev_hold(dev); skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, msg->msg_flags & MSG_DONTWAIT, &err); From davem@redhat.com Wed May 7 13:38:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 13:38:52 -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.9) with SMTP id h47KcmFu025707 for ; Wed, 7 May 2003 13:38:48 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA24067; Wed, 7 May 2003 12:31:00 -0700 Date: Wed, 07 May 2003 12:30:59 -0700 (PDT) Message-Id: <20030507.123059.84384241.davem@redhat.com> To: shemminger@osdl.org Cc: philb@gnu.org, SteveW@ACM.org, netdev@oss.sgi.com Subject: Re: [PATCH] more direct access of dev->refcnt From: "David S. Miller" In-Reply-To: <20030507132326.0864b07f.shemminger@osdl.org> References: <20030507132326.0864b07f.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2460 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 From: Stephen Hemminger Date: Wed, 7 May 2003 13:23:26 -0700 The following places directly increment dev refcount rather than using the inline dev_hold. Applied, thanks Stephen. Also, Econet keeps pointers to devices without holding refcount which is wrong. Econet is pure orphan for years, looking for maintainer. I occaisional consider trying to repair it. From davem@redhat.com Wed May 7 13:42:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 13:42: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.9) with SMTP id h47KgcFu026045 for ; Wed, 7 May 2003 13:42:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA24081; Wed, 7 May 2003 12:34:21 -0700 Date: Wed, 07 May 2003 12:34:21 -0700 (PDT) Message-Id: <20030507.123421.133894691.davem@redhat.com> To: kuznet@ms2.inr.ac.ru Cc: anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com Subject: Re: acenic lockup From: "David S. Miller" In-Reply-To: <200305071706.VAA00295@mops.inr.ac.ru> References: <20030506.234316.68138442.davem@redhat.com> <200305071706.VAA00295@mops.inr.ac.ru> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2461 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 From: Alexey Kuznetsov Date: Wed, 7 May 2003 21:06:32 +0400 (MSD) I remember we discussed this with Dave and he was very angry about this flaw shared by most of drivers and, seems, did not eat this fix. Yes, this netif_wake_queue() in acenic's watchdog routine is bogus. It is guarenteed lockup. Ok, I applied this. However, what does kick device back into working state? Do we make shamans dance when this message hits the logs and pray for the best? :-) From pb@bieringer.de Wed May 7 14:15:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 14:15:54 -0700 (PDT) Received: from smtp2.aerasec.de (gromit.aerasec.de [195.226.187.57]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47LFgFu027841 for ; Wed, 7 May 2003 14:15:43 -0700 Received: by smtp2.aerasec.de (Postfix, from userid 995) id 7B4201387A; Wed, 7 May 2003 23:15:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.aerasec.de (Postfix) with SMTP id 989901387B; Wed, 7 May 2003 23:15:39 +0200 (CEST) X-AV-Checked: Wed May 7 23:15:39 2003 smtp2.aerasec.de Received: from p50805EE1.dip.t-dialin.net (p50805EE1.dip.t-dialin.net [80.128.94.225]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client did not present a certificate) by smtp2.aerasec.de (Postfix) with ESMTP id 74A7E1387A; Wed, 7 May 2003 23:15:38 +0200 (CEST) Date: Wed, 07 May 2003 23:15:34 +0200 From: Peter Bieringer To: "David S. Miller" Cc: lucas75it@yahoo.it, netdev@oss.sgi.com Subject: Re: Linux and Wake-On-Lan Message-ID: <112220000.1052342133@gate.muc.bieringer.de> In-Reply-To: <20030507.010630.48509535.davem@redhat.com> References: <20030507090530.91065.qmail@web9703.mail.yahoo.com> <20030507.010630.48509535.davem@redhat.com> X-Mailer: Mulberry/3.0.3 (Linux/x86) X-URL: http://www.bieringer.de/pb/ X-OS: Linux MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-archive-position: 2462 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pb@bieringer.de Precedence: bulk X-list: netdev --On Wednesday, May 07, 2003 01:06:30 AM -0700 "David S. Miller" wrote: > From: Gianluca Masone > Date: Wed, 7 May 2003 11:05:30 +0200 (CEST) > > Suppose i put a net device in wake-on-lan status. > There is some kernel function that notifies presence > of a wake packet ? > > This is not how wake-on-lan works. > > When your computer is put to sleep (via APM or ACPI), > the network card can listen for the wake packets. > > If it is listening and a wakeup packet is received, your computer > wakes up from sleep state. > > All of this happens in the hardware, all Linux can do is > enable/disable the feature. That's right, but afair at least one driver has problems with this. It's here not working with the eepro100 driver. The e100 works. See here for more details: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=84695 Peter -- Dr. Peter Bieringer http://www.bieringer.de/pb/ GPG/PGP Key 0x958F422D mailto: pb at bieringer dot de Deep Space 6 Co-Founder and Core Member http://www.deepspace6.net/ From shemminger@osdl.org Wed May 7 14:29:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 14:29:22 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47LTCFu028332 for ; Wed, 7 May 2003 14:29:13 -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 h47LTBW04229; Wed, 7 May 2003 14:29:11 -0700 Date: Wed, 7 May 2003 14:29:11 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69] pktgen module and dev cleanup Message-Id: <20030507142911.4a8a7573.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2463 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 Fix pktgen so the /proc interface uses owner instead of inc/dec the module ref count itself. Gets rid of warnings, and properly ref counts all readers/writers now. Change how network device ref count is acquired. Instead of forced inc, just get reference via dev_get_by_name. Use in_dev_get when looking at inet info, more race avoidance. Built and tested with injection on gigabit ethernet and SMP machine. Ref counts come out right during access, and can be unloaded fine. diff -Nru a/net/core/pktgen.c b/net/core/pktgen.c --- a/net/core/pktgen.c Wed May 7 14:21:14 2003 +++ b/net/core/pktgen.c Wed May 7 14:21:14 2003 @@ -226,21 +226,20 @@ { struct net_device *odev; - rtnl_lock(); - odev = __dev_get_by_name(info->outdev); + odev = dev_get_by_name(info->outdev); if (!odev) { sprintf(info->result, "No such netdevice: \"%s\"", info->outdev); - goto out_unlock; + goto out; } if (odev->type != ARPHRD_ETHER) { sprintf(info->result, "Not ethernet device: \"%s\"", info->outdev); - goto out_unlock; + goto out_put; } if (!netif_running(odev)) { sprintf(info->result, "Device is down: \"%s\"", info->outdev); - goto out_unlock; + goto out_put; } /* Default to the interface's mac if not explicitly set. */ @@ -257,13 +256,13 @@ info->saddr_min = 0; info->saddr_max = 0; if (strlen(info->src_min) == 0) { - if (odev->ip_ptr) { - struct in_device *in_dev = odev->ip_ptr; - + struct in_device *in_dev = in_dev_get(odev); + if (in_dev) { if (in_dev->ifa_list) { info->saddr_min = in_dev->ifa_list->ifa_address; info->saddr_max = info->saddr_min; } + in_dev_put(in_dev); } } else { @@ -282,13 +281,11 @@ info->cur_udp_dst = info->udp_dst_min; info->cur_udp_src = info->udp_src_min; - atomic_inc(&odev->refcnt); - rtnl_unlock(); - return odev; -out_unlock: - rtnl_unlock(); +out_put: + dev_put(odev); +out: return NULL; } @@ -1258,7 +1255,6 @@ } if (!strcmp(name, "inject") || !strcmp(name, "start")) { - MOD_INC_USE_COUNT; if (info->busy) { strcpy(info->result, "Already running...\n"); } @@ -1268,7 +1264,6 @@ inject(info); info->busy = 0; } - MOD_DEC_USE_COUNT; return count; } @@ -1337,6 +1332,7 @@ pginfos[i].proc_ent->read_proc = proc_read; pginfos[i].proc_ent->write_proc = proc_write; pginfos[i].proc_ent->data = (void*)(long)(i); + pginfos[i].proc_ent->owner = THIS_MODULE; sprintf(pginfos[i].busy_fname, "net/%s/pg_busy%i", PG_PROC_DIR, i); pginfos[i].busy_proc_ent = create_proc_entry(pginfos[i].busy_fname, 0, 0); From hch@verein.lst.de Wed May 7 15:14:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 15:15:08 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47MEuFu029315 for ; Wed, 7 May 2003 15:14:58 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h47LtlH15815; Wed, 7 May 2003 23:55:47 +0200 Date: Wed, 7 May 2003 23:55:47 +0200 From: Christoph Hellwig To: jgarzik@pobox.com Cc: netdev@oss.sgi.com Subject: [PATCH] move slip over to initcalls Message-ID: <20030507235547.A15805@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2464 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 Time to get rid of a few entries in setup.c :) --- 1.6/drivers/net/setup.c Mon Feb 17 18:39:52 2003 +++ edited/drivers/net/setup.c Wed May 7 22:15:22 2003 @@ -9,7 +9,6 @@ #include #include -extern int slip_init_ctrl_dev(void); extern int x25_asy_init_ctrl_dev(void); extern int dmascc_init(void); @@ -109,9 +108,6 @@ static void __init network_ldisc_init(void) { -#if defined(CONFIG_SLIP) - slip_init_ctrl_dev(); -#endif #if defined(CONFIG_X25_ASY) x25_asy_init_ctrl_dev(); #endif --- 1.13/drivers/net/slip.c Mon Apr 21 23:58:43 2003 +++ edited/drivers/net/slip.c Wed May 7 22:06:59 2003 @@ -81,11 +81,7 @@ #include #endif -#ifdef MODULE -#define SLIP_VERSION "0.8.4-NET3.019-NEWTTY-MODULAR" -#else -#define SLIP_VERSION "0.8.4-NET3.019-NEWTTY" +#define SLIP_VERSION "0.8.4-NET3.019-NEWTTY" -#endif typedef struct slip_ctrl { @@ -98,8 +94,6 @@ MODULE_PARM(slip_maxdev, "i"); MODULE_PARM_DESC(slip_maxdev, "Maximum number of slip devices"); -static struct tty_ldisc sl_ldisc; - static int slip_esc(unsigned char *p, unsigned char *d, int len); static void slip_unesc(struct slip *sl, unsigned char c); #ifdef CONFIG_SLIP_MODE_SLIP6 @@ -1309,13 +1303,24 @@ #endif /* VSV changes end */ -/* Initialize SLIP control device -- register SLIP line discipline */ +static struct tty_ldisc sl_ldisc = { + .owner = THIS_MODULE, + .magic = TTY_LDISC_MAGIC, + .name = "slip", + .open = slip_open, + .close = slip_close, + .ioctl = slip_ioctl, + .receive_buf = slip_receive_buf, + .receive_room = slip_receive_room, + .write_wakeup = slip_write_wakeup, +}; -int __init slip_init_ctrl_dev(void) +static int __init slip_init(void) { int status; - if (slip_maxdev < 4) slip_maxdev = 4; /* Sanity */ + if (slip_maxdev < 4) + slip_maxdev = 4; /* Sanity */ printk(KERN_INFO "SLIP: version %s (dynamic channels, max=%d)" #ifdef CONFIG_SLIP_MODE_SLIP6 @@ -1323,16 +1328,15 @@ #endif ".\n", SLIP_VERSION, slip_maxdev ); -#if defined(SL_INCLUDE_CSLIP) && !defined(MODULE) +#if defined(SL_INCLUDE_CSLIP) printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California.\n"); #endif #ifdef CONFIG_SLIP_SMART printk(KERN_INFO "SLIP linefill/keepalive option.\n"); #endif - slip_ctrls = (slip_ctrl_t **) kmalloc(sizeof(void*)*slip_maxdev, GFP_KERNEL); - if (slip_ctrls == NULL) - { + slip_ctrls = kmalloc(sizeof(void*)*slip_maxdev, GFP_KERNEL); + if (!slip_ctrls) { printk(KERN_ERR "SLIP: Can't allocate slip_ctrls[] array! Uaargh! (-> No SLIP available)\n"); return -ENOMEM; } @@ -1347,28 +1351,7 @@ return status; } -static struct tty_ldisc sl_ldisc = -{ - .owner = THIS_MODULE, - .magic = TTY_LDISC_MAGIC, - .name = "slip", - .open = slip_open, - .close = slip_close, - .ioctl = slip_ioctl, - .receive_buf = slip_receive_buf, - .receive_room = slip_receive_room, - .write_wakeup = slip_write_wakeup, -}; - -#ifdef MODULE - -int init_module(void) -{ - return slip_init_ctrl_dev(); -} - -void -cleanup_module(void) +static void __exit slip_exit(void) { int i; @@ -1425,7 +1408,9 @@ printk(KERN_ERR "SLIP: can't unregister line discipline (err = %d)\n", i); } } -#endif /* MODULE */ + +module_init(slip_init); +module_exit(slip_exit); #ifdef CONFIG_SLIP_SMART /* --- 1.2/drivers/net/slip.h Mon Apr 21 23:58:43 2003 +++ edited/drivers/net/slip.h Wed May 7 21:51:30 2003 @@ -116,10 +116,6 @@ #endif }; - - #define SLIP_MAGIC 0x5302 - -extern int slip_init(struct net_device *dev); #endif /* _LINUX_SLIP.H */ From kuznet@ms2.inr.ac.ru Wed May 7 16:25:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 16:25:52 -0700 (PDT) Received: from mops.inr.ac.ru ([212.44.140.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h47NPXFu030590 for ; Wed, 7 May 2003 16:25:39 -0700 Received: (from kuznet@localhost) by mops.inr.ac.ru (8.6.13/ANK) id CAA00973; Thu, 8 May 2003 02:21:11 +0400 Message-Id: <200305072221.CAA00973@mops.inr.ac.ru> Subject: Re: acenic lockup To: davem@redhat.com (David S. Miller) Date: Thu, 8 May 2003 02:21:11 +0400 (MSD) Cc: anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com In-Reply-To: <20030507.123421.133894691.davem@redhat.com> from "David S. Miller" at May 7, 3 12:34:21 pm From: Alexey Kuznetsov X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 X-archive-position: 2465 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > However, what does kick device back into working state? Usually it is a link problem and device will recover after link is restored. This happens here. If it is some PCI failure or something went wrong in hardware, the device will stop forever, I guess. And I guess this happens with the same frequency as memory parity errors i.e. not so much. :-) > Do we make shamans dance when this message hits the logs > and pray for the best? :-) Sort of. I was about to dance for a while when saw creepy "ethX: BUG, tx ring is full" from tulip, which has the same bogus netif_wake_queue(). :-) Well, full reset is difficult thing with lock-free acenic. Seems, it has to throttle card, wake up something at process context, to disable irq there and to reset nic like it happens at ifconfig down (or even module unload in face of hard hardware failure?) Alexey From jmorris@intercode.com.au Wed May 7 17:54:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 17:54:53 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:Q9CKNwXW91tLUA3+CXT48Ntzn5gljvrQ@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h480skFu031365 for ; Wed, 7 May 2003 17:54:48 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h480rtr20217; Thu, 8 May 2003 10:53:56 +1000 Date: Thu, 8 May 2003 10:53:55 +1000 (EST) From: James Morris To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , Subject: Re: [PATCH] IPv4 IPComp In-Reply-To: <87znlymypm.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2466 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Thu, 8 May 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > > Hello, > > In ipcomp_input(): > > The original IP header(iph) is stored(copied) in tmp_iph. > > But after skb_pull(), tmp_iph is copied back to > same place where the original IP header exists in skb->nh.raw. > > I believe the attached diff is to fix it for correct behavior > which you intend. > > Could you check it? This looks correct. Dave, please apply. - James -- James Morris --- bk.pending/net/ipv4/ipcomp.c Mon May 5 15:12:29 2003 +++ bk.w1/net/ipv4/ipcomp.c Thu May 8 09:59:01 2003 @@ -94,7 +94,9 @@ memcpy(&tmp_iph, iph, iph->ihl * 4); nexthdr = *(u8 *)skb->data; skb_pull(skb, sizeof(struct ipcomp_hdr)); + skb->nh.raw += sizeof(struct ipcomp_hdr); memcpy(skb->nh.raw, &tmp_iph, tmp_iph.iph.ihl * 4); + iph = skb->nh.iph; iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ipcomp_hdr)); iph->protocol = nexthdr; skb->h.raw = skb->data; From rusty@samba.org Wed May 7 18:51:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 07 May 2003 18:51:10 -0700 (PDT) Received: from lists.samba.org (dp.samba.org [66.70.73.150]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h481oqFu032024 for ; Wed, 7 May 2003 18:50:53 -0700 Received: by lists.samba.org (Postfix, from userid 590) id 36E012C01B; Thu, 8 May 2003 01:21:01 +0000 (GMT) From: Rusty Russell To: "David S. Miller" Cc: laforge@netfilter.org, Jens Axboe , linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: Fw: kernel BUG at net/core/skbuff.c:1028! In-reply-to: Your message of "Wed, 07 May 2003 04:20:03 MST." <20030507.042003.26512841.davem@redhat.com> Date: Thu, 08 May 2003 11:20:27 +1000 Message-Id: <20030508012101.36E012C01B@lists.samba.org> X-archive-position: 2467 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rusty@rustcorp.com.au Precedence: bulk X-list: netdev In message <20030507.042003.26512841.davem@redhat.com> you write: > It has to be from some of the skb linearization changes. > I can't think of any other change we've made that would > make this start to happen. Yep, culprit is obvious stupid bug. This indicates a serious lack of testing on my part 8( Jens, does this help? Rusty. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.69-bk2/net/ipv4/netfilter/ip_nat_core.c working-2.5.69-bk2-fix-nat/net/ipv4/netfilter/ip_nat_core.c --- linux-2.5.69-bk2/net/ipv4/netfilter/ip_nat_core.c 2003-05-08 10:31:08.000000000 +1000 +++ working-2.5.69-bk2-fix-nat/net/ipv4/netfilter/ip_nat_core.c 2003-05-08 11:19:04.000000000 +1000 @@ -870,7 +870,8 @@ icmp_reply_translation(struct sk_buff ** adjustment, so make sure the current checksum is correct. */ if ((*pskb)->ip_summed != CHECKSUM_UNNECESSARY && (u16)csum_fold(skb_checksum(*pskb, (*pskb)->nh.iph->ihl*4, - (*pskb)->len, 0))) + (*pskb)->len + - (*pskb)->nh.iph->ihl*4, 0))) return 0; /* Must be RELATED */ -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. From lenehan@twibble.org Thu May 8 04:48:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 04:48:47 -0700 (PDT) Received: from egwene.twibble.org (charon.twibble.org [203.217.29.134]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48BmfFu011548 for ; Thu, 8 May 2003 04:48:43 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by egwene.twibble.org (Postfix) with ESMTP id 1CCD220F280 for ; Thu, 8 May 2003 21:48:39 +1000 (EST) Received: from egwene.twibble.org ([127.0.0.1]) by localhost (egwene.twibble.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22332-04 for ; Thu, 8 May 2003 21:48:37 +1000 (EST) Received: from nynaeve.twibble.org (nynaeve.twibble.org [203.217.29.154]) by egwene.twibble.org (Postfix) with ESMTP id 212C320F171 for ; Thu, 8 May 2003 21:48:37 +1000 (EST) Received: by nynaeve.twibble.org (Postfix, from userid 500) id 9AE03200082; Thu, 8 May 2003 07:48:36 -0400 (EDT) Date: Thu, 8 May 2003 21:48:36 +1000 From: Jamie Lenehan To: netdev@oss.sgi.com Subject: Re: 2.5.69 IPv6 (modular) crash on boot Message-ID: <20030508114836.GA1395@twibble.org> References: <20030506232037.GA5576@twibble.org> <20030506.201618.39175334.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030506.201618.39175334.davem@redhat.com> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at twibble.org X-archive-position: 2468 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: lenehan@twibble.org Precedence: bulk X-list: netdev On Tue, May 06, 2003 at 08:16:18PM -0700, David S. Miller wrote: [...] > IPv6 worked fine in 2.5.68, but I get a crash in 2.5.69 on boot. I > haven't seen anyone else mention this though. This is a RedHat 8 > systems with the new modutils added and pretty much everything built > modular: > > Yes, we know it's broken and we're thinking about how Right. I saw all the modules related stuff but no mention of it actually being broken as is ;) Built in works fine (and I don't see any reaon not to build it in now that I think about it). Thanks. -- Jamie Lenehan Work Phone: +61 3 9843 8817 lenehan@twibble.org Work Email: jamie.lenehan@activcard.com.au From davem@redhat.com Thu May 8 09:11:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 09:11: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.9) with SMTP id h48GBoFu017436 for ; Thu, 8 May 2003 09:11:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id IAA26400; Thu, 8 May 2003 08:03:23 -0700 Date: Thu, 08 May 2003 08:03:23 -0700 (PDT) Message-Id: <20030508.080323.58436808.davem@redhat.com> To: jmorris@intercode.com.au Cc: mk@linux-ipv6.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, usagi-core@linux-ipv6.org Subject: Re: [PATCH] IPv4 IPComp From: "David S. Miller" In-Reply-To: References: <87znlymypm.wl@karaba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2469 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 From: James Morris Date: Thu, 8 May 2003 10:53:55 +1000 (EST) On Thu, 8 May 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > Could you check it? This looks correct. Dave, please apply. Applied, thanks. From davem@redhat.com Thu May 8 09:45:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 09:45: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.9) with SMTP id h48GjOFu018160 for ; Thu, 8 May 2003 09:45:24 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id IAA26480; Thu, 8 May 2003 08:37:37 -0700 Date: Thu, 08 May 2003 08:37:37 -0700 (PDT) Message-Id: <20030508.083737.57463230.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] pktgen module and dev cleanup From: "David S. Miller" In-Reply-To: <20030507142911.4a8a7573.shemminger@osdl.org> References: <20030507142911.4a8a7573.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2470 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 From: Stephen Hemminger Date: Wed, 7 May 2003 14:29:11 -0700 Fix pktgen so the /proc interface uses owner instead of inc/dec the module ref count itself. Gets rid of warnings, and properly ref counts all readers/writers now. Applied, thanks a lot Stephen. From davem@redhat.com Thu May 8 09:48:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 09:48: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.9) with SMTP id h48GmTFu018504 for ; Thu, 8 May 2003 09:48:30 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id IAA26504; Thu, 8 May 2003 08:40:37 -0700 Date: Thu, 08 May 2003 08:40:36 -0700 (PDT) Message-Id: <20030508.084036.54208052.davem@redhat.com> To: hch@lst.de Cc: jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [PATCH] move slip over to initcalls From: "David S. Miller" In-Reply-To: <20030507235547.A15805@lst.de> References: <20030507235547.A15805@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2471 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 From: Christoph Hellwig Date: Wed, 7 May 2003 23:55:47 +0200 Time to get rid of a few entries in setup.c :) Applied, thanks Christoph. From davem@redhat.com Thu May 8 10:09:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:09: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.9) with SMTP id h48H9FFu019012 for ; Thu, 8 May 2003 10:09:15 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA26586; Thu, 8 May 2003 09:00:49 -0700 Date: Thu, 08 May 2003 09:00:49 -0700 (PDT) Message-Id: <20030508.090049.48375778.davem@redhat.com> To: kuznet@ms2.inr.ac.ru Cc: anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com, jgarzik@redhat.com Subject: Re: acenic lockup From: "David S. Miller" In-Reply-To: <200305072221.CAA00973@mops.inr.ac.ru> References: <20030507.123421.133894691.davem@redhat.com> <200305072221.CAA00973@mops.inr.ac.ru> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2472 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 From: Alexey Kuznetsov Date: Thu, 8 May 2003 02:21:11 +0400 (MSD) > However, what does kick device back into working state? Usually it is a link problem and device will recover after link is restored. This happens here. I fully recognize this. If it is some PCI failure or something went wrong in hardware, the device will stop forever, I guess. And I guess this happens with the same frequency as memory parity errors i.e. not so much. :-) Sometimes it is not cosmic bit-flip which causes this, but rather bit-flip caused by programmer of some unrelated area of kernel :-))) I am happy that hard-hang part is probably gone now. But I also desire real resiliency in this area of drivers. > Do we make shamans dance when this message hits the logs > and pray for the best? :-) Sort of. I was about to dance for a while when saw creepy "ethX: BUG, tx ring is full" from tulip, which has the same bogus netif_wake_queue(). :-) Note to Jeff, independant of what is being discussed here, a real audit of drivers that blindly invoke netif_wake_queue() from transmit timeout watchdog routine is in order at some point. This is what Alexey is referring to as "same bogus netif_wake_queue()". Well, full reset is difficult thing with lock-free acenic. Seems, it has to throttle card, wake up something at process context, to disable irq there and to reset nic like it happens at ifconfig down (or even module unload in face of hard hardware failure?) It is simple, use schedule_work(), tg3.c does exactly this. Only difference in acenic is need to use disable_irq(), that is all. From jgarzik@redhat.com Thu May 8 10:11:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:11:47 -0700 (PDT) Received: from devserv.devel.redhat.com (nat-pool-rdu.redhat.com [66.187.233.200]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48HBhFu019358 for ; Thu, 8 May 2003 10:11:43 -0700 Received: (from jgarzik@localhost) by devserv.devel.redhat.com (8.11.6/8.11.0) id h48HBaS12642; Thu, 8 May 2003 13:11:36 -0400 Date: Thu, 8 May 2003 13:11:35 -0400 From: Jeff Garzik To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com Subject: Re: acenic lockup Message-ID: <20030508131135.G22565@devserv.devel.redhat.com> References: <20030507.123421.133894691.davem@redhat.com> <200305072221.CAA00973@mops.inr.ac.ru> <20030508.090049.48375778.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: <20030508.090049.48375778.davem@redhat.com>; from davem@redhat.com on Thu, May 08, 2003 at 09:00:49AM -0700 X-archive-position: 2473 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@redhat.com Precedence: bulk X-list: netdev On Thu, May 08, 2003 at 09:00:49AM -0700, David S. Miller wrote: > Note to Jeff, independant of what is being discussed here, a real > audit of drivers that blindly invoke netif_wake_queue() from transmit > timeout watchdog routine is in order at some point. This is what > Alexey is referring to as "same bogus netif_wake_queue()". Agreed. Alexey has pointed out netif_wake_queue stupidities in drivers before, and he's absolutely right. Jeff P.S. Can you please email @pobox.com for stuff that is not Red Hat specific? I am trying to use @redhat.com for only official Red Hat business. My boss forces me to bk-commit as @redhat.com, otherwise you would never see that address in public at all. From davem@redhat.com Thu May 8 10:18:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:18: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.9) with SMTP id h48HIPFu019711 for ; Thu, 8 May 2003 10:18:26 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA26637; Thu, 8 May 2003 09:09:55 -0700 Date: Thu, 08 May 2003 09:09:54 -0700 (PDT) Message-Id: <20030508.090954.94579344.davem@redhat.com> To: jgarzik@redhat.com Cc: kuznet@ms2.inr.ac.ru, anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com Subject: Re: acenic lockup From: "David S. Miller" In-Reply-To: <20030508131135.G22565@devserv.devel.redhat.com> References: <200305072221.CAA00973@mops.inr.ac.ru> <20030508.090049.48375778.davem@redhat.com> <20030508131135.G22565@devserv.devel.redhat.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2474 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 From: Jeff Garzik Date: Thu, 8 May 2003 13:11:35 -0400 P.S. Can you please email @pobox.com for stuff that is not Red Hat specific? My apologies, I will do this in the future. How much will this affect latency though? :-) From jgarzik@redhat.com Thu May 8 10:27:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:27:59 -0700 (PDT) Received: from devserv.devel.redhat.com (nat-pool-rdu.redhat.com [66.187.233.200]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48HRpFu020085 for ; Thu, 8 May 2003 10:27:51 -0700 Received: (from jgarzik@localhost) by devserv.devel.redhat.com (8.11.6/8.11.0) id h48HRb619362; Thu, 8 May 2003 13:27:37 -0400 Date: Thu, 8 May 2003 13:27:35 -0400 From: Jeff Garzik To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com Subject: Re: acenic lockup Message-ID: <20030508132735.J22565@devserv.devel.redhat.com> References: <200305072221.CAA00973@mops.inr.ac.ru> <20030508.090049.48375778.davem@redhat.com> <20030508131135.G22565@devserv.devel.redhat.com> <20030508.090954.94579344.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: <20030508.090954.94579344.davem@redhat.com>; from davem@redhat.com on Thu, May 08, 2003 at 09:09:54AM -0700 X-archive-position: 2475 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@redhat.com Precedence: bulk X-list: netdev On Thu, May 08, 2003 at 09:09:54AM -0700, David S. Miller wrote: > From: Jeff Garzik > Date: Thu, 8 May 2003 13:11:35 -0400 > > P.S. Can you please email @pobox.com for stuff that is not Red Hat > specific? > > My apologies, I will do this in the future. > > How much will this affect latency though? :-) Should improve it :) I didn't check my redhat.com email all weekend this past weekend, for example. Jeff From greearb@candelatech.com Thu May 8 10:48:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:48:14 -0700 (PDT) Received: from grok.yi.org (IDENT:l/BWurGKjoQkS10lk4yJfhrCdo6M/k2Z@dhcp93-dsl-usw3.w-link.net [206.129.84.93]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48Hm4Fu020596 for ; Thu, 8 May 2003 10:48:05 -0700 Received: from candelatech.com (IDENT:PLEvSK+ByjXdpmCyeXFoAbQqZM7lzRqU@localhost.localdomain [127.0.0.1]) by grok.yi.org (8.11.6/8.11.6) with ESMTP id h48Hm3528730 for ; Thu, 8 May 2003 10:48:03 -0700 Message-ID: <3EBA9852.4030808@candelatech.com> Date: Thu, 08 May 2003 10:48:02 -0700 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "'netdev@oss.sgi.com'" Subject: new networking features Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2476 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greearb@candelatech.com Precedence: bulk X-list: netdev I have a little collection of networking features that may be of interest. My patches are against 2.4.20... If anyone thinks any of these are of interest, I will break them out and send them to the list for review/inclusion... 1) send-to-self: Add an IOCTL that allows an interface to be configured so that it will answer arps from other interfaces on the same machine. Also tweaks ip-v4 a bit. Allows: can send traffic from one interface to another interface on same machine over an external network. Tested with ipv4, may automatically work with ipv6 too. 2) 802.1Q VLAN: Add an ioctl that can be used to verify that a device is indeed an 802.1Q VLAN device (no more relying on name or luck). 3) MAC-VLANs: (Upgraded patch that someone else sent me.) Allows one to specify VLAN-like devices based on source or destination MAC addresses (no extra padding in the ethernet frame.) This requires a hook in the skb-rx logic, near where the bridging logic has it's hook. 4) Pktgen updates: Allows receiving (and accounting) packets & threading changes. Also requires a hook in the skb-rx logic. (Dave already said he didn't like it before, and I assume he still doesn't, but including it here for completeness). Thanks, Ben -- Ben Greear President of Candela Technologies Inc http://www.candelatech.com ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear From davem@redhat.com Thu May 8 10:51:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 10:51: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.9) with SMTP id h48HprFu020930 for ; Thu, 8 May 2003 10:51:54 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA26835; Thu, 8 May 2003 09:44:06 -0700 Date: Thu, 08 May 2003 09:44:05 -0700 (PDT) Message-Id: <20030508.094405.55858508.davem@redhat.com> To: greearb@candelatech.com Cc: netdev@oss.sgi.com Subject: Re: new networking features From: "David S. Miller" In-Reply-To: <3EBA9852.4030808@candelatech.com> References: <3EBA9852.4030808@candelatech.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2477 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 Independant of whether I'm interested in the changes, please use ethtool in deference to ioctls. If you absolutely must use ioctls, I can't accept the changes without updates to the compatability layer ioctl translation code of every platform. From greearb@candelatech.com Thu May 8 11:00:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 11:00:38 -0700 (PDT) Received: from grok.yi.org (IDENT:LOx+T8AbaeC4/nAmeQQZ7r+LlQGR5dti@dhcp93-dsl-usw3.w-link.net [206.129.84.93]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48I0YFu021348 for ; Thu, 8 May 2003 11:00:34 -0700 Received: from candelatech.com (IDENT:13SXfPh3gu/W2YJRWPCpuMOTpfuc7x4A@localhost.localdomain [127.0.0.1]) by grok.yi.org (8.11.6/8.11.6) with ESMTP id h48I0U528887; Thu, 8 May 2003 11:00:30 -0700 Message-ID: <3EBA9B3D.4050203@candelatech.com> Date: Thu, 08 May 2003 11:00:29 -0700 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David S. Miller" CC: netdev@oss.sgi.com Subject: Re: new networking features References: <3EBA9852.4030808@candelatech.com> <20030508.094405.55858508.davem@redhat.com> In-Reply-To: <20030508.094405.55858508.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2478 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greearb@candelatech.com Precedence: bulk X-list: netdev David S. Miller wrote: > Independant of whether I'm interested in the changes, please use > ethtool in deference to ioctls. If you absolutely must use > ioctls, I can't accept the changes without updates to the > compatability layer ioctl translation code of every platform. > Ok, so the general plan would be to add new structs as needed to ethtool.h and then extend of the the ethtool enums? Will ethtool ioctls work for generic/virtual interfaces/drivers? I need some way to get hooks into specific (ie dev.c, vlan, macvlan) code, but I'm not too particular about how it gets there as long as it isn't netlink :) Also, for the VLAN code, it's not really adding a new ioctl, but adding a new enum value to an existing ioctl payload... Thanks, Ben -- Ben Greear President of Candela Technologies Inc http://www.candelatech.com ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear From davem@redhat.com Thu May 8 11:03:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 11:03:06 -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.9) with SMTP id h48I33Fu021679 for ; Thu, 8 May 2003 11:03:03 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA26879; Thu, 8 May 2003 09:55:16 -0700 Date: Thu, 08 May 2003 09:55:16 -0700 (PDT) Message-Id: <20030508.095516.83600195.davem@redhat.com> To: greearb@candelatech.com Cc: netdev@oss.sgi.com Subject: Re: new networking features From: "David S. Miller" In-Reply-To: <3EBA9B3D.4050203@candelatech.com> References: <3EBA9852.4030808@candelatech.com> <20030508.094405.55858508.davem@redhat.com> <3EBA9B3D.4050203@candelatech.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2479 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 From: Ben Greear Date: Thu, 08 May 2003 11:00:29 -0700 Ok, so the general plan would be to add new structs as needed to ethtool.h and then extend of the the ethtool enums? There are no enumerations, ethtool commands are merely macro defines to numbers. But, otherwise yes. Will ethtool ioctls work for generic/virtual interfaces/drivers? It's all via the devices netdev->do_ioctl(), what is the problem? From shemminger@osdl.org Thu May 8 11:25:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 11:25:49 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48IPhFu022168 for ; Thu, 8 May 2003 11:25:43 -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 h48IPVW32355; Thu, 8 May 2003 11:25:31 -0700 Date: Thu, 8 May 2003 11:25:31 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Oops on bootup. Message-Id: <20030508112531.0483fccf.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2480 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 happened once and is not reproducible. There appears to be initialization window where netlink data can arrive before socket slab cache is initialized or something like that. Probably a packet has to arrive at just the right time or something similar. System is 4 CPU with 3 ethernets. Any leads? ============================== Initializing RT netlink socket Unable to handle kernel NULL pointer dereference at virtual address 00000000 printing eip: c01444b2 *pde = 00000000 Oops: 0000 [#1] CPU: 4 EIP: 0060:[] Not tainted EFLAGS: 00010086 EIP is at kmem_cache_alloc+0x38/0x18a eax: 00000004 ebx: c041e250 ecx: c0360598 edx: 00000000 esi: f7ffa860 edi: 00000246 ebp: c377ff24 esp: c377ff04 ds: 007b es: 007b ss: 0068 Process swapper (pid: 1, threadinfo=c377e000 task=c377c080) Stack: f7ffa860 000000d0 ffffffff 00005566 00005566 c041e250 f7ff7800 c028e8f4 c377ff38 c027f45a f7ffa860 000000d0 c041e250 c377ff54 c0176e62 f7ff7800 00005544 c041e250 00000000 c028e8f4 c377ff68 c017794c f7ff7800 c041e250 Call Trace: [] rtnetlink_rcv+0x0/0x532 [] sock_alloc_inode+0x1e/0x7a [] alloc_inode+0x1e/0x14a [] rtnetlink_rcv+0x0/0x532 [] new_inode+0x1c/0xd8 [] sock_alloc+0x19/0x80 [] netlink_kernel_create+0x2e/0x88 [] rtnetlink_init+0x26/0x74 [] rtnetlink_rcv+0x0/0x532 [] netlink_proto_init+0x45/0x4c [] do_initcalls+0x2a/0x98 [] init_workqueues+0x12/0x29 [] init+0x5d/0x1fa [] init+0x0/0x1fa [] kernel_thread_helper+0x5/0xc Code: 8b 1a 85 db 0f 84 11 01 00 00 f0 ff 86 10 01 00 00 8b 02 c7 <0>Kernel panic: Attempted to kill init! From davem@redhat.com Thu May 8 11:28:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 11:28: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.9) with SMTP id h48IS5Fu022538 for ; Thu, 8 May 2003 11:28:06 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id KAA27107; Thu, 8 May 2003 10:20:11 -0700 Date: Thu, 08 May 2003 10:20:10 -0700 (PDT) Message-Id: <20030508.102010.90804594.davem@redhat.com> To: rusty@rustcorp.com.au Cc: laforge@netfilter.org, axboe@suse.de, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: kernel BUG at net/core/skbuff.c:1028! From: "David S. Miller" In-Reply-To: <20030508012101.36E012C01B@lists.samba.org> References: <20030507.042003.26512841.davem@redhat.com> <20030508012101.36E012C01B@lists.samba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2481 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 From: Rusty Russell Date: Thu, 08 May 2003 11:20:27 +1000 Yep, culprit is obvious stupid bug. This indicates a serious lack of testing on my part 8( Jens, does this help? There were two cases of the same bug, you fixed only one instance :-) Jens, try this patch instead. --- net/ipv4/netfilter/ip_nat_core.c.~1~ Thu May 8 11:23:22 2003 +++ net/ipv4/netfilter/ip_nat_core.c Thu May 8 11:25:56 2003 @@ -861,6 +861,7 @@ } *inside; unsigned int i; struct ip_nat_info *info = &conntrack->nat.info; + int hdrlen; if (!skb_ip_make_writable(pskb,(*pskb)->nh.iph->ihl*4+sizeof(*inside))) return 0; @@ -868,10 +869,12 @@ /* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ - if ((*pskb)->ip_summed != CHECKSUM_UNNECESSARY - && (u16)csum_fold(skb_checksum(*pskb, (*pskb)->nh.iph->ihl*4, - (*pskb)->len, 0))) - return 0; + if ((*pskb)->ip_summed != CHECKSUM_UNNECESSARY) { + hdrlen = (*pskb)->nh.iph->ihl * 4; + if ((u16)csum_fold(skb_checksum(*pskb, hdrlen, + (*pskb)->len - hdrlen, 0))) + return 0; + } /* Must be RELATED */ IP_NF_ASSERT((*pskb)->nfct @@ -948,10 +951,12 @@ } READ_UNLOCK(&ip_nat_lock); + hdrlen = (*pskb)->nh.iph->ihl * 4; + inside->icmp.checksum = 0; - inside->icmp.checksum = csum_fold(skb_checksum(*pskb, - (*pskb)->nh.iph->ihl*4, - (*pskb)->len, 0)); + inside->icmp.checksum = csum_fold(skb_checksum(*pskb, hdrlen, + (*pskb)->len - hdrlen, + 0)); return 1; unlock_fail: From davem@redhat.com Thu May 8 11:35:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 11:35: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.9) with SMTP id h48IZhFu022899 for ; Thu, 8 May 2003 11:35:44 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id KAA27147; Thu, 8 May 2003 10:27:56 -0700 Date: Thu, 08 May 2003 10:27:55 -0700 (PDT) Message-Id: <20030508.102755.25135206.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: Oops on bootup. From: "David S. Miller" In-Reply-To: <20030508112531.0483fccf.shemminger@osdl.org> References: <20030508112531.0483fccf.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2482 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 From: Stephen Hemminger Date: Thu, 8 May 2003 11:25:31 -0700 This happened once and is not reproducible. There appears to be initialization window where netlink data can arrive before socket slab cache is initialized or something like that. Probably a packet has to arrive at just the right time or something similar. It's oopsing on sock_inode_cachep. We init that in sock_init() which is invoked explicitly by do_basic_setup(). The calltrace is back into netlink_kernel_create via rtnetlink_init via netlink_proto_init. netlink_proto_init was recently changed into a subsys initcall. Because it is a subsys initcall, it must be invoked after sock_init() and therefore the sock_inode_cachep must be initialized properly at this point. I have no idea how your trace is possible besides possible mem corruption. From rddunlap@osdl.org Thu May 8 15:33:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 15:33:56 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48MXrFu026688 for ; Thu, 8 May 2003 15:33:54 -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 h48MXlW02244; Thu, 8 May 2003 15:33:47 -0700 Date: Thu, 8 May 2003 15:30:32 -0700 From: "Randy.Dunlap" To: linux-net@vger.kernel.org Cc: netdev@oss.sgi.com Subject: confuzed bit flags Message-Id: <20030508153032.06e7c98a.rddunlap@osdl.org> Organization: OSDL X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i586-pc-linux-gnu) X-Face: +5V?h'hZQPB9kW Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2484 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 I'm confused or the source code is or both. net/ipv6/ndisc.c sets rt->rt6i_flags = RTF_LOCAL; This is OK AFAIK since RTF_LOCAL is #defined in ./linux/ipv6_route.h:36:#define RTF_LOCAL 0x80000000 But then RTF_LOCAL is never used anywhere else. OK or not? Further checking finds that net/ipv6/xfrm6_policy.c does this: x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); but these RTCF_ bits are defined in include/linux/in_route.h, which says: /* IPv4 routing cache flags */ So it's nice or good that RTF_LOCAL and RTCF_LOCAL are both #defined as 0x80000000. Right? Oh, I see now that there's even a comment that might be applicable to this : /* Sheit... I remember I did this right. Apparently, * it was magically lost, so this code needs audit */ I guess that my (idealistic) position is that those RTCF_ bit flags shouldn't be used here (in net/ipv6) at all. Am I off track on this? -- ~Randy From shemminger@osdl.org Thu May 8 15:33:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 15:33:30 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h48MXLFu026660 for ; Thu, 8 May 2003 15:33:22 -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 h48MX7W02199; Thu, 8 May 2003 15:33:07 -0700 Date: Thu, 8 May 2003 15:33:07 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69] IPV4/6 inetsw using RCU Message-Id: <20030508153307.73d16f5e.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2483 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 replaces the brlock with RCU for the IPV4 and IPV6 protocol switch (inetsw) with Read Copy Update (RCU). This gets rid of one of the last two uses of brlock in the kernel. Tested on 8-way SMP and it is marginally faster when running on 1G Ethernet using netperf. It changes inetsw from a public variable to static since there is a well define register/unregister interface. IPV6 unregister needs to be a seperate function because it has a seperate lock. This is a revised version of the earlier brlock removal patch, and addresses all comments received so far. It is stable and works reliably, but Dave, you may want to wait for any additional comments before applying. diff -urNp -X dontdiff linux-2.5/include/net/protocol.h linux-2.5-nbr/include/net/protocol.h --- linux-2.5/include/net/protocol.h 2003-04-17 09:05:10.000000000 -0700 +++ linux-2.5-nbr/include/net/protocol.h 2003-04-30 14:32:25.000000000 -0700 @@ -80,11 +80,9 @@ struct inet_protosw { extern struct inet_protocol *inet_protocol_base; extern struct inet_protocol *inet_protos[MAX_INET_PROTOS]; -extern struct list_head inetsw[SOCK_MAX]; #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; -extern struct list_head inetsw6[SOCK_MAX]; #endif extern int inet_add_protocol(struct inet_protocol *prot, unsigned char num); diff -urNp -X dontdiff linux-2.5/net/ipv4/af_inet.c linux-2.5-nbr/net/ipv4/af_inet.c --- linux-2.5/net/ipv4/af_inet.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-nbr/net/ipv4/af_inet.c 2003-05-05 09:44:36.000000000 -0700 @@ -94,7 +94,6 @@ #include #include #include -#include #include #include #include @@ -129,7 +128,8 @@ static kmem_cache_t *raw4_sk_cachep; /* The inetsw table contains everything that inet_create needs to * build a new socket. */ -struct list_head inetsw[SOCK_MAX]; +static struct list_head inetsw[SOCK_MAX]; +static spinlock_t inetsw_lock = SPIN_LOCK_UNLOCKED; /* New destruction routine */ @@ -337,8 +337,8 @@ static int inet_create(struct socket *so /* Look for the requested type/protocol pair. */ answer = NULL; - br_read_lock_bh(BR_NETPROTO_LOCK); - list_for_each(p, &inetsw[sock->type]) { + rcu_read_lock(); + list_for_each_rcu(p, &inetsw[sock->type]) { answer = list_entry(p, struct inet_protosw, list); /* Check the non-wild match. */ @@ -356,7 +356,6 @@ static int inet_create(struct socket *so } answer = NULL; } - br_read_unlock_bh(BR_NETPROTO_LOCK); err = -ESOCKTNOSUPPORT; if (!answer) @@ -373,6 +372,7 @@ static int inet_create(struct socket *so sk->no_check = answer->no_check; if (INET_PROTOSW_REUSE & answer->flags) sk->reuse = 1; + rcu_read_unlock(); inet = inet_sk(sk); @@ -427,6 +427,7 @@ static int inet_create(struct socket *so out: return err; out_sk_free: + rcu_read_unlock(); sk_free(sk); goto out; } @@ -978,7 +979,7 @@ void inet_register_protosw(struct inet_p int protocol = p->protocol; struct list_head *last_perm; - br_write_lock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&inetsw_lock); if (p->type > SOCK_MAX) goto out_illegal; @@ -1007,9 +1008,12 @@ void inet_register_protosw(struct inet_p * non-permanent entry. This means that when we remove this entry, the * system automatically returns to the old behavior. */ - list_add(&p->list, last_perm); + list_add_rcu(&p->list, last_perm); out: - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&inetsw_lock); + + synchronize_kernel(); + return; out_permanent: @@ -1031,9 +1035,11 @@ void inet_unregister_protosw(struct inet "Attempt to unregister permanent protocol %d.\n", p->protocol); } else { - br_write_lock_bh(BR_NETPROTO_LOCK); - list_del(&p->list); - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&inetsw_lock); + list_del_rcu(&p->list); + spin_unlock_bh(&inetsw_lock); + + synchronize_kernel(); } } diff -urNp -X dontdiff linux-2.5/net/ipv4/icmp.c linux-2.5-nbr/net/ipv4/icmp.c --- linux-2.5/net/ipv4/icmp.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-nbr/net/ipv4/icmp.c 2003-05-01 09:54:44.000000000 -0700 @@ -695,15 +695,12 @@ static void icmp_unreach(struct sk_buff } read_unlock(&raw_v4_lock); - /* - * This can't change while we are doing it. - * Callers have obtained BR_NETPROTO_LOCK so - * we are OK. - */ - + rcu_read_lock(); ipprot = inet_protos[hash]; + smp_read_barrier_depends(); if (ipprot && ipprot->err_handler) ipprot->err_handler(skb, info); + rcu_read_unlock(); out: return; diff -urNp -X dontdiff linux-2.5/net/ipv4/ip_input.c linux-2.5-nbr/net/ipv4/ip_input.c --- linux-2.5/net/ipv4/ip_input.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-nbr/net/ipv4/ip_input.c 2003-05-01 09:54:44.000000000 -0700 @@ -215,6 +215,7 @@ static inline int ip_local_deliver_finis /* Point into the IP datagram, just past the header. */ skb->h.raw = skb->data; + rcu_read_lock(); { /* Note: See raw.c and net/raw.h, RAWV4_HTABLE_SIZE==MAX_INET_PROTOS */ int protocol = skb->nh.iph->protocol; @@ -235,10 +236,11 @@ static inline int ip_local_deliver_finis if ((ipprot = inet_protos[hash]) != NULL) { int ret; + smp_read_barrier_depends(); if (!ipprot->no_policy && !xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { kfree_skb(skb); - return 0; + goto out; } ret = ipprot->handler(skb); if (ret < 0) { @@ -258,6 +260,8 @@ static inline int ip_local_deliver_finis kfree_skb(skb); } } + out: + rcu_read_unlock(); return 0; } diff -urNp -X dontdiff linux-2.5/net/ipv4/protocol.c linux-2.5-nbr/net/ipv4/protocol.c --- linux-2.5/net/ipv4/protocol.c 2003-04-14 13:32:26.000000000 -0700 +++ linux-2.5-nbr/net/ipv4/protocol.c 2003-04-30 16:30:33.000000000 -0700 @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include struct inet_protocol *inet_protos[MAX_INET_PROTOS]; +static spinlock_t inet_proto_lock = SPIN_LOCK_UNLOCKED; /* * Add a protocol handler to the hash tables @@ -60,16 +60,14 @@ int inet_add_protocol(struct inet_protoc hash = protocol & (MAX_INET_PROTOS - 1); - br_write_lock_bh(BR_NETPROTO_LOCK); - + spin_lock_bh(&inet_proto_lock); if (inet_protos[hash]) { ret = -1; } else { inet_protos[hash] = prot; ret = 0; } - - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&inet_proto_lock); return ret; } @@ -84,16 +82,15 @@ int inet_del_protocol(struct inet_protoc hash = protocol & (MAX_INET_PROTOS - 1); - br_write_lock_bh(BR_NETPROTO_LOCK); - + spin_lock_bh(&inet_proto_lock); if (inet_protos[hash] == prot) { inet_protos[hash] = NULL; ret = 0; } else { ret = -1; } + spin_unlock_bh(&inet_proto_lock); - br_write_unlock_bh(BR_NETPROTO_LOCK); return ret; } diff -urNp -X dontdiff linux-2.5/net/ipv6/af_inet6.c linux-2.5-nbr/net/ipv6/af_inet6.c --- linux-2.5/net/ipv6/af_inet6.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-nbr/net/ipv6/af_inet6.c 2003-05-05 09:44:36.000000000 -0700 @@ -45,7 +45,6 @@ #include #include #include -#include #include #include @@ -102,7 +101,8 @@ kmem_cache_t *raw6_sk_cachep; /* The inetsw table contains everything that inet_create needs to * build a new socket. */ -struct list_head inetsw6[SOCK_MAX]; +static struct list_head inetsw6[SOCK_MAX]; +static spinlock_t inetsw6_lock = SPIN_LOCK_UNLOCKED; static void inet6_sock_destruct(struct sock *sk) { @@ -163,8 +163,8 @@ static int inet6_create(struct socket *s /* Look for the requested type/protocol pair. */ answer = NULL; - br_read_lock_bh(BR_NETPROTO_LOCK); - list_for_each(p, &inetsw6[sock->type]) { + rcu_read_lock(); + list_for_each_rcu(p, &inetsw6[sock->type]) { answer = list_entry(p, struct inet_protosw, list); /* Check the non-wild match. */ @@ -182,7 +182,6 @@ static int inet6_create(struct socket *s } answer = NULL; } - br_read_unlock_bh(BR_NETPROTO_LOCK); if (!answer) goto free_and_badtype; @@ -199,6 +198,7 @@ static int inet6_create(struct socket *s sk->no_check = answer->no_check; if (INET_PROTOSW_REUSE & answer->flags) sk->reuse = 1; + rcu_read_unlock(); inet = inet_sk(sk); @@ -267,12 +267,15 @@ static int inet6_create(struct socket *s return 0; free_and_badtype: + rcu_read_unlock(); sk_free(sk); return -ESOCKTNOSUPPORT; free_and_badperm: + rcu_read_unlock(); sk_free(sk); return -EPERM; free_and_noproto: + rcu_read_unlock(); sk_free(sk); return -EPROTONOSUPPORT; do_oom: @@ -580,7 +583,7 @@ inet6_register_protosw(struct inet_proto int protocol = p->protocol; struct list_head *last_perm; - br_write_lock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&inetsw6_lock); if (p->type > SOCK_MAX) goto out_illegal; @@ -609,9 +612,9 @@ inet6_register_protosw(struct inet_proto * non-permanent entry. This means that when we remove this entry, the * system automatically returns to the old behavior. */ - list_add(&p->list, last_perm); + list_add_rcu(&p->list, last_perm); out: - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&inetsw6_lock); return; out_permanent: @@ -629,7 +632,17 @@ out_illegal: void inet6_unregister_protosw(struct inet_protosw *p) { - inet_unregister_protosw(p); + if (INET_PROTOSW_PERMANENT & p->flags) { + printk(KERN_ERR + "Attempt to unregister permanent protocol %d.\n", + p->protocol); + } else { + spin_lock_bh(&inetsw6_lock); + list_del_rcu(&p->list); + spin_unlock_bh(&inetsw6_lock); + + synchronize_kernel(); + } } int diff -urNp -X dontdiff linux-2.5/net/ipv6/icmp.c linux-2.5-nbr/net/ipv6/icmp.c --- linux-2.5/net/ipv6/icmp.c 2003-04-29 09:57:41.000000000 -0700 +++ linux-2.5-nbr/net/ipv6/icmp.c 2003-05-01 09:54:44.000000000 -0700 @@ -456,9 +456,12 @@ static void icmpv6_notify(struct sk_buff hash = nexthdr & (MAX_INET_PROTOS - 1); + rcu_read_lock(); ipprot = inet6_protos[hash]; + smp_read_barrier_depends(); if (ipprot && ipprot->err_handler) ipprot->err_handler(skb, NULL, type, code, inner_offset, info); + rcu_read_unlock(); read_lock(&raw_v6_lock); if ((sk = raw_v6_htable[hash]) != NULL) { diff -urNp -X dontdiff linux-2.5/net/ipv6/ip6_input.c linux-2.5-nbr/net/ipv6/ip6_input.c --- linux-2.5/net/ipv6/ip6_input.c 2003-04-17 09:05:10.000000000 -0700 +++ linux-2.5-nbr/net/ipv6/ip6_input.c 2003-05-01 09:54:44.000000000 -0700 @@ -152,6 +152,7 @@ static inline int ip6_input_finish(struc skb->h.raw += (skb->h.raw[1]+1)<<3; } + rcu_read_lock(); resubmit: if (!pskb_pull(skb, skb->h.raw - skb->data)) goto discard; @@ -165,6 +166,7 @@ resubmit: if ((ipprot = inet6_protos[hash]) != NULL) { int ret; + smp_read_barrier_depends(); if (ipprot->flags & INET6_PROTO_FINAL) { if (!cksum_sub && skb->ip_summed == CHECKSUM_HW) { skb->csum = csum_sub(skb->csum, @@ -173,10 +175,8 @@ resubmit: } } if (!(ipprot->flags & INET6_PROTO_NOPOLICY) && - !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { - kfree_skb(skb); - return 0; - } + !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) + goto discard; ret = ipprot->handler(&skb, &nhoff); if (ret > 0) @@ -194,10 +194,11 @@ resubmit: kfree_skb(skb); } } - + rcu_read_unlock(); return 0; discard: + rcu_read_unlock(); kfree_skb(skb); return 0; } diff -urNp -X dontdiff linux-2.5/net/ipv6/protocol.c linux-2.5-nbr/net/ipv6/protocol.c --- linux-2.5/net/ipv6/protocol.c 2003-04-14 13:32:27.000000000 -0700 +++ linux-2.5-nbr/net/ipv6/protocol.c 2003-04-30 14:39:23.000000000 -0700 @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -41,12 +40,14 @@ #include struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; +static spinlock_t inet6_proto_lock = SPIN_LOCK_UNLOCKED; + int inet6_add_protocol(struct inet6_protocol *prot, unsigned char protocol) { int ret, hash = protocol & (MAX_INET_PROTOS - 1); - br_write_lock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&inet6_proto_lock); if (inet6_protos[hash]) { ret = -1; @@ -55,7 +56,7 @@ int inet6_add_protocol(struct inet6_prot ret = 0; } - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&inet6_proto_lock); return ret; } @@ -68,7 +69,7 @@ int inet6_del_protocol(struct inet6_prot { int ret, hash = protocol & (MAX_INET_PROTOS - 1); - br_write_lock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&inet6_proto_lock); if (inet6_protos[hash] != prot) { ret = -1; @@ -77,7 +78,7 @@ int inet6_del_protocol(struct inet6_prot ret = 0; } - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&inet6_proto_lock); return ret; } From davem@redhat.com Thu May 8 15:41:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 15:41:54 -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.9) with SMTP id h48MflFu027326 for ; Thu, 8 May 2003 15:41:48 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id PAA28140; Thu, 8 May 2003 15:41:43 -0700 Date: Thu, 08 May 2003 15:41:43 -0700 (PDT) Message-Id: <20030508.154143.88024940.davem@redhat.com> To: rddunlap@osdl.org Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: confuzed bit flags From: "David S. Miller" In-Reply-To: <20030508153032.06e7c98a.rddunlap@osdl.org> References: <20030508153032.06e7c98a.rddunlap@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2485 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 From: "Randy.Dunlap" Date: Thu, 8 May 2003 15:30:32 -0700 I'm confused or the source code is or both. net/ipv6/ndisc.c sets rt->rt6i_flags = RTF_LOCAL; Any time you see some absolutely strange handling inside of ipv6 routing, it usually indicates a place where ipv4 routing does things one way and the ipv6 side cannot implement things in that way for one reason or another. Yet, some ipv4'lets remain in the ipv6 code, almost as a marker to be mindful of this difference. This RTF_LOCAL thing is just such a case. In many ways the ipv6 routing code is lacking in features that ipv4 routing has. I'm in fact right now killing on of them, rtnetlink route metrics are ignored by ipv6. From davem@redhat.com Thu May 8 15:43:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 15:43:26 -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.9) with SMTP id h48MhMFu027642 for ; Thu, 8 May 2003 15:43:23 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id PAA28161; Thu, 8 May 2003 15:43:20 -0700 Date: Thu, 08 May 2003 15:43:20 -0700 (PDT) Message-Id: <20030508.154320.128592193.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] IPV4/6 inetsw using RCU From: "David S. Miller" In-Reply-To: <20030508153307.73d16f5e.shemminger@osdl.org> References: <20030508153307.73d16f5e.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2486 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 From: Stephen Hemminger Date: Thu, 8 May 2003 15:33:07 -0700 This is a revised version of the earlier brlock removal patch, and addresses all comments received so far. It is stable and works reliably, but Dave, you may want to wait for any additional comments before applying. Okie dokie. The patch looks fine to me. Just let me know when it's ready to go in. From ak@suse.de Thu May 8 22:49:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 08 May 2003 22:49:23 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h495nHFu001413 for ; Thu, 8 May 2003 22:49:18 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 8B84A144E1; Fri, 9 May 2003 07:49:12 +0200 (MEST) Date: Fri, 9 May 2003 07:49:12 +0200 From: Andi Kleen To: "David S. Miller" Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] IPV4/6 inetsw using RCU Message-ID: <20030509054912.GL15829@Wotan.suse.de> References: <20030508153307.73d16f5e.shemminger@osdl.org> <20030508.154320.128592193.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030508.154320.128592193.davem@redhat.com> X-archive-position: 2487 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, May 08, 2003 at 03:43:20PM -0700, David S. Miller wrote: > From: Stephen Hemminger > Date: Thu, 8 May 2003 15:33:07 -0700 > > This is a revised version of the earlier brlock removal patch, and > addresses all comments received so far. It is stable and works > reliably, but Dave, you may want to wait for any additional > comments before applying. > > Okie dokie. The patch looks fine to me. Just let me know when > it's ready to go in. FWIW it looks good to me too. -Andi From hch@verein.lst.de Fri May 9 00:12:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 00:13:03 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h497CLFu003659 for ; Fri, 9 May 2003 00:12:26 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h497CJB01514; Fri, 9 May 2003 09:12:19 +0200 Date: Fri, 9 May 2003 09:12:19 +0200 From: Christoph Hellwig To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] switch x25_asy over to initcalls Message-ID: <20030509091219.A1499@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2488 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 I also had to fix the ldisc initialization because it was so ugly and the different ioctl + cast mess because I couldn't look at it. --- 1.7/drivers/net/setup.c Thu May 8 12:47:20 2003 +++ edited/drivers/net/setup.c Fri May 9 07:31:44 2003 @@ -9,8 +9,6 @@ #include #include -extern int x25_asy_init_ctrl_dev(void); - extern int dmascc_init(void); extern int arcnet_init(void); @@ -101,19 +99,6 @@ } } - -/* - * Initialise the line discipline drivers - */ - -static void __init network_ldisc_init(void) -{ -#if defined(CONFIG_X25_ASY) - x25_asy_init_ctrl_dev(); -#endif -} - - static void __init special_device_init(void) { #ifdef CONFIG_NET_SB1000 @@ -133,11 +118,8 @@ void __init net_device_init(void) { - /* Devices supporting the new probing API */ + /* Devices supporting the new^H^H^Hold probing API */ network_probe(); - /* Line disciplines */ - network_ldisc_init(); /* Special devices */ special_device_init(); - /* That kicks off the legacy init functions */ } --- 1.5/drivers/net/wan/x25_asy.c Mon Apr 21 23:58:40 2003 +++ edited/drivers/net/wan/x25_asy.c Fri May 9 07:45:43 2003 @@ -46,8 +46,6 @@ MODULE_PARM(x25_asy_maxdev, "i"); MODULE_LICENSE("GPL"); -static struct tty_ldisc x25_ldisc; - static int x25_asy_esc(unsigned char *p, unsigned char *d, int len); static void x25_asy_unesc(struct x25_asy *sl, unsigned char c); @@ -634,8 +632,6 @@ if ((err = x25_asy_open(sl->dev))) return err; - MOD_INC_USE_COUNT; - /* Done. We have linked the TTY line to a channel. */ return sl->dev->base_addr; } @@ -664,7 +660,6 @@ sl->tty = NULL; x25_asy_free(sl); unregister_netdev(sl->dev); - MOD_DEC_USE_COUNT; } @@ -769,32 +764,29 @@ /* Perform I/O control on an active X.25 channel. */ -static int x25_asy_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) +static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, + unsigned int cmd, unsigned long arg) { struct x25_asy *sl = (struct x25_asy *) tty->disc_data; /* First make sure we're connected. */ - if (!sl || sl->magic != X25_ASY_MAGIC) { + if (!sl || sl->magic != X25_ASY_MAGIC) return -EINVAL; - } - switch(cmd) - { - case SIOCGIFNAME: - if(copy_to_user(arg, sl->dev->name, strlen(sl->dev->name) + 1)) - return -EFAULT; - return 0; - - case SIOCSIFHWADDR: - return -EINVAL; - - /* Allow stty to read, but not set, the serial port */ - case TCGETS: - case TCGETA: - return n_tty_ioctl(tty, (struct file *) file, cmd, (unsigned long) arg); - - default: - return -ENOIOCTLCMD; + switch(cmd) { + case SIOCGIFNAME: + if (copy_to_user((void *)arg, sl->dev->name, + strlen(sl->dev->name) + 1)) + return -EFAULT; + return 0; + case SIOCSIFHWADDR: + return -EINVAL; + /* Allow stty to read, but not set, the serial port */ + case TCGETS: + case TCGETA: + return n_tty_ioctl(tty, file, cmd, arg); + default: + return -ENOIOCTLCMD; } } @@ -806,51 +798,7 @@ return 0; } -/* Initialize X.25 control device -- register X.25 line discipline */ - -int __init x25_asy_init_ctrl_dev(void) -{ - int status; - - if (x25_asy_maxdev < 4) x25_asy_maxdev = 4; /* Sanity */ - - printk(KERN_INFO "X.25 async: version 0.00 ALPHA (dynamic channels, max=%d).\n", - x25_asy_maxdev ); - x25_asy_ctrls = (x25_asy_ctrl_t **) kmalloc(sizeof(void*)*x25_asy_maxdev, GFP_KERNEL); - if (x25_asy_ctrls == NULL) - { - printk("X25 async: Can't allocate x25_asy_ctrls[] array! Uaargh! (-> No X.25 available)\n"); - return -ENOMEM; - } - - /* Clear the pointer array, we allocate devices when we need them */ - memset(x25_asy_ctrls, 0, sizeof(void*)*x25_asy_maxdev); /* Pointers */ - - /* Fill in our line protocol discipline, and register it */ - memset(&x25_ldisc, 0, sizeof(x25_ldisc)); - x25_ldisc.magic = TTY_LDISC_MAGIC; - x25_ldisc.name = "X.25"; - x25_ldisc.flags = 0; - x25_ldisc.open = x25_asy_open_tty; - x25_ldisc.close = x25_asy_close_tty; - x25_ldisc.read = NULL; - x25_ldisc.write = NULL; - x25_ldisc.ioctl = (int (*)(struct tty_struct *, struct file *, - unsigned int, unsigned long)) x25_asy_ioctl; - x25_ldisc.poll = NULL; - x25_ldisc.receive_buf = x25_asy_receive_buf; - x25_ldisc.receive_room = x25_asy_receive_room; - x25_ldisc.write_wakeup = x25_asy_write_wakeup; - if ((status = tty_register_ldisc(N_X25, &x25_ldisc)) != 0) { - printk("X.25 async: can't register line discipline (err = %d)\n", status); - } - - return status; -} - - /* Initialise the X.25 driver. Called by the device init code */ - int x25_asy_init(struct net_device *dev) { struct x25_asy *sl = (struct x25_asy*)(dev->priv); @@ -885,43 +833,58 @@ return 0; } -#ifdef MODULE -int -init_module(void) -{ - return x25_asy_init_ctrl_dev(); +static struct tty_ldisc x25_ldisc = { + .owner = THIS_MODULE, + .magic = TTY_LDISC_MAGIC, + .name = "X.25", + .open = x25_asy_open_tty, + .close = x25_asy_close_tty, + .ioctl = x25_asy_ioctl, + .receive_buf = x25_asy_receive_buf, + .receive_room = x25_asy_receive_room, + .write_wakeup = x25_asy_write_wakeup, +}; + +static int __init init_x25_asy(void) +{ + if (x25_asy_maxdev < 4) + x25_asy_maxdev = 4; /* Sanity */ + + printk(KERN_INFO "X.25 async: version 0.00 ALPHA " + "(dynamic channels, max=%d).\n", x25_asy_maxdev ); + x25_asy_ctrls = kmalloc(sizeof(void*)*x25_asy_maxdev, GFP_KERNEL); + if (!x25_asy_ctrls) { + printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " + "array! Uaargh! (-> No X.25 available)\n"); + return -ENOMEM; + } + memset(x25_asy_ctrls, 0, sizeof(void*)*x25_asy_maxdev); /* Pointers */ + + return tty_register_ldisc(N_X25, &x25_ldisc); } -void -cleanup_module(void) + +static void __exit exit_x25_asy(void) { int i; - if (x25_asy_ctrls != NULL) - { - for (i = 0; i < x25_asy_maxdev; i++) - { - if (x25_asy_ctrls[i]) - { - /* - * VSV = if dev->start==0, then device - * unregistered while close proc. - */ - if (netif_running(&(x25_asy_ctrls[i]->dev))) - unregister_netdev(&(x25_asy_ctrls[i]->dev)); + for (i = 0; i < x25_asy_maxdev; i++) { + if (x25_asy_ctrls[i]) { + /* + * VSV = if dev->start==0, then device + * unregistered while close proc. + */ + if (netif_running(&(x25_asy_ctrls[i]->dev))) + unregister_netdev(&(x25_asy_ctrls[i]->dev)); - kfree(x25_asy_ctrls[i]); - x25_asy_ctrls[i] = NULL; - } + kfree(x25_asy_ctrls[i]); } - kfree(x25_asy_ctrls); - x25_asy_ctrls = NULL; - } - if ((i = tty_register_ldisc(N_X25, NULL))) - { - printk("X.25 async: can't unregister line discipline (err = %d)\n", i); } + + kfree(x25_asy_ctrls); + tty_register_ldisc(N_X25, NULL); } -#endif /* MODULE */ +module_init(init_x25_asy); +module_exit(exit_x25_asy); From Robert.Olsson@data.slu.se Fri May 9 04:35:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 04:35:21 -0700 (PDT) Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h49BZDFu010016 for ; Fri, 9 May 2003 04:35:14 -0700 Received: (from robert@localhost) by robur.slu.se (8.9.3p2/8.9.3) id NAA24105; Fri, 9 May 2003 13:34:58 +0200 From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16059.37474.453731.39031@robur.slu.se> Date: Fri, 9 May 2003 13:34:58 +0200 To: "Seong Moon" Cc: Subject: IPv6 : ICMPV6_DEST_UNREACH type with ICMPV6_NOROUTE code In-Reply-To: <003e01c313b8$e55db620$28acfe81@seong> References: <003e01c313b8$e55db620$28acfe81@seong> X-Mailer: VM 6.92 under Emacs 19.34.1 X-archive-position: 2489 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Seong Moon writes: > I found that when the kernel has no forwarding entry of a packet, > the kernel sends an ICMPV6_DEST_UNREACH icmp message with > ICMPV6_ADDR_UNREACH code to the source of the packet. > > But According to RFC 2463, If the kerenl has no forwarding entry of a > packet, > the kernel must send an ICMPV6_DEST_UNREACH icmp message with ICMPV6_NOROUTE > code. > How about you ? Am I right ? I think you are... --- linux/net/ipv6/route.c.030508 2003-03-24 23:01:14.000000000 +0100 +++ linux/net/ipv6/route.c 2003-05-09 13:29:31.000000000 +0200 @@ -1166,7 +1166,7 @@ int ip6_pkt_discard(struct sk_buff *skb) { IP6_INC_STATS(Ip6OutNoRoutes); - icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev); + icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); kfree_skb(skb); return 0; } Cheers. --ro From yoshfuji@linux-ipv6.org Fri May 9 04:44:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 04:44:18 -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.9) with SMTP id h49BhxFu010389 for ; Fri, 9 May 2003 04:44:00 -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 h49Bi4Bo030824; Fri, 9 May 2003 20:44:04 +0900 Date: Fri, 09 May 2003 20:44:03 +0900 (JST) Message-Id: <20030509.204403.72834600.yoshfuji@linux-ipv6.org> To: Robert.Olsson@data.slu.se Cc: seong@etri.re.kr, netdev@oss.sgi.com Subject: Re: IPv6 : ICMPV6_DEST_UNREACH type with ICMPV6_NOROUTE code From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <16059.37474.453731.39031@robur.slu.se> References: <003e01c313b8$e55db620$28acfe81@seong> <16059.37474.453731.39031@robur.slu.se> 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: 2490 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 <16059.37474.453731.39031@robur.slu.se> (at Fri, 9 May 2003 13:34:58 +0200), Robert Olsson says: > > the kernel must send an ICMPV6_DEST_UNREACH icmp message with ICMPV6_NOROUTE > > code. > > How about you ? Am I right ? > > I think you are... > > --- linux/net/ipv6/route.c.030508 2003-03-24 23:01:14.000000000 +0100 > +++ linux/net/ipv6/route.c 2003-05-09 13:29:31.000000000 +0200 > @@ -1166,7 +1166,7 @@ > int ip6_pkt_discard(struct sk_buff *skb) > { > IP6_INC_STATS(Ip6OutNoRoutes); > - icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev); > + icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); > kfree_skb(skb); > return 0; > } Yes, code is already in the tree. Thanks. --yoshfuji From davem@redhat.com Fri May 9 08:58:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 08:58:52 -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.9) with SMTP id h49FwLFu014648 for ; Fri, 9 May 2003 08:58:44 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id IAA29591; Fri, 9 May 2003 08:58:07 -0700 Date: Fri, 09 May 2003 08:58:07 -0700 (PDT) Message-Id: <20030509.085807.71115903.davem@redhat.com> To: Robert.Olsson@data.slu.se Cc: seong@etri.re.kr, netdev@oss.sgi.com Subject: Re: IPv6 : ICMPV6_DEST_UNREACH type with ICMPV6_NOROUTE code From: "David S. Miller" In-Reply-To: <16059.37474.453731.39031@robur.slu.se> References: <003e01c313b8$e55db620$28acfe81@seong> <16059.37474.453731.39031@robur.slu.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2491 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 From: Robert Olsson Date: Fri, 9 May 2003 13:34:58 +0200 Seong Moon writes: > How about you ? Am I right ? I think you are... Yoshfuji already composed a patch which is already in the tree. From davem@redhat.com Fri May 9 09:37:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 09:37: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.9) with SMTP id h49Gb1Fu015675 for ; Fri, 9 May 2003 09:37:01 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id JAA29711; Fri, 9 May 2003 09:36:48 -0700 Date: Fri, 09 May 2003 09:36:48 -0700 (PDT) Message-Id: <20030509.093648.59680645.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch x25_asy over to initcalls From: "David S. Miller" In-Reply-To: <20030509091219.A1499@lst.de> References: <20030509091219.A1499@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2492 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 From: Christoph Hellwig Date: Fri, 9 May 2003 09:12:19 +0200 I also had to fix the ldisc initialization because it was so ugly and the different ioctl + cast mess because I couldn't look at it. Applied, thanks Christoph. From shemminger@osdl.org Fri May 9 13:15:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 13:15:35 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h49KFRFu019222 for ; Fri, 9 May 2003 13:15: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 h49KFFW28963; Fri, 9 May 2003 13:15:15 -0700 Date: Fri, 9 May 2003 13:15:15 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69] Don't use destructor in bridge Message-Id: <20030509131515.6c3d34ca.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2493 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 changes the Ethernet bridge back to the original way without having a destructor function. This is done so the route cache side effect code doesn't hold onto a reference to the device. Fixing the device ref count/module/ destructor code is harder and should still be done, but this avoids the problem till then. diff -urNp -X dontdiff linux-2.5.69/net/bridge/br_device.c linux-2.5-bridge/net/bridge/br_device.c --- linux-2.5.69/net/bridge/br_device.c 2003-05-06 12:07:56.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_device.c 2003-05-08 15:59:11.000000000 -0700 @@ -110,11 +110,6 @@ static int br_dev_accept_fastpath(struct return -1; } -static void br_dev_destruct(struct net_device *dev) -{ - kfree(dev->priv); -} - void br_dev_setup(struct net_device *dev) { memset(dev->dev_addr, 0, ETH_ALEN); @@ -124,7 +119,6 @@ void br_dev_setup(struct net_device *dev dev->hard_start_xmit = br_dev_xmit; dev->open = br_dev_open; dev->set_multicast_list = br_dev_set_multicast_list; - dev->destructor = br_dev_destruct; dev->owner = THIS_MODULE; dev->stop = br_dev_stop; dev->accept_fastpath = br_dev_accept_fastpath; diff -urNp -X dontdiff linux-2.5.69/net/bridge/br_if.c linux-2.5-bridge/net/bridge/br_if.c --- linux-2.5.69/net/bridge/br_if.c 2003-05-06 12:07:56.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_if.c 2003-05-08 15:59:11.000000000 -0700 @@ -174,27 +174,22 @@ int br_del_bridge(const char *name) struct net_device *dev; int ret = 0; - dev = dev_get_by_name(name); + rtnl_lock(); + dev = __dev_get_by_name(name); if (dev == NULL) - return -ENXIO; /* Could not find device */ - - if (!(dev->priv_flags & IFF_EBRIDGE)) { - /* Attempt to delete non bridge device! */ - ret = -EPERM; - } - - else if (dev->flags & IFF_UP) { - /* Not shutdown yet. */ - ret = -EBUSY; - } - + ret = -ENXIO; /* Could not find device */ + else if (!(dev->priv_flags & IFF_EBRIDGE)) + ret = -EPERM; /* Attempt to delete non bridge device! */ + else if (dev->flags & IFF_UP) + ret = -EBUSY; /* Not shutdown yet. */ else { del_ifs((struct net_bridge *) dev->priv); - unregister_netdev(dev); - } + unregister_netdevice(dev); - dev_put(dev); + kfree(dev->priv); + } + rtnl_unlock(); return ret; } @@ -283,11 +278,10 @@ void __exit br_cleanup_bridges(void) nxt = dev->next; if ((dev->priv_flags & IFF_EBRIDGE) && dev->owner == THIS_MODULE) { - pr_debug("cleanup %s\n", dev->name); - del_ifs((struct net_bridge *) dev->priv); unregister_netdevice(dev); + kfree(dev->priv); } } rtnl_unlock(); From shemminger@osdl.org Fri May 9 13:20:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 13:20:32 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h49KKOFu019563 for ; Fri, 9 May 2003 13:20: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 h49KKCW30241; Fri, 9 May 2003 13:20:12 -0700 Date: Fri, 9 May 2003 13:20:12 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com, bridge@math.leidenuniv.nl Subject: [PATCH 2.5.69] Bridge timer performance enhancement Message-Id: <20030509132012.598602ec.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2494 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 Existing bridge code was waking up every jiffie then scanning internal structures for what internal timers had expired. This is a waste of CPU especially given the efficient kernel timer interface. With this patch, code should scale better to 1000's of forward table entries and many ports. - Change Ethernet bridge to use multiple kernel timers. - Prevent restarting timers during shutdown. - Keep ordered list of forward table entries, so oldest entries show up first; then only older entries need to be scanned. - Automatically adjust GC interval to the next entry to delete existing parameter is ignored. No visible changes to the API or other devices. diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_fdb.c linux-2.5-bridge/net/bridge/br_fdb.c --- linux-2.5-b1/net/bridge/br_fdb.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_fdb.c 2003-05-09 09:37:28.000000000 -0700 @@ -20,25 +20,19 @@ #include #include "br_private.h" -static __inline__ unsigned long __timeout(struct net_bridge *br) +/* if topology_changing then use forward_delay (default 15 sec) + * otherwise keep longer (default 5 minutes) + */ +static __inline__ unsigned long hold_time(const struct net_bridge *br) { - unsigned long timeout; - - timeout = jiffies - br->ageing_time; - if (br->topology_change) - timeout = jiffies - br->forward_delay; - - return timeout; + return br->topology_change ? br->forward_delay : br->ageing_time; } -static __inline__ int has_expired(struct net_bridge *br, - struct net_bridge_fdb_entry *fdb) +static __inline__ int has_expired(const struct net_bridge *br, + const struct net_bridge_fdb_entry *fdb) { - if (!fdb->is_static && - time_before_eq(fdb->ageing_timer, __timeout(br))) - return 1; - - return 0; + return !fdb->is_static + && time_before_eq(fdb->ageing_timer + hold_time(br), jiffies); } static __inline__ void copy_fdb(struct __fdb_entry *ent, @@ -52,7 +46,7 @@ static __inline__ void copy_fdb(struct _ : ((jiffies - f->ageing_timer) * USER_HZ) / HZ; } -static __inline__ int br_mac_hash(unsigned char *mac) +static __inline__ int br_mac_hash(const unsigned char *mac) { unsigned long x; @@ -68,7 +62,14 @@ static __inline__ int br_mac_hash(unsign return x & (BR_HASH_SIZE - 1); } -void br_fdb_changeaddr(struct net_bridge_port *p, unsigned char *newaddr) +static __inline__ void fdb_delete(struct net_bridge_fdb_entry *f) +{ + hlist_del(&f->hlist); + list_del(&f->age_list); + br_fdb_put(f); +} + +void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) { struct net_bridge *br; int i; @@ -98,25 +99,29 @@ void br_fdb_changeaddr(struct net_bridge write_unlock_bh(&br->hash_lock); } -void br_fdb_cleanup(struct net_bridge *br) +void br_fdb_cleanup(unsigned long _data) { - int i; - unsigned long timeout; - - timeout = __timeout(br); + struct net_bridge *br = (struct net_bridge *)_data; + struct list_head *l, *n; + unsigned long delay; write_lock_bh(&br->hash_lock); - for (i=0;ihash[i]) { - struct net_bridge_fdb_entry *f - = hlist_entry(h, struct net_bridge_fdb_entry, hlist); - if (!f->is_static && - time_before_eq(f->ageing_timer, timeout)) { - hlist_del(&f->hlist); - br_fdb_put(f); + delay = hold_time(br); + + list_for_each_safe(l, n, &br->age_list) { + struct net_bridge_fdb_entry *f + = list_entry(l, struct net_bridge_fdb_entry, age_list); + unsigned long expires = f->ageing_timer + delay; + + if (time_before_eq(expires, jiffies)) { + if (!f->is_static) { + pr_debug("expire age %lu jiffies %lu\n", + f->ageing_timer, jiffies); + fdb_delete(f); } + } else { + mod_timer(&br->gc_timer, expires); + break; } } write_unlock_bh(&br->hash_lock); @@ -134,8 +139,7 @@ void br_fdb_delete_by_port(struct net_br struct net_bridge_fdb_entry *f = hlist_entry(h, struct net_bridge_fdb_entry, hlist); if (f->dst == p) { - hlist_del(&f->hlist); - br_fdb_put(f); + fdb_delete(f); } } } @@ -237,55 +241,46 @@ int br_fdb_get_entries(struct net_bridge return num; } -static __inline__ void __fdb_possibly_replace(struct net_bridge_fdb_entry *fdb, - struct net_bridge_port *source, - int is_local) -{ - if (!fdb->is_static || is_local) { - fdb->dst = source; - fdb->is_local = is_local; - fdb->is_static = is_local; - fdb->ageing_timer = jiffies; - } -} - -void br_fdb_insert(struct net_bridge *br, - struct net_bridge_port *source, - unsigned char *addr, - int is_local) +void br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source, + const unsigned char *addr, int is_local) { struct hlist_node *h; struct net_bridge_fdb_entry *fdb; - int hash; - - hash = br_mac_hash(addr); + int hash = br_mac_hash(addr); write_lock_bh(&br->hash_lock); hlist_for_each(h, &br->hash[hash]) { fdb = hlist_entry(h, struct net_bridge_fdb_entry, hlist); if (!fdb->is_local && !memcmp(fdb->addr.addr, addr, ETH_ALEN)) { - __fdb_possibly_replace(fdb, source, is_local); - write_unlock_bh(&br->hash_lock); - return; + if (likely(!fdb->is_static || is_local)) { + /* move to end of age list */ + list_del(&fdb->age_list); + goto update; + } + goto out; } - } fdb = kmalloc(sizeof(*fdb), GFP_ATOMIC); - if (fdb == NULL) { - write_unlock_bh(&br->hash_lock); - return; - } + if (fdb == NULL) + goto out; memcpy(fdb->addr.addr, addr, ETH_ALEN); atomic_set(&fdb->use_count, 1); + hlist_add_head(&fdb->hlist, &br->hash[hash]); + + if (!timer_pending(&br->gc_timer)) { + br->gc_timer.expires = jiffies + hold_time(br); + add_timer(&br->gc_timer); + } + + update: fdb->dst = source; fdb->is_local = is_local; fdb->is_static = is_local; fdb->ageing_timer = jiffies; - - hlist_add_head(&fdb->hlist, &br->hash[hash]); - + list_add_tail(&fdb->age_list, &br->age_list); + out: write_unlock_bh(&br->hash_lock); } diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_if.c linux-2.5-bridge/net/bridge/br_if.c --- linux-2.5-b1/net/bridge/br_if.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_if.c 2003-05-09 09:37:28.000000000 -0700 @@ -84,8 +84,6 @@ static struct net_bridge *new_nb(const c memset(br, 0, sizeof(*br)); dev = &br->dev; - init_timer(&br->tick); - strncpy(dev->name, name, IFNAMSIZ); dev->priv = br; dev->priv_flags = IFF_EBRIDGE; @@ -109,12 +107,10 @@ static struct net_bridge *new_nb(const c br->bridge_forward_delay = br->forward_delay = 15 * HZ; br->topology_change = 0; br->topology_change_detected = 0; - br_timer_clear(&br->hello_timer); - br_timer_clear(&br->tcn_timer); - br_timer_clear(&br->topology_change_timer); - br->ageing_time = 300 * HZ; - br->gc_interval = 4 * HZ; + INIT_LIST_HEAD(&br->age_list); + + br_stp_timer_init(br); return br; } diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_ioctl.c linux-2.5-bridge/net/bridge/br_ioctl.c --- linux-2.5-b1/net/bridge/br_ioctl.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_ioctl.c 2003-05-09 09:37:28.000000000 -0700 @@ -32,9 +32,10 @@ static inline unsigned long ticks_to_use } /* Report time remaining in user HZ */ -static unsigned long timer_residue(const struct br_timer *timer) +static unsigned long timer_residue(const struct timer_list *timer) { - return ticks_to_user(timer->running ? (jiffies - timer->expires) : 0); + return ticks_to_user(timer_pending(timer) + ? (timer->expires - jiffies) : 0); } static int br_ioctl_device(struct net_bridge *br, @@ -87,7 +88,6 @@ static int br_ioctl_device(struct net_br b.root_port = br->root_port; b.stp_enabled = br->stp_enabled; b.ageing_time = ticks_to_user(br->ageing_time); - b.gc_interval = ticks_to_user(br->gc_interval); b.hello_timer_value = timer_residue(&br->hello_timer); b.tcn_timer_value = timer_residue(&br->tcn_timer); b.topology_change_timer_value = timer_residue(&br->topology_change_timer); @@ -146,8 +146,7 @@ static int br_ioctl_device(struct net_br br->ageing_time = user_to_ticks(arg0); return 0; - case BRCTL_SET_GC_INTERVAL: - br->gc_interval = user_to_ticks(arg0); + case BRCTL_SET_GC_INTERVAL: /* no longer used */ return 0; case BRCTL_GET_PORT_INFO: diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_private.h linux-2.5-bridge/net/bridge/br_private.h --- linux-2.5-b1/net/bridge/br_private.h 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_private.h 2003-05-09 09:37:28.000000000 -0700 @@ -18,7 +18,6 @@ #include #include #include -#include "br_private_timer.h" #define BR_HASH_BITS 8 #define BR_HASH_SIZE (1 << BR_HASH_BITS) @@ -44,10 +43,11 @@ struct mac_addr struct net_bridge_fdb_entry { struct hlist_node hlist; - atomic_t use_count; - mac_addr addr; struct net_bridge_port *dst; + struct list_head age_list; + atomic_t use_count; unsigned long ageing_timer; + mac_addr addr; unsigned is_local:1; unsigned is_static:1; }; @@ -71,10 +71,9 @@ struct net_bridge_port unsigned config_pending:1; int priority; - struct br_timer forward_delay_timer; - struct br_timer hold_timer; - struct br_timer message_age_timer; - + struct timer_list forward_delay_timer; + struct timer_list hold_timer; + struct timer_list message_age_timer; struct rcu_head rcu; }; @@ -86,7 +85,7 @@ struct net_bridge struct net_device_stats statistics; rwlock_t hash_lock; struct hlist_head hash[BR_HASH_SIZE]; - struct timer_list tick; + struct list_head age_list; /* STP */ bridge_id designated_root; @@ -103,13 +102,12 @@ struct net_bridge unsigned topology_change:1; unsigned topology_change_detected:1; - struct br_timer hello_timer; - struct br_timer tcn_timer; - struct br_timer topology_change_timer; - struct br_timer gc_timer; + struct timer_list hello_timer; + struct timer_list tcn_timer; + struct timer_list topology_change_timer; + struct timer_list gc_timer; int ageing_time; - int gc_interval; }; extern struct notifier_block br_device_notifier; @@ -128,8 +126,8 @@ extern int br_dev_xmit(struct sk_buff *s /* br_fdb.c */ extern void br_fdb_changeaddr(struct net_bridge_port *p, - unsigned char *newaddr); -extern void br_fdb_cleanup(struct net_bridge *br); + const unsigned char *newaddr); +extern void br_fdb_cleanup(unsigned long arg); extern void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p); extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, @@ -140,9 +138,9 @@ extern int br_fdb_get_entries(struct ne int maxnum, int offset); extern void br_fdb_insert(struct net_bridge *br, - struct net_bridge_port *source, - unsigned char *addr, - int is_local); + struct net_bridge_port *source, + const unsigned char *addr, + int is_local); /* br_forward.c */ extern void br_deliver(const struct net_bridge_port *to, @@ -188,10 +186,10 @@ extern int br_netfilter_init(void); extern void br_netfilter_fini(void); /* br_stp.c */ +extern void br_log_state(const struct net_bridge_port *p); extern struct net_bridge_port *br_get_port(struct net_bridge *br, int port_no); extern void br_init_port(struct net_bridge_port *p); -extern port_id br_make_port_id(struct net_bridge_port *p); extern void br_become_designated_port(struct net_bridge_port *p); /* br_stp_if.c */ @@ -210,4 +208,8 @@ extern void br_stp_set_path_cost(struct /* br_stp_bpdu.c */ extern void br_stp_handle_bpdu(struct sk_buff *skb); +/* br_stp_timer.c */ +extern void br_stp_timer_init(struct net_bridge *br); +extern void br_stp_port_timer_init(struct net_bridge_port *p); + #endif diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_private_stp.h linux-2.5-bridge/net/bridge/br_private_stp.h --- linux-2.5-b1/net/bridge/br_private_stp.h 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_private_stp.h 2003-05-07 15:11:52.000000000 -0700 @@ -47,7 +47,6 @@ extern void br_configuration_update(stru extern void br_port_state_selection(struct net_bridge *); extern void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu); extern void br_received_tcn_bpdu(struct net_bridge_port *p); -extern void br_tick(unsigned long __data); extern void br_transmit_config(struct net_bridge_port *p); extern void br_transmit_tcn(struct net_bridge *br); extern void br_topology_change_detection(struct net_bridge *br); diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_private_timer.h linux-2.5-bridge/net/bridge/br_private_timer.h --- linux-2.5-b1/net/bridge/br_private_timer.h 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_private_timer.h 1969-12-31 16:00:00.000000000 -0800 @@ -1,54 +0,0 @@ -/* - * Linux ethernet bridge - * - * Authors: - * Lennert Buytenhek - * - * $Id: br_private_timer.h,v 1.1 2000/02/18 16:47:13 davem Exp $ - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef _BR_PRIVATE_TIMER_H -#define _BR_PRIVATE_TIMER_H - -struct br_timer -{ - int running; - unsigned long expires; -}; - -extern __inline__ void br_timer_clear(struct br_timer *t) -{ - t->running = 0; -} - -extern __inline__ unsigned long br_timer_get_residue(struct br_timer *t) -{ - if (t->running) - return jiffies - t->expires; - - return 0; -} - -extern __inline__ void br_timer_set(struct br_timer *t, unsigned long x) -{ - t->expires = x; - t->running = 1; -} - -extern __inline__ int br_timer_is_running(struct br_timer *t) -{ - return t->running; -} - -extern __inline__ int br_timer_has_expired(struct br_timer *t, unsigned long to) -{ - return t->running && time_after_eq(jiffies, t->expires + to); -} - - -#endif diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_stp.c linux-2.5-bridge/net/bridge/br_stp.c --- linux-2.5-b1/net/bridge/br_stp.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_stp.c 2003-05-09 09:26:05.000000000 -0700 @@ -12,7 +12,6 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ - #include #include #include @@ -20,6 +19,18 @@ #include "br_private.h" #include "br_private_stp.h" +static const char *br_port_state_names[] = { + "disabled", "learning", "forwarding", "blocking", +}; + +void br_log_state(const struct net_bridge_port *p) +{ + pr_info("%s: port %d(%s) entering %s state\n", + p->br->dev.name, p->port_no, p->dev->name, + br_port_state_names[p->state]); + +} + /* called under bridge lock */ struct net_bridge_port *br_get_port(struct net_bridge *br, int port_no) { @@ -34,7 +45,8 @@ struct net_bridge_port *br_get_port(stru } /* called under bridge lock */ -static int br_should_become_root_port(struct net_bridge_port *p, int root_port) +static int br_should_become_root_port(const struct net_bridge_port *p, + int root_port) { struct net_bridge *br; struct net_bridge_port *rp; @@ -116,9 +128,12 @@ void br_become_root_bridge(struct net_br br->hello_time = br->bridge_hello_time; br->forward_delay = br->bridge_forward_delay; br_topology_change_detection(br); - br_timer_clear(&br->tcn_timer); - br_config_bpdu_generation(br); - br_timer_set(&br->hello_timer, jiffies); + del_timer(&br->tcn_timer); + + if (br->dev.flags & IFF_UP) { + br_config_bpdu_generation(br); + mod_timer(&br->hello_timer, jiffies + br->hello_time); + } } /* called under bridge lock */ @@ -127,7 +142,8 @@ void br_transmit_config(struct net_bridg struct br_config_bpdu bpdu; struct net_bridge *br; - if (br_timer_is_running(&p->hold_timer)) { + + if (timer_pending(&p->hold_timer)) { p->config_pending = 1; return; } @@ -142,12 +158,11 @@ void br_transmit_config(struct net_bridg bpdu.port_id = p->port_id; bpdu.message_age = 0; if (!br_is_root_bridge(br)) { - struct net_bridge_port *root; - unsigned long age; + struct net_bridge_port *root + = br_get_port(br, br->root_port); + bpdu.max_age = root->message_age_timer.expires - jiffies; - root = br_get_port(br, br->root_port); - age = br_timer_get_residue(&root->message_age_timer) + 1; - bpdu.message_age = age; + if (bpdu.max_age <= 0) bpdu.max_age = 1; } bpdu.max_age = br->max_age; bpdu.hello_time = br->hello_time; @@ -157,22 +172,26 @@ void br_transmit_config(struct net_bridg p->topology_change_ack = 0; p->config_pending = 0; - br_timer_set(&p->hold_timer, jiffies); + + mod_timer(&p->hold_timer, jiffies + BR_HOLD_TIME); } /* called under bridge lock */ -static void br_record_config_information(struct net_bridge_port *p, struct br_config_bpdu *bpdu) +static inline void br_record_config_information(struct net_bridge_port *p, + const struct br_config_bpdu *bpdu) { p->designated_root = bpdu->root; p->designated_cost = bpdu->root_path_cost; p->designated_bridge = bpdu->bridge_id; p->designated_port = bpdu->port_id; - br_timer_set(&p->message_age_timer, jiffies - bpdu->message_age); + mod_timer(&p->message_age_timer, jiffies + + (p->br->max_age - bpdu->message_age)); } /* called under bridge lock */ -static void br_record_config_timeout_values(struct net_bridge *br, struct br_config_bpdu *bpdu) +static inline void br_record_config_timeout_values(struct net_bridge *br, + const struct br_config_bpdu *bpdu) { br->max_age = bpdu->max_age; br->hello_time = bpdu->hello_time; @@ -187,7 +206,7 @@ void br_transmit_tcn(struct net_bridge * } /* called under bridge lock */ -static int br_should_become_designated_port(struct net_bridge_port *p) +static int br_should_become_designated_port(const struct net_bridge_port *p) { struct net_bridge *br; int t; @@ -261,25 +280,28 @@ static int br_supersedes_port_info(struc } /* called under bridge lock */ -static void br_topology_change_acknowledged(struct net_bridge *br) +static inline void br_topology_change_acknowledged(struct net_bridge *br) { br->topology_change_detected = 0; - br_timer_clear(&br->tcn_timer); + del_timer(&br->tcn_timer); } /* called under bridge lock */ void br_topology_change_detection(struct net_bridge *br) { - printk(KERN_INFO "%s: topology change detected", br->dev.name); + if (!(br->dev.flags & IFF_UP)) + return; + pr_info("%s: topology change detected", br->dev.name); if (br_is_root_bridge(br)) { printk(", propagating"); br->topology_change = 1; - br_timer_set(&br->topology_change_timer, jiffies); + mod_timer(&br->topology_change_timer, jiffies + + br->bridge_forward_delay + br->bridge_max_age); } else if (!br->topology_change_detected) { printk(", sending tcn bpdu"); br_transmit_tcn(br); - br_timer_set(&br->tcn_timer, jiffies); + mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time); } printk("\n"); @@ -299,7 +321,7 @@ void br_config_bpdu_generation(struct ne } /* called under bridge lock */ -static void br_reply(struct net_bridge_port *p) +static inline void br_reply(struct net_bridge_port *p) { br_transmit_config(p); } @@ -323,6 +345,7 @@ void br_become_designated_port(struct ne p->designated_port = p->port_id; } + /* called under bridge lock */ static void br_make_blocking(struct net_bridge_port *p) { @@ -332,11 +355,9 @@ static void br_make_blocking(struct net_ p->state == BR_STATE_LEARNING) br_topology_change_detection(p->br); - printk(KERN_INFO "%s: port %i(%s) entering %s state\n", - p->br->dev.name, p->port_no, p->dev->name, "blocking"); - p->state = BR_STATE_BLOCKING; - br_timer_clear(&p->forward_delay_timer); + br_log_state(p); + del_timer(&p->forward_delay_timer); } } @@ -345,20 +366,12 @@ static void br_make_forwarding(struct ne { if (p->state == BR_STATE_BLOCKING) { if (p->br->stp_enabled) { - printk(KERN_INFO "%s: port %i(%s) entering %s state\n", - p->br->dev.name, p->port_no, p->dev->name, - "listening"); - p->state = BR_STATE_LISTENING; } else { - printk(KERN_INFO "%s: port %i(%s) entering %s state\n", - p->br->dev.name, p->port_no, p->dev->name, - "learning"); - p->state = BR_STATE_LEARNING; } - br_timer_set(&p->forward_delay_timer, jiffies); - } + br_log_state(p); + mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay); } } /* called under bridge lock */ @@ -373,7 +386,7 @@ void br_port_state_selection(struct net_ p->topology_change_ack = 0; br_make_forwarding(p); } else if (br_is_designated_port(p)) { - br_timer_clear(&p->message_age_timer); + del_timer(&p->message_age_timer); br_make_forwarding(p); } else { p->config_pending = 0; @@ -381,11 +394,12 @@ void br_port_state_selection(struct net_ br_make_blocking(p); } } + } } /* called under bridge lock */ -static void br_topology_change_acknowledge(struct net_bridge_port *p) +static inline void br_topology_change_acknowledge(struct net_bridge_port *p) { p->topology_change_ack = 1; br_transmit_config(p); @@ -396,20 +410,23 @@ void br_received_config_bpdu(struct net_ { struct net_bridge *br; int was_root; - + br = p->br; was_root = br_is_root_bridge(br); + if (br_supersedes_port_info(p, bpdu)) { br_record_config_information(p, bpdu); br_configuration_update(br); br_port_state_selection(br); if (!br_is_root_bridge(br) && was_root) { - br_timer_clear(&br->hello_timer); + del_timer(&br->hello_timer); if (br->topology_change_detected) { - br_timer_clear(&br->topology_change_timer); + del_timer(&br->topology_change_timer); br_transmit_tcn(br); - br_timer_set(&br->tcn_timer, jiffies); + + mod_timer(&br->tcn_timer, + jiffies + br->bridge_hello_time); } } @@ -428,7 +445,7 @@ void br_received_config_bpdu(struct net_ void br_received_tcn_bpdu(struct net_bridge_port *p) { if (br_is_designated_port(p)) { - printk(KERN_INFO "%s: received tcn bpdu on port %i(%s)\n", + pr_info("%s: received tcn bpdu on port %i(%s)\n", p->br->dev.name, p->port_no, p->dev->name); br_topology_change_detection(p->br); diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_stp_if.c linux-2.5-bridge/net/bridge/br_stp_if.c --- linux-2.5-b1/net/bridge/br_stp_if.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_stp_if.c 2003-05-09 09:37:28.000000000 -0700 @@ -20,7 +20,7 @@ #include "br_private.h" #include "br_private_stp.h" -__u16 br_make_port_id(struct net_bridge_port *p) +static inline __u16 br_make_port_id(const struct net_bridge_port *p) { return (p->priority << 8) | p->port_no; } @@ -33,33 +33,25 @@ void br_init_port(struct net_bridge_port p->state = BR_STATE_BLOCKING; p->topology_change_ack = 0; p->config_pending = 0; - br_timer_clear(&p->message_age_timer); - br_timer_clear(&p->forward_delay_timer); - br_timer_clear(&p->hold_timer); + + br_stp_port_timer_init(p); } /* called under bridge lock */ void br_stp_enable_bridge(struct net_bridge *br) { struct net_bridge_port *p; - struct timer_list *timer = &br->tick; spin_lock_bh(&br->lock); - init_timer(timer); - timer->data = (unsigned long) br; - timer->function = br_tick; - timer->expires = jiffies + 1; - add_timer(timer); - - br_timer_set(&br->hello_timer, jiffies); + br->hello_timer.expires = jiffies + br->hello_time; + add_timer(&br->hello_timer); br_config_bpdu_generation(br); list_for_each_entry(p, &br->port_list, list) { if (p->dev->flags & IFF_UP) br_stp_enable_port(p); - } - br_timer_set(&br->gc_timer, jiffies); + } spin_unlock_bh(&br->lock); } @@ -68,22 +60,22 @@ void br_stp_disable_bridge(struct net_br { struct net_bridge_port *p; - spin_lock_bh(&br->lock); - br->topology_change = 0; - br->topology_change_detected = 0; - br_timer_clear(&br->hello_timer); - br_timer_clear(&br->topology_change_timer); - br_timer_clear(&br->tcn_timer); - br_timer_clear(&br->gc_timer); - br_fdb_cleanup(br); - + spin_lock(&br->lock); list_for_each_entry(p, &br->port_list, list) { if (p->state != BR_STATE_DISABLED) br_stp_disable_port(p); + } - spin_unlock_bh(&br->lock); - del_timer_sync(&br->tick); + br->topology_change = 0; + br->topology_change_detected = 0; + spin_unlock(&br->lock); + + del_timer_sync(&br->hello_timer); + del_timer_sync(&br->topology_change_timer); + del_timer_sync(&br->tcn_timer); + del_timer_sync(&br->gc_timer); + } /* called under bridge lock */ @@ -108,10 +100,13 @@ void br_stp_disable_port(struct net_brid p->state = BR_STATE_DISABLED; p->topology_change_ack = 0; p->config_pending = 0; - br_timer_clear(&p->message_age_timer); - br_timer_clear(&p->forward_delay_timer); - br_timer_clear(&p->hold_timer); + + del_timer(&p->message_age_timer); + del_timer(&p->forward_delay_timer); + del_timer(&p->hold_timer); + br_configuration_update(br); + br_port_state_selection(br); if (br_is_root_bridge(br) && !wasroot) diff -urNp -X dontdiff linux-2.5-b1/net/bridge/br_stp_timer.c linux-2.5-bridge/net/bridge/br_stp_timer.c --- linux-2.5-b1/net/bridge/br_stp_timer.c 2003-05-09 11:58:20.000000000 -0700 +++ linux-2.5-bridge/net/bridge/br_stp_timer.c 2003-05-09 09:37:28.000000000 -0700 @@ -20,51 +20,59 @@ #include "br_private.h" #include "br_private_stp.h" -static void dump_bridge_id(bridge_id *id) -{ - printk("%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", id->prio[0], - id->prio[1], id->addr[0], id->addr[1], id->addr[2], id->addr[3], - id->addr[4], id->addr[5]); -} - /* called under bridge lock */ -static int br_is_designated_for_some_port(struct net_bridge *br) +static int br_is_designated_for_some_port(const struct net_bridge *br) { struct net_bridge_port *p; list_for_each_entry(p, &br->port_list, list) { if (p->state != BR_STATE_DISABLED && - !memcmp(&p->designated_bridge, &br->bridge_id, 8)) + !memcmp(&p->designated_bridge, &br->bridge_id, 8)) return 1; } return 0; } -/* called under bridge lock */ -static void br_hello_timer_expired(struct net_bridge *br) +static void br_hello_timer_expired(unsigned long arg) { - br_config_bpdu_generation(br); - br_timer_set(&br->hello_timer, jiffies); + struct net_bridge *br = (struct net_bridge *)arg; + + pr_debug("%s: hello timer expired\n", br->dev.name); + spin_lock_bh(&br->lock); + if (br->dev.flags & IFF_UP) { + br_config_bpdu_generation(br); + + br->hello_timer.expires = jiffies + br->hello_time; + add_timer(&br->hello_timer); + } + spin_unlock_bh(&br->lock); } -/* called under bridge lock */ -static void br_message_age_timer_expired(struct net_bridge_port *p) +static void br_message_age_timer_expired(unsigned long arg) { - struct net_bridge *br; + struct net_bridge_port *p = (struct net_bridge_port *) arg; + struct net_bridge *br = p->br; + const bridge_id *id = &p->designated_bridge; int was_root; - br = p->br; - printk(KERN_INFO "%s: ", br->dev.name); - printk("neighbour "); - dump_bridge_id(&p->designated_bridge); - printk(" lost on port %i(%s)\n", p->port_no, p->dev->name); + if (p->state == BR_STATE_DISABLED) + return; + + + pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n", + br->dev.name, + id->prio[0], id->prio[1], + id->addr[0], id->addr[1], id->addr[2], + id->addr[3], id->addr[4], id->addr[5], + p->port_no, p->dev->name); /* * According to the spec, the message age timer cannot be * running when we are the root bridge. So.. this was_root * check is redundant. I'm leaving it in for now, though. */ + spin_lock_bh(&br->lock); was_root = br_is_root_bridge(br); br_become_designated_port(p); @@ -72,107 +80,101 @@ static void br_message_age_timer_expired br_port_state_selection(br); if (br_is_root_bridge(br) && !was_root) br_become_root_bridge(br); + spin_unlock_bh(&br->lock); } -/* called under bridge lock */ -static void br_forward_delay_timer_expired(struct net_bridge_port *p) +static void br_forward_delay_timer_expired(unsigned long arg) { - if (p->state == BR_STATE_LISTENING) { - printk(KERN_INFO "%s: port %i(%s) entering %s state\n", - p->br->dev.name, p->port_no, p->dev->name, "learning"); + struct net_bridge_port *p = (struct net_bridge_port *) arg; + struct net_bridge *br = p->br; + pr_debug("%s: %d(%s) forward delay timer\n", + br->dev.name, p->port_no, p->dev->name); + spin_lock_bh(&br->lock); + if (p->state == BR_STATE_LISTENING) { p->state = BR_STATE_LEARNING; - br_timer_set(&p->forward_delay_timer, jiffies); + p->forward_delay_timer.expires = jiffies + br->forward_delay; + add_timer(&p->forward_delay_timer); } else if (p->state == BR_STATE_LEARNING) { - printk(KERN_INFO "%s: port %i(%s) entering %s state\n", - p->br->dev.name, p->port_no, p->dev->name, "forwarding"); - p->state = BR_STATE_FORWARDING; - if (br_is_designated_for_some_port(p->br)) - br_topology_change_detection(p->br); + if (br_is_designated_for_some_port(br)) + br_topology_change_detection(br); } + br_log_state(p); + spin_unlock_bh(&br->lock); } -/* called under bridge lock */ -static void br_tcn_timer_expired(struct net_bridge *br) +static void br_tcn_timer_expired(unsigned long arg) { - printk(KERN_INFO "%s: retransmitting tcn bpdu\n", br->dev.name); - br_transmit_tcn(br); - br_timer_set(&br->tcn_timer, jiffies); + struct net_bridge *br = (struct net_bridge *) arg; + + pr_debug("%s: tcn timer expired\n", br->dev.name); + spin_lock_bh(&br->lock); + if (br->dev.flags & IFF_UP) { + br_transmit_tcn(br); + + br->tcn_timer.expires = jiffies + br->bridge_hello_time; + add_timer(&br->tcn_timer); + } + spin_unlock_bh(&br->lock); } -/* called under bridge lock */ -static void br_topology_change_timer_expired(struct net_bridge *br) +static void br_topology_change_timer_expired(unsigned long arg) { + struct net_bridge *br = (struct net_bridge *) arg; + + pr_debug("%s: topo change timer expired\n", br->dev.name); + spin_lock_bh(&br->lock); br->topology_change_detected = 0; br->topology_change = 0; + spin_unlock_bh(&br->lock); } -/* called under bridge lock */ -static void br_hold_timer_expired(struct net_bridge_port *p) +static void br_hold_timer_expired(unsigned long arg) { + struct net_bridge_port *p = (struct net_bridge_port *) arg; + + pr_debug("%s: %d(%s) hold timer expired\n", + p->br->dev.name, p->port_no, p->dev->name); + + spin_lock_bh(&p->br->lock); if (p->config_pending) br_transmit_config(p); + spin_unlock_bh(&p->br->lock); } -/* called under bridge lock */ -static void br_check_port_timers(struct net_bridge_port *p) +static inline void br_timer_init(struct timer_list *timer, + void (*_function)(unsigned long), + unsigned long _data) { - if (br_timer_has_expired(&p->message_age_timer, p->br->max_age)) { - br_timer_clear(&p->message_age_timer); - br_message_age_timer_expired(p); - } - - if (br_timer_has_expired(&p->forward_delay_timer, p->br->forward_delay)) { - br_timer_clear(&p->forward_delay_timer); - br_forward_delay_timer_expired(p); - } - - if (br_timer_has_expired(&p->hold_timer, BR_HOLD_TIME)) { - br_timer_clear(&p->hold_timer); - br_hold_timer_expired(p); - } + init_timer(timer); + timer->function = _function; + timer->data = _data; } -/* called under bridge lock */ -static void br_check_timers(struct net_bridge *br) +void br_stp_timer_init(struct net_bridge *br) { - struct net_bridge_port *p; + br_timer_init(&br->hello_timer, br_hello_timer_expired, + (unsigned long) br); - if (br_timer_has_expired(&br->gc_timer, br->gc_interval)) { - br_timer_set(&br->gc_timer, jiffies); - br_fdb_cleanup(br); - } + br_timer_init(&br->tcn_timer, br_tcn_timer_expired, + (unsigned long) br); - if (br_timer_has_expired(&br->hello_timer, br->hello_time)) { - br_timer_clear(&br->hello_timer); - br_hello_timer_expired(br); - } - - if (br_timer_has_expired(&br->tcn_timer, br->bridge_hello_time)) { - br_timer_clear(&br->tcn_timer); - br_tcn_timer_expired(br); - } - - if (br_timer_has_expired(&br->topology_change_timer, br->bridge_forward_delay + br->bridge_max_age)) { - br_timer_clear(&br->topology_change_timer); - br_topology_change_timer_expired(br); - } + br_timer_init(&br->topology_change_timer, + br_topology_change_timer_expired, + (unsigned long) br); - list_for_each_entry(p, &br->port_list, list) { - if (p->state != BR_STATE_DISABLED) - br_check_port_timers(p); - } + br_timer_init(&br->gc_timer, br_fdb_cleanup, (unsigned long) br); } -void br_tick(unsigned long __data) +void br_stp_port_timer_init(struct net_bridge_port *p) { - struct net_bridge *br = (struct net_bridge *)__data; + br_timer_init(&p->message_age_timer, br_message_age_timer_expired, + (unsigned long) p); - if (spin_trylock_bh(&br->lock)) { - br_check_timers(br); - spin_unlock_bh(&br->lock); - } - br->tick.expires = jiffies + 1; - add_timer(&br->tick); -} + br_timer_init(&p->forward_delay_timer, br_forward_delay_timer_expired, + (unsigned long) p); + + br_timer_init(&p->hold_timer, br_hold_timer_expired, + (unsigned long) p); +} From shemminger@osdl.org Fri May 9 14:25:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 14:25:56 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h49LPnFu021142 for ; Fri, 9 May 2003 14:25:50 -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 h49LPcW12035; Fri, 9 May 2003 14:25:38 -0700 Date: Fri, 9 May 2003 14:25:38 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69] Network packet type using RCU Message-Id: <20030509142538.548cbd71.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2495 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 network packet type list from using brlock to RCU based list. Some collataral changes to af_packet were necessary since it needs to unregister packet types without sleeping. Summary: * packet type converted from linked list to list_macro * writer lock replaced with spin lock, readers use RCU * add __dev_remove_pack for callers that can't sleep. * af_packet changes to handle and sleeping requirements, and possible races that could cause. Tested on 8-way SMP running 2.5.69 latest. Dave, please wait till Monday to apply this in case there are any comments. diff -urNp -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-nbr/include/linux/netdevice.h --- linux-2.5/include/linux/netdevice.h 2003-04-14 13:32:21.000000000 -0700 +++ linux-2.5-nbr/include/linux/netdevice.h 2003-05-02 15:07:06.000000000 -0700 @@ -456,7 +456,7 @@ struct packet_type int (*func) (struct sk_buff *, struct net_device *, struct packet_type *); void *data; /* Private to the packet type */ - struct packet_type *next; + struct list_head list; }; @@ -472,6 +472,7 @@ extern int netdev_boot_setup_check(st extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); +extern void __dev_remove_pack(struct packet_type *pt); extern int dev_get(const char *name); extern struct net_device *dev_get_by_flags(unsigned short flags, unsigned short mask); diff -urNp -X dontdiff linux-2.5/net/core/dev.c linux-2.5-nbr/net/core/dev.c --- linux-2.5/net/core/dev.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-nbr/net/core/dev.c 2003-05-05 09:44:36.000000000 -0700 @@ -90,7 +90,6 @@ #include #include #include -#include #include #include #include @@ -170,8 +169,9 @@ const char *if_port_text[] = { * 86DD IPv6 */ -static struct packet_type *ptype_base[16]; /* 16 way hashed list */ -static struct packet_type *ptype_all; /* Taps */ +static spinlock_t ptype_lock = SPIN_LOCK_UNLOCKED; +static struct list_head ptype_base[16]; /* 16 way hashed list */ +static struct list_head ptype_all; /* Taps */ #ifdef OFFLINE_SAMPLE static void sample_queue(unsigned long dummy); @@ -239,14 +239,17 @@ int netdev_nit; * Add a protocol handler to the networking stack. The passed &packet_type * is linked into kernel lists and may not be freed until it has been * removed from the kernel lists. + * + * This call does not sleep therefore it can not + * guarantee all CPU's that are in middle of receiving packets + * will see the new packet type (until the next received packet). */ void dev_add_pack(struct packet_type *pt) { int hash; - br_write_lock_bh(BR_NETPROTO_LOCK); - + spin_lock_bh(&ptype_lock); #ifdef CONFIG_NET_FASTROUTE /* Hack to detect packet socket */ if (pt->data && (long)(pt->data) != 1) { @@ -256,52 +259,76 @@ void dev_add_pack(struct packet_type *pt #endif if (pt->type == htons(ETH_P_ALL)) { netdev_nit++; - pt->next = ptype_all; - ptype_all = pt; + list_add_rcu(&pt->list, &ptype_all); } else { hash = ntohs(pt->type) & 15; - pt->next = ptype_base[hash]; - ptype_base[hash] = pt; + list_add_rcu(&pt->list, &ptype_base[hash]); } - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&ptype_lock); } extern void linkwatch_run_queue(void); + + /** - * dev_remove_pack - remove packet handler + * __dev_remove_pack - remove packet handler * @pt: packet type declaration * * Remove a protocol handler that was previously added to the kernel * protocol handlers by dev_add_pack(). The passed &packet_type is removed * from the kernel lists and can be freed or reused once this function - * returns. + * returns. + * + * The packet type might still be in use by receivers + * and must not be freed until after all the CPU's have gone + * through a quiescent state. */ -void dev_remove_pack(struct packet_type *pt) +void __dev_remove_pack(struct packet_type *pt) { - struct packet_type **pt1; + struct list_head *head; + struct packet_type *pt1; - br_write_lock_bh(BR_NETPROTO_LOCK); + spin_lock_bh(&ptype_lock); if (pt->type == htons(ETH_P_ALL)) { netdev_nit--; - pt1 = &ptype_all; + head = &ptype_all; } else - pt1 = &ptype_base[ntohs(pt->type) & 15]; + head = &ptype_base[ntohs(pt->type) & 15]; - for (; *pt1; pt1 = &((*pt1)->next)) { - if (pt == *pt1) { - *pt1 = pt->next; + list_for_each_entry(pt1, head, list) { + if (pt == pt1) { #ifdef CONFIG_NET_FASTROUTE if (pt->data) netdev_fastroute_obstacles--; #endif + list_del_rcu(&pt->list); goto out; } } + printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt); out: - br_write_unlock_bh(BR_NETPROTO_LOCK); + spin_unlock_bh(&ptype_lock); +} +/** + * dev_remove_pack - remove packet handler + * @pt: packet type declaration + * + * Remove a protocol handler that was previously added to the kernel + * protocol handlers by dev_add_pack(). The passed &packet_type is removed + * from the kernel lists and can be freed or reused once this function + * returns. + * + * This call sleeps to guarantee that no CPU is looking at the packet + * type after return. + */ +void dev_remove_pack(struct packet_type *pt) +{ + __dev_remove_pack(pt); + + synchronize_net(); } /****************************************************************************** @@ -943,8 +970,8 @@ void dev_queue_xmit_nit(struct sk_buff * struct packet_type *ptype; do_gettimeofday(&skb->stamp); - br_read_lock(BR_NETPROTO_LOCK); - for (ptype = ptype_all; ptype; ptype = ptype->next) { + rcu_read_lock(); + list_for_each_entry_rcu(ptype, &ptype_all, list) { /* Never send packets back to the socket * they originated from - MvS (miquels@drinkel.ow.org) */ @@ -974,7 +1001,7 @@ void dev_queue_xmit_nit(struct sk_buff * ptype->func(skb2, skb->dev, ptype); } } - br_read_unlock(BR_NETPROTO_LOCK); + rcu_read_unlock(); } /* Calculate csum in the case, when packet is misrouted. @@ -1488,7 +1515,8 @@ int netif_receive_skb(struct sk_buff *sk skb->h.raw = skb->nh.raw = skb->data; pt_prev = NULL; - for (ptype = ptype_all; ptype; ptype = ptype->next) { + rcu_read_lock(); + list_for_each_entry_rcu(ptype, &ptype_all, list) { if (!ptype->dev || ptype->dev == skb->dev) { if (pt_prev) { if (!pt_prev->data) { @@ -1511,17 +1539,15 @@ int netif_receive_skb(struct sk_buff *sk #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) if (skb->dev->br_port) { - int ret; - ret = handle_bridge(skb, pt_prev); if (br_handle_frame_hook(skb) == 0) - return ret; + goto out; pt_prev = NULL; } #endif - for (ptype = ptype_base[ntohs(type) & 15]; ptype; ptype = ptype->next) { + list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { if (ptype->type == type && (!ptype->dev || ptype->dev == skb->dev)) { if (pt_prev) { @@ -1552,6 +1578,8 @@ int netif_receive_skb(struct sk_buff *sk ret = NET_RX_DROP; } + out: + rcu_read_unlock(); return ret; } @@ -1625,7 +1653,8 @@ static void net_rx_action(struct softirq unsigned long start_time = jiffies; int budget = netdev_max_backlog; - br_read_lock(BR_NETPROTO_LOCK); + + preempt_disable(); local_irq_disable(); while (!list_empty(&queue->poll_list)) { @@ -1654,7 +1683,7 @@ static void net_rx_action(struct softirq } out: local_irq_enable(); - br_read_unlock(BR_NETPROTO_LOCK); + preempt_enable(); return; softnet_break: @@ -1995,9 +2024,9 @@ int netdev_set_master(struct net_device dev_hold(master); } - br_write_lock_bh(BR_NETPROTO_LOCK); slave->master = master; - br_write_unlock_bh(BR_NETPROTO_LOCK); + + synchronize_net(); if (old) dev_put(old); @@ -2661,8 +2690,8 @@ int netdev_finish_unregister(struct net_ /* Synchronize with packet receive processing. */ void synchronize_net(void) { - br_write_lock_bh(BR_NETPROTO_LOCK); - br_write_unlock_bh(BR_NETPROTO_LOCK); + might_sleep(); + synchronize_kernel(); } /** @@ -2846,6 +2875,10 @@ static int __init net_dev_init(void) subsystem_register(&net_subsys); + INIT_LIST_HEAD(&ptype_all); + for (i = 0; i < 16; i++) + INIT_LIST_HEAD(&ptype_base[i]); + #ifdef CONFIG_NET_DIVERT dv_init(); #endif /* CONFIG_NET_DIVERT */ diff -urNp -X dontdiff linux-2.5/net/netsyms.c linux-2.5-nbr/net/netsyms.c --- linux-2.5/net/netsyms.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-nbr/net/netsyms.c 2003-05-05 09:44:36.000000000 -0700 @@ -577,6 +577,7 @@ EXPORT_SYMBOL(netif_rx); EXPORT_SYMBOL(netif_receive_skb); EXPORT_SYMBOL(dev_add_pack); EXPORT_SYMBOL(dev_remove_pack); +EXPORT_SYMBOL(__dev_remove_pack); EXPORT_SYMBOL(dev_get); EXPORT_SYMBOL(dev_alloc); EXPORT_SYMBOL(dev_alloc_name); diff -urNp -X dontdiff linux-2.5/net/packet/af_packet.c linux-2.5-nbr/net/packet/af_packet.c --- linux-2.5/net/packet/af_packet.c 2003-05-05 09:41:03.000000000 -0700 +++ linux-2.5-nbr/net/packet/af_packet.c 2003-05-05 11:14:52.000000000 -0700 @@ -774,6 +774,7 @@ static int packet_release(struct socket */ dev_remove_pack(&po->prot_hook); po->running = 0; + po->num = 0; __sock_put(sk); } @@ -819,9 +820,12 @@ static int packet_do_bind(struct sock *s spin_lock(&po->bind_lock); if (po->running) { - dev_remove_pack(&po->prot_hook); __sock_put(sk); po->running = 0; + po->num = 0; + spin_unlock(&po->bind_lock); + dev_remove_pack(&po->prot_hook); + spin_lock(&po->bind_lock); } po->num = protocol; @@ -1374,7 +1378,7 @@ static int packet_notifier(struct notifi if (dev->ifindex == po->ifindex) { spin_lock(&po->bind_lock); if (po->running) { - dev_remove_pack(&po->prot_hook); + __dev_remove_pack(&po->prot_hook); __sock_put(sk); po->running = 0; sk->err = ENETDOWN; @@ -1618,9 +1622,14 @@ static int packet_set_ring(struct sock * /* Detach socket from network */ spin_lock(&po->bind_lock); - if (po->running) - dev_remove_pack(&po->prot_hook); + if (po->running) { + __dev_remove_pack(&po->prot_hook); + po->num = 0; + po->running = 0; + } spin_unlock(&po->bind_lock); + + synchronize_net(); err = -EBUSY; if (closing || atomic_read(&po->mapped) == 0) { From davem@redhat.com Fri May 9 21:35:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 21:36:02 -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.9) with SMTP id h4A4ZxFu027073 for ; Fri, 9 May 2003 21:35:59 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id VAA30860; Fri, 9 May 2003 21:35:43 -0700 Date: Fri, 09 May 2003 21:35:43 -0700 (PDT) Message-Id: <20030509.213543.70190877.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com, bridge@math.leidenuniv.nl Subject: Re: [PATCH 2.5.69] Bridge timer performance enhancement From: "David S. Miller" In-Reply-To: <20030509132012.598602ec.shemminger@osdl.org> References: <20030509132012.598602ec.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2497 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 From: Stephen Hemminger Date: Fri, 9 May 2003 13:20:12 -0700 Existing bridge code was waking up every jiffie then scanning internal structures for what internal timers had expired. You're going to have to redo the rest of these bridging patches since I'm not going to apply the one which kills off destructor usage. From davem@redhat.com Fri May 9 21:35:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 09 May 2003 21:35: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.9) with SMTP id h4A4ZAFu027000 for ; Fri, 9 May 2003 21:35:11 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id VAA30853; Fri, 9 May 2003 21:34:54 -0700 Date: Fri, 09 May 2003 21:34:53 -0700 (PDT) Message-Id: <20030509.213453.23041916.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Don't use destructor in bridge From: "David S. Miller" In-Reply-To: <20030509131515.6c3d34ca.shemminger@osdl.org> References: <20030509131515.6c3d34ca.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2496 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 From: Stephen Hemminger Date: Fri, 9 May 2003 13:15:15 -0700 This patch changes the Ethernet bridge back to the original way without having a destructor function. This is done so the route cache side effect code doesn't hold onto a reference to the device. If destructors are racy and do not work, we don't fix this by removing destructors from netdevice drivers. I do not accept this patch. We must fix the core problem. And your patch even creates a new problem. Remember how Alexey mentioned that that spinning/sleeping loop in unregister_netdevice() is deadlock prone and basically illegal itself. From hch@verein.lst.de Sat May 10 03:47:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 10 May 2003 03:47:25 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4AAlHFu000338 for ; Sat, 10 May 2003 03:47:18 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4AAlAQ16217; Sat, 10 May 2003 12:47:10 +0200 Date: Sat, 10 May 2003 12:47:10 +0200 From: Christoph Hellwig To: jgarzik@pobox.com Cc: netdev@oss.sgi.com Subject: [PATCH] switch sb1000 to new style net init & pnp Message-ID: <20030510124710.A16201@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2498 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 This cleans up the driver big time and gets rid of a big ugly wart in setup.c. Note that I don't have the hardware so this is only compile-tested. --- 1.25/drivers/net/Kconfig Mon Apr 28 00:05:07 2003 +++ edited/drivers/net/Kconfig Sat May 10 07:07:56 2003 @@ -158,7 +158,7 @@ config NET_SB1000 tristate "General Instruments Surfboard 1000" - depends on NETDEVICES && ISAPNP + depends on NETDEVICES && PNP ---help--- This is a driver for the General Instrument (also known as NextLevel) SURFboard 1000 internal --- 1.16/drivers/net/sb1000.c Sun Apr 27 23:36:20 2003 +++ edited/drivers/net/sb1000.c Sat May 10 07:34:43 2003 @@ -49,7 +49,7 @@ #include #include /* for udelay() */ #include -#include +#include #include #include @@ -131,146 +131,122 @@ static inline int sb1000_rx(struct net_device *dev); static inline void sb1000_error_dpc(struct net_device *dev); -static struct isapnp_device_id id_table[] = { - { ISAPNP_ANY_ID, ISAPNP_ANY_ID, - ISAPNP_VENDOR('G','I','C'), ISAPNP_FUNCTION(0x1000), 0 }, - {0} +static const struct pnp_device_id sb1000_pnp_ids[] = { + { "GIC1000", 0 }, + { "", 0 } }; +MODULE_DEVICE_TABLE(pnp, sb1000_pnp_ids); -MODULE_DEVICE_TABLE(isapnp, id_table); - -/* probe for SB1000 using Plug-n-Play mechanism */ -int -sb1000_probe(struct net_device *dev) +static void +sb1000_setup(struct net_device *dev) { + dev->type = ARPHRD_ETHER; + dev->mtu = 1500; + dev->addr_len = ETH_ALEN; + + /* New-style flags. */ + dev->flags = IFF_POINTOPOINT|IFF_NOARP; +} +static int +sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id) +{ + struct net_device *dev; unsigned short ioaddr[2], irq; - struct pnp_dev *idev=NULL; unsigned int serial_number; + int error = -ENODEV; - while(1) - { - /* - * Find the card - */ - - idev=pnp_find_dev(NULL, ISAPNP_VENDOR('G','I','C'), - ISAPNP_FUNCTION(0x1000), idev); - - /* - * No card - */ - - if(idev==NULL || idev->card == NULL) - return -ENODEV; - - /* - * Bring it online - */ - - if (pnp_device_attach(idev) < 0) - continue; - if (pnp_activate_dev(idev) < 0) { - __again: - pnp_device_detach(idev); - continue; - } - - /* - * Ports free ? - */ - - if(!pnp_port_valid(idev, 0) || !pnp_port_valid(idev, 1) || !pnp_irq_valid(idev, 0)) - goto __again; + if (pnp_device_attach(pdev) < 0) + return -ENODEV; + if (pnp_activate_dev(pdev) < 0) + goto out_detach; + + if (!pnp_port_valid(pdev, 0) || !pnp_port_valid(pdev, 1)) + goto out_disable; + if (!pnp_irq_valid(pdev, 0)) + goto out_disable; - serial_number = idev->card->serial; + serial_number = pdev->card->serial; - ioaddr[0]=pnp_port_start(idev, 0); - ioaddr[1]=pnp_port_start(idev, 0); + ioaddr[0] = pnp_port_start(pdev, 0); + ioaddr[1] = pnp_port_start(pdev, 0); - irq = pnp_irq(idev, 0); + irq = pnp_irq(pdev, 0); - /* check I/O base and IRQ */ - if (dev->base_addr != 0 && dev->base_addr != ioaddr[0]) - goto __again; - if (dev->mem_start != 0 && dev->mem_start != ioaddr[1]) - goto __again; - if (dev->irq != 0 && dev->irq != irq) - goto __again; - - /* - * Ok set it up. - */ - if (!request_region(ioaddr[0], 16, dev->name)) - goto __again; - if (!request_region(ioaddr[1], 16, dev->name)) { - release_region(ioaddr[0], 16); - goto __again; - } + if (!request_region(ioaddr[0], 16, dev->name)) + goto out_disable; + if (!request_region(ioaddr[1], 16, dev->name)) + goto out_release_region0; - dev->base_addr = ioaddr[0]; - /* mem_start holds the second I/O address */ - dev->mem_start = ioaddr[1]; - dev->irq = irq; - - if (sb1000_debug > 0) - printk(KERN_NOTICE "%s: sb1000 at (%#3.3lx,%#3.3lx), " - "S/N %#8.8x, IRQ %d.\n", dev->name, dev->base_addr, - dev->mem_start, serial_number, dev->irq); - - dev = init_etherdev(dev, 0); - if (!dev) { - pnp_device_detach(idev); - release_region(ioaddr[1], 16); - release_region(ioaddr[0], 16); - return -ENOMEM; - } - SET_MODULE_OWNER(dev); - - /* Make up a SB1000-specific-data structure. */ - dev->priv = kmalloc(sizeof(struct sb1000_private), GFP_KERNEL); - if (dev->priv == NULL) - return -ENOMEM; - memset(dev->priv, 0, sizeof(struct sb1000_private)); - - if (sb1000_debug > 0) - printk(KERN_NOTICE "%s", version); - - /* The SB1000-specific entries in the device structure. */ - dev->open = sb1000_open; - dev->do_ioctl = sb1000_dev_ioctl; - dev->hard_start_xmit = sb1000_start_xmit; - dev->stop = sb1000_close; - dev->get_stats = sb1000_stats; - - /* Fill in the generic fields of the device structure. */ - dev->change_mtu = NULL; - dev->hard_header = NULL; - dev->rebuild_header = NULL; - dev->set_mac_address = NULL; - dev->header_cache_update= NULL; - - dev->type = ARPHRD_ETHER; - dev->hard_header_len = 0; - dev->mtu = 1500; - dev->addr_len = ETH_ALEN; - /* hardware address is 0:0:serial_number */ - dev->dev_addr[0] = 0; - dev->dev_addr[1] = 0; - dev->dev_addr[2] = serial_number >> 24 & 0xff; - dev->dev_addr[3] = serial_number >> 16 & 0xff; - dev->dev_addr[4] = serial_number >> 8 & 0xff; - dev->dev_addr[5] = serial_number >> 0 & 0xff; - dev->tx_queue_len = 0; - - /* New-style flags. */ - dev->flags = IFF_POINTOPOINT|IFF_NOARP; + dev->base_addr = ioaddr[0]; + /* mem_start holds the second I/O address */ + dev->mem_start = ioaddr[1]; + dev->irq = irq; - /* Lock resources */ + if (sb1000_debug > 0) + printk(KERN_NOTICE "%s: sb1000 at (%#3.3lx,%#3.3lx), " + "S/N %#8.8x, IRQ %d.\n", dev->name, dev->base_addr, + dev->mem_start, serial_number, dev->irq); + + dev = alloc_netdev(sizeof(struct sb1000_private), "cm%d", sb1000_setup); + if (!dev) { + error = -ENOMEM; + goto out_release_regions; + } + SET_MODULE_OWNER(dev); + + if (sb1000_debug > 0) + printk(KERN_NOTICE "%s", version); + + /* The SB1000-specific entries in the device structure. */ + dev->open = sb1000_open; + dev->do_ioctl = sb1000_dev_ioctl; + dev->hard_start_xmit = sb1000_start_xmit; + dev->stop = sb1000_close; + dev->get_stats = sb1000_stats; + + /* hardware address is 0:0:serial_number */ + dev->dev_addr[2] = serial_number >> 24 & 0xff; + dev->dev_addr[3] = serial_number >> 16 & 0xff; + dev->dev_addr[4] = serial_number >> 8 & 0xff; + dev->dev_addr[5] = serial_number >> 0 & 0xff; + + pnp_set_drvdata(pdev, dev); + + error = register_netdev(dev); + if (error) + goto out_unregister; + return 0; - return 0; - } -} + out_unregister: + unregister_netdev(dev); + out_release_regions: + release_region(ioaddr[1], 16); + out_release_region0: + release_region(ioaddr[0], 16); + out_disable: + pnp_disable_dev(pdev); + out_detach: + pnp_device_detach(pdev); + return error; +} + +static void +sb1000_remove_one(struct pnp_dev *pdev) +{ + struct net_device *dev = pnp_get_drvdata(pdev); + + unregister_netdev(dev); + release_region(dev->base_addr, 16); + release_region(dev->mem_start, 16); +} + +static struct pnp_driver sb1000_driver = { + .name = "sb1000", + .id_table = sb1000_pnp_ids, + .probe = sb1000_probe_one, + .remove = sb1000_remove_one, +}; /* @@ -1207,60 +1183,21 @@ return 0; } -#ifdef MODULE MODULE_AUTHOR("Franco Venturi "); MODULE_DESCRIPTION("General Instruments SB1000 driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(io, "1-2i"); -MODULE_PARM(irq, "i"); -MODULE_PARM_DESC(io, "SB1000 I/O base addresses"); -MODULE_PARM_DESC(irq, "SB1000 IRQ number"); - -static struct net_device dev_sb1000; -static int io[2]; -static int irq; - -int -init_module(void) +static int __init +sb1000_init(void) { - int i; - for (i = 0; i < 100; i++) { - sprintf(dev_sb1000.name, "cm%d", i); - if (dev_get(dev_sb1000.name) == 0) break; - } - if (i == 100) { - printk(KERN_ERR "sb1000: can't register any device cm\n"); - return -ENFILE; - } - dev_sb1000.init = sb1000_probe; - dev_sb1000.base_addr = io[0]; - /* mem_start holds the second I/O address */ - dev_sb1000.mem_start = io[1]; - dev_sb1000.irq = irq; - if (register_netdev(&dev_sb1000) != 0) { - printk(KERN_ERR "sb1000: failed to register device (io: %03x,%03x " - "irq: %d)\n", io[0], io[1], irq); - return -EIO; - } - return 0; + return pnp_register_driver(&sb1000_driver); } -void cleanup_module(void) +static void __exit +sb1000_exit(void) { - unregister_netdev(&dev_sb1000); - release_region(dev_sb1000.base_addr, 16); - release_region(dev_sb1000.mem_start, 16); - kfree(dev_sb1000.priv); - dev_sb1000.priv = NULL; + pnp_unregister_driver(&sb1000_driver); } -#endif /* MODULE */ - -/* - * Local variables: - * compile-command: "gcc -D__KERNEL__ -DMODULE -Wall -Wstrict-prototypes -O -m486 -c sb1000.c" - * version-control: t - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ + +module_init(sb1000_init); +module_exit(sb1000_exit); ===== drivers/net/setup.c 1.9 vs edited ===== --- 1.9/drivers/net/setup.c Fri May 9 12:35:53 2003 +++ edited/drivers/net/setup.c Sat May 10 07:07:26 2003 @@ -21,14 +21,6 @@ extern int madgemc_probe(void); -/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is string of 9 zeros. */ -#define __PAD6 "\0\0\0\0\0\0\0\0\0" -#define __PAD5 __PAD6 "\0" -#define __PAD4 __PAD5 "\0" -#define __PAD3 __PAD4 "\0" -#define __PAD2 __PAD3 "\0" - - /* * Devices in this list must do new style probing. That is they must * allocate their own device objects and do their own bus scans. @@ -84,7 +76,7 @@ * into them. */ -static void __init network_probe(void) +void __init net_device_init(void) { struct net_probe *p = pci_probes; @@ -93,29 +85,4 @@ p->status = p->probe(); p++; } -} - -static void __init special_device_init(void) -{ -#ifdef CONFIG_NET_SB1000 - extern int sb1000_probe(struct net_device *dev); - - static struct net_device sb1000_dev = { - .name = "cm0" __PAD3, - .init = sb1000_probe, - }; - register_netdev(&sb1000_dev); -#endif -} - -/* - * Initialise network devices - */ - -void __init net_device_init(void) -{ - /* Devices supporting the new^H^H^Hold probing API */ - network_probe(); - /* Special devices */ - special_device_init(); } From olh@suse.de Sun May 11 13:27:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 11 May 2003 13:27:42 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4BKRXFu023256 for ; Sun, 11 May 2003 13:27:34 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id AF5DE14EB7 for ; Sun, 11 May 2003 22:27:28 +0200 (MEST) Date: Sun, 11 May 2003 22:27:28 +0200 From: Olaf Hering To: netdev@oss.sgi.com Subject: pppoe handles MOD_DEC_USE_COUNT incorrectly Message-ID: <20030511202728.GA9018@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-DOS: I got your 640K Real Mode Right Here Buddy! X-Homeland-Security: You are not supposed to read this line! You are a terrorist! User-Agent: Mutt und vi sind doch schneller als Notes X-archive-position: 2499 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: olh@suse.de Precedence: bulk X-list: netdev Hi, it seems pppoe does increase its usage count with each reconnect, but it never releases it when the ppp connection dies. Linux version 2.4.20-ibook (builds@ibook) (gcc version 3.2.1 20021026 (prerelease)) #1 Sam Dez 7 19:52:20 CET 2002 Module Size Used by Not tainted nfsd 71364 4 (autoclean) keyspan 96308 1 usbserial 20736 0 [keyspan] ipt_REJECT 3280 2 (autoclean) ipt_LOG 3312 1 (autoclean) ipt_state 752 4 (autoclean) ipt_TCPMSS 2512 1 (autoclean) iptable_filter 1904 1 (autoclean) ipt_MASQUERADE 1664 3 (autoclean) ip_conntrack_irc 3072 1 (autoclean) ip_nat_irc 2512 0 (unused) ip_conntrack_ftp 4096 1 (autoclean) ip_nat_ftp 3264 0 (unused) iptable_nat 17140 3 [ipt_MASQUERADE ip_nat_irc ip_nat_ftp] ip_tables 13936 9 [ipt_REJECT ipt_LOG ipt_state ipt_TCPMSS iptable_filter ipt_MASQUERADE iptable_nat] ip_conntrack 20604 4 [ipt_state ipt_MASQUERADE ip_conntrack_irc ip_nat_irc ip_conntrack_ftp ip_nat_ftp iptable_nat] sbp2 17696 0 (unused) pppoe 9168 3 pppox 1464 1 [pppoe] ppp_async 8336 0 (unused) ppp_generic 24780 3 [pppoe pppox ppp_async] slhc 4272 0 [ppp_generic] ide-scsi 9760 0 sungem 27348 1 ohci1394 27984 0 (unused) ieee1394 44792 0 [sbp2 ohci1394] My DSL connection is terminated after 24h, now, after the reconnect: --- /tmp/1 Sun May 11 21:21:04 2003 +++ /tmp/11 Sun May 11 21:41:00 2003 @@ -7,7 +7,7 @@ ipt_state 752 4 (autoclean) ipt_TCPMSS 2512 1 (autoclean) iptable_filter 1904 1 (autoclean) -ipt_MASQUERADE 1664 3 (autoclean) +ipt_MASQUERADE 1664 4 (autoclean) ip_conntrack_irc 3072 1 (autoclean) ip_nat_irc 2512 0 (unused) ip_conntrack_ftp 4096 1 (autoclean) @@ -16,7 +16,7 @@ ip_tables 13936 9 [ipt_REJECT ipt_LOG ipt_state ipt_TCPMSS iptable_filter ipt_MASQUERADE iptable_nat] ip_conntrack 20604 4 [ipt_state ipt_MASQUERADE ip_conntrack_irc ip_nat_irc ip_conntrack_ftp ip_nat_ftp iptable_nat] sbp2 17696 0 (unused) -pppoe 9168 3 +pppoe 9168 4 pppox 1464 1 [pppoe] ppp_async 8336 0 (unused) ppp_generic 24780 3 [pppoe pppox ppp_async] I tried to fix it myself, but its not obvious to me where to place the MOD_DEC_USE_COUNT. I believe the socket is still active when the connection terminates, and pppoe_sock_destruct() is not called. Gruss Olaf -- USB is for mice, FireWire is for men! From davem@redhat.com Sun May 11 15:51:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 11 May 2003 15:52:00 -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.9) with SMTP id h4BMppFu025245 for ; Sun, 11 May 2003 15:51:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA08978; Sun, 11 May 2003 14:46:21 -0700 Date: Sun, 11 May 2003 14:46:21 -0700 (PDT) Message-Id: <20030511.144621.35018826.davem@redhat.com> To: linux-kernel@vger.kernel.org CC: linux-net@vger.kernel.org, netdev@oss.sgi.com, kuznet@ms2.inr.ac.ru, jmorris@intercode.com.au Subject: 2.4.x IPSEC backport available From: "David S. Miller" X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2500 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 There is a 2.4.x backport of IPSEC available. However there is a STRONG caveat about using these changes in that we absolutely refuse to take bug reports against this release, 2.5.x is where the active development is taking place and thus where the testing is supposed to take place. This patch is a convenience for people, and nothing more. Fetch it from: ftp://ftp.kernel.org/pub/linux/kernel/davem/IPSEC/linux-2.4.21-ipsec.patch bk://kernel.bkbits.net/davem/ipsec-2.4/ Enjoy. From acme@conectiva.com.br Sun May 11 18:55:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 11 May 2003 18:56:03 -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.9) with SMTP id h4C1tnFu026432 for ; Sun, 11 May 2003 18:55:53 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19F2em-0006mS-00; Sun, 11 May 2003 23:03:12 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 66F871966D; Mon, 12 May 2003 01:57:13 +0000 (UTC) Date: Sun, 11 May 2003 22:57:12 -0300 From: Arnaldo Carvalho de Melo To: Olaf Hering Cc: netdev@oss.sgi.com Subject: Re: pppoe handles MOD_DEC_USE_COUNT incorrectly Message-ID: <20030512015712.GE8880@conectiva.com.br> References: <20030511202728.GA9018@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030511202728.GA9018@suse.de> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2501 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 Sun, May 11, 2003 at 10:27:28PM +0200, Olaf Hering escreveu: > Hi, > > it seems pppoe does increase its usage count with each reconnect, but it > never releases it when the ppp connection dies. I'm looking at this right now, thanks for reporting. - Arnaldo From rask@sygehus.dk Mon May 12 06:45:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 12 May 2003 06:45:26 -0700 (PDT) Received: from cicero0.cybercity.dk (cicero0.cybercity.dk [212.242.40.52]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4CDjFFu008294 for ; Mon, 12 May 2003 06:45:17 -0700 Received: from user4.cybercity.dk (fxp0.user4.ip.cybercity.dk [212.242.41.50]) by cicero0.cybercity.dk (Postfix) with ESMTP id 2280B102F69 for ; Mon, 12 May 2003 15:45:12 +0200 (CEST) Received: from webmail.cybercity.dk (webmail.cybercity.dk [212.242.40.37]) by user4.cybercity.dk (Postfix) with SMTP id 61ECB5450 for ; Mon, 12 May 2003 15:45:11 +0200 (CEST) Reply-To: rask@sygehus.dk From: rask@sygehus.dk (Rask Ingemann Lambertsen) To: netdev@oss.sgi.com Subject: Where is netif_rx() not safe to use? Date: Mon, 12 May 2003 15:45:11 +0200 Message-Id: <3ebfa567b38e59.35614148@not right> X-Authenticated-IP: [152.95.52.86] X-Sender: ccc94453@vip.cybercity.dk X-Mailer: Cybercity Webmail 1.06 (http://webmail.cybercity.dk/) MIME-version: 1.0 Content-type: text/plain; charset="iso-8859-1" X-archive-position: 2502 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rask@sygehus.dk Precedence: bulk X-list: netdev Hi. I'd like to know if there are situations where netif_rx() is not safe to use. For example, is it safe to call from a timer or from dev->poll()? Regards, Rask Ingemann Lambertsen From garzik@gtf.org Mon May 12 07:59:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 12 May 2003 07:59:53 -0700 (PDT) Received: from havoc.gtf.org (havoc.daloft.com [64.213.145.173]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4CExiFu009820 for ; Mon, 12 May 2003 07:59:45 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id E9C896642; Mon, 12 May 2003 10:59:43 -0400 (EDT) Date: Mon, 12 May 2003 10:59:43 -0400 From: Jeff Garzik To: Rask Ingemann Lambertsen Cc: netdev@oss.sgi.com Subject: Re: Where is netif_rx() not safe to use? Message-ID: <20030512145943.GB27111@gtf.org> References: <3ebfa567b38e59.35614148@not right> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ebfa567b38e59.35614148@not right> User-Agent: Mutt/1.3.28i X-archive-position: 2503 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@pobox.com Precedence: bulk X-list: netdev On Mon, May 12, 2003 at 03:45:11PM +0200, Rask Ingemann Lambertsen wrote: > > Hi. > > I'd like to know if there are situations where netif_rx() is not safe to use. > For example, is it safe to call from a timer or from dev->poll()? Sure, that's fine. Jeff From linux-netdev@gmane.org Mon May 12 08:24:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 12 May 2003 08:24:18 -0700 (PDT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4CFO7Fu010358 for ; Mon, 12 May 2003 08:24:09 -0700 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19FF6I-0000R2-00 for ; Mon, 12 May 2003 17:20:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: netdev@oss.sgi.com Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19FF2t-00008H-00 for ; Mon, 12 May 2003 17:16:55 +0200 From: Jason Lunz Subject: Re: Where is netif_rx() not safe to use? Date: Mon, 12 May 2003 15:16:55 +0000 (UTC) Organization: PBR Streetgang Lines: 11 Message-ID: References: <3ebfa567b38e59.35614148@not right> <20030512145943.GB27111@gtf.org> X-Complaints-To: usenet@main.gmane.org User-Agent: slrn/0.9.7.4 (Linux) X-archive-position: 2504 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: lunz@falooley.org Precedence: bulk X-list: netdev jgarzik@pobox.com said: >> I'd like to know if there are situations where netif_rx() is not safe to use. >> For example, is it safe to call from a timer or from dev->poll()? > > Sure, that's fine. from dev->poll()? It could work, but that's abusing the napi design. netif_rx() is for non-napi drivers. If a dev has a ->poll() method, it should use netif_receive_skb(). Jason From garzik@gtf.org Mon May 12 08:44:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 12 May 2003 08:44:41 -0700 (PDT) Received: from havoc.gtf.org (havoc.daloft.com [64.213.145.173]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4CFiYFu011515 for ; Mon, 12 May 2003 08:44:35 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 69348663C; Mon, 12 May 2003 11:44:34 -0400 (EDT) Date: Mon, 12 May 2003 11:44:34 -0400 From: Jeff Garzik To: Jason Lunz Cc: netdev@oss.sgi.com Subject: Re: Where is netif_rx() not safe to use? Message-ID: <20030512154434.GD27111@gtf.org> References: <3ebfa567b38e59.35614148@notright> <20030512145943.GB27111@gtf.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: 2505 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@pobox.com Precedence: bulk X-list: netdev On Mon, May 12, 2003 at 03:16:55PM +0000, Jason Lunz wrote: > jgarzik@pobox.com said: > >> I'd like to know if there are situations where netif_rx() is not safe to use. > >> For example, is it safe to call from a timer or from dev->poll()? > > > > Sure, that's fine. > > from dev->poll()? It could work, but that's abusing the napi design. > netif_rx() is for non-napi drivers. If a dev has a ->poll() method, it > should use netif_receive_skb(). agreed. Jeff From ralf@linux-mips.org Tue May 13 06:30:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 06:30:17 -0700 (PDT) Received: from dea.linux-mips.net (p508B717E.dip.t-dialin.net [80.139.113.126]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4DDU2Fu005591 for ; Tue, 13 May 2003 06:30:06 -0700 Received: from dea.linux-mips.net (localhost [127.0.0.1]) by dea.linux-mips.net (8.12.8/8.12.8) with ESMTP id h4DDUR4P008531 for ; Tue, 13 May 2003 15:30:28 +0200 Received: (from ralf@localhost) by dea.linux-mips.net (8.12.8/8.12.8/Submit) id h4DDURdI008530 for netdev@oss.sgi.com; Tue, 13 May 2003 15:30:27 +0200 Date: Tue, 13 May 2003 15:30:27 +0200 From: Ralf Baechle To: netdev@oss.sgi.com Subject: ADMIN: oss.sgi.com will move Message-ID: <20030513133027.GA8273@linux-mips.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-archive-position: 2506 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ralf@oss.sgi.com Precedence: bulk X-list: netdev The oss.sgi.com machine will be moved to another location starting at 7am UTC on next Friday. It's expect to be back in operation on Saturday. Sorry for any inconvenience this may cause. Ralf From gandalf@wlug.westbo.se Tue May 13 09:24:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 09:24:48 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4DGORFu009596 for ; Tue, 13 May 2003 09:24:30 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 6356936FD1; Tue, 13 May 2003 17:51:31 +0200 (CEST) Subject: Dump of TCP hang in established state From: Martin Josefsson To: netdev@oss.sgi.com Content-Type: multipart/mixed; boundary="=-56Ud6M+4hK77yJ8lMw4i" Organization: Message-Id: <1052841090.13492.20.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 13 May 2003 17:51:31 +0200 X-archive-position: 2508 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev --=-56Ud6M+4hK77yJ8lMw4i Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi from 2.6 must-fix list - There are those mysterious TCP hangs of established state sockets. Someone has to get a good log in order for us to effectively debug this. I think this is what I've seen a few times when using distcc. Client (x.x.x.x) is running 2.5.67 and server (y.y.y.y) is running 2.4.20 There's a router in between with sometimes clogged interfaces so there is some packetloss and the hang looks related to this. When the hangs happen there's a lot of data sitting in send-q on the client. The connections continues a few seconds after the timer has expired iirc. I've included two tcpdumps of these hangs. I've included everything from the beginning of the connections, gzipped. It should be quite easy to see when the hang happened, just look for a large jump in the timestamps. If more details are needed I can try to reproduce it again, shouldn't be too difficult. -- /Martin --=-56Ud6M+4hK77yJ8lMw4i Content-Disposition: attachment; filename=stall-57682-anon.gz Content-Type: application/x-gzip; name=stall-57682-anon.gz Content-Transfer-Encoding: base64 H4sICK0PwT4AA3N0YWxsLTU3NjgyLWFub24A1Z3LjibHcYX3fopeUgBB5P0GQytDGy88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e5hiSnIK1Pv7mk8BW65yHCzPdrpmC BEPzv3/BfV0Lg7ah0axQE8r3AqvvmvB/AeOgNskeAQA= --=-56Ud6M+4hK77yJ8lMw4i Content-Disposition: attachment; filename=stall-57798-anon.gz Content-Type: application/x-gzip; name=stall-57798-anon.gz Content-Transfer-Encoding: base64 H4sICFgPwT4AA3N0YWxsLTU3Nzk4LWFub24AxZzbihzJEYbv/RR9KcHQ5CHyyLJXRje+8ICfQCx7 sdhaL8zC2ph9d0dEaaZ71KX6I9Q5iJGEGJr+orLi+FdmxTpDmqGfK+We2uk/5+2ntDb66cfTf8/b T645zdM/TrGmOkakQvPy33fh/emPX349lU7h9MOnp6dTpBoenj7+9M+//+3h918+/fz0+8dPv8lv a84hUTuFh1///dvDH08/ffzXz6f84+ndXz+8/0u8GNNSr6/gbMsr28SY1tjkVOt8/o8YwtCLlWWz q476bFeue3blTCW1emXhtX1hxz7+FFis82aKWtD40z/IN8rf2wUp4WLDl6wRmBYhK85Iqbzjf+i9 GVzCOAaPgsGMnanTWMwuEXnj40mwk1LLS9kx1NqA832+uXztiuuFaJ8nEL7DV+Q9Xksmnlyv8mLM I307MKY8TEBZ2w3I6/uVFUXAcQ411D6gJwlscqw2592slS5m7LBbJMgW7GwxxdXs3KEXC3ayB3mj F7ILvm7BzjGqN3ohmz0asQU7xZO94Qvh3ZC2hDtj6nGxu1HstuQht32LrTFyPYgtToQX9B5w2LKH +PgGbKH3u4BkAopzKTCl1o/yIwJSiSageNQGLPKpe4C2K1Qv2oid+lGCxETU73wmiscqMcecvvku sgtQyDhKhCadBXkTY+PC8WLIHj3ixKjcGUut3tQI6YbuTblTYsWbHCG9GPo54c7YS/RmR0ivqCzw ygt3SmLyZkdI77gwKHemmOtyr+NBANGVOyVlrfY6XlPc0gp3JkphtdeVhCKOr124U7Lnaq8rZFh5 4c7EH17tdaWieOeVF65MMn2x13Gq69ZxgjZeptiOWgK+lRf2DrEkW3+vOW4jNp567yHmbCNKXtuI o7ejGo2JxUa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DXAvdx3eDP/kXfRvJh/y++lW0uIwLdlOnp1Q+kj1Cv4mmUa Ax4AuyPo1NJ8MX+Pnw2Pdr416CCfkrzYxXabxAYFypkw623KX1HOXt2m2/tC5v0J21eoXXI+86vv U/nSrtfIchatrKBu4vGk6mh9x/+U91/yD6Oc+RHxK+J/kKcsdTMhLOf3gcXCzRVqVWAMcRy4Xq3p gr7lDXk38jHvw+fLe673z9cca7MZkA8MIJ4UjTOD0A0PHF6tcX1Z4/8DB4elup1aAAA= --=-56Ud6M+4hK77yJ8lMw4i-- From olh@suse.de Tue May 13 14:07:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 14:07:07 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4DL71Fu014040 for ; Tue, 13 May 2003 14:07:02 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 417791519F; Tue, 13 May 2003 23:05:42 +0200 (MEST) Date: Tue, 13 May 2003 23:05:41 +0200 From: Olaf Hering To: Marcelo Tosatti , "David S. Miller" Cc: netdev@oss.sgi.com Subject: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030513210541.GA4415@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-DOS: I got your 640K Real Mode Right Here Buddy! X-Homeland-Security: You are not supposed to read this line! You are a terrorist! User-Agent: Mutt und vi sind doch schneller als Notes X-archive-position: 2509 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: olh@suse.de Precedence: bulk X-list: netdev Hi, we just hit this one. struct tcp_tw_bucket and stuct sock must match. Please apply. --- linux-2.4/include/net/sock.h 2003-04-24 17:11:20.000000000 +0200 +++ linux-2.4.21-rc2/include/net/sock.h 2003-05-13 23:00:32.000000000 +0200 @@ -498,6 +498,10 @@ do { spin_lock_init(&((__sk)->lock.slock } while(0) struct sock { + /* These _must_ match the beginning of struct tcp_tw_bucket precisely. + * XXX Yes I know this is gross, but I'd have to edit every single + * XXX networking file if I created a "struct sock_header". -DaveM + */ /* Socket demultiplex comparisons on incoming packets. */ __u32 daddr; /* Foreign IPv4 addr */ __u32 rcv_saddr; /* Bound local IPv4 addr */ -- USB is for mice, FireWire is for men! From daniel@osdl.org Tue May 13 15:26:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 15:26:28 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4DMQIFu014778 for ; Tue, 13 May 2003 15:26:19 -0700 Received: from ibm-c.pdx.osdl.net (ibm-c.pdx.osdl.net [172.20.1.54]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h4DMQDW09699; Tue, 13 May 2003 15:26:13 -0700 Subject: [PATCH 2.5.69] net/ipv6 missing kmem_cache_destroy in module exit From: Daniel McNeil To: "netdev@oss.sgi.com" Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, pekkas@netcore.fi, jmorris@intercode.com.au Content-Type: multipart/mixed; boundary="=-ywQdVU7VcCa55jELU9BG" Organization: Message-Id: <1052864772.2442.8.camel@ibm-c.pdx.osdl.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 13 May 2003 15:26:13 -0700 X-archive-position: 2510 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: daniel@osdl.org Precedence: bulk X-list: netdev --=-ywQdVU7VcCa55jELU9BG Content-Type: text/plain Content-Transfer-Encoding: 7bit ipv6 is missing the calls to kmem_cache_destory() in module_exit and some cleanup routines. -- Daniel McNeil --=-ywQdVU7VcCa55jELU9BG Content-Disposition: attachment; filename=patch.2.5.69-ipv6.kmem Content-Type: text/x-patch; name=patch.2.5.69-ipv6.kmem; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit diff -rupN -X /home/daniel/dontdiff linux-2.5.69/net/ipv6/af_inet6.c linux-2.5.69-ipv6/net/ipv6/af_inet6.c --- linux-2.5.69/net/ipv6/af_inet6.c Sun May 4 16:53:32 2003 +++ linux-2.5.69-ipv6/net/ipv6/af_inet6.c Tue May 13 11:33:41 2003 @@ -867,6 +867,9 @@ static void inet6_exit(void) ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); + kmem_cache_destroy(tcp6_sk_cachep); + kmem_cache_destroy(udp6_sk_cachep); + kmem_cache_destroy(raw6_sk_cachep); } module_exit(inet6_exit); #endif /* MODULE */ diff -rupN -X /home/daniel/dontdiff linux-2.5.69/net/ipv6/ip6_fib.c linux-2.5.69-ipv6/net/ipv6/ip6_fib.c --- linux-2.5.69/net/ipv6/ip6_fib.c Sun May 4 16:53:37 2003 +++ linux-2.5.69-ipv6/net/ipv6/ip6_fib.c Tue May 13 11:33:41 2003 @@ -1241,6 +1241,8 @@ void __init fib6_init(void) void fib6_gc_cleanup(void) { del_timer(&ip6_fib_timer); + if (fib6_node_kmem) + kmem_cache_destroy(fib6_node_kmem); } #endif diff -rupN -X /home/daniel/dontdiff linux-2.5.69/net/ipv6/route.c linux-2.5.69-ipv6/net/ipv6/route.c --- linux-2.5.69/net/ipv6/route.c Sun May 4 16:53:36 2003 +++ linux-2.5.69-ipv6/net/ipv6/route.c Tue May 13 11:33:41 2003 @@ -1899,5 +1899,6 @@ void ip6_route_cleanup(void) xfrm6_fini(); rt6_ifdown(NULL); fib6_gc_cleanup(); + kmem_cache_destroy(ip6_dst_ops.kmem_cachep); } #endif /* MODULE */ --=-ywQdVU7VcCa55jELU9BG-- From davem@redhat.com Tue May 13 16:32:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 16:32: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.9) with SMTP id h4DNWZFu015523 for ; Tue, 13 May 2003 16:32:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA16767; Tue, 13 May 2003 16:31:50 -0700 Date: Tue, 13 May 2003 16:31:50 -0700 (PDT) Message-Id: <20030513.163150.28800008.davem@redhat.com> To: olh@suse.de Cc: marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock From: "David S. Miller" In-Reply-To: <20030513210541.GA4415@suse.de> References: <20030513210541.GA4415@suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2511 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 From: Olaf Hering Date: Tue, 13 May 2003 23:05:41 +0200 we just hit this one. struct tcp_tw_bucket and stuct sock must match. Please apply. It's documented in tcp.h already. From davem@redhat.com Tue May 13 16:59:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 16:59:59 -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.9) with SMTP id h4DNxtFu016666 for ; Tue, 13 May 2003 16:59:56 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA16845; Tue, 13 May 2003 16:59:46 -0700 Date: Tue, 13 May 2003 16:59:46 -0700 (PDT) Message-Id: <20030513.165946.35026472.davem@redhat.com> To: daniel@osdl.org Cc: netdev@oss.sgi.com, kuznet@ms2.inr.ac.ru, pekkas@netcore.fi, jmorris@intercode.com.au Subject: Re: [PATCH 2.5.69] net/ipv6 missing kmem_cache_destroy in module exit From: "David S. Miller" In-Reply-To: <1052864772.2442.8.camel@ibm-c.pdx.osdl.net> References: <1052864772.2442.8.camel@ibm-c.pdx.osdl.net> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2512 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 From: Daniel McNeil Date: 13 May 2003 15:26:13 -0700 ipv6 is missing the calls to kmem_cache_destory() in module_exit and some cleanup routines. Applied, thanks. From acme@conectiva.com.br Tue May 13 19:43:28 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 19:43:34 -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.9) with SMTP id h4E2hQFu019427 for ; Tue, 13 May 2003 19:43:28 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19FmM8-00058b-00; Tue, 13 May 2003 23:51:00 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 88E171966C; Wed, 14 May 2003 02:44:56 +0000 (UTC) Date: Tue, 13 May 2003 23:44:56 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514024456.GE28128@conectiva.com.br> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030513.163150.28800008.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2513 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, May 13, 2003 at 04:31:50PM -0700, David S. Miller escreveu: > From: Olaf Hering > Date: Tue, 13 May 2003 23:05:41 +0200 > > we just hit this one. struct tcp_tw_bucket and stuct sock must match. > > Please apply. > > It's documented in tcp.h already. Yes, and in 2.5 the situation is a bit better, I still have an itching to revisit this at some point, together with struct open_request, etc 8) - Arnaldo From acme@conectiva.com.br Tue May 13 19:45:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 19:45:06 -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.9) with SMTP id h4E2j1Fu019909 for ; Tue, 13 May 2003 19:45:02 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19FmNd-00058k-00; Tue, 13 May 2003 23:52:33 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 9D73C1966C; Wed, 14 May 2003 02:46:29 +0000 (UTC) Date: Tue, 13 May 2003 23:46:29 -0300 From: Arnaldo Carvalho de Melo To: Daniel McNeil Cc: "netdev@oss.sgi.com" , davem@redhat.com, kuznet@ms2.inr.ac.ru, pekkas@netcore.fi, jmorris@intercode.com.au Subject: Re: [PATCH 2.5.69] net/ipv6 missing kmem_cache_destroy in module exit Message-ID: <20030514024629.GF28128@conectiva.com.br> References: <1052864772.2442.8.camel@ibm-c.pdx.osdl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1052864772.2442.8.camel@ibm-c.pdx.osdl.net> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2514 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, May 13, 2003 at 03:26:13PM -0700, Daniel McNeil escreveu: > ipv6 is missing the calls to kmem_cache_destory() in module_exit > and some cleanup routines. Thanks, this was overlooked because IPv6 doesn't unloads 8) But this may well change if we get to some solution to the complex subsystem module handling that is being discussed recently. - Arnaldo From acme@conectiva.com.br Tue May 13 21:33:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 21:34:00 -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.9) with SMTP id h4E4XkFu021205 for ; Tue, 13 May 2003 21:33:47 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19Fo4v-0005Kz-00; Wed, 14 May 2003 01:41:22 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 831361966C; Wed, 14 May 2003 04:35:14 +0000 (UTC) Date: Wed, 14 May 2003 01:35:13 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Linux Networking Development Mailing List Subject: [PATCH] ipv4/ipv6: call tcp_timewait_kill in tcp_tw_deschedule Message-ID: <20030514043513.GA30200@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: 2515 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 Hi David, As discussed in the past, please pull from: bk://kernel.bkbits.net/acme/net-2.5 There is just this outstanding changeset in this tree. Best Regards, - Arnaldo 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.1114, 2003-05-14 01:26:18-03:00, acme@conectiva.com.br o ipv4/ipv6: call tcp_timewait_kill in tcp_tw_deschedule After all calls to tcp_tw_deschedule we had a call to tcp_timewait_kill, move it to the end of tcp_tw_deschedule and unexport tcp_timewait_kill, making it static. include/net/tcp.h | 1 - net/ipv4/tcp_ipv4.c | 3 --- net/ipv4/tcp_minisocks.c | 5 ++--- net/ipv6/tcp_ipv6.c | 2 -- net/netsyms.c | 1 - 5 files changed, 2 insertions(+), 10 deletions(-) diff -Nru a/include/net/tcp.h b/include/net/tcp.h --- a/include/net/tcp.h Wed May 14 01:30:34 2003 +++ b/include/net/tcp.h Wed May 14 01:30:34 2003 @@ -222,7 +222,6 @@ extern atomic_t tcp_orphan_count; extern int tcp_tw_count; extern void tcp_time_wait(struct sock *sk, int state, int timeo); -extern void tcp_timewait_kill(struct tcp_tw_bucket *tw); extern void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo); extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw); diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c --- a/net/ipv4/tcp_ipv4.c Wed May 14 01:30:34 2003 +++ b/net/ipv4/tcp_ipv4.c Wed May 14 01:30:34 2003 @@ -633,7 +633,6 @@ } else if (tw) { /* Silly. Should hash-dance instead... */ tcp_tw_deschedule(tw); - tcp_timewait_kill(tw); NET_INC_STATS_BH(TimeWaitRecycled); tcp_tw_put(tw); @@ -737,7 +736,6 @@ if (tw) { tcp_tw_deschedule(tw); - tcp_timewait_kill(tw); tcp_tw_put(tw); } @@ -1853,7 +1851,6 @@ tcp_v4_iif(skb)); if (sk2) { tcp_tw_deschedule((struct tcp_tw_bucket *)sk); - tcp_timewait_kill((struct tcp_tw_bucket *)sk); tcp_tw_put((struct tcp_tw_bucket *)sk); sk = sk2; goto process; diff -Nru a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c --- a/net/ipv4/tcp_minisocks.c Wed May 14 01:30:35 2003 +++ b/net/ipv4/tcp_minisocks.c Wed May 14 01:30:35 2003 @@ -54,7 +54,7 @@ /* Must be called with locally disabled BHs. */ -void tcp_timewait_kill(struct tcp_tw_bucket *tw) +static void tcp_timewait_kill(struct tcp_tw_bucket *tw) { struct tcp_ehash_bucket *ehead; struct tcp_bind_hashbucket *bhead; @@ -166,7 +166,6 @@ if (!th->fin || TCP_SKB_CB(skb)->end_seq != tw->rcv_nxt+1) { kill_with_rst: tcp_tw_deschedule(tw); - tcp_timewait_kill(tw); tcp_tw_put(tw); return TCP_TW_RST; } @@ -223,7 +222,6 @@ if (sysctl_tcp_rfc1337 == 0) { kill: tcp_tw_deschedule(tw); - tcp_timewait_kill(tw); tcp_tw_put(tw); return TCP_TW_SUCCESS; } @@ -484,6 +482,7 @@ del_timer(&tcp_tw_timer); } spin_unlock(&tw_death_lock); + tcp_timewait_kill(tw); } /* Short-time timewait calendar */ diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c --- a/net/ipv6/tcp_ipv6.c Wed May 14 01:30:34 2003 +++ b/net/ipv6/tcp_ipv6.c Wed May 14 01:30:34 2003 @@ -505,7 +505,6 @@ /* Silly. Should hash-dance instead... */ local_bh_disable(); tcp_tw_deschedule(tw); - tcp_timewait_kill(tw); NET_INC_STATS_BH(TimeWaitRecycled); local_bh_enable(); @@ -1698,7 +1697,6 @@ sk2 = tcp_v6_lookup_listener(&skb->nh.ipv6h->daddr, ntohs(th->dest), tcp_v6_iif(skb)); if (sk2 != NULL) { tcp_tw_deschedule((struct tcp_tw_bucket *)sk); - tcp_timewait_kill((struct tcp_tw_bucket *)sk); tcp_tw_put((struct tcp_tw_bucket *)sk); sk = sk2; goto process; diff -Nru a/net/netsyms.c b/net/netsyms.c --- a/net/netsyms.c Wed May 14 01:30:34 2003 +++ b/net/netsyms.c Wed May 14 01:30:34 2003 @@ -420,7 +420,6 @@ EXPORT_SYMBOL(tcp_rcv_state_process); EXPORT_SYMBOL(tcp_timewait_state_process); EXPORT_SYMBOL(tcp_timewait_cachep); -EXPORT_SYMBOL(tcp_timewait_kill); EXPORT_SYMBOL(tcp_sendmsg); EXPORT_SYMBOL(tcp_v4_rebuild_header); EXPORT_SYMBOL(tcp_v4_send_check); =================================================================== This BitKeeper patch contains the following changesets: 1.1114 ## Wrapped with gzip_uu ## M'XL( &O&P3X ^V876^C.!2&K^-?86EN]BO$WT!6665F.MH=S4A;=377E6-, M<1MP!2:92OSX-63:I4F:)G0ODQ! -AQ>SGEXL?,.?JMT.1U)E6OP#OYE*S<= M*5MHYCJTY_?OKZ_ F V@Q\S6=SH?[2#LQEPMES)95+-IJG]J7YYGSI=PO:L]M3*Z]L]$JXUS&0"Y8_P=O<*O_E0N5UI:%S7GVFHBP3: M=$\TZ3OJ0G^_MZ5[(9*\,\5-&ZMRTAD5@"]0Q#P"E__Q ,8G?@! $H$_7JF MA[0%M7K(JT#UJQ#SL$$4H["1!"V$D*E&"Y*FBNZO^&ZD#4N,4!8W%(<,'R6F MK>NDS5*[LRTI;C"A(FZ8HMJWTX3AT.LZH&A/N+XN3 5GQ^IBCX'8MJZH88R) ML"&4+'B:1(M8*X%H>EC8=KR^,([BZ'5AIE#+.M%MWMM80?9,%HM\&!&))J6: M1$1$A&$6T9B\(&MOM+XHP1"*3LM6;@I3676W0U>K+?3/.%L(%.L%Q9$0_D+Q M,2G;"MJ72&(L2.>D.W?SNJ,.3"=(Y$KG\Z)V55"8XDX&/L"+V?2_D!$2-\AG MDW;^2L5S=Z53%A]V5P3'^.RN;W#7CN2_X;A<=XNWR\M=8@9X[@4A'.(.P#U/ M^>L(#K8:\&"K+*UOS7QIBOK[N/.[]OU^P&P0CIB@O.%Q3#8D;.QAF[A033CAJO'-2MG%, M?"JGY,SIFSC=O%@/<=HKW!!8>>CA_-RM-U>%*VN278$_5:ZLE7N\L46M[OQL MZ1>W_MDC+N*6=$):T#_[$OG-:#>"/_;W_G/0'R$>_0BL#PQ4_0@\1!C[<0VB5 RW:')&?SCZFTG"?O3[-1M$/8HZ;_95[GGS MTSSJ.!I/G, !E8G>NNM\1FB:) N)P;\^ZGLZ]Q( From davem@redhat.com Tue May 13 23:06:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 13 May 2003 23:06: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.9) with SMTP id h4E66MFu022796 for ; Tue, 13 May 2003 23:06:25 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA17489; Tue, 13 May 2003 23:06:09 -0700 Date: Tue, 13 May 2003 23:06:08 -0700 (PDT) Message-Id: <20030513.230608.98876096.davem@redhat.com> To: acme@conectiva.com.br Cc: netdev@oss.sgi.com Subject: Re: [PATCH] ipv4/ipv6: call tcp_timewait_kill in tcp_tw_deschedule From: "David S. Miller" In-Reply-To: <20030514043513.GA30200@conectiva.com.br> References: <20030514043513.GA30200@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2516 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 From: Arnaldo Carvalho de Melo Date: Wed, 14 May 2003 01:35:13 -0300 As discussed in the past, please pull from: bk://kernel.bkbits.net/acme/net-2.5 There is just this outstanding changeset in this tree. Looks fin to me, I just want to review this a little bit more and I'll probably pull this tomorrow. From olh@suse.de Wed May 14 01:00:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 01:01:02 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4E80pFu024621 for ; Wed, 14 May 2003 01:00:52 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 5CB8C14600; Wed, 14 May 2003 10:00:43 +0200 (MEST) Date: Wed, 14 May 2003 10:00:43 +0200 From: Olaf Hering To: "David S. Miller" Cc: marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514080043.GA2575@suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20030513.163150.28800008.davem@redhat.com> X-DOS: I got your 640K Real Mode Right Here Buddy! X-Homeland-Security: You are not supposed to read this line! You are a terrorist! User-Agent: Mutt und vi sind doch schneller als Notes X-archive-position: 2517 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: olh@suse.de Precedence: bulk X-list: netdev On Tue, May 13, David S. Miller wrote: > From: Olaf Hering > Date: Tue, 13 May 2003 23:05:41 +0200 > > we just hit this one. struct tcp_tw_bucket and stuct sock must match. > > Please apply. > > It's documented in tcp.h already. True, but not in struct sock. -- USB is for mice, FireWire is for men! From ak@suse.de Wed May 14 01:32:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 01:32:54 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4E8WgFu025608 for ; Wed, 14 May 2003 01:32:43 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 23589146BD; Wed, 14 May 2003 10:32:37 +0200 (MEST) Date: Wed, 14 May 2003 10:32:36 +0200 From: Andi Kleen To: "David S. Miller" Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514083236.GD8290@Wotan.suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030513.163150.28800008.davem@redhat.com> X-archive-position: 2518 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, May 13, 2003 at 04:31:50PM -0700, David S. Miller wrote: > From: Olaf Hering > Date: Tue, 13 May 2003 23:05:41 +0200 > > we just hit this one. struct tcp_tw_bucket and stuct sock must match. > > Please apply. > > It's documented in tcp.h already. Just not everybody changing sock.h also reads tcp.h :-( -Andi From jmorris@intercode.com.au Wed May 14 02:08:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 02:09:23 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:KaX8xwJZ/JTQRNJ8FkeHZCIG9X8Pbd4k@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4E98aFu027241 for ; Wed, 14 May 2003 02:08:43 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4E98Rr27666; Wed, 14 May 2003 19:08:28 +1000 Date: Wed, 14 May 2003 19:08:27 +1000 (EST) From: James Morris To: Martin Josefsson cc: netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state In-Reply-To: <1052841090.13492.20.camel@tux.rsn.bth.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2519 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On 13 May 2003, Martin Josefsson wrote: > - There are those mysterious TCP hangs of established state sockets. > Someone has to get a good log in order for us to effectively debug this. > > I think this is what I've seen a few times when using distcc. Does anyone know if the other hangs are seen when the app is using TCP_CORK (like distcc does) ? - James -- James Morris From hadi@shell.cyberus.ca Wed May 14 04:29:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 04:29:43 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4EBTXFu000519 for ; Wed, 14 May 2003 04:29:34 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19FuRk-00065D-LE; Wed, 14 May 2003 07:29:20 -0400 Date: Wed, 14 May 2003 07:29:20 -0400 (EDT) From: Jamal Hadi To: Stephen Hemminger cc: "David S. Miller" , netdev@oss.sgi.com, bridge@math.leidenuniv.nl Subject: Re: [PATCH 2.5.69] Bridge timer performance enhancement In-Reply-To: <20030509132012.598602ec.shemminger@osdl.org> Message-ID: <20030514072350.P23367@shell.cyberus.ca> References: <20030509132012.598602ec.shemminger@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2520 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Stephen, Seems you are the new maintainer to the bridging code? I suppose Lennert is still still listening in the background somewhere. One thing we should do post 2.6 is move all the STP protocol specific out of the kernel. i.e leave the datapath controllers (such as controlling STP states) in the kernel but have a user sapce daemon. This way you can start adding a lot more feature rich extensions in user space without waiting for kernel releases or having kernel patches (Fast Forward etc). A second item is to start looking at integrating STP with the VLAN code. Too bad Lennert (and someone else - cant remember the name) VLAN code never made it in. We can still fix this. cheers, jamal From hadi@shell.cyberus.ca Wed May 14 04:40:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 04:40:36 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4EBeWFu001352 for ; Wed, 14 May 2003 04:40:32 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19FucK-00065j-W8; Wed, 14 May 2003 07:40:16 -0400 Date: Wed, 14 May 2003 07:40:16 -0400 (EDT) From: Jamal Hadi To: Jeff Garzik cc: "David S. Miller" , kuznet@ms2.inr.ac.ru, anton@samba.org, jes@trained-monkey.org, netdev@oss.sgi.com Subject: Re: acenic lockup In-Reply-To: <20030508132735.J22565@devserv.devel.redhat.com> Message-ID: <20030514073815.G23367@shell.cyberus.ca> References: <200305072221.CAA00973@mops.inr.ac.ru> <20030508.090049.48375778.davem@redhat.com> <20030508131135.G22565@devserv.devel.redhat.com> <20030508.090954.94579344.davem@redhat.com> <20030508132735.J22565@devserv.devel.redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2521 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Jeff, Dont forget that nice looking fixed tulip which gets rid of the nonsense tx_timeout;-> http://www.cyberus.ca/~hadi/patches/tulip-sym-fixed-20030103.tgz cheers, jamal From davem@redhat.com Wed May 14 12:19:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:19: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.9) with SMTP id h4EJJXFu013804 for ; Wed, 14 May 2003 12:19:33 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA18848; Wed, 14 May 2003 12:19:13 -0700 Date: Wed, 14 May 2003 12:19:13 -0700 (PDT) Message-Id: <20030514.121913.71103997.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Network packet type using RCU From: "David S. Miller" In-Reply-To: <20030514072006.D23367@shell.cyberus.ca> References: <20030509142538.548cbd71.shemminger@osdl.org> <20030514072006.D23367@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2524 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 From: Jamal Hadi Date: Wed, 14 May 2003 07:23:32 -0400 (EDT) Something wrong with the linked lists? We're still using linked lists Jamal. From davem@redhat.com Wed May 14 12:19:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:19:12 -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.9) with SMTP id h4EJJ8Fu013626 for ; Wed, 14 May 2003 12:19:08 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA18823; Wed, 14 May 2003 12:18:06 -0700 Date: Wed, 14 May 2003 12:18:06 -0700 (PDT) Message-Id: <20030514.121806.41651014.davem@redhat.com> To: ak@suse.de Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock From: "David S. Miller" In-Reply-To: <20030514083236.GD8290@Wotan.suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514083236.GD8290@Wotan.suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2523 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 From: Andi Kleen Date: Wed, 14 May 2003 10:32:36 +0200 On Tue, May 13, 2003 at 04:31:50PM -0700, David S. Miller wrote: > It's documented in tcp.h already. Just not everybody changing sock.h also reads tcp.h :-( You assume that protocols in the tree are the only thing that might break if you edit struct sock. From davem@redhat.com Wed May 14 12:18:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:18: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.9) with SMTP id h4EJI2Fu013532 for ; Wed, 14 May 2003 12:18:03 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA18816; Wed, 14 May 2003 12:17:28 -0700 Date: Wed, 14 May 2003 12:17:27 -0700 (PDT) Message-Id: <20030514.121727.74733052.davem@redhat.com> To: olh@suse.de Cc: marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock From: "David S. Miller" In-Reply-To: <20030514080043.GA2575@suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514080043.GA2575@suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2522 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 From: Olaf Hering Date: Wed, 14 May 2003 10:00:43 +0200 On Tue, May 13, David S. Miller wrote: > It's documented in tcp.h already. True, but not in struct sock. When you edit the layout of struct sock you assume the full responsibility that you might be breaking something that uses struct sock. This includes third party modules. You shouldn't be making changing to it lightly. How this made TCP blow up is the negative feedback you get for trying to change struct sock ;-) From ak@suse.de Wed May 14 12:21:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:21:37 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4EJLNFu014310 for ; Wed, 14 May 2003 12:21:24 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id B9BD2145B8; Wed, 14 May 2003 21:21:17 +0200 (MEST) Date: Wed, 14 May 2003 21:21:17 +0200 From: Andi Kleen To: "David S. Miller" Cc: ak@suse.de, olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514192117.GA31303@Wotan.suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514083236.GD8290@Wotan.suse.de> <20030514.121806.41651014.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030514.121806.41651014.davem@redhat.com> X-archive-position: 2525 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 Wed, May 14, 2003 at 12:18:06PM -0700, David S. Miller wrote: > From: Andi Kleen > Date: Wed, 14 May 2003 10:32:36 +0200 > > On Tue, May 13, 2003 at 04:31:50PM -0700, David S. Miller wrote: > > It's documented in tcp.h already. > > Just not everybody changing sock.h also reads tcp.h :-( > > You assume that protocols in the tree are the only thing > that might break if you edit struct sock. I'm not assuming anything and didn't even edit struct sock, just pointing out that such a fragile hack as the current tw bucket is needs an explicit comment on both places. Best would be to bite the bullet and give them a common structure. -Andi From ak@suse.de Wed May 14 12:23:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:23:15 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4EJNBFu014806 for ; Wed, 14 May 2003 12:23:11 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id B0FC8149EE; Wed, 14 May 2003 21:23:05 +0200 (MEST) Date: Wed, 14 May 2003 21:23:05 +0200 From: Andi Kleen To: "David S. Miller" Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514192305.GB31303@Wotan.suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514080043.GA2575@suse.de> <20030514.121727.74733052.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030514.121727.74733052.davem@redhat.com> X-archive-position: 2526 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 Wed, May 14, 2003 at 12:17:27PM -0700, David S. Miller wrote: > When you edit the layout of struct sock you assume > the full responsibility that you might be breaking > something that uses struct sock. This includes > third party modules. What third party modules are you refering too ? I know openafs did or still does the cardinal sin of duplicating struct inode and TCP has this hack too since ages, but other than that I hope "cut'n'paste" usage of structures is not common. -Andi From davem@redhat.com Wed May 14 12:34:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:34:57 -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.9) with SMTP id h4EJYqFu015422 for ; Wed, 14 May 2003 12:34:53 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id MAA18937; Wed, 14 May 2003 12:34:21 -0700 Date: Wed, 14 May 2003 12:34:21 -0700 (PDT) Message-Id: <20030514.123421.85395571.davem@redhat.com> To: ak@suse.de Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock From: "David S. Miller" In-Reply-To: <20030514192305.GB31303@Wotan.suse.de> References: <20030514080043.GA2575@suse.de> <20030514.121727.74733052.davem@redhat.com> <20030514192305.GB31303@Wotan.suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2527 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 From: Andi Kleen Date: Wed, 14 May 2003 21:23:05 +0200 What third party modules are you refering too ? We don't know, and that's precisely my point. From ak@suse.de Wed May 14 12:57:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 12:57:42 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4EJvbFu017561 for ; Wed, 14 May 2003 12:57:37 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id F26F714AFF; Wed, 14 May 2003 21:57:31 +0200 (MEST) Date: Wed, 14 May 2003 21:57:31 +0200 From: Andi Kleen To: "David S. Miller" Cc: ak@suse.de, olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030514195731.GC31303@Wotan.suse.de> References: <20030514080043.GA2575@suse.de> <20030514.121727.74733052.davem@redhat.com> <20030514192305.GB31303@Wotan.suse.de> <20030514.123421.85395571.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030514.123421.85395571.davem@redhat.com> X-archive-position: 2528 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 Wed, May 14, 2003 at 12:34:21PM -0700, David S. Miller wrote: > From: Andi Kleen > Date: Wed, 14 May 2003 21:23:05 +0200 > > What third party modules are you refering too ? > > We don't know, and that's precisely my point. When they cut'n'paste structures they're completely on their own ... I hope you will never let stop such an omnious third party module you from doing any bug fix or optimization. -Andi From davem@redhat.com Wed May 14 13:02:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 13:03:01 -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.9) with SMTP id h4EK2vFu018325 for ; Wed, 14 May 2003 13:02:57 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id NAA19094; Wed, 14 May 2003 13:02:32 -0700 Date: Wed, 14 May 2003 13:02:32 -0700 (PDT) Message-Id: <20030514.130232.88490119.davem@redhat.com> To: ak@suse.de Cc: olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock From: "David S. Miller" In-Reply-To: <20030514195731.GC31303@Wotan.suse.de> References: <20030514192305.GB31303@Wotan.suse.de> <20030514.123421.85395571.davem@redhat.com> <20030514195731.GC31303@Wotan.suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2529 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 From: Andi Kleen Date: Wed, 14 May 2003 21:57:31 +0200 When they cut'n'paste structures they're completely on their own ... Depends upon who's willing to support them. I hope you will never let stop such an omnious third party module you from doing any bug fix or optimization. Aha, you're right and _I_ don't need to worry about this. I'm merely saying some vendor's _might_. :-) But see, since it only matters in the main kernel, every attempt to change the layout of struct sock will go through me before it hits the vanilla tree, so as a result I'll catch such problems and we thus have no problems :-) You can't have it both ways Andi, either we care about arbitrary third parties do or we don't. From davej@deviant.impure.org.uk Wed May 14 20:31:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 20:31:21 -0700 (PDT) Received: from deviant.impure.org.uk (root@deviant.impure.org.uk [195.82.120.238]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4F3VFFu024713 for ; Wed, 14 May 2003 20:31:17 -0700 Received: from deviant.impure.org.uk (davej@localhost [127.0.0.1]) by deviant.impure.org.uk (8.12.3/8.12.3/Debian-5) with ESMTP id h4F3VETb000724 for ; Thu, 15 May 2003 04:31:14 +0100 X-Envelope-To: Received: (from davej@localhost) by deviant.impure.org.uk (8.12.3/8.12.3/Debian-5) id h4F3VESL000719; Thu, 15 May 2003 04:31:14 +0100 Date: Thu, 15 May 2003 04:31:14 +0100 Message-Id: <200305150331.h4F3VESL000719@deviant.impure.org.uk> To: netdev@oss.sgi.com From: davej@codemonkey.org.uk Subject: missing netrom patch in 2.5 X-archive-position: 2530 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davej@codemonkey.org.uk Precedence: bulk X-list: netdev This went into 2.4 a year back in 2.4.19pre1-pre2, and is still missing in current 2.5 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/netrom/nr_loopback.c linux-2.5/net/netrom/nr_loopback.c --- bk-linus/net/netrom/nr_loopback.c 2003-04-10 06:01:43.000000000 +0100 +++ linux-2.5/net/netrom/nr_loopback.c 2003-03-17 23:43:10.000000000 +0000 @@ -76,6 +76,9 @@ static void nr_loopback_timer(unsigned l if (dev == NULL || nr_rx_frame(skb, dev) == 0) kfree_skb(skb); + if (dev != NULL) + dev_put(dev); + if (!skb_queue_empty(&loopback_queue) && !nr_loopback_running()) nr_set_loopback_timer(); } From davem@redhat.com Wed May 14 20:41:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 20:41:14 -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.9) with SMTP id h4F3f6Fu025054 for ; Wed, 14 May 2003 20:41:10 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA19986; Wed, 14 May 2003 20:40:44 -0700 Date: Wed, 14 May 2003 20:40:43 -0700 (PDT) Message-Id: <20030514.204043.26518703.davem@redhat.com> To: davej@codemonkey.org.uk Cc: netdev@oss.sgi.com Subject: Re: missing netrom patch in 2.5 From: "David S. Miller" In-Reply-To: <200305150331.h4F3VESL000719@deviant.impure.org.uk> References: <200305150331.h4F3VESL000719@deviant.impure.org.uk> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2531 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 From: davej@codemonkey.org.uk Date: Thu, 15 May 2003 04:31:14 +0100 This went into 2.4 a year back in 2.4.19pre1-pre2, and is still missing in current 2.5 Applied, thanks. From jmorris@intercode.com.au Wed May 14 22:38:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 22:38:35 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:FvotL1dQwXgO5STGO1+Q+1JbfuEZFtav@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4F5cRFu026651 for ; Wed, 14 May 2003 22:38:29 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4F5cFr00613; Thu, 15 May 2003 15:38:16 +1000 Date: Thu, 15 May 2003 15:38:15 +1000 (EST) From: James Morris To: Alex Davis cc: linux-kernel@vger.kernel.org, Subject: Re: link error building kernel with gcc-3.3 In-Reply-To: <20030514202941.39519.qmail@web40503.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2532 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Wed, 14 May 2003, Alex Davis wrote: > I got the following linking 2.4.21rc1: > > net/network.o(.text+0xdcb7): In function `rtnetlink_rcv': > : undefined reference to `rtnetlink_rcv_skb' > make: *** [vmlinux] Error 1 > > Removing '__inline__' from the definition of rtnetlink_rcv_skb > in net/core/rtnetlink.c fixed the problem. > > Note: this error also occurs in 2.4.21rc2-ac2 I wonder, does this mean that the compiler failed to inline the function? Removing __inline__ is not the correct solution. - James -- James Morris From davem@redhat.com Wed May 14 22:43:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 22:43:06 -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.9) with SMTP id h4F5h1Fu026996 for ; Wed, 14 May 2003 22:43:01 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id WAA20270; Wed, 14 May 2003 22:42:15 -0700 Date: Wed, 14 May 2003 22:42:14 -0700 (PDT) Message-Id: <20030514.224214.42791773.davem@redhat.com> To: jmorris@intercode.com.au Cc: alex14641@yahoo.com, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: link error building kernel with gcc-3.3 From: "David S. Miller" In-Reply-To: References: <20030514202941.39519.qmail@web40503.mail.yahoo.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2533 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 From: James Morris Date: Thu, 15 May 2003 15:38:15 +1000 (EST) I wonder, does this mean that the compiler failed to inline the function? Removing __inline__ is not the correct solution. I already posted what the correct fix is :-) And this is already pushed to 2.5.x Inlining is not guarenteed, and: extern inline ... foo(...) means "inline if you can, I have a compiled-in implementation in some object somewhere" whereas: static inline ... foo(...) means "inline if you can, if there is a case where you cannot emit this as a function into the current module" From jgarzik@pobox.com Wed May 14 23:37:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 14 May 2003 23:37:37 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4F6bUFu027697 for ; Wed, 14 May 2003 23:37:31 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19GCMr-0005oO-0s; Thu, 15 May 2003 07:37:29 +0100 Message-ID: <3EC3359D.5050207@pobox.com> Date: Thu, 15 May 2003 02:37:17 -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: davej@codemonkey.org.uk CC: Linux Kernel Mailing List , netdev@oss.sgi.com Subject: Re: [PATCH] iphase fix. References: <200305150417.h4F4HTRA025809@hera.kernel.org> In-Reply-To: <200305150417.h4F4HTRA025809@hera.kernel.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2534 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 Linux Kernel Mailing List wrote: > ChangeSet 1.1127, 2003/05/14 20:44:02-07:00, davej@codemonkey.org.uk > > [PATCH] iphase fix. > > This went into 2.4 nearly a year back with the wonderfully > descriptive "Fix from maintainer" comment. > diff -Nru a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c > --- a/drivers/net/fc/iph5526.c Wed May 14 21:17:37 2003 > +++ b/drivers/net/fc/iph5526.c Wed May 14 21:17:37 2003 > @@ -2984,8 +2984,7 @@ > */ > if ((type == ETH_P_ARP) || (status == 0)) > dev_kfree_skb(skb); > - else > - netif_wake_queue(dev); > + netif_wake_queue(dev); > LEAVE("iph5526_send_packet"); This appears to revert a fix. You only want to wake the queue if you have room to queue another skb. Jeff From davej@codemonkey.org.uk Thu May 15 04:31:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 04:32:02 -0700 (PDT) Received: from deviant.impure.org.uk (root@deviant.impure.org.uk [195.82.120.238]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4FBVrFu003069 for ; Thu, 15 May 2003 04:31:55 -0700 Received: from tetrachloride (davej@localhost [127.0.0.1]) by deviant.impure.org.uk (8.12.3/8.12.3/Debian-5) with SMTP id h4FBVrTb022569; Thu, 15 May 2003 12:31:54 +0100 Received: by tetrachloride (sSMTP sendmail emulation); Thu, 15 May 2003 12:32:58 +0100 Date: Thu, 15 May 2003 12:32:58 +0100 From: Dave Jones To: Jeff Garzik Cc: Linux Kernel Mailing List , netdev@oss.sgi.com Subject: Re: [PATCH] iphase fix. Message-ID: <20030515113258.GA31078@suse.de> Mail-Followup-To: Dave Jones , Jeff Garzik , Linux Kernel Mailing List , netdev@oss.sgi.com References: <200305150417.h4F4HTRA025809@hera.kernel.org> <3EC3359D.5050207@pobox.com> <3EC336FE.1030805@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EC336FE.1030805@pobox.com> User-Agent: Mutt/1.5.4i X-archive-position: 2535 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davej@codemonkey.org.uk Precedence: bulk X-list: netdev On Thu, May 15, 2003 at 02:43:10AM -0400, Jeff Garzik wrote: > Jeff Garzik wrote: > >> dev_kfree_skb(skb); > >>- else > >>- netif_wake_queue(dev); > >>+ netif_wake_queue(dev); > >> LEAVE("iph5526_send_packet"); > > > >This appears to revert a fix. > >You only want to wake the queue if you have room to queue another skb. > > Actually, I'm wrong. > > But it could still use some looking-at. You don't want to stop_queue at > the beginning of send_packet and wake_queue at the end. Instead, the > queue should be awakened in the Tx completion routine, and the > stop_queue should be moved from the beginning to the end of the function. Bring it up with whoever merged it into 2.4.. Dave From alex14641@yahoo.com Thu May 15 07:56:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 07:56:47 -0700 (PDT) Received: from web40506.mail.yahoo.com (web40506.mail.yahoo.com [66.218.78.123]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4FEucFu005965 for ; Thu, 15 May 2003 07:56:39 -0700 Message-ID: <20030515145633.37071.qmail@web40506.mail.yahoo.com> Received: from [68.55.238.6] by web40506.mail.yahoo.com via HTTP; Thu, 15 May 2003 07:56:33 PDT Date: Thu, 15 May 2003 07:56:33 -0700 (PDT) From: Alex Davis Subject: Re: link error building kernel with gcc-3.3 To: "David S. Miller" , jmorris@intercode.com.au Cc: alex14641@yahoo.com, linux-kernel@vger.kernel.org, netdev@oss.sgi.com In-Reply-To: <20030514.224214.42791773.davem@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 2536 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: alex14641@yahoo.com Precedence: bulk X-list: netdev Can you push it to 2.4.x as well? -Alex --- "David S. Miller" wrote: > From: James Morris > Date: Thu, 15 May 2003 15:38:15 +1000 (EST) > > I wonder, does this mean that the compiler failed to inline the function? > > Removing __inline__ is not the correct solution. > > I already posted what the correct fix is :-) And this is already > pushed to 2.5.x __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com From davem@redhat.com Thu May 15 13:11:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 13:11: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.9) with SMTP id h4FKBdFu011105 for ; Thu, 15 May 2003 13:11:40 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id NAA21957; Thu, 15 May 2003 13:11:02 -0700 Date: Thu, 15 May 2003 13:11:01 -0700 (PDT) Message-Id: <20030515.131101.78728190.davem@redhat.com> To: alex14641@yahoo.com Cc: jmorris@intercode.com.au, linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: link error building kernel with gcc-3.3 From: "David S. Miller" In-Reply-To: <20030515145633.37071.qmail@web40506.mail.yahoo.com> References: <20030514.224214.42791773.davem@redhat.com> <20030515145633.37071.qmail@web40506.mail.yahoo.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2537 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 From: Alex Davis Date: Thu, 15 May 2003 07:56:33 -0700 (PDT) Can you push it to 2.4.x as well? I did, but it won't go in until 2.4.22-pre1, this isn't critical at all. From acme@conectiva.com.br Thu May 15 13:27:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 13:27:52 -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.9) with SMTP id h4FKRbFu011520 for ; Thu, 15 May 2003 13:27:39 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19GPRh-0001NQ-00; Thu, 15 May 2003 17:35:21 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id C6B831966C; Thu, 15 May 2003 20:29:15 +0000 (UTC) Date: Thu, 15 May 2003 17:29:14 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Linux Networking Development Mailing List Subject: [PATCH] wanrouter: don't use typedefs for wan_device, just struct wan_device Message-ID: <20030515202914.GF11319@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: 2538 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 David, Please consider pulling from: bk://kernel.bkbits.net/acme/net-2.5 Next one is to kill the obnoxious netdevice_t 8) Then, to fix the MOD_{INC,DEC}_USE_COUNT stuff. - Arnaldo 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.1144, 2003-05-15 17:17:01-03:00, acme@conectiva.com.br o wanrouter: don't use typedefs for wan_device, just struct wan_device drivers/net/wan/cycx_main.c | 14 +++++------ drivers/net/wan/cycx_x25.c | 44 +++++++++++++++++++----------------- drivers/net/wan/sdla_chdlc.c | 13 +++++----- drivers/net/wan/sdla_fr.c | 16 +++++++------ drivers/net/wan/sdla_ppp.c | 16 +++++++------ drivers/net/wan/sdla_x25.c | 25 ++++++++++---------- drivers/net/wan/sdlamain.c | 14 +++++------ drivers/net/wan/wanpipe_multppp.c | 15 ++++++------ include/linux/cyclomx.h | 2 - include/linux/wanpipe.h | 2 - include/linux/wanrouter.h | 13 ++++------ net/wanrouter/wanmain.c | 46 +++++++++++++++++++------------------- net/wanrouter/wanproc.c | 18 +++++++------- 13 files changed, 123 insertions(+), 115 deletions(-) diff -Nru a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c --- a/drivers/net/wan/cycx_main.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/cycx_main.c Thu May 15 17:24:14 2003 @@ -70,9 +70,9 @@ /* Function Prototypes */ /* WAN link driver entry points */ -static int setup (wan_device_t *wandev, wandev_conf_t *conf); -static int shutdown (wan_device_t *wandev); -static int ioctl (wan_device_t *wandev, unsigned cmd, unsigned long arg); +static int setup(struct wan_device *wandev, wandev_conf_t *conf); +static int shutdown(struct wan_device *wandev); +static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg); /* Miscellaneous functions */ static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs); @@ -122,7 +122,7 @@ /* Register adapters with WAN router */ for (cnt = 0; cnt < ncards; ++cnt) { cycx_t *card = &card_array[cnt]; - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; sprintf(card->devname, "%s%d", drvname, cnt + 1); wandev->magic = ROUTER_MAGIC; @@ -181,7 +181,7 @@ * configuration structure is in kernel memory (including extended data, if * any). */ -static int setup (wan_device_t *wandev, wandev_conf_t *conf) +static int setup(struct wan_device *wandev, wandev_conf_t *conf) { int err = -EFAULT; cycx_t *card; @@ -273,7 +273,7 @@ * This function is called by the router when device is being unregistered or * when it handles ROUTER_DOWN IOCTL. */ -static int shutdown (wan_device_t *wandev) +static int shutdown(struct wan_device *wandev) { int ret = -EFAULT; cycx_t *card; @@ -305,7 +305,7 @@ * * no reserved ioctls for the cyclom 2x up to now */ -static int ioctl (wan_device_t *wandev, unsigned cmd, unsigned long arg) +static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg) { return -EINVAL; } diff -Nru a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c --- a/drivers/net/wan/cycx_x25.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/cycx_x25.c Thu May 15 17:24:14 2003 @@ -120,10 +120,10 @@ /* Function Prototypes */ /* WAN link driver entry points. These are called by the WAN router module. */ -static int update (wan_device_t *wandev), - new_if (wan_device_t *wandev, struct net_device *dev, - wanif_conf_t *conf), - del_if (wan_device_t *wandev, struct net_device *dev); +static int update(struct wan_device *wandev), + new_if(struct wan_device *wandev, struct net_device *dev, + wanif_conf_t *conf), + del_if(struct wan_device *wandev, struct net_device *dev); /* Network device interface */ static int if_init (struct net_device *dev), @@ -175,14 +175,15 @@ static unsigned dec_to_uint (u8 *str, int len); -static struct net_device *get_dev_by_lcn (wan_device_t *wandev, s16 lcn); -static struct net_device *get_dev_by_dte_addr (wan_device_t *wandev, char *dte); +static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn); +static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, + char *dte); #ifdef CYCLOMX_X25_DEBUG static void hex_dump(char *msg, unsigned char *p, int len); static void x25_dump_config(TX25Config *conf); static void x25_dump_stats(TX25Stats *stats); -static void x25_dump_devs(wan_device_t *wandev); +static void x25_dump_devs(struct wan_device *wandev); #else #define hex_dump(msg, p, len) #define x25_dump_config(conf) @@ -318,7 +319,7 @@ /* WAN Device Driver Entry Points */ /* Update device status & statistics. */ -static int update (wan_device_t *wandev) +static int update(struct wan_device *wandev) { /* sanity checks */ if (!wandev || !wandev->private) @@ -342,8 +343,8 @@ * * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if (wan_device_t *wandev, struct net_device *dev, - wanif_conf_t *conf) +static int new_if(struct wan_device *wandev, struct net_device *dev, + wanif_conf_t *conf) { cycx_t *card = wandev->private; x25_channel_t *chan; @@ -431,7 +432,7 @@ } /* Delete logical channel. */ -static int del_if (wan_device_t *wandev, struct net_device *dev) +static int del_if(struct wan_device *wandev, struct net_device *dev) { if (dev->priv) { x25_channel_t *chan = dev->priv; @@ -461,7 +462,7 @@ { x25_channel_t *chan = dev->priv; cycx_t *card = chan->card; - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; /* Initialize device driver entry points */ dev->open = if_open; @@ -711,7 +712,7 @@ static void tx_intr (cycx_t *card, TX25Cmd *cmd) { struct net_device *dev; - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; u8 lcn; cycx_peek(&card->hw, cmd->buf, &lcn, sizeof(lcn)); @@ -741,7 +742,7 @@ * socket buffers available) the whole packet sequence must be discarded. */ static void rx_intr (cycx_t *card, TX25Cmd *cmd) { - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; struct net_device *dev; x25_channel_t *chan; struct sk_buff *skb; @@ -825,7 +826,7 @@ /* Connect interrupt handler. */ static void connect_intr (cycx_t *card, TX25Cmd *cmd) { - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; struct net_device *dev = NULL; x25_channel_t *chan; u8 d[32], @@ -867,7 +868,7 @@ /* Connect confirm interrupt handler. */ static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd) { - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; struct net_device *dev; x25_channel_t *chan; u8 lcn, key; @@ -894,7 +895,7 @@ /* Disconnect confirm interrupt handler. */ static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd) { - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; struct net_device *dev; u8 lcn; @@ -914,7 +915,7 @@ /* disconnect interrupt handler. */ static void disconnect_intr (cycx_t *card, TX25Cmd *cmd) { - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; struct net_device *dev; u8 lcn; @@ -1255,7 +1256,7 @@ /* Miscellaneous */ /* Find network device by its channel number. */ -static struct net_device *get_dev_by_lcn (wan_device_t *wandev, s16 lcn) +static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn) { struct net_device *dev = wandev->dev; x25_channel_t *chan; @@ -1271,7 +1272,8 @@ } /* Find network device by its remote dte address. */ -static struct net_device *get_dev_by_dte_addr (wan_device_t *wandev, char *dte) +static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, + char *dte) { struct net_device *dev = wandev->dev; x25_channel_t *chan; @@ -1556,7 +1558,7 @@ printk(KERN_INFO "rx_aborts=%d\n", stats->rx_aborts); } -static void x25_dump_devs(wan_device_t *wandev) +static void x25_dump_devs(struct wan_device *wandev) { struct net_device *dev = wandev->dev; diff -Nru a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c --- a/drivers/net/wan/sdla_chdlc.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/sdla_chdlc.c Thu May 15 17:24:14 2003 @@ -186,8 +186,8 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ -static int update (wan_device_t* wandev); -static int new_if (wan_device_t* wandev, netdevice_t* dev, +static int update(struct wan_device* wandev); +static int new_if(struct wan_device* wandev, netdevice_t* dev, wanif_conf_t* conf); /* Network device interface */ @@ -598,7 +598,7 @@ * as to minimize the time that we are inside the interrupt handler. * */ -static int update (wan_device_t* wandev) +static int update(struct wan_device* wandev) { sdla_t* card = wandev->private; netdevice_t* dev; @@ -666,7 +666,8 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) +static int new_if(struct wan_device* wandev, netdevice_t* dev, + wanif_conf_t* conf) { sdla_t* card = wandev->private; chdlc_private_area_t* chdlc_priv_area; @@ -898,10 +899,10 @@ * registration. */ static int if_init (netdevice_t* dev) - { +{ chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; /* Initialize device driver entry points */ dev->open = &if_open; diff -Nru a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c --- a/drivers/net/wan/sdla_fr.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/sdla_fr.c Thu May 15 17:24:14 2003 @@ -323,9 +323,10 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ -static int update(wan_device_t *wandev); -static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf); -static int del_if(wan_device_t *wandev, netdevice_t *dev); +static int update(struct wan_device *wandev); +static int new_if(struct wan_device *wandev, netdevice_t *dev, + wanif_conf_t *conf); +static int del_if(struct wan_device *wandev, netdevice_t *dev); static void disable_comm (sdla_t *card); /* WANPIPE-specific entry points */ @@ -746,7 +747,7 @@ /*============================================================================ * Update device status & statistics. */ -static int update (wan_device_t* wandev) +static int update(struct wan_device* wandev) { volatile sdla_t* card; unsigned long timeout; @@ -791,7 +792,8 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) +static int new_if(struct wan_device* wandev, netdevice_t* dev, + wanif_conf_t* conf) { sdla_t* card = wandev->private; fr_channel_t* chan; @@ -1020,7 +1022,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if (wan_device_t* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, netdevice_t* dev) { fr_channel_t* chan = dev->priv; unsigned long smp_flags=0; @@ -1120,7 +1122,7 @@ { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; /* Initialize device driver entry points */ dev->open = &if_open; diff -Nru a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c --- a/drivers/net/wan/sdla_ppp.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/sdla_ppp.c Thu May 15 17:24:14 2003 @@ -231,9 +231,10 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ -static int update(wan_device_t *wandev); -static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf); -static int del_if(wan_device_t *wandev, netdevice_t *dev); +static int update(struct wan_device *wandev); +static int new_if(struct wan_device *wandev, netdevice_t *dev, + wanif_conf_t *conf); +static int del_if(struct wan_device *wandev, netdevice_t *dev); /* WANPIPE-specific entry points */ static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data); @@ -444,7 +445,7 @@ /*============================================================================ * Update device status & statistics. */ -static int update(wan_device_t *wandev) +static int update(struct wan_device *wandev) { sdla_t* card = wandev->private; netdevice_t* dev; @@ -504,7 +505,8 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf) +static int new_if(struct wan_device *wandev, netdevice_t *dev, + wanif_conf_t *conf) { sdla_t *card = wandev->private; ppp_private_area_t *ppp_priv_area; @@ -622,7 +624,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if(wan_device_t *wandev, netdevice_t *dev) +static int del_if(struct wan_device *wandev, netdevice_t *dev) { return 0; } @@ -685,7 +687,7 @@ { ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; - wan_device_t *wandev = &card->wandev; + struct wan_device *wandev = &card->wandev; /* Initialize device driver entry points */ dev->open = &if_open; diff -Nru a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c --- a/drivers/net/wan/sdla_x25.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/sdla_x25.c Thu May 15 17:24:14 2003 @@ -330,10 +330,10 @@ * WAN link driver entry points. These are * called by the WAN router module. */ -static int update (wan_device_t* wandev); -static int new_if (wan_device_t* wandev, netdevice_t* dev, - wanif_conf_t* conf); -static int del_if (wan_device_t* wandev, netdevice_t* dev); +static int update(struct wan_device* wandev); +static int new_if(struct wan_device* wandev, netdevice_t* dev, + wanif_conf_t* conf); +static int del_if(struct wan_device* wandev, netdevice_t* dev); static void disable_comm (sdla_t* card); static void disable_comm_shutdown(sdla_t *card); @@ -425,7 +425,7 @@ */ static int connect (sdla_t* card); static int disconnect (sdla_t* card); -static netdevice_t* get_dev_by_lcn(wan_device_t* wandev, unsigned lcn); +static netdevice_t* get_dev_by_lcn(struct wan_device* wandev, unsigned lcn); static int chan_connect (netdevice_t* dev); static int chan_disc (netdevice_t* dev); static void set_chan_state (netdevice_t* dev, int state); @@ -830,7 +830,7 @@ * <0 Failed (or busy). */ -static int update (wan_device_t* wandev) +static int update(struct wan_device* wandev) { volatile sdla_t* card; TX25Status* status; @@ -895,7 +895,8 @@ * Return: 0 Ok * <0 Failed (channel will not be created) */ -static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) +static int new_if(struct wan_device* wandev, netdevice_t* dev, + wanif_conf_t* conf) { sdla_t* card = wandev->private; x25_channel_t* chan; @@ -1029,7 +1030,7 @@ //FIXME Del IF Should be taken out now. -static int del_if (wan_device_t* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, netdevice_t* dev) { return 0; } @@ -1099,7 +1100,7 @@ { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; /* Initialize device driver entry points */ dev->open = &if_open; @@ -3101,7 +3102,7 @@ static int incoming_call (sdla_t* card, int cmd, int lcn, TX25Mbox* mb) { - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; int new_lcn = mb->cmd.lcn; netdevice_t* dev = get_dev_by_lcn(wandev, new_lcn); x25_channel_t* chan = NULL; @@ -3336,7 +3337,7 @@ static int restart_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb) { - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; netdevice_t* dev; x25_channel_t *chan; unsigned char old_state; @@ -3447,7 +3448,7 @@ * Find network device by its channel number. */ -static netdevice_t* get_dev_by_lcn (wan_device_t* wandev, unsigned lcn) +static netdevice_t* get_dev_by_lcn(struct wan_device* wandev, unsigned lcn) { netdevice_t* dev; diff -Nru a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c --- a/drivers/net/wan/sdlamain.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/sdlamain.c Thu May 15 17:24:14 2003 @@ -184,9 +184,9 @@ void cleanup_module (void); /* WAN link driver entry points */ -static int setup (wan_device_t* wandev, wandev_conf_t* conf); -static int shutdown (wan_device_t* wandev); -static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg); +static int setup(struct wan_device* wandev, wandev_conf_t* conf); +static int shutdown(struct wan_device* wandev); +static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg); /* IOCTL handlers */ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump); @@ -279,7 +279,7 @@ /* Register adapters with WAN router */ for (cnt = 0; cnt < ncards; ++ cnt) { sdla_t* card = &card_array[cnt]; - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; card->next = NULL; sprintf(card->devname, "%s%d", drvname, cnt + 1); @@ -352,7 +352,7 @@ * any). */ -static int setup (wan_device_t* wandev, wandev_conf_t* conf) +static int setup(struct wan_device* wandev, wandev_conf_t* conf) { sdla_t* card; int err = 0; @@ -779,7 +779,7 @@ * This function is called by the router when device is being unregistered or * when it handles ROUTER_DOWN IOCTL. */ -static int shutdown (wan_device_t* wandev) +static int shutdown(struct wan_device* wandev) { sdla_t *card; int err=0; @@ -888,7 +888,7 @@ * This function is called when router handles one of the reserved user * IOCTLs. Note that 'arg' stil points to user address space. */ -static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg) +static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg) { sdla_t* card; int err; diff -Nru a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c --- a/drivers/net/wan/wanpipe_multppp.c Thu May 15 17:24:14 2003 +++ b/drivers/net/wan/wanpipe_multppp.c Thu May 15 17:24:14 2003 @@ -130,10 +130,10 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ -static int update (wan_device_t* wandev); -static int new_if (wan_device_t* wandev, netdevice_t* dev, +static int update(struct wan_device* wandev); +static int new_if(struct wan_device* wandev, netdevice_t* dev, wanif_conf_t* conf); -static int del_if (wan_device_t* wandev, netdevice_t* dev); +static int del_if(struct wan_device* wandev, netdevice_t* dev); /* Network device interface */ static int if_init (netdevice_t* dev); @@ -456,7 +456,7 @@ * as to minimize the time that we are inside the interrupt handler. * */ -static int update (wan_device_t* wandev) +static int update(struct wan_device* wandev) { sdla_t* card = wandev->private; netdevice_t* dev; @@ -522,7 +522,8 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf) +static int new_if(struct wan_device* wandev, netdevice_t* pdev, + wanif_conf_t* conf) { struct ppp_device *pppdev = (struct ppp_device *)pdev; @@ -616,7 +617,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if (wan_device_t* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, netdevice_t* dev) { chdlc_private_area_t *chdlc_priv_area = dev->priv; sdla_t *card = chdlc_priv_area->card; @@ -655,7 +656,7 @@ { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; - wan_device_t* wandev = &card->wandev; + struct wan_device* wandev = &card->wandev; /* NOTE: Most of the dev initialization was * done in sppp_attach(), called by new_if() diff -Nru a/include/linux/cyclomx.h b/include/linux/cyclomx.h --- a/include/linux/cyclomx.h Thu May 15 17:24:14 2003 +++ b/include/linux/cyclomx.h Thu May 15 17:24:14 2003 @@ -46,7 +46,7 @@ typedef struct cycx { char devname[WAN_DRVNAME_SZ+1]; /* card name */ cycxhw_t hw; /* hardware configuration */ - wan_device_t wandev; /* WAN device data space */ + struct wan_device wandev; /* WAN device data space */ u32 open_cnt; /* number of open interfaces */ u32 state_tick; /* link state timestamp */ spinlock_t lock; diff -Nru a/include/linux/wanpipe.h b/include/linux/wanpipe.h --- a/include/linux/wanpipe.h Thu May 15 17:24:14 2003 +++ b/include/linux/wanpipe.h Thu May 15 17:24:14 2003 @@ -286,7 +286,7 @@ { char devname[WAN_DRVNAME_SZ+1]; /* card name */ sdlahw_t hw; /* hardware configuration */ - wan_device_t wandev; /* WAN device data space */ + struct wan_device wandev; /* WAN device data space */ unsigned open_cnt; /* number of open interfaces */ unsigned long state_tick; /* link state timestamp */ diff -Nru a/include/linux/wanrouter.h b/include/linux/wanrouter.h --- a/include/linux/wanrouter.h Thu May 15 17:24:14 2003 +++ b/include/linux/wanrouter.h Thu May 15 17:24:14 2003 @@ -462,8 +462,7 @@ /*---------------------------------------------------------------------------- * WAN device data space. */ -typedef struct wan_device -{ +struct wan_device { unsigned magic; /* magic number */ char* name; /* -> WAN device name (ASCIIZ) */ void* private; /* -> driver private data */ @@ -514,10 +513,10 @@ netdevice_t* dev; /* list of network interfaces */ unsigned ndev; /* number of interfaces */ struct proc_dir_entry *dent; /* proc filesystem entry */ -} wan_device_t; +}; /* Public functions available for device drivers */ -extern int register_wan_device(wan_device_t *wandev); +extern int register_wan_device(struct wan_device *wandev); extern int unregister_wan_device(char *name); unsigned short wanrouter_type_trans(struct sk_buff *skb, netdevice_t *dev); int wanrouter_encapsulate(struct sk_buff *skb, netdevice_t *dev,unsigned short type); @@ -525,8 +524,8 @@ /* Proc interface functions. These must not be called by the drivers! */ extern int wanrouter_proc_init(void); extern void wanrouter_proc_cleanup(void); -extern int wanrouter_proc_add(wan_device_t *wandev); -extern int wanrouter_proc_delete(wan_device_t *wandev); +extern int wanrouter_proc_add(struct wan_device *wandev); +extern int wanrouter_proc_delete(struct wan_device *wandev); extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); extern void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); @@ -535,7 +534,7 @@ /* Public Data */ -extern wan_device_t *router_devlist; /* list of registered devices */ +extern struct wan_device *router_devlist; /* list of registered devices */ #endif /* __KERNEL__ */ #endif /* _ROUTER_H */ diff -Nru a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c --- a/net/wanrouter/wanmain.c Thu May 15 17:24:14 2003 +++ b/net/wanrouter/wanmain.c Thu May 15 17:24:14 2003 @@ -127,18 +127,18 @@ * WAN device IOCTL handlers */ -static int device_setup(wan_device_t *wandev, wandev_conf_t *u_conf); -static int device_stat(wan_device_t *wandev, wandev_stat_t *u_stat); -static int device_shutdown(wan_device_t *wandev); -static int device_new_if(wan_device_t *wandev, wanif_conf_t *u_conf); -static int device_del_if(wan_device_t *wandev, char *u_name); +static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf); +static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat); +static int device_shutdown(struct wan_device *wandev); +static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf); +static int device_del_if(struct wan_device *wandev, char *u_name); /* * Miscellaneous */ -static wan_device_t *find_device (char *name); -static int delete_interface (wan_device_t *wandev, char *name); +static struct wan_device *find_device (char *name); +static int delete_interface (struct wan_device *wandev, char *name); void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); @@ -148,11 +148,11 @@ * Global Data */ -static char fullname[] = "Sangoma WANPIPE Router"; -static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc."; -static char modname[] = ROUTER_NAME; /* short module name */ -wan_device_t* router_devlist = NULL; /* list of registered devices */ -static int devcnt = 0; +static char fullname[] = "Sangoma WANPIPE Router"; +static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc."; +static char modname[] = ROUTER_NAME; /* short module name */ +struct wan_device* router_devlist; /* list of registered devices */ +static int devcnt; /* * Organize Unique Identifiers for encapsulation/decapsulation @@ -262,7 +262,7 @@ */ -int register_wan_device(wan_device_t *wandev) +int register_wan_device(struct wan_device *wandev) { int err, namelen; @@ -322,7 +322,7 @@ int unregister_wan_device(char *name) { - wan_device_t *wandev, *prev; + struct wan_device *wandev, *prev; if (name == NULL) return -EINVAL; @@ -457,7 +457,7 @@ { int err = 0; struct proc_dir_entry *dent; - wan_device_t *wandev; + struct wan_device *wandev; if (!capable(CAP_NET_ADMIN)) return -EPERM; @@ -519,7 +519,7 @@ * o call driver's setup() entry point */ -static int device_setup (wan_device_t *wandev, wandev_conf_t *u_conf) +static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf) { void *data = NULL; wandev_conf_t *conf; @@ -595,7 +595,7 @@ * o call driver's shutdown() entry point */ -static int device_shutdown (wan_device_t *wandev) +static int device_shutdown(struct wan_device *wandev) { netdevice_t *dev; int err=0; @@ -628,7 +628,7 @@ * Get WAN device status & statistics. */ -static int device_stat (wan_device_t *wandev, wandev_stat_t *u_stat) +static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat) { wandev_stat_t stat; @@ -658,7 +658,7 @@ * o register network interface */ -static int device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf) +static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf) { wanif_conf_t conf; netdevice_t *dev=NULL; @@ -774,7 +774,7 @@ * o copy configuration data to kernel address space */ -static int device_del_if (wan_device_t *wandev, char *u_name) +static int device_del_if(struct wan_device *wandev, char *u_name) { char name[WAN_IFNAME_SZ + 1]; int err = 0; @@ -815,9 +815,9 @@ * Return pointer to the WAN device data space or NULL if device not found. */ -static wan_device_t *find_device(char *name) +static struct wan_device *find_device(char *name) { - wan_device_t *wandev; + struct wan_device *wandev; for (wandev = router_devlist;wandev && strcmp(wandev->name, name); wandev = wandev->next); @@ -841,7 +841,7 @@ * sure that opened interfaces are not removed! */ -static int delete_interface (wan_device_t *wandev, char *name) +static int delete_interface(struct wan_device *wandev, char *name) { netdevice_t *dev=NULL, *prev=NULL; unsigned long smp_flags=0; diff -Nru a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c --- a/net/wanrouter/wanproc.c Thu May 15 17:24:14 2003 +++ b/net/wanrouter/wanproc.c Thu May 15 17:24:14 2003 @@ -96,7 +96,7 @@ */ static void *r_start(struct seq_file *m, loff_t *pos) { - wan_device_t *wandev; + struct wan_device *wandev; loff_t l = *pos; lock_kernel(); @@ -108,7 +108,7 @@ } static void *r_next(struct seq_file *m, void *v, loff_t *pos) { - wan_device_t *wandev = v; + struct wan_device *wandev = v; (*pos)++; return (v == (void *)1) ? router_devlist : wandev->next; } @@ -119,7 +119,7 @@ static int config_show(struct seq_file *m, void *v) { - wan_device_t *p = v; + struct wan_device *p = v; if (v == (void *)1) { seq_puts(m, "Device name | port |IRQ|DMA| mem.addr |"); seq_puts(m, "mem.size|option1|option2|option3|option4\n"); @@ -135,7 +135,7 @@ static int status_show(struct seq_file *m, void *v) { - wan_device_t *p = v; + struct wan_device *p = v; if (v == (void *)1) { seq_puts(m, "Device name |protocol|station|interface|"); seq_puts(m, "clocking|baud rate| MTU |ndev|link state\n"); @@ -221,7 +221,7 @@ static int wandev_show(struct seq_file *m, void *v) { - wan_device_t *wandev = v; + struct wan_device *wandev = v; if (wandev->magic != ROUTER_MAGIC) return 0; @@ -339,7 +339,7 @@ * Add directory entry for WAN device. */ -int wanrouter_proc_add (wan_device_t* wandev) +int wanrouter_proc_add(struct wan_device* wandev) { if (wandev->magic != ROUTER_MAGIC) return -EINVAL; @@ -356,7 +356,7 @@ * Delete directory entry for WAN device. */ -int wanrouter_proc_delete(wan_device_t* wandev) +int wanrouter_proc_delete(struct wan_device* wandev) { if (wandev->magic != ROUTER_MAGIC) return -EINVAL; @@ -379,12 +379,12 @@ { } -int wanrouter_proc_add(wan_device_t *wandev) +int wanrouter_proc_add(struct wan_device *wandev) { return 0; } -int wanrouter_proc_delete(wan_device_t *wandev) +int wanrouter_proc_delete(struct wan_device *wandev) { return 0; } =================================================================== This BitKeeper patch contains the following changesets: 1.1144 ## Wrapped with gzip_uu ## M'XL( &[WPSX ]U3C]2+)+_F5W9-/R6I]<\&NQ/:;_,LRN;EX_^:O'_[Q^KWCW-Z2'^_#Q5WR2Y*3VULG MSU:?PEF\?A7F][-L<96OPL5ZGN3FGL5V:,$IY?"?8IZ@RBV82Z571"QF+)0L MB2F7OBN=\.-R_BJ>WB79\728QQ3,XU(54E+&G1%A5XQ)2:BXINJ:*<*\&_A+ MV245-Y02O1NO#G>!_(4)0@7JVR3PUF0.%O\.2>;=6+V M,$[2-4FSE1XQCI-/TRCYCOQ[L\[).E]MHKSRO?-W(H1@TGFWVVOGTO*/X]"0 M.M]W/"0(P/5VR?IJ'DX75U'UD0,5%"[W65"$W/-]-V6Q8B*A(JK?WS:>Y@PY MA3-3!>>^KSH7.%U$LTV<7,^FB\UGS6PY7297]WL+E P6R'Q9!!,O 'Q51#Y M$SEA#0MLX5E=H.+*%9T+C%=3#9KK\JFOHR_1Y_'1+DI*6<%]E_%"I*GB?,)D M*N)XDC1(:1??ZD)=Z0G[A:[C63A.5\?+%))[JHACS3V)%)^X,FP\[%:NU45* MUZ.>O3PN5UE4(X]"^7X1T GS8N;*1$QH*I.^\KCC65T@I-R?N:HY[8 ' MK B229P*.N$>2WPJ; Y[R[6Z2A8$K'L;]R4<:U&B^Q03 ,V%IXD^H MK](T[H6:/9Y[L/:#'J@Y@B">3AVP RX*SY,IHS(&%-MY+[8+U6V-IQL;S MS2P_6*K/F) %@Y,."K 4/F4T#:D$-9\TZW/XV'Z\V'S>;*[B$B]\>S_[WOD\IJ$<9V!VO$+X2'OJ=8M_KE#=2 MM7N=/KGTSMOIQ#/\F5RN'LQ?<"+?=1_G ,]TQ(0@W'D+IP=DG8?Y-"+3!:Q[ M&8=Y\NQH<2_T-5P^?UD=O4@>QM.T>?1W,"+'K\;Y"Z*_T;=V"=.WUJ3"+$YF MEL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\0QXEA_UAF#EN"%^VQVU&I)O93 _Z[?>+6_+-+R#QV3S4YOG=VW=O MR'LC:=^\W)L29:N@244/+(X=%K@GMD-B;"UUDQ-@0^T];SN3%E2;%]J;^LQAHBC13M*:YT" M4^"+63DD@Y#FC%R!_02"U?,8A'O=:X!LW7JV ]$,(;=GO 4D)T,;HG"&B4UV MW.O4@.PJL'57&/9V\4XA\+'S#$F+/NBI#NH= 'P!X+T/L?6!"LZ A,MO)&F,,,]^LJ\2&'7^8 M)^?U:7)0>(\#T9=%TC:0$2IOAX_\6(KI/HH_KS?PV9A0; Thu, 15 May 2003 14:51:15 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19GQkV-0001YG-00; Thu, 15 May 2003 18:58:52 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 910161966C; Thu, 15 May 2003 21:52:44 +0000 (UTC) Date: Thu, 15 May 2003 18:52:43 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Linux Networking Development Mailing List Subject: [PATCH] wanrouter: kill netdevice_t, do as all the rest of the tree, use struct net_device Message-ID: <20030515215243.GC12303@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: 2539 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 Hi David, Please consider pulling from: bk://kernel.bkbits.net/acme/net-2.5 Now there are two outstanding changesets in this tree. - Arnaldo 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.1145, 2003-05-15 18:42:15-03:00, acme@conectiva.com.br o wanrouter: kill netdevice_t, do as all the rest of the tree, use struct net_device drivers/net/wan/sdla_chdlc.c | 96 +++++++++--------- drivers/net/wan/sdla_fr.c | 184 ++++++++++++++++++----------------- drivers/net/wan/sdla_ft1.c | 2 drivers/net/wan/sdla_ppp.c | 89 ++++++++--------- drivers/net/wan/sdla_x25.c | 195 ++++++++++++++++++++------------------ drivers/net/wan/sdlamain.c | 10 - drivers/net/wan/wanpipe_multppp.c | 70 ++++++------- include/linux/if_wanpipe.h | 6 - include/linux/if_wanpipe_common.h | 9 - include/linux/wanpipe.h | 26 ++--- include/linux/wanrouter.h | 16 +-- net/wanrouter/af_wanpipe.c | 75 +++++++------- net/wanrouter/wanmain.c | 39 +++---- 13 files changed, 420 insertions(+), 397 deletions(-) diff -Nru a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c --- a/drivers/net/wan/sdla_chdlc.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdla_chdlc.c Thu May 15 18:49:30 2003 @@ -187,20 +187,21 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ static int update(struct wan_device* wandev); -static int new_if(struct wan_device* wandev, netdevice_t* dev, - wanif_conf_t* conf); +static int new_if(struct wan_device* wandev, struct net_device* dev, + wanif_conf_t* conf); /* Network device interface */ -static int if_init (netdevice_t* dev); -static int if_open (netdevice_t* dev); -static int if_close (netdevice_t* dev); -static int if_header (struct sk_buff* skb, netdevice_t* dev, - unsigned short type, void* daddr, void* saddr, unsigned len); +static int if_init(struct net_device* dev); +static int if_open(struct net_device* dev); +static int if_close(struct net_device* dev); +static int if_header(struct sk_buff* skb, struct net_device* dev, + unsigned short type, void* daddr, void* saddr, + unsigned len); static int if_rebuild_hdr (struct sk_buff *skb); -static struct net_device_stats* if_stats (netdevice_t* dev); +static struct net_device_stats* if_stats(struct net_device* dev); -static int if_send (struct sk_buff* skb, netdevice_t* dev); +static int if_send(struct sk_buff* skb, struct net_device* dev); /* CHDLC Firmware interface functions */ static int chdlc_configure (sdla_t* card, void* data); @@ -214,7 +215,7 @@ static int chdlc_disable_comm_shutdown (sdla_t *card); -static void if_tx_timeout (netdevice_t *dev); +static void if_tx_timeout(struct net_device *dev); /* Miscellaneous CHDLC Functions */ static int set_chdlc_config (sdla_t* card); @@ -230,8 +231,8 @@ static int config_chdlc (sdla_t *card); static void disable_comm (sdla_t *card); -static void trigger_chdlc_poll (netdevice_t *); -static void chdlc_poll (netdevice_t *); +static void trigger_chdlc_poll(struct net_device *dev); +static void chdlc_poll(struct net_device *dev); static void chdlc_poll_delay (unsigned long dev_ptr); @@ -245,20 +246,20 @@ static void timer_intr(sdla_t *); /* Bottom half handlers */ -static void chdlc_work (netdevice_t *); -static int chdlc_work_cleanup (netdevice_t *); -static int bh_enqueue (netdevice_t *, struct sk_buff *); +static void chdlc_work(struct net_device *dev); +static int chdlc_work_cleanup(struct net_device *dev); +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb); /* Miscellaneous functions */ -static int chk_bcast_mcast_addr(sdla_t* card, netdevice_t* dev, +static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev, struct sk_buff *skb); static int reply_udp( unsigned char *data, unsigned int mbox_len ); static int intr_test( sdla_t* card); static int udp_pkt_type( struct sk_buff *skb , sdla_t* card); static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, + struct sk_buff *skb, struct net_device* dev, chdlc_private_area_t* chdlc_priv_area); -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, +static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev, chdlc_private_area_t* chdlc_priv_area); static unsigned short calc_checksum (char *, int); static void s508_lock (sdla_t *card, unsigned long *smp_flags); @@ -601,7 +602,7 @@ static int update(struct wan_device* wandev) { sdla_t* card = wandev->private; - netdevice_t* dev; + struct net_device* dev; volatile chdlc_private_area_t* chdlc_priv_area; SHARED_MEMORY_INFO_STRUCT *flags; unsigned long timeout; @@ -666,7 +667,7 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if(struct wan_device* wandev, netdevice_t* dev, +static int new_if(struct wan_device* wandev, struct net_device* dev, wanif_conf_t* conf) { sdla_t* card = wandev->private; @@ -898,7 +899,7 @@ * interface registration. Returning anything but zero will fail interface * registration. */ -static int if_init (netdevice_t* dev) +static int if_init(struct net_device* dev) { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; @@ -961,7 +962,7 @@ * * Return 0 if O.k. or errno. */ -static int if_open (netdevice_t* dev) +static int if_open(struct net_device* dev) { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; @@ -1014,7 +1015,7 @@ * o if this is the last close, then disable communications and interrupts. * o reset flags. */ -static int if_close (netdevice_t* dev) +static int if_close(struct net_device* dev) { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; @@ -1085,8 +1086,9 @@ * * Return: media header length. */ -static int if_header (struct sk_buff* skb, netdevice_t* dev, - unsigned short type, void* daddr, void* saddr, unsigned len) +static int if_header(struct sk_buff* skb, struct net_device* dev, + unsigned short type, void* daddr, void* saddr, + unsigned len) { skb->protocol = htons(type); @@ -1097,7 +1099,7 @@ /*============================================================================ * Handle transmit timeout event from netif watchdog */ -static void if_tx_timeout (netdevice_t *dev) +static void if_tx_timeout(struct net_device *dev) { chdlc_private_area_t* chan = dev->priv; sdla_t *card = chan->card; @@ -1145,7 +1147,7 @@ * 2. Setting tbusy flag will inhibit further transmit requests from the * protocol stack and can be used for flow control with protocol layer. */ -static int if_send (struct sk_buff* skb, netdevice_t* dev) +static int if_send(struct sk_buff* skb, struct net_device* dev) { chdlc_private_area_t *chdlc_priv_area = dev->priv; sdla_t *card = chdlc_priv_area->card; @@ -1279,7 +1281,7 @@ * multicast source IP address. */ -static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev, +static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev, struct sk_buff *skb) { u32 src_ip_addr; @@ -1422,7 +1424,7 @@ * Get ethernet-style interface statistics. * Return a pointer to struct enet_statistics. */ -static struct net_device_stats* if_stats (netdevice_t* dev) +static struct net_device_stats* if_stats(struct net_device* dev) { sdla_t *my_card; chdlc_private_area_t* chdlc_priv_area; @@ -1711,7 +1713,7 @@ * PREPROCESSOR STATEMENT ABOVE, UNLESS YOU KNOW WHAT YOU ARE * DOING */ -static void chdlc_work (netdevice_t * dev) +static void chdlc_work(struct net_device * dev) { chdlc_private_area_t* chan = dev->priv; sdla_t *card = chan->card; @@ -1752,7 +1754,7 @@ return; } -static int chdlc_work_cleanup (netdevice_t *dev) +static int chdlc_work_cleanup(struct net_device *dev) { chdlc_private_area_t* chan = dev->priv; @@ -1770,7 +1772,7 @@ -static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb) +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb) { /* Check for full */ chdlc_private_area_t* chan = dev->priv; @@ -1805,7 +1807,7 @@ */ static void wpc_isr (sdla_t* card) { - netdevice_t* dev; + struct net_device* dev; SHARED_MEMORY_INFO_STRUCT* flags = NULL; int i; sdla_t *my_card; @@ -1932,7 +1934,7 @@ */ static void rx_intr (sdla_t* card) { - netdevice_t *dev; + struct net_device *dev; chdlc_private_area_t *chdlc_priv_area; SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags; CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb; @@ -2084,7 +2086,7 @@ */ void timer_intr(sdla_t *card) { - netdevice_t* dev; + struct net_device* dev; chdlc_private_area_t* chdlc_priv_area = NULL; SHARED_MEMORY_INFO_STRUCT* flags = NULL; @@ -2173,7 +2175,7 @@ cfg.IP_netmask = 0; }else if (card->wandev.dev){ - netdevice_t * dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area = dev->priv; struct in_device *in_dev = dev->ip_ptr; @@ -2403,7 +2405,7 @@ static int configure_ip (sdla_t* card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area; char err; @@ -2450,7 +2452,7 @@ static int unconfigure_ip (sdla_t* card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area; if (!dev) @@ -2478,7 +2480,7 @@ static void process_route (sdla_t *card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; unsigned char port_num; chdlc_private_area_t *chdlc_priv_area = NULL; u32 local_IP_addr = 0; @@ -2659,8 +2661,8 @@ */ static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, - chdlc_private_area_t* chdlc_priv_area ) + struct sk_buff *skb, struct net_device* dev, + chdlc_private_area_t* chdlc_priv_area) { int udp_pkt_stored = 0; @@ -2687,7 +2689,7 @@ * Process UDP management packet. */ -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, +static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev, chdlc_private_area_t* chdlc_priv_area ) { unsigned char *buf; @@ -3264,7 +3266,7 @@ card->wandev.state = card->u.c.state = state; if (card->wandev.dev){ - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area = dev->priv; chdlc_priv_area->common.state = state; } @@ -3294,7 +3296,7 @@ static int config_chdlc (sdla_t *card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area = dev->priv; SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags; @@ -3418,7 +3420,7 @@ * the chldc_poll routine. */ -static void chdlc_poll (netdevice_t *dev) +static void chdlc_poll(struct net_device *dev) { chdlc_private_area_t *chdlc_priv_area; sdla_t *card; @@ -3568,7 +3570,7 @@ * a polling routine. * */ -static void trigger_chdlc_poll (netdevice_t *dev) +static void trigger_chdlc_poll(struct net_device *dev) { chdlc_private_area_t *chdlc_priv_area; sdla_t *card; @@ -3593,7 +3595,7 @@ static void chdlc_poll_delay (unsigned long dev_ptr) { - netdevice_t *dev = (netdevice_t *)dev_ptr; + struct net_device *dev = (struct net_device *)dev_ptr; trigger_chdlc_poll(dev); } diff -Nru a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c --- a/drivers/net/wan/sdla_fr.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdla_fr.c Thu May 15 18:49:30 2003 @@ -324,27 +324,27 @@ /* WAN link driver entry points. These are called by the WAN router module. */ static int update(struct wan_device *wandev); -static int new_if(struct wan_device *wandev, netdevice_t *dev, +static int new_if(struct wan_device *wandev, struct net_device *dev, wanif_conf_t *conf); -static int del_if(struct wan_device *wandev, netdevice_t *dev); +static int del_if(struct wan_device *wandev, struct net_device *dev); static void disable_comm (sdla_t *card); /* WANPIPE-specific entry points */ static int wpf_exec(struct sdla *card, void *u_cmd, void *u_data); /* Network device interface */ -static int if_init(netdevice_t *dev); -static int if_open(netdevice_t *dev); -static int if_close(netdevice_t *dev); +static int if_init(struct net_device *dev); +static int if_open(struct net_device *dev); +static int if_close(struct net_device *dev); -static void if_tx_timeout (netdevice_t *dev); +static void if_tx_timeout(struct net_device *dev); static int if_rebuild_hdr (struct sk_buff *skb); -static int if_send(struct sk_buff *skb, netdevice_t *dev); -static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev, +static int if_send(struct sk_buff *skb, struct net_device *dev); +static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev, struct sk_buff *skb); -static struct net_device_stats *if_stats(netdevice_t *dev); +static struct net_device_stats *if_stats(struct net_device *dev); /* Interrupt handlers */ static void fr_isr(sdla_t *card); @@ -383,9 +383,9 @@ static int fr_dlci_change(sdla_t *card, fr_mbox_t *mbox); /* Miscellaneous functions */ -static int update_chan_state(netdevice_t *dev); -static void set_chan_state(netdevice_t *dev, int state); -static netdevice_t *find_channel(sdla_t *card, unsigned dlci); +static int update_chan_state(struct net_device *dev); +static void set_chan_state(struct net_device *dev, int state); +static struct net_device *find_channel(sdla_t *card, unsigned dlci); static int is_tx_ready(sdla_t *card, fr_channel_t *chan); static unsigned int dec_to_uint(unsigned char *str, int len); static int reply_udp( unsigned char *data, unsigned int mbox_len ); @@ -394,22 +394,23 @@ static void init_chan_statistics( fr_channel_t* chan ); static void init_global_statistics( sdla_t* card ); static void read_DLCI_IB_mapping( sdla_t* card, fr_channel_t* chan ); -static int setup_for_delayed_transmit(netdevice_t* dev, struct sk_buff *skb); +static int setup_for_delayed_transmit(struct net_device* dev, + struct sk_buff *skb); -netdevice_t * move_dev_to_next (sdla_t *, netdevice_t *); -static int check_tx_status(sdla_t *, netdevice_t *); +struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev); +static int check_tx_status(sdla_t *card, struct net_device *dev); /* Frame Relay Socket API */ static void trigger_fr_bh (fr_channel_t *); -static void fr_bh (netdevice_t *); -static int fr_bh_cleanup (netdevice_t *); -static int bh_enqueue (netdevice_t *, struct sk_buff *); - -static void trigger_fr_poll (netdevice_t *); -static void fr_poll (netdevice_t *); -//static void add_gateway (netdevice_t *); +static void fr_bh(struct net_device *dev); +static int fr_bh_cleanup(struct net_device *dev); +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb); + +static void trigger_fr_poll(struct net_device *dev); +static void fr_poll(struct net_device *dev); +//static void add_gateway(struct net_device *dev); -static void trigger_unconfig_fr (netdevice_t *dev); +static void trigger_unconfig_fr(struct net_device *dev); static void unconfig_fr (sdla_t *); static void trigger_config_fr (sdla_t *); @@ -417,11 +418,11 @@ /* Inverse ARP and Dynamic routing functions */ -int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, netdevice_t *dev); +int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device *dev); int is_arp(void *buf); -int send_inarp_request(sdla_t *card, netdevice_t *dev); +int send_inarp_request(sdla_t *card, struct net_device *dev); -static void trigger_fr_arp (netdevice_t *); +static void trigger_fr_arp(struct net_device *dev); static void fr_arp (unsigned long data); @@ -443,7 +444,8 @@ void s508_s514_lock(sdla_t *card, unsigned long *smp_flags); unsigned short calc_checksum (char *, int); -static int setup_fr_header(struct sk_buff** skb, netdevice_t* dev, char op_mode); +static int setup_fr_header(struct sk_buff** skb, + struct net_device* dev, char op_mode); /****** Public Functions ****************************************************/ @@ -792,7 +794,7 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if(struct wan_device* wandev, netdevice_t* dev, +static int new_if(struct wan_device* wandev, struct net_device* dev, wanif_conf_t* conf) { sdla_t* card = wandev->private; @@ -1022,7 +1024,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if(struct wan_device* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, struct net_device* dev) { fr_channel_t* chan = dev->priv; unsigned long smp_flags=0; @@ -1118,7 +1120,7 @@ * interface registration. Returning anything but zero will fail interface * registration. */ -static int if_init (netdevice_t* dev) +static int if_init(struct net_device* dev) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1196,7 +1198,7 @@ * * Return 0 if O.k. or errno. */ -static int if_open (netdevice_t* dev) +static int if_open(struct net_device* dev) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1238,7 +1240,7 @@ * o if this is the last open, then disable communications and interrupts. * o reset flags. */ -static int if_close (netdevice_t* dev) +static int if_close(struct net_device* dev) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1261,8 +1263,7 @@ */ static int if_rebuild_hdr (struct sk_buff* skb) { - - netdevice_t *dev = skb->dev; + struct net_device *dev = skb->dev; fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1274,7 +1275,7 @@ /*============================================================================ * Handle transmit timeout event from netif watchdog */ -static void if_tx_timeout (netdevice_t *dev) +static void if_tx_timeout(struct net_device *dev) { fr_channel_t* chan = dev->priv; sdla_t *card = chan->card; @@ -1317,7 +1318,7 @@ * will inhibit further transmit requests from the protocol stack * and can be used for flow control with protocol layer. */ -static int if_send (struct sk_buff* skb, netdevice_t* dev) +static int if_send(struct sk_buff* skb, struct net_device* dev) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1564,7 +1565,8 @@ * Setup so that a frame can be transmitted on the occurrence of a transmit * interrupt. */ -static int setup_for_delayed_transmit (netdevice_t* dev, struct sk_buff *skb) +static int setup_for_delayed_transmit(struct net_device* dev, + struct sk_buff *skb) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1616,7 +1618,7 @@ * Return 0 if not broadcast/multicast address, otherwise return 1. */ -static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev, +static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev, struct sk_buff *skb) { u32 src_ip_addr; @@ -1828,7 +1830,7 @@ * Get ethernet-style interface statistics. * Return a pointer to struct enet_statistics. */ -static struct net_device_stats *if_stats(netdevice_t *dev) +static struct net_device_stats *if_stats(struct net_device *dev) { fr_channel_t* chan = dev->priv; @@ -1954,7 +1956,7 @@ fr_channel_t* chan; char *ptr = &flags->iflag; struct sk_buff* skb; - netdevice_t* dev; + struct net_device* dev; void* buf; unsigned dlci, len, offs, len_incl_hdr; int i, udp_type; @@ -2225,7 +2227,7 @@ { fr508_flags_t* flags = card->flags; fr_tx_buf_ctl_t* bctl; - netdevice_t* dev; + struct net_device* dev; fr_channel_t* chan; if(card->hw.type == SDLA_S514){ @@ -2354,9 +2356,10 @@ /* Update the channel state call. This is call is * triggered by if_send() function */ if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UPDATE_STATE){ - netdevice_t *dev; + struct net_device *dev; if (card->wandev.state == WAN_CONNECTED){ - for (dev=card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)){ fr_channel_t *chan = dev->priv; if (chan->common.state != WAN_CONNECTED){ update_chan_state(dev); @@ -2382,7 +2385,7 @@ /* Transmit ARP packets */ if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_ARP){ int i=0; - netdevice_t *dev; + struct net_device *dev; if (card->u.f.arp_dev == NULL) card->u.f.arp_dev = card->wandev.dev; @@ -2586,7 +2589,7 @@ * This function is called by fr_poll() polling funtion. */ -static void process_route (netdevice_t *dev) +static void process_route(struct net_device *dev) { fr_channel_t *chan = dev->priv; sdla_t *card = chan->card; @@ -2987,7 +2990,7 @@ static unsigned int fr_send_hdr (sdla_t*card, int dlci, unsigned int offset) { - netdevice_t *dev = find_channel(card,dlci); + struct net_device *dev = find_channel(card,dlci); fr_channel_t *chan; if (!dev || !(chan=dev->priv)) @@ -3090,12 +3093,12 @@ case FRRES_MODEM_FAILURE: return fr_modem_failure(card, mbox); - case FRRES_CHANNEL_DOWN: - { - netdevice_t *dev; + case FRRES_CHANNEL_DOWN: { + struct net_device *dev; /* Remove all routes from associated DLCI's */ - for (dev = card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)) { + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { fr_channel_t *chan = dev->priv; if (chan->route_flag == ROUTE_ADDED) { chan->route_flag = REMOVE_ROUTE; @@ -3116,13 +3119,13 @@ return 1; } - case FRRES_CHANNEL_UP: - { - netdevice_t *dev; + case FRRES_CHANNEL_UP: { + struct net_device *dev; /* FIXME: Only startup devices that are on the list */ - for (dev = card->wandev.dev; dev; dev = *((netdevice_t **)dev->priv)) { + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { set_chan_state(dev,WAN_CONNECTED); } @@ -3196,13 +3199,13 @@ dlci_status_t* status = (void*)mbox->data; int cnt = mbox->cmd.length / sizeof(dlci_status_t); fr_channel_t *chan; - netdevice_t* dev2; + struct net_device* dev2; for (; cnt; --cnt, ++status) { unsigned short dlci= status->dlci; - netdevice_t* dev = find_channel(card, dlci); + struct net_device* dev = find_channel(card, dlci); if (dev == NULL){ printk(KERN_INFO @@ -3261,7 +3264,8 @@ } } - for (dev2 =card->wandev.dev; dev2; dev2 = *((netdevice_t **)dev2->priv)){ + for (dev2 = card->wandev.dev; dev2; + dev2 = *((struct net_device **)dev2->priv)){ chan = dev2->priv; @@ -3317,7 +3321,7 @@ /*============================================================================ * Update channel state. */ -static int update_chan_state (netdevice_t* dev) +static int update_chan_state(struct net_device* dev) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -3363,7 +3367,7 @@ /*============================================================================ * Set channel state. */ -static void set_chan_state (netdevice_t* dev, int state) +static void set_chan_state(struct net_device* dev, int state) { fr_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -3416,7 +3420,7 @@ * NOTE: del_if() functions updates this array, it uses * the spin locks to avoid corruption. */ -static netdevice_t* find_channel (sdla_t* card, unsigned dlci) +static struct net_device* find_channel(sdla_t* card, unsigned dlci) { if(dlci > HIGHEST_VALID_DLCI) return NULL; @@ -3473,7 +3477,7 @@ { int udp_pkt_stored = 0; - netdevice_t *dev=find_channel(card,dlci); + struct net_device *dev = find_channel(card, dlci); fr_channel_t *chan; if (!dev || !(chan=dev->priv)) @@ -3519,7 +3523,7 @@ int err; struct timeval tv; int udp_mgmt_req_valid = 1; - netdevice_t* dev; + struct net_device* dev; fr_channel_t* chan; fr_udp_pkt_t *fr_udp_pkt; unsigned short num_trc_els; @@ -3920,7 +3924,7 @@ * Send Inverse ARP Request */ -int send_inarp_request(sdla_t *card, netdevice_t *dev) +int send_inarp_request(sdla_t *card, struct net_device *dev) { int err=0; @@ -3997,7 +4001,7 @@ * Process ARP Packet Type */ -int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, netdevice_t* dev) +int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device* dev) { @@ -4154,7 +4158,7 @@ * at a later date. */ -static void trigger_fr_arp (netdevice_t *dev) +static void trigger_fr_arp(struct net_device *dev) { fr_channel_t* chan = dev->priv; @@ -4175,7 +4179,7 @@ static void fr_arp (unsigned long data) { - netdevice_t *dev = (netdevice_t *)data; + struct net_device *dev = (struct net_device *)data; fr_channel_t *chan = dev->priv; volatile sdla_t *card = chan->card; fr508_flags_t* flags = card->flags; @@ -4367,7 +4371,7 @@ * */ -static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb) +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb) { /* Check for full */ fr_channel_t* chan = dev->priv; @@ -4440,7 +4444,7 @@ * */ -static void fr_bh (netdevice_t * dev) +static void fr_bh(struct net_device * dev) { fr_channel_t* chan = dev->priv; sdla_t *card = chan->card; @@ -4487,7 +4491,7 @@ return; } -static int fr_bh_cleanup (netdevice_t *dev) +static int fr_bh_cleanup(struct net_device *dev) { fr_channel_t* chan = dev->priv; @@ -4521,7 +4525,7 @@ * a polling routine. * */ -static void trigger_fr_poll (netdevice_t *dev) +static void trigger_fr_poll(struct net_device *dev) { fr_channel_t* chan = dev->priv; schedule_task(&chan->fr_poll_task); @@ -4551,7 +4555,7 @@ * the fr_poll routine. */ -static void fr_poll (netdevice_t *dev) +static void fr_poll(struct net_device *dev) { fr_channel_t* chan; @@ -4638,7 +4642,7 @@ * an interrupt. */ -static int check_tx_status(sdla_t *card, netdevice_t *dev) +static int check_tx_status(sdla_t *card, struct net_device *dev) { if (card->hw.type == SDLA_S514){ @@ -4668,14 +4672,13 @@ * */ -netdevice_t * move_dev_to_next (sdla_t *card, netdevice_t *dev) +struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev) { if (card->wandev.new_if_cnt != 1){ - if (*((netdevice_t **)dev->priv) == NULL){ + if (!*((struct net_device **)dev->priv)) return card->wandev.dev; - }else{ - return *((netdevice_t **)dev->priv); - } + else + return *((struct net_device **)dev->priv); } return dev; } @@ -4725,10 +4728,11 @@ static void config_fr (sdla_t *card) { - netdevice_t *dev; + struct net_device *dev; fr_channel_t *chan; - for (dev=card->wandev.dev; dev; dev=*((netdevice_t **)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { if ((chan=dev->priv) == NULL) continue; @@ -4797,7 +4801,7 @@ * */ -static void trigger_unconfig_fr (netdevice_t *dev) +static void trigger_unconfig_fr(struct net_device *dev) { fr_channel_t *chan = dev->priv; volatile sdla_t *card = chan->card; @@ -4849,10 +4853,11 @@ static void unconfig_fr (sdla_t *card) { - netdevice_t *dev; + struct net_device *dev; fr_channel_t *chan; - for (dev=card->wandev.dev; dev; dev=*((netdevice_t **)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)){ if ((chan=dev->priv) == NULL) continue; @@ -4871,7 +4876,8 @@ } } -static int setup_fr_header(struct sk_buff ** skb_orig, netdevice_t* dev, char op_mode) +static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev, + char op_mode) { struct sk_buff *skb = *skb_orig; fr_channel_t *chan=dev->priv; @@ -4929,7 +4935,7 @@ fr_conf_t *conf=NULL; unsigned short dlci_num = chan->dlci; int dlci_offset=0; - netdevice_t *dev=NULL; + struct net_device *dev = NULL; mbox->cmd.command = FR_READ_CONFIG; mbox->cmd.length = 0; @@ -4941,9 +4947,9 @@ return 0; } - for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev=*((struct net_device **)dev->priv)) set_chan_state(dev,WAN_DISCONNECTED); - } printk(KERN_INFO "DLCI %i Not configured, configuring\n",dlci_num); @@ -4971,7 +4977,8 @@ conf = (fr_conf_t *)mbox->data; dlci_offset=0; - for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { fr_channel_t *chan_tmp = dev->priv; conf->dlci[dlci_offset] = chan_tmp->dlci; dlci_offset++; @@ -5005,7 +5012,8 @@ printk(KERN_INFO "Enabling Communications \n"); - for (dev=card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { fr_channel_t *chan_tmp = dev->priv; fr_init_dlci(card,chan_tmp); fr_add_dlci(card, chan_tmp->dlci); diff -Nru a/drivers/net/wan/sdla_ft1.c b/drivers/net/wan/sdla_ft1.c --- a/drivers/net/wan/sdla_ft1.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdla_ft1.c Thu May 15 18:49:30 2003 @@ -70,7 +70,7 @@ typedef struct chdlc_private_area { - netdevice_t *slave; + struct net_device *slave; sdla_t *card; int TracingEnabled; /* For enabling Tracing */ unsigned long curr_trace_addr; /* Used for Tracing */ diff -Nru a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c --- a/drivers/net/wan/sdla_ppp.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdla_ppp.c Thu May 15 18:49:30 2003 @@ -168,7 +168,7 @@ typedef struct ppp_private_area { - netdevice_t *slave; + struct net_device *slave; sdla_t* card; unsigned long router_start_time; /*router start time in sec */ unsigned long tick_counter; /*used for 5 second counter*/ @@ -232,25 +232,26 @@ /* WAN link driver entry points. These are called by the WAN router module. */ static int update(struct wan_device *wandev); -static int new_if(struct wan_device *wandev, netdevice_t *dev, +static int new_if(struct wan_device *wandev, struct net_device *dev, wanif_conf_t *conf); -static int del_if(struct wan_device *wandev, netdevice_t *dev); +static int del_if(struct wan_device *wandev, struct net_device *dev); /* WANPIPE-specific entry points */ static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data); /* Network device interface */ -static int if_init(netdevice_t *dev); -static int if_open(netdevice_t *dev); -static int if_close(netdevice_t *dev); -static int if_header(struct sk_buff *skb, netdevice_t *dev, unsigned short type, +static int if_init(struct net_device *dev); +static int if_open(struct net_device *dev); +static int if_close(struct net_device *dev); +static int if_header(struct sk_buff *skb, struct net_device *dev, + unsigned short type, void *daddr, void *saddr, unsigned len); -static void if_tx_timeout (netdevice_t *dev); +static void if_tx_timeout(struct net_device *dev); static int if_rebuild_hdr(struct sk_buff *skb); -static struct net_device_stats *if_stats(netdevice_t *dev); -static int if_send(struct sk_buff *skb, netdevice_t *dev); +static struct net_device_stats *if_stats(struct net_device *dev); +static int if_send(struct sk_buff *skb, struct net_device *dev); /* PPP firmware interface functions */ @@ -279,10 +280,10 @@ static int read_info( sdla_t *card ); static int read_connection_info (sdla_t *card); static void remove_route( sdla_t *card ); -static int config508(netdevice_t *dev, sdla_t *card); +static int config508(struct net_device *dev, sdla_t *card); static void show_disc_cause(sdla_t * card, unsigned cause); static int reply_udp( unsigned char *data, unsigned int mbox_len ); -static void process_udp_mgmt_pkt(sdla_t *card, netdevice_t *dev, +static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev, ppp_private_area_t *ppp_priv_area); static void init_ppp_tx_rx_buff( sdla_t *card ); static int intr_test( sdla_t *card ); @@ -291,12 +292,12 @@ static void init_global_statistics( sdla_t *card ); static int tokenize(char *str, char **tokens); static char* strstrip(char *str, char *s); -static int chk_bcast_mcast_addr(sdla_t* card, netdevice_t* dev, +static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev, struct sk_buff *skb); static int config_ppp (sdla_t *); -static void ppp_poll(netdevice_t *); -static void trigger_ppp_poll(netdevice_t *); +static void ppp_poll(struct net_device *dev); +static void trigger_ppp_poll(struct net_device *dev); static void ppp_poll_delay (unsigned long dev_ptr); @@ -316,7 +317,7 @@ static void s508_unlock (sdla_t *card, unsigned long *smp_flags); static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, + struct sk_buff *skb, struct net_device* dev, ppp_private_area_t* ppp_priv_area ); static unsigned short calc_checksum (char *data, int len); static void disable_comm (sdla_t *card); @@ -448,7 +449,7 @@ static int update(struct wan_device *wandev) { sdla_t* card = wandev->private; - netdevice_t* dev; + struct net_device* dev; volatile ppp_private_area_t *ppp_priv_area; ppp_flags_t *flags = card->flags; unsigned long timeout; @@ -505,7 +506,7 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if(struct wan_device *wandev, netdevice_t *dev, +static int new_if(struct wan_device *wandev, struct net_device *dev, wanif_conf_t *conf) { sdla_t *card = wandev->private; @@ -624,7 +625,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if(struct wan_device *wandev, netdevice_t *dev) +static int del_if(struct wan_device *wandev, struct net_device *dev) { return 0; } @@ -683,7 +684,7 @@ * interface registration. Returning anything but zero will fail interface * registration. */ -static int if_init(netdevice_t *dev) +static int if_init(struct net_device *dev) { ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; @@ -732,7 +733,7 @@ * * Return 0 if O.k. or errno. */ -static int if_open (netdevice_t *dev) +static int if_open(struct net_device *dev) { ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; @@ -771,7 +772,7 @@ * o if this is the last open, then disable communications and interrupts. * o reset flags. */ -static int if_close(netdevice_t *dev) +static int if_close(struct net_device *dev) { ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; @@ -792,7 +793,7 @@ * * Return: media header length. */ -static int if_header(struct sk_buff *skb, netdevice_t *dev, +static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) { switch (type) @@ -817,7 +818,7 @@ */ static int if_rebuild_hdr (struct sk_buff *skb) { - netdevice_t *dev = skb->dev; + struct net_device *dev = skb->dev; ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; @@ -829,7 +830,7 @@ /*============================================================================ * Handle transmit timeout event from netif watchdog */ -static void if_tx_timeout (netdevice_t *dev) +static void if_tx_timeout(struct net_device *dev) { ppp_private_area_t* chan = dev->priv; sdla_t *card = chan->card; @@ -867,7 +868,7 @@ * 2. Setting tbusy flag will inhibit further transmit requests from the * protocol stack and can be used for flow control with protocol layer. */ -static int if_send (struct sk_buff *skb, netdevice_t *dev) +static int if_send (struct sk_buff *skb, struct net_device *dev) { ppp_private_area_t *ppp_priv_area = dev->priv; sdla_t *card = ppp_priv_area->card; @@ -997,7 +998,7 @@ */ static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, + struct sk_buff *skb, struct net_device* dev, ppp_private_area_t* ppp_priv_area ) { int udp_pkt_stored = 0; @@ -1191,7 +1192,7 @@ * Get ethernet-style interface statistics. * Return a pointer to struct net_device_stats. */ -static struct net_device_stats *if_stats(netdevice_t *dev) +static struct net_device_stats *if_stats(struct net_device *dev) { ppp_private_area_t *ppp_priv_area = dev->priv; @@ -1571,7 +1572,7 @@ { ppp_flags_t *flags = card->flags; char *ptr = &flags->iflag; - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; int i; card->in_isr = 1; @@ -1651,7 +1652,7 @@ static void rx_intr(sdla_t *card) { ppp_buf_ctl_t *rxbuf = card->rxmb; - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; ppp_private_area_t *ppp_priv_area; struct sk_buff *skb; unsigned len; @@ -1791,7 +1792,7 @@ void event_intr (sdla_t *card) { - netdevice_t* dev = card->wandev.dev; + struct net_device* dev = card->wandev.dev; ppp_private_area_t* ppp_priv_area = dev->priv; volatile ppp_flags_t *flags = card->flags; @@ -1910,7 +1911,7 @@ void timer_intr (sdla_t *card) { - netdevice_t* dev = card->wandev.dev; + struct net_device* dev = card->wandev.dev; ppp_private_area_t* ppp_priv_area = dev->priv; ppp_flags_t *flags = card->flags; @@ -2107,7 +2108,7 @@ static void process_route (sdla_t *card) { ppp_flags_t *flags = card->flags; - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; ppp_private_area_t *ppp_priv_area = dev->priv; if ((card->u.p.ip_mode == WANOPT_PPP_PEER) && @@ -2149,7 +2150,7 @@ */ static void retrigger_comm(sdla_t *card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; if (dev && ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) { @@ -2166,7 +2167,7 @@ /*============================================================================ * Configure S508 adapter. */ -static int config508(netdevice_t *dev, sdla_t *card) +static int config508(struct net_device *dev, sdla_t *card) { ppp508_conf_t cfg; struct in_device *in_dev = dev->ip_ptr; @@ -2338,7 +2339,7 @@ /*============================================================================= * Process UDP call of type PTPIPEAB. */ -static void process_udp_mgmt_pkt(sdla_t *card, netdevice_t *dev, +static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev, ppp_private_area_t *ppp_priv_area ) { unsigned char buf2[5]; @@ -2849,7 +2850,7 @@ */ static int read_info( sdla_t *card ) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; ppp_private_area_t *ppp_priv_area = dev->priv; int err; @@ -2898,7 +2899,7 @@ static void remove_route( sdla_t *card ) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; long ip_addr; int err; @@ -3024,7 +3025,7 @@ * multicast source IP address. */ -static int chk_bcast_mcast_addr(sdla_t *card, netdevice_t* dev, +static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev, struct sk_buff *skb) { u32 src_ip_addr; @@ -3075,7 +3076,7 @@ static int read_connection_info (sdla_t *card) { ppp_mbox_t *mb = card->mbox; - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; ppp_private_area_t *ppp_priv_area = dev->priv; ppp508_connect_info_t *ppp508_connect_info; int err; @@ -3124,7 +3125,7 @@ static int config_ppp (sdla_t *card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; ppp_flags_t *flags = card->flags; ppp_private_area_t *ppp_priv_area = dev->priv; @@ -3232,7 +3233,7 @@ * trigger_ppp_poll() function is used to kick * the ppp_poll routine. */ -static void ppp_poll (netdevice_t *dev) +static void ppp_poll(struct net_device *dev) { ppp_private_area_t *ppp_priv_area; sdla_t *card; @@ -3377,7 +3378,7 @@ * */ -static void trigger_ppp_poll (netdevice_t *dev) +static void trigger_ppp_poll(struct net_device *dev) { ppp_private_area_t *ppp_priv_area; if ((ppp_priv_area=dev->priv) != NULL){ @@ -3399,7 +3400,7 @@ static void ppp_poll_delay (unsigned long dev_ptr) { - netdevice_t *dev = (netdevice_t *)dev_ptr; + struct net_device *dev = (struct net_device *)dev_ptr; trigger_ppp_poll(dev); } diff -Nru a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c --- a/drivers/net/wan/sdla_x25.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdla_x25.c Thu May 15 18:49:30 2003 @@ -241,7 +241,7 @@ * * Assumptions: * - * Description: This is an extention of the 'netdevice_t' + * Description: This is an extention of the struct net_device * we create for each network interface to keep * the rest of X.25 channel-specific data. * @@ -271,7 +271,7 @@ atomic_t bh_buff_used; sdla_t* card; /* -> owner */ - netdevice_t *dev; /* -> bound devce */ + struct net_device *dev; /* -> bound devce */ int ch_idx; unsigned char enable_IPX; @@ -331,9 +331,9 @@ * called by the WAN router module. */ static int update(struct wan_device* wandev); -static int new_if(struct wan_device* wandev, netdevice_t* dev, +static int new_if(struct wan_device* wandev, struct net_device* dev, wanif_conf_t* conf); -static int del_if(struct wan_device* wandev, netdevice_t* dev); +static int del_if(struct wan_device* wandev, struct net_device* dev); static void disable_comm (sdla_t* card); static void disable_comm_shutdown(sdla_t *card); @@ -343,24 +343,24 @@ * WANPIPE-specific entry points */ static int wpx_exec (struct sdla* card, void* u_cmd, void* u_data); -static void x25api_bh (netdevice_t *); -static int x25api_bh_cleanup (netdevice_t *); -static int bh_enqueue (netdevice_t *, struct sk_buff *); +static void x25api_bh(struct net_device *dev); +static int x25api_bh_cleanup(struct net_device *dev); +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb); /*================================================= * Network device interface */ -static int if_init (netdevice_t* dev); -static int if_open (netdevice_t* dev); -static int if_close (netdevice_t* dev); -static int if_header (struct sk_buff* skb, netdevice_t* dev, +static int if_init(struct net_device* dev); +static int if_open(struct net_device* dev); +static int if_close(struct net_device* dev); +static int if_header(struct sk_buff* skb, struct net_device* dev, unsigned short type, void* daddr, void* saddr, unsigned len); static int if_rebuild_hdr (struct sk_buff* skb); -static int if_send (struct sk_buff* skb, netdevice_t* dev); -static struct net_device_stats *if_stats (netdevice_t* dev); +static int if_send(struct sk_buff* skb, struct net_device* dev); +static struct net_device_stats *if_stats(struct net_device* dev); -static void if_tx_timeout (netdevice_t *dev); +static void if_tx_timeout(struct net_device *dev); /*================================================= * Interrupt handlers @@ -373,8 +373,9 @@ static void spur_intr (sdla_t *); static void timer_intr (sdla_t *); -static int tx_intr_send(sdla_t *, netdevice_t *); -static netdevice_t * move_dev_to_next (sdla_t *, netdevice_t *); +static int tx_intr_send(sdla_t *card, struct net_device *dev); +static struct net_device *move_dev_to_next(sdla_t *card, + struct net_device *dev); /*================================================= * Background polling routines @@ -425,35 +426,41 @@ */ static int connect (sdla_t* card); static int disconnect (sdla_t* card); -static netdevice_t* get_dev_by_lcn(struct wan_device* wandev, unsigned lcn); -static int chan_connect (netdevice_t* dev); -static int chan_disc (netdevice_t* dev); -static void set_chan_state (netdevice_t* dev, int state); -static int chan_send (netdevice_t* , void* , unsigned, unsigned char); +static struct net_device* get_dev_by_lcn(struct wan_device* wandev, + unsigned lcn); +static int chan_connect(struct net_device* dev); +static int chan_disc(struct net_device* dev); +static void set_chan_state(struct net_device* dev, int state); +static int chan_send(struct net_device *dev, void* buff, unsigned data_len, + unsigned char tx_intr); static unsigned char bps_to_speed_code (unsigned long bps); static unsigned int dec_to_uint (unsigned char* str, int len); static unsigned int hex_to_uint (unsigned char*, int); static void parse_call_info (unsigned char*, x25_call_info_t*); -static netdevice_t * find_channel(sdla_t *, unsigned); -static void bind_lcn_to_dev (sdla_t *, netdevice_t *,unsigned); -static void setup_for_delayed_transmit (netdevice_t*, void*, unsigned); +static struct net_device *find_channel(sdla_t *card, unsigned lcn); +static void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn); +static void setup_for_delayed_transmit(struct net_device *dev, + void *buf, unsigned len); /*================================================= * X25 API Functions */ -static int wanpipe_pull_data_in_skb (sdla_t *, netdevice_t *, struct sk_buff **); +static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev, + struct sk_buff **); static void timer_intr_exec(sdla_t *, unsigned char); -static int execute_delayed_cmd (sdla_t*, netdevice_t *, mbox_cmd_t *,char); +static int execute_delayed_cmd(sdla_t *card, struct net_device *dev, + mbox_cmd_t *usr_cmd, char bad_cmd); static int api_incoming_call (sdla_t*, TX25Mbox *, int); static int alloc_and_init_skb_buf (sdla_t *,struct sk_buff **, int); -static void send_delayed_cmd_result(sdla_t *, netdevice_t *dev, TX25Mbox*); +static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev, + TX25Mbox* mbox); static int clear_confirm_event (sdla_t *, TX25Mbox*); -static void send_oob_msg (sdla_t *, netdevice_t *, TX25Mbox *); +static void send_oob_msg (sdla_t *card, struct net_device *dev, TX25Mbox *mbox); static int timer_intr_cmd_exec(sdla_t *card); static void api_oob_event (sdla_t *card,TX25Mbox *mbox); -static int check_bad_command (sdla_t *, netdevice_t *); -static int channel_disconnect (sdla_t*, netdevice_t *); +static int check_bad_command(sdla_t *card, struct net_device *dev); +static int channel_disconnect(sdla_t* card, struct net_device *dev); static void hdlc_link_down (sdla_t*); /*================================================= @@ -464,7 +471,9 @@ static int reply_udp( unsigned char *, unsigned int); static void init_x25_channel_struct( x25_channel_t *); static void init_global_statistics( sdla_t *); -static int store_udp_mgmt_pkt(int, char, sdla_t*, netdevice_t *, struct sk_buff *, int); +static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t *card, + struct net_device *dev, + struct sk_buff *skb, int lcn); static unsigned short calc_checksum (char *, int); @@ -895,7 +904,7 @@ * Return: 0 Ok * <0 Failed (channel will not be created) */ -static int new_if(struct wan_device* wandev, netdevice_t* dev, +static int new_if(struct wan_device* wandev, struct net_device* dev, wanif_conf_t* conf) { sdla_t* card = wandev->private; @@ -1030,7 +1039,7 @@ //FIXME Del IF Should be taken out now. -static int del_if(struct wan_device* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, struct net_device* dev) { return 0; } @@ -1096,7 +1105,7 @@ * * Return: 0 Ok : Void function. */ -static int if_init (netdevice_t* dev) +static int if_init(struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1168,7 +1177,7 @@ * <0 Failur: Interface will not come up. */ -static int if_open (netdevice_t* dev) +static int if_open(struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1261,7 +1270,7 @@ * Return: 0 Ok * <0 Failure: Interface will not exit properly. */ -static int if_close (netdevice_t* dev) +static int if_close(struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1319,8 +1328,9 @@ * Return: media header length. *======================================================================*/ -static int if_header (struct sk_buff* skb, netdevice_t* dev, - unsigned short type, void* daddr, void* saddr, unsigned len) +static int if_header(struct sk_buff* skb, struct net_device* dev, + unsigned short type, void* daddr, void* saddr, + unsigned len) { x25_channel_t* chan = dev->priv; int hdr_len = dev->hard_header_len; @@ -1345,7 +1355,7 @@ static int if_rebuild_hdr (struct sk_buff* skb) { - netdevice_t *dev = skb->dev; + struct net_device *dev = skb->dev; x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1358,7 +1368,7 @@ /*============================================================================ * Handle transmit timeout event from netif watchdog */ -static void if_tx_timeout (netdevice_t *dev) +static void if_tx_timeout(struct net_device *dev) { x25_channel_t* chan = dev->priv; sdla_t *card = chan->card; @@ -1395,7 +1405,7 @@ * *========================================================================*/ -static int if_send (struct sk_buff* skb, netdevice_t* dev) +static int if_send(struct sk_buff* skb, struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1528,8 +1538,8 @@ * interrupt. *===========================================================================*/ -static void setup_for_delayed_transmit (netdevice_t* dev, void* buf, - unsigned len) +static void setup_for_delayed_transmit(struct net_device* dev, void* buf, + unsigned len) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -1580,7 +1590,7 @@ * Return a pointer to struct enet_statistics. * *==============================================================*/ -static struct net_device_stats *if_stats (netdevice_t* dev) +static struct net_device_stats *if_stats(struct net_device* dev) { x25_channel_t *chan = dev->priv; @@ -1676,7 +1686,7 @@ { TX25Mbox* rxmb = card->rxmb; unsigned lcn = rxmb->cmd.lcn; - netdevice_t* dev = find_channel(card,lcn); + struct net_device* dev = find_channel(card,lcn); x25_channel_t* chan; struct sk_buff* skb=NULL; @@ -1774,7 +1784,8 @@ } -static int wanpipe_pull_data_in_skb (sdla_t *card, netdevice_t *dev, struct sk_buff **skb) +static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev, + struct sk_buff **skb) { void *bufptr; TX25Mbox* rxmb = card->rxmb; @@ -1884,7 +1895,7 @@ static void tx_intr (sdla_t* card) { - netdevice_t *dev; + struct net_device *dev; TX25Status* status = card->flags; unsigned char more_to_tx=0; x25_channel_t *chan=NULL; @@ -1978,14 +1989,13 @@ *===============================================================*/ -netdevice_t * move_dev_to_next (sdla_t *card, netdevice_t *dev) +struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev) { if (card->u.x.no_dev != 1){ - if (*((netdevice_t**)dev->priv) == NULL){ + if (!*((struct net_device **)dev->priv)) return card->wandev.dev; - }else{ - return *((netdevice_t**)dev->priv); - } + else + return *((struct net_device **)dev->priv); } return dev; } @@ -1996,7 +2006,7 @@ * *===============================================================*/ -static int tx_intr_send(sdla_t *card, netdevice_t *dev) +static int tx_intr_send(sdla_t *card, struct net_device *dev) { x25_channel_t* chan = dev->priv; @@ -2059,7 +2069,7 @@ }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_ACTIVE) { - netdevice_t *dev = card->u.x.poll_device; + struct net_device *dev = card->u.x.poll_device; x25_channel_t *chan = NULL; if (!dev){ @@ -2080,7 +2090,7 @@ wanpipe_set_state(card, WAN_CONNECTED); if (card->u.x.LAPB_hdlc){ - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; set_chan_state(dev,WAN_CONNECTED); send_delayed_cmd_result(card,dev,card->mbox); } @@ -2136,7 +2146,7 @@ TX25Mbox* mbox = card->mbox; TX25ModemStatus *modem_status; - netdevice_t *dev; + struct net_device *dev; x25_channel_t *chan; int err; @@ -2165,7 +2175,8 @@ mbox->cmd.result = 0x08; /* Send a OOB to all connected sockets */ - for (dev = card->wandev.dev; dev; dev = *((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device**)dev->priv)) { chan=dev->priv; if (chan->common.usedby == API){ send_oob_msg(card,dev,mbox); @@ -2295,7 +2306,7 @@ static void poll_disconnected (sdla_t* card) { - netdevice_t *dev; + struct net_device *dev; x25_channel_t *chan; TX25Status* status = card->flags; @@ -2332,10 +2343,11 @@ static void poll_active (sdla_t* card) { - netdevice_t* dev; + struct net_device* dev; TX25Status* status = card->flags; - for (dev = card->wandev.dev; dev; dev = *((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)){ x25_channel_t* chan = dev->priv; /* If SVC has been idle long enough, close virtual circuit */ @@ -3104,7 +3116,7 @@ { struct wan_device* wandev = &card->wandev; int new_lcn = mb->cmd.lcn; - netdevice_t* dev = get_dev_by_lcn(wandev, new_lcn); + struct net_device* dev = get_dev_by_lcn(wandev, new_lcn); x25_channel_t* chan = NULL; int accept = 0; /* set to '1' if o.k. to accept call */ unsigned int user_data; @@ -3156,7 +3168,7 @@ user_data = hex_to_uint(info->user,2); /* Find available channel */ - for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv)){ + for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) { chan = dev->priv; if (chan->common.usedby == API) @@ -3253,7 +3265,7 @@ static int call_accepted (sdla_t* card, int cmd, int lcn, TX25Mbox* mb) { unsigned new_lcn = mb->cmd.lcn; - netdevice_t* dev = find_channel(card, new_lcn); + struct net_device* dev = find_channel(card, new_lcn); x25_channel_t* chan; if (dev == NULL){ @@ -3293,7 +3305,7 @@ static int call_cleared (sdla_t* card, int cmd, int lcn, TX25Mbox* mb) { unsigned new_lcn = mb->cmd.lcn; - netdevice_t* dev = find_channel(card, new_lcn); + struct net_device* dev = find_channel(card, new_lcn); x25_channel_t *chan; unsigned char old_state; @@ -3338,7 +3350,7 @@ static int restart_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb) { struct wan_device* wandev = &card->wandev; - netdevice_t* dev; + struct net_device* dev; x25_channel_t *chan; unsigned char old_state; @@ -3347,7 +3359,7 @@ card->devname, mb->cmd.cause, mb->cmd.diagn); /* down all logical channels */ - for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv)){ + for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) { chan=dev->priv; old_state = chan->common.state; @@ -3378,7 +3390,7 @@ if (mb->cmd.pktType == 0x05) /* call request time out */ { - netdevice_t* dev = find_channel(card,new_lcn); + struct net_device* dev = find_channel(card,new_lcn); printk(KERN_INFO "%s: X.25 call timed timeout on LCN %d!\n", card->devname, new_lcn); @@ -3448,11 +3460,12 @@ * Find network device by its channel number. */ -static netdevice_t* get_dev_by_lcn(struct wan_device* wandev, unsigned lcn) +static struct net_device* get_dev_by_lcn(struct wan_device* wandev, + unsigned lcn) { - netdevice_t* dev; + struct net_device* dev; - for (dev = wandev->dev; dev; dev = *((netdevice_t**)dev->priv)) + for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) if (((x25_channel_t*)dev->priv)->common.lcn == lcn) break; return dev; @@ -3468,7 +3481,7 @@ * <0 failure */ -static int chan_connect (netdevice_t* dev) +static int chan_connect(struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -3501,7 +3514,7 @@ * o if SVC then clear X.25 call */ -static int chan_disc (netdevice_t* dev) +static int chan_disc(struct net_device* dev) { x25_channel_t* chan = dev->priv; @@ -3524,7 +3537,7 @@ * Set logical channel state. */ -static void set_chan_state (netdevice_t* dev, int state) +static void set_chan_state(struct net_device* dev, int state) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -3614,7 +3627,8 @@ * to the router. */ -static int chan_send (netdevice_t* dev, void* buff, unsigned data_len, unsigned char tx_intr) +static int chan_send(struct net_device* dev, void* buff, unsigned data_len, + unsigned char tx_intr) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -4081,7 +4095,7 @@ *===============================================================*/ -netdevice_t * find_channel(sdla_t *card, unsigned lcn) +struct net_device *find_channel(sdla_t *card, unsigned lcn) { if (card->u.x.LAPB_hdlc){ @@ -4128,7 +4142,7 @@ } } -void bind_lcn_to_dev (sdla_t *card, netdevice_t *dev,unsigned lcn) +void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn) { x25_channel_t *chan = dev->priv; @@ -4155,7 +4169,7 @@ * *==============================================================*/ -static void x25api_bh (netdevice_t * dev) +static void x25api_bh(struct net_device* dev) { x25_channel_t* chan = dev->priv; sdla_t* card = chan->card; @@ -4231,7 +4245,7 @@ * *==============================================================*/ -static int x25api_bh_cleanup (netdevice_t *dev) +static int x25api_bh_cleanup(struct net_device *dev) { x25_channel_t* chan = dev->priv; sdla_t *card = chan->card; @@ -4270,7 +4284,7 @@ * *==============================================================*/ -static int bh_enqueue (netdevice_t *dev, struct sk_buff *skb) +static int bh_enqueue(struct net_device *dev, struct sk_buff *skb) { x25_channel_t* chan = dev->priv; sdla_t *card = chan->card; @@ -4310,7 +4324,7 @@ static int timer_intr_cmd_exec (sdla_t* card) { - netdevice_t *dev; + struct net_device *dev; unsigned char more_to_exec=0; volatile x25_channel_t *chan=NULL; int i=0,bad_cmd=0,err=0; @@ -4437,7 +4451,8 @@ * *===============================================================*/ -static int execute_delayed_cmd (sdla_t* card, netdevice_t *dev, mbox_cmd_t *usr_cmd,char bad_cmd) +static int execute_delayed_cmd(sdla_t* card, struct net_device *dev, + mbox_cmd_t *usr_cmd, char bad_cmd) { TX25Mbox* mbox = card->mbox; int err; @@ -4670,7 +4685,8 @@ * the result to a waiting sock. * *===============================================================*/ -static void send_delayed_cmd_result(sdla_t *card, netdevice_t *dev, TX25Mbox* mbox) +static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev, + TX25Mbox* mbox) { x25_channel_t *chan = dev->priv; mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox; @@ -4725,7 +4741,7 @@ static int clear_confirm_event (sdla_t *card, TX25Mbox* mb) { - netdevice_t *dev; + struct net_device *dev; x25_channel_t *chan; unsigned char old_state; @@ -4773,7 +4789,7 @@ * *===============================================================*/ -static void send_oob_msg (sdla_t *card, netdevice_t *dev, TX25Mbox *mbox) +static void send_oob_msg(sdla_t *card, struct net_device *dev, TX25Mbox *mbox) { x25_channel_t *chan = dev->priv; mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox; @@ -4871,7 +4887,7 @@ static void api_oob_event (sdla_t *card,TX25Mbox *mbox) { - netdevice_t *dev = find_channel(card,mbox->cmd.lcn); + struct net_device *dev = find_channel(card, mbox->cmd.lcn); x25_channel_t *chan; if (!dev) @@ -4887,7 +4903,7 @@ -static int channel_disconnect (sdla_t* card, netdevice_t *dev) +static int channel_disconnect(sdla_t* card, struct net_device *dev) { int err; @@ -4961,7 +4977,7 @@ } -static int check_bad_command (sdla_t* card, netdevice_t *dev) +static int check_bad_command(sdla_t* card, struct net_device *dev) { x25_channel_t *chan = dev->priv; int bad_cmd = 0; @@ -5014,7 +5030,7 @@ TX25Mbox *mbox = card->mbox; int err; int udp_mgmt_req_valid = 1; - netdevice_t *dev; + struct net_device *dev; x25_channel_t *chan; unsigned short lcn; struct timeval tv; @@ -5338,7 +5354,8 @@ */ static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t* card, - netdevice_t *dev, struct sk_buff *skb, int lcn) + struct net_device *dev, struct sk_buff *skb, + int lcn) { int udp_pkt_stored = 0; diff -Nru a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c --- a/drivers/net/wan/sdlamain.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/sdlamain.c Thu May 15 18:49:30 2003 @@ -64,8 +64,6 @@ #include #include -#define netdevice_t struct net_device - #include /* kernel <-> user copy */ #include @@ -1255,7 +1253,7 @@ } } -void wakeup_sk_bh (netdevice_t *dev) +void wakeup_sk_bh(struct net_device *dev) { wanpipe_common_t *chan = dev->priv; @@ -1268,7 +1266,7 @@ } } -int change_dev_flags (netdevice_t *dev, unsigned flags) +int change_dev_flags(struct net_device *dev, unsigned flags) { struct ifreq if_info; mm_segment_t fs = get_fs(); @@ -1285,7 +1283,7 @@ return err; } -unsigned long get_ip_address (netdevice_t *dev, int option) +unsigned long get_ip_address(struct net_device *dev, int option) { struct in_ifaddr *ifaddr; @@ -1323,7 +1321,7 @@ return 0; } -void add_gateway(sdla_t *card, netdevice_t *dev) +void add_gateway(sdla_t *card, struct net_device *dev) { mm_segment_t oldfs; struct rtentry route; diff -Nru a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c --- a/drivers/net/wan/wanpipe_multppp.c Thu May 15 18:49:30 2003 +++ b/drivers/net/wan/wanpipe_multppp.c Thu May 15 18:49:30 2003 @@ -131,18 +131,18 @@ /****** Function Prototypes *************************************************/ /* WAN link driver entry points. These are called by the WAN router module. */ static int update(struct wan_device* wandev); -static int new_if(struct wan_device* wandev, netdevice_t* dev, - wanif_conf_t* conf); -static int del_if(struct wan_device* wandev, netdevice_t* dev); +static int new_if(struct wan_device* wandev, struct net_device* dev, + wanif_conf_t* conf); +static int del_if(struct wan_device* wandev, struct net_device* dev); /* Network device interface */ -static int if_init (netdevice_t* dev); -static int if_open (netdevice_t* dev); -static int if_close (netdevice_t* dev); -static int if_send (struct sk_buff* skb, netdevice_t* dev); -static struct net_device_stats* if_stats (netdevice_t* dev); +static int if_init(struct net_device* dev); +static int if_open(struct net_device* dev); +static int if_close(struct net_device* dev); +static int if_send(struct sk_buff* skb, struct net_device* dev); +static struct net_device_stats* if_stats(struct net_device* dev); -static void if_tx_timeout (netdevice_t *dev); +static void if_tx_timeout(struct net_device *dev); /* CHDLC Firmware interface functions */ static int chdlc_configure (sdla_t* card, void* data); @@ -158,7 +158,7 @@ /* Miscellaneous CHDLC Functions */ static int set_chdlc_config (sdla_t* card); -static void init_chdlc_tx_rx_buff( sdla_t* card, netdevice_t *dev ); +static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev); static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb); static int process_chdlc_exception(sdla_t *card); static int process_global_exception(sdla_t *card); @@ -176,14 +176,14 @@ static int intr_test( sdla_t* card); static int udp_pkt_type( struct sk_buff *skb , sdla_t* card); static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, - chdlc_private_area_t* chdlc_priv_area); -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, + struct sk_buff *skb, struct net_device* dev, + chdlc_private_area_t* chdlc_priv_area); +static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev, chdlc_private_area_t* chdlc_priv_area); static unsigned short calc_checksum (char *, int); static void s508_lock (sdla_t *card, unsigned long *smp_flags); static void s508_unlock (sdla_t *card, unsigned long *smp_flags); -static void send_ppp_term_request (netdevice_t*); +static void send_ppp_term_request(struct net_device *dev); static int Intr_test_counter; @@ -459,7 +459,7 @@ static int update(struct wan_device* wandev) { sdla_t* card = wandev->private; - netdevice_t* dev; + struct net_device* dev; volatile chdlc_private_area_t* chdlc_priv_area; SHARED_MEMORY_INFO_STRUCT *flags; unsigned long timeout; @@ -522,12 +522,12 @@ * Return: 0 o.k. * < 0 failure (channel will not be created) */ -static int new_if(struct wan_device* wandev, netdevice_t* pdev, +static int new_if(struct wan_device* wandev, struct net_device* pdev, wanif_conf_t* conf) { struct ppp_device *pppdev = (struct ppp_device *)pdev; - netdevice_t *dev=NULL; + struct net_device *dev = NULL; struct sppp *sp; sdla_t* card = wandev->private; chdlc_private_area_t* chdlc_priv_area; @@ -617,7 +617,7 @@ /*============================================================================ * Delete logical channel. */ -static int del_if(struct wan_device* wandev, netdevice_t* dev) +static int del_if(struct wan_device* wandev, struct net_device* dev) { chdlc_private_area_t *chdlc_priv_area = dev->priv; sdla_t *card = chdlc_priv_area->card; @@ -652,8 +652,8 @@ * interface registration. Returning anything but zero will fail interface * registration. */ -static int if_init (netdevice_t* dev) - { +static int if_init(struct net_device* dev) +{ chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; struct wan_device* wandev = &card->wandev; @@ -695,7 +695,7 @@ /*============================================================================ * Handle transmit timeout event from netif watchdog */ -static void if_tx_timeout (netdevice_t *dev) +static void if_tx_timeout(struct net_device *dev) { chdlc_private_area_t* chan = dev->priv; sdla_t *card = chan->card; @@ -720,7 +720,7 @@ * * Return 0 if O.k. or errno. */ -static int if_open (netdevice_t* dev) +static int if_open(struct net_device* dev) { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; @@ -753,7 +753,7 @@ * o if this is the last close, then disable communications and interrupts. * o reset flags. */ -static int if_close (netdevice_t* dev) +static int if_close(struct net_device* dev) { chdlc_private_area_t* chdlc_priv_area = dev->priv; sdla_t* card = chdlc_priv_area->card; @@ -784,7 +784,7 @@ * 2. Setting tbusy flag will inhibit further transmit requests from the * protocol stack and can be used for flow control with protocol layer. */ -static int if_send (struct sk_buff* skb, netdevice_t* dev) +static int if_send(struct sk_buff* skb, struct net_device* dev) { chdlc_private_area_t *chdlc_priv_area = dev->priv; sdla_t *card = chdlc_priv_area->card; @@ -974,7 +974,7 @@ * Get ethernet-style interface statistics. * Return a pointer to struct enet_statistics. */ -static struct net_device_stats* if_stats (netdevice_t* dev) +static struct net_device_stats* if_stats(struct net_device* dev) { sdla_t *my_card; chdlc_private_area_t* chdlc_priv_area; @@ -1243,7 +1243,7 @@ */ STATIC void wsppp_isr (sdla_t* card) { - netdevice_t* dev; + struct net_device* dev; SHARED_MEMORY_INFO_STRUCT* flags = NULL; int i; sdla_t *my_card; @@ -1356,7 +1356,7 @@ */ static void rx_intr (sdla_t* card) { - netdevice_t *dev; + struct net_device *dev; chdlc_private_area_t *chdlc_priv_area; SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags; CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb; @@ -1478,7 +1478,7 @@ */ void timer_intr(sdla_t *card) { - netdevice_t* dev; + struct net_device* dev; chdlc_private_area_t* chdlc_priv_area = NULL; SHARED_MEMORY_INFO_STRUCT* flags = NULL; @@ -1666,8 +1666,8 @@ */ static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, - struct sk_buff *skb, netdevice_t* dev, - chdlc_private_area_t* chdlc_priv_area ) + struct sk_buff *skb, struct net_device* dev, + chdlc_private_area_t* chdlc_priv_area ) { int udp_pkt_stored = 0; @@ -1693,7 +1693,7 @@ * Process UDP management packet. */ -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, +static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev, chdlc_private_area_t* chdlc_priv_area ) { unsigned char *buf; @@ -2077,7 +2077,7 @@ * Initialize Receive and Transmit Buffers. */ -static void init_chdlc_tx_rx_buff( sdla_t* card, netdevice_t *dev ) +static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev) { CHDLC_MAILBOX_STRUCT* mb = card->mbox; CHDLC_TX_STATUS_EL_CFG_STRUCT *tx_config; @@ -2214,7 +2214,7 @@ */ static void port_set_state (sdla_t *card, int state) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; chdlc_private_area_t *chdlc_priv_area = dev->priv; if (card->u.c.state != state) @@ -2285,7 +2285,7 @@ static int config_chdlc (sdla_t *card) { - netdevice_t *dev = card->wandev.dev; + struct net_device *dev = card->wandev.dev; SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags; if (card->u.c.comm_enabled){ @@ -2331,7 +2331,7 @@ } -static void send_ppp_term_request (netdevice_t *dev) +static void send_ppp_term_request(struct net_device *dev) { struct sk_buff *new_skb; unsigned char *buf; diff -Nru a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h --- a/include/linux/if_wanpipe.h Thu May 15 18:49:30 2003 +++ b/include/linux/if_wanpipe.h Thu May 15 18:49:30 2003 @@ -101,16 +101,12 @@ #ifdef __KERNEL__ -#ifndef netdevice_t -#define netdevice_t struct net_device -#endif - /* Private wanpipe socket structures. */ struct wanpipe_opt { void *mbox; /* Mail box */ void *card; /* Card bouded to */ - netdevice_t *dev; /* Bounded device */ + struct net_device *dev; /* Bounded device */ unsigned short lcn; /* Binded LCN */ unsigned char svc; /* 0=pvc, 1=svc */ unsigned char timer; /* flag for delayed transmit*/ diff -Nru a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h --- a/include/linux/if_wanpipe_common.h Thu May 15 18:49:30 2003 +++ b/include/linux/if_wanpipe_common.h Thu May 15 18:49:30 2003 @@ -19,11 +19,8 @@ #include -#define netdevice_t struct net_device - - typedef struct { - netdevice_t *slave; + struct net_device *slave; atomic_t packet_sent; atomic_t receive_block; atomic_t command; @@ -32,8 +29,8 @@ long common_critical; struct timer_list *tx_timer; struct sock *sk; /* Wanpipe Sock bind's here */ - int (*func) (struct sk_buff *, netdevice_t *, - struct sock *); + int (*func)(struct sk_buff *skb, struct net_device *dev, + struct sock *sk); struct work_struct wanpipe_work; /* deferred keventd work */ unsigned char rw_bind; /* Sock bind state */ diff -Nru a/include/linux/wanpipe.h b/include/linux/wanpipe.h --- a/include/linux/wanpipe.h Thu May 15 18:49:30 2003 +++ b/include/linux/wanpipe.h Thu May 15 18:49:30 2003 @@ -39,8 +39,6 @@ #ifndef _WANPIPE_H #define _WANPIPE_H -#define netdevice_t struct net_device - #include /* Defines */ @@ -335,22 +333,22 @@ u32 hi_pvc; u32 lo_svc; u32 hi_svc; - netdevice_t *svc_to_dev_map[MAX_X25_LCN]; - netdevice_t *pvc_to_dev_map[MAX_X25_LCN]; - netdevice_t *tx_dev; - netdevice_t *cmd_dev; + struct net_device *svc_to_dev_map[MAX_X25_LCN]; + struct net_device *pvc_to_dev_map[MAX_X25_LCN]; + struct net_device *tx_dev; + struct net_device *cmd_dev; u32 no_dev; volatile u8 *hdlc_buf_status; u32 tx_interrupts_pending; u16 timer_int_enabled; - netdevice_t *poll_device; + struct net_device *poll_device; atomic_t command_busy; u16 udp_pkt_lgth; u32 udp_type; u8 udp_pkt_src; u32 udp_lcn; - netdevice_t * udp_dev; + struct net_device *udp_dev; s8 udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT]; u8 LAPB_hdlc; /* Option to turn off X25 and run only LAPB */ @@ -369,7 +367,7 @@ unsigned rx_top; /* S508 receive buffer end */ unsigned short node_dlci[100]; unsigned short dlci_num; - netdevice_t *dlci_to_dev_map[991 + 1]; + struct net_device *dlci_to_dev_map[991 + 1]; unsigned tx_interrupts_pending; unsigned short timer_int_enabled; unsigned short udp_pkt_lgth; @@ -382,7 +380,7 @@ void *curr_trc_el; /* current trace element */ unsigned short trc_bfr_space; /* trace buffer space */ unsigned char update_comms_stats; - netdevice_t *arp_dev; + struct net_device *arp_dev; spinlock_t if_send_lock; } f; struct /****** PPP-specific data ***********/ @@ -483,10 +481,10 @@ extern void wanpipe_queue_work (struct work_struct *); extern void wanpipe_mark_bh (void); -extern void wakeup_sk_bh (netdevice_t *); -extern int change_dev_flags (netdevice_t *, unsigned); -extern unsigned long get_ip_address (netdevice_t *dev, int option); -extern void add_gateway(sdla_t *, netdevice_t *); +extern void wakeup_sk_bh(struct net_device *dev); +extern int change_dev_flags(struct net_device *dev, unsigned flags); +extern unsigned long get_ip_address(struct net_device *dev, int option); +extern void add_gateway(sdla_t *card, struct net_device *dev); #endif /* __KERNEL__ */ diff -Nru a/include/linux/wanrouter.h b/include/linux/wanrouter.h --- a/include/linux/wanrouter.h Thu May 15 18:49:30 2003 +++ b/include/linux/wanrouter.h Thu May 15 18:49:30 2003 @@ -44,8 +44,6 @@ * Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). *****************************************************************************/ -#define netdevice_t struct net_device - #include /* Support for SMP Locking */ #ifndef _ROUTER_H @@ -505,12 +503,12 @@ int (*update) (struct wan_device *wandev); int (*ioctl) (struct wan_device *wandev, unsigned cmd, unsigned long arg); - int (*new_if) (struct wan_device *wandev, netdevice_t *dev, - wanif_conf_t *conf); - int (*del_if) (struct wan_device *wandev, netdevice_t *dev); + int (*new_if)(struct wan_device *wandev, struct net_device *dev, + wanif_conf_t *conf); + int (*del_if)(struct wan_device *wandev, struct net_device *dev); /****** maintained by the router ****/ struct wan_device* next; /* -> next device */ - netdevice_t* dev; /* list of network interfaces */ + struct net_device* dev; /* list of network interfaces */ unsigned ndev; /* number of interfaces */ struct proc_dir_entry *dent; /* proc filesystem entry */ }; @@ -518,8 +516,10 @@ /* Public functions available for device drivers */ extern int register_wan_device(struct wan_device *wandev); extern int unregister_wan_device(char *name); -unsigned short wanrouter_type_trans(struct sk_buff *skb, netdevice_t *dev); -int wanrouter_encapsulate(struct sk_buff *skb, netdevice_t *dev,unsigned short type); +unsigned short wanrouter_type_trans(struct sk_buff *skb, + struct net_device *dev); +int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, + unsigned short type); /* Proc interface functions. These must not be called by the drivers! */ extern int wanrouter_proc_init(void); diff -Nru a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c --- a/net/wanrouter/af_wanpipe.c Thu May 15 18:49:30 2003 +++ b/net/wanrouter/af_wanpipe.c Thu May 15 18:49:30 2003 @@ -170,7 +170,7 @@ { void *mbox; /* Mail box */ void *card; /* Card bouded to */ - netdevice_t *dev; /* Bounded device */ + struct net_device *dev; /* Bounded device */ unsigned short lcn; /* Binded LCN */ unsigned char svc; /* 0=pvc, 1=svc */ unsigned char timer; /* flag for delayed transmit*/ @@ -185,25 +185,26 @@ extern struct proto_ops wanpipe_ops; static unsigned long find_free_critical; -static void wanpipe_unlink_driver (struct sock *); -static void wanpipe_link_driver (netdevice_t *,struct sock *sk); +static void wanpipe_unlink_driver(struct sock *sk); +static void wanpipe_link_driver(struct net_device *dev, struct sock *sk); static void wanpipe_wakeup_driver(struct sock *sk); static int execute_command(struct sock *, unsigned char, unsigned int); -static int check_dev (netdevice_t *, sdla_t *); -netdevice_t * wanpipe_find_free_dev (sdla_t *); +static int check_dev(struct net_device *dev, sdla_t *card); +struct net_device *wanpipe_find_free_dev(sdla_t *card); static void wanpipe_unlink_card (struct sock *); static int wanpipe_link_card (struct sock *); static struct sock *wanpipe_make_new(struct sock *); static struct sock *wanpipe_alloc_socket(void); -static inline int get_atomic_device (netdevice_t *); +static inline int get_atomic_device(struct net_device *dev); static int wanpipe_exec_cmd(struct sock *, int, unsigned int); static int get_ioctl_cmd (struct sock *, void *); static int set_ioctl_cmd (struct sock *, void *); -static void release_device (netdevice_t *); +static void release_device(struct net_device *dev); static void wanpipe_kill_sock_timer (unsigned long data); static void wanpipe_kill_sock_irq (struct sock *); static void wanpipe_kill_sock_accept (struct sock *); -static int wanpipe_do_bind(struct sock *, netdevice_t *, int); +static int wanpipe_do_bind(struct sock *sk, struct net_device *dev, + int protocol); struct sock * get_newsk_from_skb (struct sk_buff *); static int wanpipe_debug (struct sock *, void *); static void wanpipe_delayed_transmit (unsigned long data); @@ -225,7 +226,8 @@ * WANPIPE driver private. *===========================================================*/ -static int wanpipe_rcv(struct sk_buff *skb, netdevice_t *dev, struct sock *sk) +static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, + struct sock *sk) { struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb; wanpipe_common_t *chan = dev->priv; @@ -323,7 +325,7 @@ wanpipe_opt *wp = wp_sk(sk), *newwp; struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb; struct sock *newsk; - netdevice_t *dev; + struct net_device *dev; sdla_t *card; mbox_cmd_t *mbox_ptr; wanpipe_common_t *chan; @@ -539,7 +541,7 @@ struct sock *sk = sock->sk; struct wan_sockaddr_ll *saddr=(struct wan_sockaddr_ll *)msg->msg_name; struct sk_buff *skb; - netdevice_t *dev; + struct net_device *dev; unsigned short proto; unsigned char *addr; int ifindex, err, reserve = 0; @@ -664,7 +666,7 @@ struct sock *sk=(struct sock *)data; struct sk_buff *skb; wanpipe_opt *wp = wp_sk(sk); - netdevice_t *dev = wp->dev; + struct net_device *dev = wp->dev; sdla_t *card = (sdla_t*)wp->card; if (!card || !dev){ @@ -756,7 +758,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int flags) { wanpipe_opt *wp = wp_sk(sk); - netdevice_t *dev; + struct net_device *dev; wanpipe_common_t *chan=NULL; int err=0; DECLARE_WAITQUEUE(wait, current); @@ -861,7 +863,7 @@ *===========================================================*/ static void wanpipe_unlink_driver (struct sock *sk) { - netdevice_t *dev; + struct net_device *dev; wanpipe_common_t *chan=NULL; sk->zapped=0; @@ -901,7 +903,7 @@ * data up the socket. *===========================================================*/ -static void wanpipe_link_driver (netdevice_t *dev, struct sock *sk) +static void wanpipe_link_driver(struct net_device *dev, struct sock *sk) { wanpipe_opt *wp = wp_sk(sk); wanpipe_common_t *chan = dev->priv; @@ -926,7 +928,7 @@ *===========================================================*/ -static void release_device (netdevice_t *dev) +static void release_device(struct net_device *dev) { wanpipe_common_t *chan=dev->priv; clear_bit(0,(void*)&chan->rw_bind); @@ -965,7 +967,7 @@ if (wp->num == htons(X25_PROT) && sk->state != WANSOCK_DISCONNECTED && sk->zapped) { - netdevice_t *dev = dev_get_by_index(sk->bound_dev_if); + struct net_device *dev = dev_get_by_index(sk->bound_dev_if); wanpipe_common_t *chan; if (dev){ chan=dev->priv; @@ -1153,7 +1155,7 @@ if (wp_sk(sk)->num == htons(X25_PROT) && sk->state != WANSOCK_DISCONNECTED){ - netdevice_t *dev = dev_get_by_index(sk->bound_dev_if); + struct net_device *dev = dev_get_by_index(sk->bound_dev_if); wanpipe_common_t *chan; if (dev){ chan=dev->priv; @@ -1268,7 +1270,8 @@ * sock to the driver. *===========================================================*/ -static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol) +static int wanpipe_do_bind(struct sock *sk, struct net_device *dev, + int protocol) { wanpipe_opt *wp = wp_sk(sk); wanpipe_common_t *chan=NULL; @@ -1341,7 +1344,7 @@ struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr; struct sock *sk=sock->sk; wanpipe_opt *wp = wp_sk(sk); - netdevice_t *dev = NULL; + struct net_device *dev = NULL; sdla_t *card=NULL; char name[15]; @@ -1436,7 +1439,7 @@ *===========================================================*/ -static inline int get_atomic_device (netdevice_t *dev) +static inline int get_atomic_device(struct net_device *dev) { wanpipe_common_t *chan = dev->priv; if (!test_and_set_bit(0,(void *)&chan->rw_bind)){ @@ -1451,11 +1454,12 @@ * Check that device name belongs to a particular card. *===========================================================*/ -static int check_dev (netdevice_t *dev, sdla_t *card) +static int check_dev(struct net_device *dev, sdla_t *card) { - netdevice_t* tmp_dev; + struct net_device* tmp_dev; - for (tmp_dev = card->wandev.dev; tmp_dev; tmp_dev=*((netdevice_t**)tmp_dev->priv)){ + for (tmp_dev = card->wandev.dev; tmp_dev; + tmp_dev = *((struct net_device **)tmp_dev->priv)) { if (tmp_dev->ifindex == dev->ifindex){ return 0; } @@ -1471,16 +1475,17 @@ * X25API Specific. *===========================================================*/ -netdevice_t * wanpipe_find_free_dev (sdla_t *card) +struct net_device *wanpipe_find_free_dev(sdla_t *card) { - netdevice_t* dev; + struct net_device* dev; volatile wanpipe_common_t *chan; if (test_and_set_bit(0,&find_free_critical)){ printk(KERN_INFO "CRITICAL in Find Free\n"); } - for (dev = card->wandev.dev; dev; dev=*((netdevice_t**)dev->priv)){ + for (dev = card->wandev.dev; dev; + dev = *((struct net_device **)dev->priv)) { chan = dev->priv; if (!chan) continue; @@ -1646,7 +1651,7 @@ static void wanpipe_wakeup_driver(struct sock *sk) { - netdevice_t *dev=NULL; + struct net_device *dev = NULL; wanpipe_common_t *chan=NULL; dev = dev_get_by_index(sk->bound_dev_if); @@ -1680,7 +1685,7 @@ static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { - netdevice_t *dev; + struct net_device *dev; struct sock *sk = sock->sk; struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr; @@ -1718,7 +1723,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void *data) { struct sock *sk; - netdevice_t *dev = (netdevice_t*)data; + struct net_device *dev = (struct net_device *)data; struct wanpipe_opt *po; for (sk = wanpipe_sklist; sk; sk = sk->next) { @@ -1867,7 +1872,7 @@ static int wanpipe_debug (struct sock *origsk, void *arg) { struct sock *sk=NULL; - netdevice_t *dev=NULL; + struct net_device *dev = NULL; wanpipe_common_t *chan=NULL; int cnt=0, err=0; wan_debug_t *dbg_data = (wan_debug_t *)arg; @@ -2010,7 +2015,7 @@ if (!wp_sk(sk)->mbox) { void *mbox_ptr; - netdevice_t *dev = dev_get_by_index(sk->bound_dev_if); + struct net_device *dev = dev_get_by_index(sk->bound_dev_if); if (!dev) return -ENODEV; @@ -2351,7 +2356,7 @@ static int check_driver_busy (struct sock *sk) { - netdevice_t *dev = dev_get_by_index(sk->bound_dev_if); + struct net_device *dev = dev_get_by_index(sk->bound_dev_if); wanpipe_common_t *chan; if (!dev) @@ -2456,7 +2461,7 @@ struct sock * get_newsk_from_skb (struct sk_buff *skb) { - netdevice_t *dev = skb->dev; + struct net_device *dev = skb->dev; wanpipe_common_t *chan; if (!dev){ @@ -2486,7 +2491,7 @@ { struct sock *sk = sock->sk; struct wan_sockaddr_ll *addr = (struct wan_sockaddr_ll*)uaddr; - netdevice_t *dev; + struct net_device *dev; int err; if (wp_sk(sk)->num != htons(X25_PROT)) diff -Nru a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c --- a/net/wanrouter/wanmain.c Thu May 15 18:49:30 2003 +++ b/net/wanrouter/wanmain.c Thu May 15 18:49:30 2003 @@ -363,8 +363,8 @@ */ -int wanrouter_encapsulate (struct sk_buff *skb, netdevice_t *dev, - unsigned short type) +int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, + unsigned short type) { int hdr_len = 0; @@ -406,7 +406,7 @@ */ -unsigned short wanrouter_type_trans (struct sk_buff *skb, netdevice_t *dev) +unsigned short wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev) { int cnt = skb->data[0] ? 0 : 1; /* there may be a pad present */ unsigned short ethertype; @@ -597,7 +597,7 @@ static int device_shutdown(struct wan_device *wandev) { - netdevice_t *dev; + struct net_device *dev; int err=0; if (wandev->state == WAN_UNCONFIGURED) @@ -661,7 +661,7 @@ static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf) { wanif_conf_t conf; - netdevice_t *dev=NULL; + struct net_device *dev = NULL; #ifdef CONFIG_WANPIPE_MULTPPP struct ppp_device *pppdev=NULL; #endif @@ -682,13 +682,14 @@ if (pppdev == NULL) return -ENOBUFS; memset(pppdev, 0, sizeof(struct ppp_device)); - pppdev->dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL); + pppdev->dev = kmalloc(sizeof(struct net_device), GFP_KERNEL); if (pppdev->dev == NULL) { kfree(pppdev); return -ENOBUFS; } - memset(pppdev->dev, 0, sizeof(netdevice_t)); - err = wandev->new_if(wandev, (netdevice_t *)pppdev, &conf); + memset(pppdev->dev, 0, sizeof(struct net_device)); + err = wandev->new_if(wandev, + (struct net_device *)pppdev, &conf); dev = pppdev->dev; #else printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n", @@ -696,10 +697,10 @@ return -EPROTONOSUPPORT; #endif } else { - dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL); + dev = kmalloc(sizeof(struct net_device), GFP_KERNEL); if (dev == NULL) return -ENOBUFS; - memset(dev, 0, sizeof(netdevice_t)); + memset(dev, 0, sizeof(struct net_device)); err = wandev->new_if(wandev, dev, &conf); } @@ -722,7 +723,7 @@ err = register_netdev(dev); if (!err) { - netdevice_t *slave=NULL; + struct net_device *slave = NULL; unsigned long smp_flags=0; lock_adapter_irq(&wandev->lock, &smp_flags); @@ -731,10 +732,10 @@ wandev->dev = dev; } else { for (slave=wandev->dev; - *((netdevice_t**)slave->priv); - slave=*((netdevice_t**)slave->priv)); + *((struct net_device **)slave->priv); + slave = *((struct net_device **)slave->priv)); - *((netdevice_t**)slave->priv) = dev; + *((struct net_device **)slave->priv) = dev; } ++wandev->ndev; @@ -843,14 +844,14 @@ static int delete_interface(struct wan_device *wandev, char *name) { - netdevice_t *dev=NULL, *prev=NULL; + struct net_device *dev = NULL, *prev = NULL; unsigned long smp_flags=0; lock_adapter_irq(&wandev->lock, &smp_flags); dev = wandev->dev; prev = NULL; while (dev && strcmp(name, dev->name)) { - netdevice_t **slave = dev->priv; + struct net_device **slave = dev->priv; prev = dev; dev = *slave; } @@ -867,12 +868,12 @@ lock_adapter_irq(&wandev->lock, &smp_flags); if (prev) { - netdevice_t **prev_slave = prev->priv; - netdevice_t **slave = dev->priv; + struct net_device **prev_slave = prev->priv; + struct net_device **slave = dev->priv; *prev_slave = *slave; } else { - netdevice_t **slave = dev->priv; + struct net_device **slave = dev->priv; wandev->dev = *slave; } --wandev->ndev; =================================================================== This BitKeeper patch contains the following changesets: 1.1145 ## Wrapped with gzip_uu ## M'XL( &H+Q#X ]T]:W/;R)&?R5^!JZVZDA0],"\\[+)K-RLGV8KCN)QL7:IR M6RP0!"66^ I(VMY;_?CKF6Z0((#!BY(O.J_738DSC9Z9GIY^3>,[Y^=-DKX: M1/$B&7[G_&FUV;X:Q*ME$F]GGZ/K>+6X'J?PQ:?5"KZXN5\MDIOQP\TRV5[Q M:S6$;SY&V_C>^9RDFU<#=BWVO]G^NDY>#3Z]^^//[W_X-!R^>>/\>!\M[Y*_ M)5OGS9OA=I5^CN:3S??1]GZ^6EYOTVBY621;\\S'?=-'[KH<_E/,%Z[R'IGG M2O\Q9A/&(LF2BA1!,#F\==LV85(XK;EQU MPY3#@E>2OV+JRA6O7->IQ.K\C@GGRAW^WGG:(?PXC)V5\R5:IJO=%I;$>9C- MYPY,]"3Y/(N3T?;2F:R<:.-$\.OM?>*DR6;KK*;F\S9-DDMGMTF.B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3.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 h4FNRHW16799; Thu, 15 May 2003 16:27:17 -0700 Date: Thu, 15 May 2003 16:27:17 -0700 From: Stephen Hemminger To: "David S. Miller" , Patrick Mochel Cc: netdev@oss.sgi.com, greg@kroah.com, mochel@osdl.org, jkenisto@us.ibm.com, lkessler@us.ibm.com, Daniel Stekloff Subject: [PATCH 1/2] Sysfs net class - infrastructure Message-Id: <20030515162717.477fb84b.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2542 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev This is the network core infrastructure changes for network device sysfs support. Previous /sysfs/net support is removed, it was just an empty place holder. Places where both ioctl and sysfs need to access the same value were put into one function. diff -urNp -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-sysfs/include/linux/netdevice.h --- linux-2.5/include/linux/netdevice.h 2003-05-13 09:03:54.000000000 -0700 +++ linux-2.5-sysfs/include/linux/netdevice.h 2003-05-15 14:40:13.000000000 -0700 @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -229,6 +229,7 @@ struct netdev_boot_setup { #define NETDEV_BOOT_SETUP_MAX 8 + /* * The DEVICE structure. * Actually, this whole structure is a big mistake. It mixes I/O @@ -444,8 +445,16 @@ struct net_device struct divert_blk *divert; #endif /* CONFIG_NET_DIVERT */ - /* generic object representation */ - struct kobject kobj; +#ifdef CONFIG_NET_SYSFS + /* generic device structure */ + struct device *dev; + + /* class_device representation */ + struct class_device class_dev; + + /* statistics object */ + struct kobject stats_kobj; +#endif }; @@ -563,12 +572,12 @@ static inline void netif_stop_queue(stru set_bit(__LINK_STATE_XOFF, &dev->state); } -static inline int netif_queue_stopped(struct net_device *dev) +static inline int netif_queue_stopped(const struct net_device *dev) { return test_bit(__LINK_STATE_XOFF, &dev->state); } -static inline int netif_running(struct net_device *dev) +static inline int netif_running(const struct net_device *dev) { return test_bit(__LINK_STATE_START, &dev->state); } @@ -608,7 +617,9 @@ extern int netif_rx(struct sk_buff *skb #define HAVE_NETIF_RECEIVE_SKB 1 extern int netif_receive_skb(struct sk_buff *skb); extern int dev_ioctl(unsigned int cmd, void *); +extern unsigned dev_get_flags(const struct net_device *); extern int dev_change_flags(struct net_device *, unsigned); +extern int dev_set_mtu(struct net_device *, int); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); extern void dev_init(void); @@ -644,7 +655,7 @@ static inline void dev_put(struct net_de extern void linkwatch_fire_event(struct net_device *dev); -static inline int netif_carrier_ok(struct net_device *dev) +static inline int netif_carrier_ok(const struct net_device *dev) { return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); } @@ -836,6 +847,15 @@ extern int netdev_fastroute_obstacles; extern void dev_clear_fastroute(struct net_device *dev); #endif +/* Set the sysfs physical device reference for the network logical device + * if set prior to registration will cause a symlink during initialization. + */ +#ifdef CONFIG_NET_SYSFS +#define SET_NETDEV_DEV(net, pdev) (net)->dev = (pdev) +#else +#define SET_NETDEV_DEV(net, pdev) do { } while(0) +#endif + #endif /* __KERNEL__ */ diff -urNp -X dontdiff linux-2.5/net/core/dev.c linux-2.5-sysfs/net/core/dev.c --- linux-2.5/net/core/dev.c 2003-05-14 10:41:43.000000000 -0700 +++ linux-2.5-sysfs/net/core/dev.c 2003-05-15 14:49:15.000000000 -0700 @@ -201,7 +201,12 @@ int netdev_fastroute; int netdev_fastroute_obstacles; #endif -static struct subsystem net_subsys; +#ifdef CONFIG_NET_SYSFS +extern struct class net_class; +extern int netdev_create_sysfs(struct net_device *); +#else +#define netdev_create_sysfs(net) ((void)(net), 0) +#endif /******************************************************************************* @@ -2101,6 +2106,22 @@ void dev_set_allmulti(struct net_device dev_mc_upload(dev); } +unsigned dev_get_flags(const struct net_device *dev) +{ + unsigned flags; + + flags = (dev->flags & ~(IFF_PROMISC | + IFF_ALLMULTI | + IFF_RUNNING)) | + (dev->gflags & (IFF_PROMISC | + IFF_ALLMULTI)); + + if (netif_running(dev) && netif_carrier_ok(dev)) + flags |= IFF_RUNNING; + + return flags; +} + int dev_change_flags(struct net_device *dev, unsigned flags) { int ret; @@ -2163,6 +2184,32 @@ int dev_change_flags(struct net_device * return ret; } +int dev_set_mtu(struct net_device *dev, int new_mtu) +{ + int err; + + if (new_mtu == dev->mtu) + return 0; + + /* MTU must be positive. */ + if (new_mtu < 0) + return -EINVAL; + + if (!netif_device_present(dev)) + return -ENODEV; + + err = 0; + if (dev->change_mtu) + err = dev->change_mtu(dev, new_mtu); + else + dev->mtu = new_mtu; + if (!err && dev->flags & IFF_UP) + notifier_call_chain(&netdev_chain, + NETDEV_CHANGEMTU, dev); + return err; +} + + /* * Perform the SIOCxIFxxx calls. */ @@ -2176,13 +2223,7 @@ static int dev_ifsioc(struct ifreq *ifr, switch (cmd) { case SIOCGIFFLAGS: /* Get interface flags */ - ifr->ifr_flags = (dev->flags & ~(IFF_PROMISC | - IFF_ALLMULTI | - IFF_RUNNING)) | - (dev->gflags & (IFF_PROMISC | - IFF_ALLMULTI)); - if (netif_running(dev) && netif_carrier_ok(dev)) - ifr->ifr_flags |= IFF_RUNNING; + ifr->ifr_flags = dev_get_flags(dev); return 0; case SIOCSIFFLAGS: /* Set interface flags */ @@ -2202,27 +2243,7 @@ static int dev_ifsioc(struct ifreq *ifr, return 0; case SIOCSIFMTU: /* Set the MTU of a device */ - if (ifr->ifr_mtu == dev->mtu) - return 0; - - /* - * MTU must be positive. - */ - if (ifr->ifr_mtu < 0) - return -EINVAL; - - if (!netif_device_present(dev)) - return -ENODEV; - - err = 0; - if (dev->change_mtu) - err = dev->change_mtu(dev, ifr->ifr_mtu); - else - dev->mtu = ifr->ifr_mtu; - if (!err && dev->flags & IFF_UP) - notifier_call_chain(&netdev_chain, - NETDEV_CHANGEMTU, dev); - return err; + return dev_set_mtu(dev, ifr->ifr_mtu); case SIOCGIFHWADDR: memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, @@ -2310,6 +2331,9 @@ static int dev_ifsioc(struct ifreq *ifr, return -EEXIST; memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); dev->name[IFNAMSIZ - 1] = 0; +#ifdef CONFIG_NET_SYSFS + snprintf(dev->class_dev.class_id, BUS_ID_SIZE, dev->name); +#endif notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); return 0; @@ -2556,6 +2580,7 @@ int dev_new_index(void) } } + static int dev_boot_phase = 1; /** @@ -2613,11 +2638,10 @@ int register_netdevice(struct net_device if (d == dev || !strcmp(d->name, dev->name)) goto out_err; } - snprintf(dev->kobj.name,KOBJ_NAME_LEN,dev->name); - kobj_set_kset_s(dev,net_subsys); - if ((ret = kobject_register(&dev->kobj))) - goto out_err; + if ((ret = netdev_create_sysfs(dev))) + goto out_err; + /* Fix illegal SG+CSUM combinations. */ if ((dev->features & NETIF_F_SG) && !(dev->features & (NETIF_F_IP_CSUM | @@ -2843,7 +2867,9 @@ int unregister_netdevice(struct net_devi } } out: - kobject_unregister(&dev->kobj); +#ifdef CONFIG_NET_SYSFS + class_device_unregister(&dev->class_dev); +#endif dev_put(dev); return 0; } @@ -2862,8 +2888,6 @@ extern void ip_auto_config(void); extern void dv_init(void); #endif /* CONFIG_NET_DIVERT */ -static decl_subsys(net,NULL,NULL); - /* * This is called single threaded during boot, so no need @@ -2879,7 +2903,10 @@ static int __init net_dev_init(void) if (dev_proc_init()) goto out; - subsystem_register(&net_subsys); +#ifdef CONFIG_NET_SYSFS + if (class_register(&net_class)) + goto out; +#endif INIT_LIST_HEAD(&ptype_all); for (i = 0; i < 16; i++) @@ -2953,7 +2980,7 @@ static int __init net_dev_init(void) */ netdev_boot_setup_check(dev); - if (dev->init && dev->init(dev)) { + if ((dev->init && dev->init(dev)) || netdev_create_sysfs(dev)) { /* * It failed to come up. It will be unhooked later. * dev_alloc_name can now advance to next suitable @@ -3042,3 +3069,4 @@ static int net_run_sbin_hotplug(struct n return call_usermodehelper(argv [0], argv, envp, 0); } #endif + diff -urNp -X dontdiff linux-2.5/net/core/Makefile linux-2.5-sysfs/net/core/Makefile --- linux-2.5/net/core/Makefile 2003-04-29 11:54:39.000000000 -0700 +++ linux-2.5-sysfs/net/core/Makefile 2003-05-15 15:04:20.000000000 -0700 @@ -12,6 +12,7 @@ endif obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o +obj-$(CONFIG_NET_SYSFS) += net-sysfs.o obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NET_DIVERT) += dv.o obj-$(CONFIG_NET_PROFILE) += profile.o diff -urNp -X dontdiff linux-2.5/net/core/net-sysfs.c linux-2.5-sysfs/net/core/net-sysfs.c --- linux-2.5/net/core/net-sysfs.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5-sysfs/net/core/net-sysfs.c 2003-05-15 16:03:12.000000000 -0700 @@ -0,0 +1,327 @@ +/* + * net-sysfs.c - network device class and attributes + * + * Copyright (c) 2003 Stephen Hemminber + * + * + * TODO: + * state + * last_tx + * last_rx + */ + +#include +#include +#include +#include +#include + +#define to_net_dev(class) container_of((class), struct net_device, class_dev) + +/* generate a show function for simple field */ +#define NETDEVICE_SHOW(field, format_string) \ +static ssize_t show_##field(struct class_device *dev, char *buf) \ +{ \ + return sprintf(buf, format_string, to_net_dev(dev)->field); \ +} + +/* generate a store function for a field with locking */ +#define NETDEVICE_STORE(field) \ +static ssize_t \ +store_##field(struct class_device *dev, const char *buf, size_t len) \ +{ \ + char *endp; \ + long new = simple_strtol(buf, &endp, 16); \ + \ + if (endp == buf || new < 0) \ + return -EINVAL; \ + \ + if (!capable(CAP_NET_ADMIN)) \ + return -EPERM; \ + \ + rtnl_lock(); \ + to_net_dev(dev)->field = new; \ + rtnl_unlock(); \ + return len; \ +} + +/* generate a read-only network device class attribute */ +#define NETDEVICE_ATTR(field, format_string) \ +NETDEVICE_SHOW(field, format_string) \ +static CLASS_DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) \ + +NETDEVICE_ATTR(type, "%d\n"); +NETDEVICE_ATTR(addr_len, "%d\n"); +NETDEVICE_ATTR(features, "%#x\n"); + +/* TODO: only a few devices set this now should fix others. */ +static ssize_t show_port(struct class_device *dev, char *buf) +{ + unsigned char port = to_net_dev(dev)->if_port; + if (port > IF_PORT_100BASEFX) + return sprintf(buf, "%d\n", port); + else + return sprintf(buf, "%s\n", if_port_text[port]); +} + +static CLASS_DEVICE_ATTR(if_port, S_IRUGO, show_port, NULL); + +static ssize_t format_addr(char *buf, const unsigned char *addr, int len) +{ + int i; + char *cp = buf; + + read_lock(&dev_base_lock); + for (i = 0; i < len; i++) + cp += sprintf(cp, "%02x%c", addr[i], + i == (len - 1) ? '\n' : ':'); + read_unlock(&dev_base_lock); + return cp - buf; +} + +static ssize_t show_address(struct class_device *dev, char *buf) +{ + struct net_device *net = to_net_dev(dev); + return format_addr(buf, net->dev_addr, net->addr_len); +} + +static ssize_t show_broadcast(struct class_device *dev, char *buf) +{ + struct net_device *net = to_net_dev(dev); + return format_addr(buf, net->broadcast, net->addr_len); +} + +static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL); +static CLASS_DEVICE_ATTR(broadcast, S_IRUGO, show_broadcast, NULL); + + +/* read-write attributes */ +NETDEVICE_SHOW(mtu, "%d\n"); + +static ssize_t store_mtu(struct class_device *dev, const char *buf, size_t len) +{ + char *endp; + int new_mtu; + int err; + + new_mtu = simple_strtoul(buf, &endp, 10); + if (endp == buf) + return -EINVAL; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + rtnl_lock(); + err = dev_set_mtu(to_net_dev(dev), new_mtu); + rtnl_unlock(); + + return err == 0 ? len : err; +} + +static CLASS_DEVICE_ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu); + +static ssize_t show_flags(struct class_device *dev, char *buf) +{ + return sprintf(buf, "%#x\n", dev_get_flags(to_net_dev(dev))); +} + +static ssize_t store_flags(struct class_device *dev, const char *buf, size_t len) +{ + unsigned long new_flags; + char *endp; + int err = 0; + + new_flags = simple_strtoul(buf, &endp, 16); + if (endp == buf) + return -EINVAL; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + rtnl_lock(); + err = dev_change_flags(to_net_dev(dev), new_flags); + rtnl_unlock(); + + return err ? err : len; +} + +static CLASS_DEVICE_ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags); + + +NETDEVICE_SHOW(tx_queue_len, "%lu\n"); +NETDEVICE_STORE(tx_queue_len); + +static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, + store_tx_queue_len); + +NETDEVICE_SHOW(ifindex, "%d\n"); +NETDEVICE_STORE(ifindex); + +static CLASS_DEVICE_ATTR(ifindex, S_IRUGO | S_IWUSR, show_ifindex, + store_ifindex); + +struct class net_class = { + .name = "net", +}; + + +static struct class_device_attribute *net_class_attributes[] = { + &class_device_attr_ifindex, + &class_device_attr_addr_len, + &class_device_attr_tx_queue_len, + &class_device_attr_features, + &class_device_attr_mtu, + &class_device_attr_flags, + &class_device_attr_if_port, + &class_device_attr_type, + &class_device_attr_address, + &class_device_attr_broadcast, + NULL +}; + +struct netstat_fs_entry { + struct attribute attr; + ssize_t (*show)(const struct net_device_stats *, char *); + ssize_t (*store)(struct net_device_stats *, const char *, size_t); +}; + +static ssize_t net_device_stat_show(unsigned long var, char *buf) +{ + return sprintf(buf, "%ld\n", var); +} + +/* generate a read-only statistics attribute */ +#define NETDEVICE_STAT(_NAME) \ +static ssize_t show_stat_##_NAME(const struct net_device_stats *stats, \ + char *buf) \ +{ \ + return net_device_stat_show(stats->_NAME, buf); \ +} \ +static struct netstat_fs_entry net_stat_##_NAME = { \ + .attr = {.name = __stringify(_NAME), .mode = S_IRUGO }, \ + .show = show_stat_##_NAME, \ +} + +NETDEVICE_STAT(rx_packets); +NETDEVICE_STAT(tx_packets); +NETDEVICE_STAT(rx_bytes); +NETDEVICE_STAT(tx_bytes); +NETDEVICE_STAT(rx_errors); +NETDEVICE_STAT(tx_errors); +NETDEVICE_STAT(rx_dropped); +NETDEVICE_STAT(tx_dropped); +NETDEVICE_STAT(multicast); +NETDEVICE_STAT(collisions); +NETDEVICE_STAT(rx_length_errors); +NETDEVICE_STAT(rx_over_errors); +NETDEVICE_STAT(rx_crc_errors); +NETDEVICE_STAT(rx_frame_errors); +NETDEVICE_STAT(rx_fifo_errors); +NETDEVICE_STAT(rx_missed_errors); +NETDEVICE_STAT(tx_aborted_errors); +NETDEVICE_STAT(tx_carrier_errors); +NETDEVICE_STAT(tx_fifo_errors); +NETDEVICE_STAT(tx_heartbeat_errors); +NETDEVICE_STAT(tx_window_errors); +NETDEVICE_STAT(rx_compressed); +NETDEVICE_STAT(tx_compressed); + +static struct attribute *default_attrs[] = { + &net_stat_rx_packets.attr, + &net_stat_tx_packets.attr, + &net_stat_rx_bytes.attr, + &net_stat_tx_bytes.attr, + &net_stat_rx_errors.attr, + &net_stat_tx_errors.attr, + &net_stat_rx_dropped.attr, + &net_stat_tx_dropped.attr, + &net_stat_multicast.attr, + &net_stat_collisions.attr, + &net_stat_rx_length_errors.attr, + &net_stat_rx_over_errors.attr, + &net_stat_rx_crc_errors.attr, + &net_stat_rx_frame_errors.attr, + &net_stat_rx_fifo_errors.attr, + &net_stat_rx_missed_errors.attr, + &net_stat_tx_aborted_errors.attr, + &net_stat_tx_carrier_errors.attr, + &net_stat_tx_fifo_errors.attr, + &net_stat_tx_heartbeat_errors.attr, + &net_stat_tx_window_errors.attr, + &net_stat_rx_compressed.attr, + &net_stat_tx_compressed.attr, + NULL +}; + + +static ssize_t +netstat_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct netstat_fs_entry *entry + = container_of(attr, struct netstat_fs_entry, attr); + struct class_device *class_dev + = container_of(kobj->parent, struct class_device, kobj); + struct net_device *dev + = to_net_dev(class_dev); + struct net_device_stats *stats + = dev->get_stats ? dev->get_stats(dev) : NULL; + + if (stats && entry->show) + return entry->show(stats, buf); + return -EINVAL; +} + +static struct sysfs_ops netstat_sysfs_ops = { + .show = netstat_attr_show, +}; + +static struct kobj_type netstat_ktype = { + .sysfs_ops = &netstat_sysfs_ops, + .default_attrs = default_attrs, +}; + +/* Create sysfs entries for network device. */ +int netdev_create_sysfs(struct net_device *net) +{ + struct class_device *class_dev = &(net->class_dev); + int i; + struct class_device_attribute *attr; + int ret; + + memset(class_dev, 0, sizeof(struct class_device)); + class_dev->class = &net_class; + class_dev->dev = net->dev; + class_dev->class_data = net; + + snprintf(class_dev->class_id, BUS_ID_SIZE, net->name); + if ((ret = class_device_register(class_dev))) + goto out; + + for (i = 0; (attr = net_class_attributes[i]); i++) { + if ((ret = class_device_create_file(class_dev, attr))) + goto out_unreg; + } + + if (net->get_stats) { + struct kobject *k = &net->stats_kobj; + + memset(k, 0, sizeof(*k)); + k->parent = kobject_get(&class_dev->kobj); + if (!k->parent) { + ret = -EBUSY; + goto out_unreg; + } + + snprintf(k->name, KOBJ_NAME_LEN, "%s", "statistics"); + k->ktype = &netstat_ktype; + + if((ret = kobject_register(k))) + goto out_unreg; + } + +out: + return ret; +out_unreg: + class_device_unregister(class_dev); + goto out; +} diff -urNp -X dontdiff linux-2.5/net/Kconfig linux-2.5-sysfs/net/Kconfig --- linux-2.5/net/Kconfig 2003-05-14 10:41:43.000000000 -0700 +++ linux-2.5-sysfs/net/Kconfig 2003-05-15 14:51:59.000000000 -0700 @@ -58,6 +58,18 @@ config NETLINK_DEV the real netlink socket. This is a backward compatibility option, choose Y for now. +config NET_SYSFS + bool "Sysfs support for network devices" + default y + ---help--- + Show network devices in the sysfs virtual file system. + This allows accessing network device information through + files, for example /sys/class/net/eth0/address contains + the Ethernet address. + + Some parameters (like MTU) can also be set through this + interface. + config NETFILTER bool "Network packet filtering (replaces ipchains)" ---help--- From shemminger@osdl.org Thu May 15 16:28:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 16:28:28 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4FNSHFu013991 for ; Thu, 15 May 2003 16:28:17 -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 h4FNRMW16820; Thu, 15 May 2003 16:27:22 -0700 Date: Thu, 15 May 2003 16:27:22 -0700 From: Stephen Hemminger To: "David S. Miller" , Patrick Mochel Cc: netdev@oss.sgi.com, greg@kroah.com, mochel@osdl.org, jkenisto@us.ibm.com, lkessler@us.ibm.com, Daniel Stekloff Subject: [PATCH 2/2] Sysfs class - device hook Message-Id: <20030515162722.45dc315e.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2541 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 In order to created device and driver objects for class/net/mynetdev, the driver needs to set the generic device pointer in the network device structure before registering. If a driver doesn't set the entry, nothing bad happens, just the device and driver symlink's do not get made. So there is no backward compatiablity problem. If a driver still needs to work on 2.4, then it can define SET_NETDEV_DEV as a no-op. The e100 and 8139too have been tested; other drivers have been built but don't have that hardware. diff -urNp -X dontdiff linux-2.5/drivers/net/3c59x.c linux-2.5-sysfs/drivers/net/3c59x.c --- linux-2.5/drivers/net/3c59x.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/3c59x.c 2003-05-15 10:13:25.000000000 -0700 @@ -1103,6 +1103,7 @@ static int __devinit vortex_probe1(struc goto out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, gendev); vp = dev->priv; option = global_options; diff -urNp -X dontdiff linux-2.5/drivers/net/8139cp.c linux-2.5-sysfs/drivers/net/8139cp.c --- linux-2.5/drivers/net/8139cp.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/8139cp.c 2003-05-15 10:04:45.000000000 -0700 @@ -1801,6 +1801,8 @@ static int __devinit cp_init_one (struct if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + cp = dev->priv; cp->pdev = pdev; cp->board_type = board_type; diff -urNp -X dontdiff linux-2.5/drivers/net/8139too.c linux-2.5-sysfs/drivers/net/8139too.c --- linux-2.5/drivers/net/8139too.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/8139too.c 2003-05-15 10:04:10.000000000 -0700 @@ -768,6 +768,8 @@ static int __devinit rtl8139_init_board return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + tp = dev->priv; tp->pci_dev = pdev; diff -urNp -X dontdiff linux-2.5/drivers/net/acenic.c linux-2.5-sysfs/drivers/net/acenic.c --- linux-2.5/drivers/net/acenic.c 2003-05-09 09:33:37.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/acenic.c 2003-05-15 10:06:25.000000000 -0700 @@ -188,6 +188,9 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl) #define ACE_MOD_DEC_USE_COUNT do{} while(0) #endif +#ifndef SET_NETDEV_DEV +#define SET_NETDEV_DEV(net, pdev) do{} while(0) +#endif #if LINUX_VERSION_CODE >= 0x2051c #define ace_sync_irq(irq) synchronize_irq(irq) @@ -651,6 +654,7 @@ int __devinit acenic_probe (ACE_PROBE_AR } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (!dev->priv) dev->priv = kmalloc(sizeof(*ap), GFP_KERNEL); diff -urNp -X dontdiff linux-2.5/drivers/net/amd8111e.c linux-2.5-sysfs/drivers/net/amd8111e.c --- linux-2.5/drivers/net/amd8111e.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/amd8111e.c 2003-05-15 10:06:48.000000000 -0700 @@ -1542,6 +1542,7 @@ static int __devinit amd8111e_probe_one( } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); #if AMD8111E_VLAN_TAG_USED dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; diff -urNp -X dontdiff linux-2.5/drivers/net/defxx.c linux-2.5-sysfs/drivers/net/defxx.c --- linux-2.5/drivers/net/defxx.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/defxx.c 2003-05-15 10:16:03.000000000 -0700 @@ -443,6 +443,7 @@ static int __devinit dfx_init_one_pci_or } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); bp = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/dl2k.c linux-2.5-sysfs/drivers/net/dl2k.c --- linux-2.5/drivers/net/dl2k.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/dl2k.c 2003-05-15 10:07:22.000000000 -0700 @@ -154,6 +154,7 @@ rio_probe1 (struct pci_dev *pdev, const goto err_out_res; } SET_MODULE_OWNER (dev); + SET_NETDEV_DEV(dev, &pdev->dev); #ifdef MEM_MAPPING ioaddr = pci_resource_start (pdev, 1); diff -urNp -X dontdiff linux-2.5/drivers/net/e100/e100_main.c linux-2.5-sysfs/drivers/net/e100/e100_main.c --- linux-2.5/drivers/net/e100/e100_main.c 2003-04-21 08:58:19.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e100/e100_main.c 2003-05-15 10:11:00.000000000 -0700 @@ -591,6 +591,7 @@ e100_found1(struct pci_dev *pcid, const bdp->device = dev; pci_set_drvdata(pcid, dev); + SET_NETDEV_DEV(dev, &pcid->dev); if ((rc = e100_alloc_space(bdp)) != 0) { goto err_dev; diff -urNp -X dontdiff linux-2.5/drivers/net/e1000/e1000_main.c linux-2.5-sysfs/drivers/net/e1000/e1000_main.c --- linux-2.5/drivers/net/e1000/e1000_main.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e1000/e1000_main.c 2003-05-15 10:26:04.000000000 -0700 @@ -391,6 +391,7 @@ e1000_probe(struct pci_dev *pdev, goto err_alloc_etherdev; SET_MODULE_OWNER(netdev); + SET_NETDEV_DEV(netdev, &pdev->dev); pci_set_drvdata(pdev, netdev); adapter = netdev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/eepro100.c linux-2.5-sysfs/drivers/net/eepro100.c --- linux-2.5/drivers/net/eepro100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/eepro100.c 2003-05-15 14:47:07.000000000 -0700 @@ -678,6 +678,7 @@ static int __devinit speedo_found1(struc } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (dev->mem_start > 0) option = dev->mem_start; @@ -829,6 +830,7 @@ static int __devinit speedo_found1(struc pci_set_power_state(pdev, acpi_idle_state); pci_set_drvdata (pdev, dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/epic100.c linux-2.5-sysfs/drivers/net/epic100.c --- linux-2.5/drivers/net/epic100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/epic100.c 2003-05-15 10:17:45.000000000 -0700 @@ -409,6 +409,7 @@ static int __devinit epic_init_one (stru return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_free_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/fealnx.c linux-2.5-sysfs/drivers/net/fealnx.c --- linux-2.5/drivers/net/fealnx.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/fealnx.c 2003-05-15 10:18:12.000000000 -0700 @@ -539,6 +539,7 @@ static int __devinit fealnx_init_one(str goto err_out_unmap; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); /* read ethernet id */ for (i = 0; i < 6; ++i) diff -urNp -X dontdiff linux-2.5/drivers/net/hamachi.c linux-2.5-sysfs/drivers/net/hamachi.c --- linux-2.5/drivers/net/hamachi.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/hamachi.c 2003-05-15 10:18:56.000000000 -0700 @@ -613,6 +613,7 @@ static int __init hamachi_init_one (stru goto err_out_iounmap; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); #ifdef TX_CHECKSUM printk("check that skbcopy in ip_queue_xmit isn't happening\n"); diff -urNp -X dontdiff linux-2.5/drivers/net/hp100.c linux-2.5-sysfs/drivers/net/hp100.c --- linux-2.5/drivers/net/hp100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/hp100.c 2003-05-15 10:19:20.000000000 -0700 @@ -776,6 +776,7 @@ static int __init hp100_probe1(struct ne hp100_clear_stats(lp, ioaddr); SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pci_dev->dev); ether_setup(dev); /* If busmaster mode is wanted, a dma-capable memory area is needed for diff -urNp -X dontdiff linux-2.5/drivers/net/ioc3-eth.c linux-2.5-sysfs/drivers/net/ioc3-eth.c --- linux-2.5/drivers/net/ioc3-eth.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ioc3-eth.c 2003-05-15 10:20:03.000000000 -0700 @@ -1532,6 +1532,8 @@ static int __devinit ioc3_probe(struct p goto out_free; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + ip = dev->priv; ip->dev = dev; diff -urNp -X dontdiff linux-2.5/drivers/net/ixgb/ixgb_main.c linux-2.5-sysfs/drivers/net/ixgb/ixgb_main.c --- linux-2.5/drivers/net/ixgb/ixgb_main.c 2003-04-29 10:17:00.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ixgb/ixgb_main.c 2003-05-15 12:00:30.000000000 -0700 @@ -333,6 +333,7 @@ ixgb_probe(struct pci_dev *pdev, const s } SET_MODULE_OWNER(netdev); + SET_NETDEV_DEV(netdev, &pdev->dev); pci_set_drvdata(pdev, netdev); adapter = netdev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/natsemi.c linux-2.5-sysfs/drivers/net/natsemi.c --- linux-2.5/drivers/net/natsemi.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/natsemi.c 2003-05-15 10:20:39.000000000 -0700 @@ -762,6 +762,7 @@ static int __devinit natsemi_probe1 (str if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); i = pci_request_regions(pdev, dev->name); if (i) { diff -urNp -X dontdiff linux-2.5/drivers/net/ne2k-pci.c linux-2.5-sysfs/drivers/net/ne2k-pci.c --- linux-2.5/drivers/net/ne2k-pci.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ne2k-pci.c 2003-05-15 10:20:54.000000000 -0700 @@ -265,6 +265,7 @@ static int __devinit ne2k_pci_init_one ( goto err_out_free_res; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); /* Reset card. Who knows what dain-bramaged state it was left in. */ { diff -urNp -X dontdiff linux-2.5/drivers/net/pci-skeleton.c linux-2.5-sysfs/drivers/net/pci-skeleton.c --- linux-2.5/drivers/net/pci-skeleton.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/pci-skeleton.c 2003-05-15 10:21:36.000000000 -0700 @@ -610,6 +610,7 @@ static int __devinit netdrv_init_board ( return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); tp = dev->priv; /* enable device (incl. PCI PM wakeup), and bus-mastering */ diff -urNp -X dontdiff linux-2.5/drivers/net/pcnet32.c linux-2.5-sysfs/drivers/net/pcnet32.c --- linux-2.5/drivers/net/pcnet32.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/pcnet32.c 2003-05-15 10:21:51.000000000 -0700 @@ -638,6 +638,7 @@ pcnet32_probe1(unsigned long ioaddr, uns release_region(ioaddr, PCNET32_TOTAL_SIZE); return -ENOMEM; } + SET_NETDEV_DEV(dev, &pdev->dev); printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); @@ -718,6 +719,7 @@ pcnet32_probe1(unsigned long ioaddr, uns spin_lock_init(&lp->lock); SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->priv = lp; lp->name = chipname; lp->shared_irq = shared; diff -urNp -X dontdiff linux-2.5/drivers/net/r8169.c linux-2.5-sysfs/drivers/net/r8169.c --- linux-2.5/drivers/net/r8169.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/r8169.c 2003-05-15 10:22:02.000000000 -0700 @@ -373,6 +373,7 @@ rtl8169_init_board(struct pci_dev *pdev, } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); tp = dev->priv; // enable device (incl. PCI PM wakeup and hotplug setup) diff -urNp -X dontdiff linux-2.5/drivers/net/rcpci45.c linux-2.5-sysfs/drivers/net/rcpci45.c --- linux-2.5/drivers/net/rcpci45.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/rcpci45.c 2003-05-15 10:22:09.000000000 -0700 @@ -179,6 +179,7 @@ rcpci45_init_one (struct pci_dev *pdev, goto err_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); error = pci_enable_device (pdev); if (error) { diff -urNp -X dontdiff linux-2.5/drivers/net/rrunner.c linux-2.5-sysfs/drivers/net/rrunner.c --- linux-2.5/drivers/net/rrunner.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/rrunner.c 2003-05-15 10:22:16.000000000 -0700 @@ -114,6 +114,7 @@ static int __devinit rr_init_one(struct rrpriv = (struct rr_private *)dev->priv; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, "rrunner")) { ret = -EIO; diff -urNp -X dontdiff linux-2.5/drivers/net/sb1000.c linux-2.5-sysfs/drivers/net/sb1000.c --- linux-2.5/drivers/net/sb1000.c 2003-05-12 09:35:52.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sb1000.c 2003-05-15 14:39:19.000000000 -0700 @@ -194,6 +194,7 @@ sb1000_probe_one(struct pnp_dev *pdev, c goto out_release_regions; } SET_MODULE_OWNER(dev); + set_netdev_dev(dev, &pdev->dev); if (sb1000_debug > 0) printk(KERN_NOTICE "%s", version); diff -urNp -X dontdiff linux-2.5/drivers/net/sis900.c linux-2.5-sysfs/drivers/net/sis900.c --- linux-2.5/drivers/net/sis900.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sis900.c 2003-05-15 10:10:07.000000000 -0700 @@ -397,6 +397,7 @@ static int __devinit sis900_probe (struc if (!net_dev) return -ENOMEM; SET_MODULE_OWNER(net_dev); + SET_NETDEV_DEV(net_dev, &pci_dev->dev); /* We do a request_region() to register /proc/ioports info. */ ioaddr = pci_resource_start(pci_dev, 0); diff -urNp -X dontdiff linux-2.5/drivers/net/sk98lin/skge.c linux-2.5-sysfs/drivers/net/sk98lin/skge.c --- linux-2.5/drivers/net/sk98lin/skge.c 2003-05-09 09:33:37.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sk98lin/skge.c 2003-05-15 12:01:22.000000000 -0700 @@ -460,6 +460,7 @@ static int __init skge_probe (void) dev->irq = pdev->irq; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = &SkGeOpen; dev->stop = &SkGeClose; dev->hard_start_xmit = &SkGeXmit; diff -urNp -X dontdiff linux-2.5/drivers/net/smc-mca.c linux-2.5-sysfs/drivers/net/smc-mca.c --- linux-2.5/drivers/net/smc-mca.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/smc-mca.c 2003-05-15 10:22:59.000000000 -0700 @@ -207,6 +207,7 @@ int __init ultramca_probe(struct device return -ENODEV; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, gen_dev); if((i = register_netdev(dev)) != 0) return i; diff -urNp -X dontdiff linux-2.5/drivers/net/starfire.c linux-2.5-sysfs/drivers/net/starfire.c --- linux-2.5/drivers/net/starfire.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/starfire.c 2003-05-15 10:23:16.000000000 -0700 @@ -876,6 +876,7 @@ static int __devinit starfire_init_one(s return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/sundance.c linux-2.5-sysfs/drivers/net/sundance.c --- linux-2.5/drivers/net/sundance.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sundance.c 2003-05-15 10:23:36.000000000 -0700 @@ -548,6 +548,7 @@ static int __devinit sundance_probe1 (st if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/sungem.c linux-2.5-sysfs/drivers/net/sungem.c --- linux-2.5/drivers/net/sungem.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sungem.c 2003-05-15 10:23:47.000000000 -0700 @@ -2928,6 +2928,7 @@ static int __devinit gem_init_one(struct return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); gp = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/sunhme.c linux-2.5-sysfs/drivers/net/sunhme.c --- linux-2.5/drivers/net/sunhme.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sunhme.c 2003-05-15 10:24:00.000000000 -0700 @@ -3025,6 +3025,7 @@ static int __init happy_meal_pci_init(st if (!dev) goto err_out; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (hme_version_printed++ == 0) printk(KERN_INFO "%s", version); diff -urNp -X dontdiff linux-2.5/drivers/net/tg3.c linux-2.5-sysfs/drivers/net/tg3.c --- linux-2.5/drivers/net/tg3.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tg3.c 2003-05-15 10:24:30.000000000 -0700 @@ -6764,6 +6764,7 @@ static int __devinit tg3_init_one(struct } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_using_dac) dev->features |= NETIF_F_HIGHDMA; diff -urNp -X dontdiff linux-2.5/drivers/net/tlan.c linux-2.5-sysfs/drivers/net/tlan.c --- linux-2.5/drivers/net/tlan.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tlan.c 2003-05-15 10:10:35.000000000 -0700 @@ -521,6 +521,7 @@ static int __devinit TLan_probe1(struct return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); priv = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/de2104x.c linux-2.5-sysfs/drivers/net/tulip/de2104x.c --- linux-2.5/drivers/net/tulip/de2104x.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/de2104x.c 2003-05-15 12:02:29.000000000 -0700 @@ -2006,6 +2006,7 @@ static int __init de_init_one (struct pc return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = de_open; dev->stop = de_close; dev->set_multicast_list = de_set_rx_mode; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/de4x5.c linux-2.5-sysfs/drivers/net/tulip/de4x5.c --- linux-2.5/drivers/net/tulip/de4x5.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/de4x5.c 2003-05-15 12:03:02.000000000 -0700 @@ -1350,6 +1350,7 @@ de4x5_hw_init(struct net_device *dev, u_ /* The DE4X5-specific entries in the device structure. */ SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = &de4x5_open; dev->hard_start_xmit = &de4x5_queue_pkt; dev->stop = &de4x5_close; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/dmfe.c linux-2.5-sysfs/drivers/net/tulip/dmfe.c --- linux-2.5/drivers/net/tulip/dmfe.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/dmfe.c 2003-05-15 12:03:09.000000000 -0700 @@ -348,6 +348,7 @@ static int __devinit dmfe_init_one (stru if (dev == NULL) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_set_dma_mask(pdev, 0xffffffff)) { printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/tulip_core.c linux-2.5-sysfs/drivers/net/tulip/tulip_core.c --- linux-2.5/drivers/net/tulip/tulip_core.c 2003-05-12 09:35:52.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/tulip_core.c 2003-05-15 12:03:18.000000000 -0700 @@ -1360,6 +1360,7 @@ static int __devinit tulip_init_one (str } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { printk (KERN_ERR PFX "%s: I/O region (0x%lx@0x%lx) too small, " "aborting\n", pdev->slot_name, diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/winbond-840.c linux-2.5-sysfs/drivers/net/tulip/winbond-840.c --- linux-2.5/drivers/net/tulip/winbond-840.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/winbond-840.c 2003-05-15 12:03:24.000000000 -0700 @@ -423,6 +423,7 @@ static int __devinit w840_probe1 (struct if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/xircom_cb.c linux-2.5-sysfs/drivers/net/tulip/xircom_cb.c --- linux-2.5/drivers/net/tulip/xircom_cb.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/xircom_cb.c 2003-05-15 12:03:37.000000000 -0700 @@ -276,6 +276,7 @@ static int __devinit xircom_probe(struct return -ENODEV; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq); private->dev = dev; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/xircom_tulip_cb.c linux-2.5-sysfs/drivers/net/tulip/xircom_tulip_cb.c --- linux-2.5/drivers/net/tulip/xircom_tulip_cb.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/xircom_tulip_cb.c 2003-05-15 12:04:01.000000000 -0700 @@ -560,6 +560,7 @@ static int __devinit xircom_init_one(str return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->base_addr = ioaddr; dev->irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/typhoon.c linux-2.5-sysfs/drivers/net/typhoon.c --- linux-2.5/drivers/net/typhoon.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/typhoon.c 2003-05-15 10:24:44.000000000 -0700 @@ -2266,6 +2266,7 @@ typhoon_init_one(struct pci_dev *pdev, c goto error_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); err = pci_enable_device(pdev); if(err < 0) { diff -urNp -X dontdiff linux-2.5/drivers/net/via-rhine.c linux-2.5-sysfs/drivers/net/via-rhine.c --- linux-2.5/drivers/net/via-rhine.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/via-rhine.c 2003-05-15 10:24:55.000000000 -0700 @@ -660,6 +660,7 @@ static int __devinit via_rhine_init_one goto err_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, shortname)) goto err_out_free_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/yellowfin.c linux-2.5-sysfs/drivers/net/yellowfin.c --- linux-2.5/drivers/net/yellowfin.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/yellowfin.c 2003-05-15 10:25:05.000000000 -0700 @@ -444,6 +444,7 @@ static int __devinit yellowfin_init_one( return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); np = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/usb/net/usbnet.c linux-2.5-sysfs/drivers/usb/net/usbnet.c --- linux-2.5/drivers/usb/net/usbnet.c 2003-05-01 11:19:59.000000000 -0700 +++ linux-2.5-sysfs/drivers/usb/net/usbnet.c 2003-05-15 15:03:33.000000000 -0700 @@ -2597,7 +2597,8 @@ usbnet_probe (struct usb_interface *udev return status; } dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); - + + SET_NETDEV_DEV(&dev->net, &dev->udev->dev); register_netdev (&dev->net); devinfo (dev, "register usbnet at usb-%s-%s, %s", xdev->bus->bus_name, xdev->devpath, From shemminger@osdl.org Thu May 15 16:28:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 16:28:27 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4FNSFFu013990 for ; Thu, 15 May 2003 16:28:16 -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 h4FNRCW16757; Thu, 15 May 2003 16:27:12 -0700 Date: Thu, 15 May 2003 16:27:12 -0700 From: Stephen Hemminger To: "David S. Miller" , Patrick Mochel Cc: netdev@oss.sgi.com, greg@kroah.com, mochel@osdl.org, jkenisto@us.ibm.com, lkessler@us.ibm.com, Daniel Stekloff Subject: [PATCH 0/2] Sysfs net class . Message-Id: <20030515162712.61cd153e.shemminger@osdl.org> In-Reply-To: <200305141443.57169.dsteklof@us.ibm.com> References: <20030513150303.A2406@DYN318281.beaverton.ibm.com> <200305131657.03508.dsteklof@us.ibm.com> <20030514142023.0e411f34.shemminger@osdl.org> <200305141443.57169.dsteklof@us.ibm.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2540 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 Starting with work by Pat and Daniel Stekoff , I created a sysfs network interface. There are two parts, one is the core network device piece to create sysfs entries during init and register. The other is changing the device drivers so that during registration the appropriate symlinks back to the pci physical devices gets made. All this is under a config option in case embedded or other systems don't need it. The files are in sysfs standard format with one value per file. Most are read-only, although some like flags, mtu, can be set. The sysfs tree layout is: class/net |-- eth0 | |-- addr_len | |-- address | |-- broadcast | |-- device -> ../../../devices/pci0/00:1e.0/04:04.0 | |-- driver -> ../../../bus/pci/drivers/e100 | |-- features | |-- flags | |-- if_port | |-- ifindex | |-- mtu | |-- statistics | | |-- collisions | | |-- multicast | | |-- rx_bytes | | |-- rx_compressed | | |-- rx_crc_errors | | |-- rx_dropped | | |-- rx_errors | | |-- rx_fifo_errors | | |-- rx_frame_errors | | |-- rx_length_errors | | |-- rx_missed_errors | | |-- rx_over_errors | | |-- rx_packets | | |-- tx_aborted_errors | | |-- tx_bytes | | |-- tx_carrier_errors | | |-- tx_compressed | | |-- tx_dropped | | |-- tx_errors | | |-- tx_fifo_errors | | |-- tx_heartbeat_errors | | |-- tx_packets | | `-- tx_window_errors | |-- tx_queue_len | `-- type `-- lo |-- addr_len |-- address |-- broadcast |-- features |-- flags |-- if_port |-- ifindex |-- mtu |-- statistics | |-- collisions | |-- multicast | |-- rx_bytes | |-- rx_compressed | |-- rx_crc_errors | |-- rx_dropped | |-- rx_errors | |-- rx_fifo_errors | |-- rx_frame_errors | |-- rx_length_errors | |-- rx_missed_errors | |-- rx_over_errors | |-- rx_packets | |-- tx_aborted_errors | |-- tx_bytes | |-- tx_carrier_errors | |-- tx_compressed | |-- tx_dropped | |-- tx_errors | |-- tx_fifo_errors | |-- tx_heartbeat_errors | |-- tx_packets | `-- tx_window_errors |-- tx_queue_len `-- type 6 directories, 66 files From greg@kroah.com Thu May 15 17:18:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 17:18:44 -0700 (PDT) Received: from granite.he.net (granite.he.net [216.218.226.66]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4G0IYFu015246 for ; Thu, 15 May 2003 17:18:35 -0700 Received: from [192.168.0.10] (12-231-249-244.client.attbi.com [12.231.249.244]) by granite.he.net (8.8.6p2003-03-31/8.8.2) with ESMTP id RAA00904; Thu, 15 May 2003 17:18:31 -0700 Delivered-To: netdev@oss.sgi.com Received: from greg by echidna.kroah.org with local (masqmail 0.2.19) id 19GSxT-36r-00; Thu, 15 May 2003 17:20:23 -0700 Date: Thu, 15 May 2003 17:20:23 -0700 From: Greg KH To: Stephen Hemminger Cc: "David S. Miller" , Patrick Mochel , netdev@oss.sgi.com, jkenisto@us.ibm.com, lkessler@us.ibm.com, Daniel Stekloff Subject: Re: [PATCH 1/2] Sysfs net class - infrastructure Message-ID: <20030516002023.GA11926@kroah.com> References: <20030515162717.477fb84b.shemminger@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030515162717.477fb84b.shemminger@osdl.org> User-Agent: Mutt/1.4.1i X-archive-position: 2543 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greg@kroah.com Precedence: bulk X-list: netdev On Thu, May 15, 2003 at 04:27:17PM -0700, Stephen Hemminger wrote: > +#ifdef CONFIG_NET_SYSFS No, do not make this a config option. sysfs is not a config option, and no other subsystem has this kind of option. It should always be enabled so that userspace tools know it will always be present. If we want to start worrying about CONFIG_TINY or something, then we can possibly start to implement something like this. But for now, no, the overhead is very minimal (compared to something like SCSI for example.) > + /* statistics object */ > + struct kobject stats_kobj; What is this needed for? I don't remember seeing this in your previous patches :) thanks, greg k-h From davem@redhat.com Thu May 15 17:27:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 17:27: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.9) with SMTP id h4G0RbFu015625 for ; Thu, 15 May 2003 17:27:37 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA22731; Thu, 15 May 2003 17:27:01 -0700 Date: Thu, 15 May 2003 17:27:01 -0700 (PDT) Message-Id: <20030515.172701.26515926.davem@redhat.com> To: acme@conectiva.com.br Cc: netdev@oss.sgi.com Subject: Re: [PATCH] wanrouter: kill netdevice_t, do as all the rest of the tree, use struct net_device From: "David S. Miller" In-Reply-To: <20030515215243.GC12303@conectiva.com.br> References: <20030515215243.GC12303@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2544 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 From: Arnaldo Carvalho de Melo Date: Thu, 15 May 2003 18:52:43 -0300 Please consider pulling from: bk://kernel.bkbits.net/acme/net-2.5 Now there are two outstanding changesets in this tree. I've pulled both of your cleanups, thanks. From davem@redhat.com Thu May 15 17:58:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 17:58:52 -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.9) with SMTP id h4G0wfFu016077 for ; Thu, 15 May 2003 17:58:42 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA22895; Thu, 15 May 2003 17:58:10 -0700 Date: Thu, 15 May 2003 17:58:10 -0700 (PDT) Message-Id: <20030515.175810.42792746.davem@redhat.com> To: greg@kroah.com Cc: shemminger@osdl.org, mochel@osdl.org, netdev@oss.sgi.com, jkenisto@us.ibm.com, lkessler@us.ibm.com, dsteklof@us.ibm.com Subject: Re: [PATCH 1/2] Sysfs net class - infrastructure From: "David S. Miller" In-Reply-To: <20030516002023.GA11926@kroah.com> References: <20030515162717.477fb84b.shemminger@osdl.org> <20030516002023.GA11926@kroah.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2545 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 From: Greg KH Date: Thu, 15 May 2003 17:20:23 -0700 On Thu, May 15, 2003 at 04:27:17PM -0700, Stephen Hemminger wrote: > +#ifdef CONFIG_NET_SYSFS No, do not make this a config option. I agree. > + /* statistics object */ > + struct kobject stats_kobj; What is this needed for? I don't remember seeing this in your previous patches :) He provides a sub-directory containing statistic value files. I have no problem with this. From greg@kroah.com Thu May 15 18:44:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 15 May 2003 18:44:09 -0700 (PDT) Received: from granite.he.net (granite.he.net [216.218.226.66]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4G1i4Fu017323 for ; Thu, 15 May 2003 18:44:04 -0700 Received: from [192.168.0.10] (12-231-249-244.client.attbi.com [12.231.249.244]) by granite.he.net (8.8.6p2003-03-31/8.8.2) with ESMTP id SAA14625; Thu, 15 May 2003 18:44:00 -0700 Delivered-To: netdev@oss.sgi.com Received: from greg by echidna.kroah.org with local (masqmail 0.2.19) id 19GUFL-3Ca-00; Thu, 15 May 2003 18:42:55 -0700 Date: Thu, 15 May 2003 18:42:55 -0700 From: Greg KH To: "David S. Miller" Cc: shemminger@osdl.org, mochel@osdl.org, netdev@oss.sgi.com, jkenisto@us.ibm.com, lkessler@us.ibm.com, dsteklof@us.ibm.com Subject: Re: [PATCH 1/2] Sysfs net class - infrastructure Message-ID: <20030516014255.GA12288@kroah.com> References: <20030515162717.477fb84b.shemminger@osdl.org> <20030516002023.GA11926@kroah.com> <20030515.175810.42792746.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030515.175810.42792746.davem@redhat.com> User-Agent: Mutt/1.4.1i X-archive-position: 2546 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: greg@kroah.com Precedence: bulk X-list: netdev On Thu, May 15, 2003 at 05:58:10PM -0700, David S. Miller wrote: > > + /* statistics object */ > > + struct kobject stats_kobj; > > What is this needed for? I don't remember seeing this in your previous > patches :) > > He provides a sub-directory containing statistic value files. > I have no problem with this. Doh, missed that, sorry. That looks nice. greg k-h From mk@karaba.org Fri May 16 05:15:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 05:15:38 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4GCFGFu030179 for ; Fri, 16 May 2003 05:15:19 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19Ge6n-0003rI-00; Fri, 16 May 2003 21:14:45 +0900 Date: Fri, 16 May 2003 21:14:43 +0900 Message-ID: <87llx72imk.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: davem@redhat.com, jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: [PATCH] IPv6 IPComp MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2547 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, This patch is implementation of IPComp for IPv6. I moved IPcompv4/v6 common definitions to net/ipcomp.h and also moved IPcomp header structures to general header files (linux/{ip.h,ipv6.h}). Attached diff is for linux-2.5.69 + CS1.1137 . Could you check it? Regards, -mk Index: include/linux/ip.h =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/include/linux/ip.h,v retrieving revision 1.1.1.6 retrieving revision 1.1.1.6.6.1 diff -u -r1.1.1.6 -r1.1.1.6.6.1 --- include/linux/ip.h 17 Apr 2003 18:15:47 -0000 1.1.1.6 +++ include/linux/ip.h 16 May 2003 07:38:11 -0000 1.1.1.6.6.1 @@ -198,4 +198,10 @@ __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ }; +struct ip_comp_hdr { + __u8 nexthdr; + __u8 flags; + __u16 cpi; +}; + #endif /* _LINUX_IP_H */ Index: include/linux/ipv6.h =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/include/linux/ipv6.h,v retrieving revision 1.1.1.6 retrieving revision 1.1.1.6.2.1 diff -u -r1.1.1.6 -r1.1.1.6.2.1 --- include/linux/ipv6.h 15 May 2003 07:51:46 -0000 1.1.1.6 +++ include/linux/ipv6.h 16 May 2003 07:38:11 -0000 1.1.1.6.2.1 @@ -89,6 +89,12 @@ __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ }; +struct ipv6_comp_hdr { + __u8 nexthdr; + __u8 flags; + __u16 cpi; +}; + /* * IPv6 fixed header * Index: include/net/ipcomp.h =================================================================== RCS file: include/net/ipcomp.h diff -N include/net/ipcomp.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ include/net/ipcomp.h 16 May 2003 07:38:43 -0000 1.1.2.1 @@ -0,0 +1,12 @@ +#ifndef _NET_IPCOMP_H +#define _NET_IPCOMP_H + +#define IPCOMP_SCRATCH_SIZE 65400 + +struct ipcomp_data { + u16 threshold; + u8 *scratch; + struct crypto_tfm *tfm; +}; + +#endif Index: include/net/ipv6.h =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/include/net/ipv6.h,v retrieving revision 1.1.1.7 retrieving revision 1.1.1.7.2.1 diff -u -r1.1.1.7 -r1.1.1.7.2.1 --- include/net/ipv6.h 15 May 2003 07:51:49 -0000 1.1.1.7 +++ include/net/ipv6.h 16 May 2003 08:52:57 -0000 1.1.1.7.2.1 @@ -315,6 +315,7 @@ unsigned length, struct ipv6_txoptions *opt, int hlimit, int flags); +extern int ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr); extern int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), Index: net/ipv4/ipcomp.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv4/ipcomp.c,v retrieving revision 1.1.1.5 retrieving revision 1.1.1.5.2.1 diff -u -r1.1.1.5 -r1.1.1.5.2.1 --- net/ipv4/ipcomp.c 15 May 2003 07:51:32 -0000 1.1.1.5 +++ net/ipv4/ipcomp.c 16 May 2003 07:42:15 -0000 1.1.1.5.2.1 @@ -22,20 +22,7 @@ #include #include #include - -#define IPCOMP_SCRATCH_SIZE 65400 - -struct ipcomp_hdr { - u8 nexthdr; - u8 flags; - u16 cpi; -}; - -struct ipcomp_data { - u16 threshold; - u8 *scratch; - struct crypto_tfm *tfm; -}; +#include static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) { @@ -52,7 +39,7 @@ if (err) goto out; - if (dlen < (plen + sizeof(struct ipcomp_hdr))) { + if (dlen < (plen + sizeof(struct ip_comp_hdr))) { err = -EINVAL; goto out; } @@ -93,11 +80,11 @@ iph = skb->nh.iph; memcpy(&tmp_iph, iph, iph->ihl * 4); nexthdr = *(u8 *)skb->data; - skb_pull(skb, sizeof(struct ipcomp_hdr)); - skb->nh.raw += sizeof(struct ipcomp_hdr); + skb_pull(skb, sizeof(struct ip_comp_hdr)); + skb->nh.raw += sizeof(struct ip_comp_hdr); memcpy(skb->nh.raw, &tmp_iph, tmp_iph.iph.ihl * 4); iph = skb->nh.iph; - iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ipcomp_hdr)); + iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ip_comp_hdr)); iph->protocol = nexthdr; skb->h.raw = skb->data; err = ipcomp_decompress(x, skb); @@ -122,7 +109,7 @@ if (err) goto out; - if ((dlen + sizeof(struct ipcomp_hdr)) >= plen) { + if ((dlen + sizeof(struct ip_comp_hdr)) >= plen) { err = -EMSGSIZE; goto out; } @@ -162,7 +149,7 @@ struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; struct iphdr *iph, *top_iph; - struct ipcomp_hdr *ipch; + struct ip_comp_hdr *ipch; struct ipcomp_data *ipcd = x->data; union { struct iphdr iph; @@ -215,13 +202,13 @@ /* Install ipcomp header, convert into ipcomp datagram. */ iph = skb->nh.iph; memcpy(&tmp_iph, iph, iph->ihl * 4); - top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ipcomp_hdr)); + top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ip_comp_hdr)); memcpy(top_iph, &tmp_iph, iph->ihl * 4); iph = top_iph; iph->tot_len = htons(skb->len); iph->protocol = IPPROTO_COMP; iph->check = 0; - ipch = (struct ipcomp_hdr *)((char *)iph + iph->ihl * 4); + ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4); ipch->nexthdr = x->props.mode ? IPPROTO_IPIP : tmp_iph.iph.protocol; ipch->flags = 0; ipch->cpi = htons((u16 )ntohl(x->id.spi)); @@ -252,7 +239,7 @@ { u32 spi; struct iphdr *iph = (struct iphdr *)skb->data; - struct ipcomp_hdr *ipch = (struct ipcomp_hdr *)(skb->data+(iph->ihl<<2)); + struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); struct xfrm_state *x; if (skb->h.icmph->type != ICMP_DEST_UNREACH || @@ -356,7 +343,7 @@ goto error; memset(ipcd, 0, sizeof(*ipcd)); - x->props.header_len = sizeof(struct ipcomp_hdr); + x->props.header_len = sizeof(struct ip_comp_hdr); if (x->props.mode) x->props.header_len += sizeof(struct iphdr); x->data = ipcd; Index: net/ipv6/Kconfig =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/Kconfig,v retrieving revision 1.1.1.3 retrieving revision 1.1.1.3.38.1 diff -u -r1.1.1.3 -r1.1.1.3.38.1 --- net/ipv6/Kconfig 13 Mar 2003 17:29:06 -0000 1.1.1.3 +++ net/ipv6/Kconfig 16 May 2003 07:48:16 -0000 1.1.1.3.38.1 @@ -33,4 +33,13 @@ If unsure, say Y. +config INET6_IPCOMP + tristate "IPv6: IPComp transformation" + depends on IPV6 + ---help--- + Support for IP Paylod Compression (RFC3173), typically needed + for IPsec. + + If unsure, say Y. + source "net/ipv6/netfilter/Kconfig" Index: net/ipv6/Makefile =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/Makefile,v retrieving revision 1.1.1.9 retrieving revision 1.1.1.9.22.1 diff -u -r1.1.1.9 -r1.1.1.9.22.1 --- net/ipv6/Makefile 24 Mar 2003 05:46:10 -0000 1.1.1.9 +++ net/ipv6/Makefile 16 May 2003 07:48:51 -0000 1.1.1.9.22.1 @@ -13,4 +13,5 @@ obj-$(CONFIG_INET6_AH) += ah6.o obj-$(CONFIG_INET6_ESP) += esp6.o +obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o obj-$(CONFIG_NETFILTER) += netfilter/ Index: net/ipv6/ip6_output.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ip6_output.c,v retrieving revision 1.1.1.12 retrieving revision 1.1.1.12.2.1 diff -u -r1.1.1.12 -r1.1.1.12.2.1 --- net/ipv6/ip6_output.c 15 May 2003 07:51:36 -0000 1.1.1.12 +++ net/ipv6/ip6_output.c 16 May 2003 08:53:50 -0000 1.1.1.12.2.1 @@ -887,7 +887,7 @@ #endif } -static int ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr) +int ip6_found_nexthdr(struct sk_buff *skb, u8 **nexthdr) { u16 offset = sizeof(struct ipv6hdr); struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1); Index: net/ipv6/ipcomp6.c =================================================================== RCS file: net/ipv6/ipcomp6.c diff -N net/ipv6/ipcomp6.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ net/ipv6/ipcomp6.c 16 May 2003 10:51:00 -0000 1.1.2.3 @@ -0,0 +1,368 @@ +/* + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 + * + * Copyright (C)2003 USAGI/WIDE Project + * + * Author Mitsuru KANDA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* + * [Memo] + * + * Outbound: + * The compression of IP datagram MUST be done before AH/ESP processing, + * fragmentation, and the addition of Hop-by-Hop/Routing header. + * + * Inbound: + * The decompression of IP datagram MUST be done after the reassembly, + * AH/ESP processing. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* XXX no ipv6 ipcomp specific */ +#define NIP6(addr) \ + ntohs((addr).s6_addr16[0]),\ + ntohs((addr).s6_addr16[1]),\ + ntohs((addr).s6_addr16[2]),\ + ntohs((addr).s6_addr16[3]),\ + ntohs((addr).s6_addr16[4]),\ + ntohs((addr).s6_addr16[5]),\ + ntohs((addr).s6_addr16[6]),\ + ntohs((addr).s6_addr16[7]) + +static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) +{ + int err = 0; + u8 nexthdr = 0; + u8 *prevhdr; + int hdr_len = skb->h.raw - skb->nh.raw; + unsigned char *tmp_hdr = NULL; + struct ipv6hdr *iph; + int plen, dlen; + struct ipcomp_data *ipcd = x->data; + u8 *start, *scratch = ipcd->scratch; + + if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && + skb_linearize(skb, GFP_ATOMIC) != 0) { + err = -ENOMEM; + goto out; + } + + skb->ip_summed = CHECKSUM_NONE; + + /* Remove ipcomp header and decompress original payload */ + iph = skb->nh.ipv6h; + tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC); + if (!tmp_hdr) + goto out; + memcpy(tmp_hdr, iph, hdr_len); + nexthdr = *(u8 *)skb->data; + skb_pull(skb, sizeof(struct ipv6_comp_hdr)); + skb->nh.raw += sizeof(struct ipv6_comp_hdr); + memcpy(skb->nh.raw, tmp_hdr, hdr_len); + iph = skb->nh.ipv6h; + iph->payload_len = htons(ntohs(iph->payload_len) - sizeof(struct ipv6_comp_hdr)); + skb->h.raw = skb->data; + + /* decompression */ + plen = skb->len; + dlen = IPCOMP_SCRATCH_SIZE; + start = skb->data; + + err = crypto_comp_decompress(ipcd->tfm, start, plen, scratch, &dlen); + if (err) { + err = -EINVAL; + goto out; + } + + if (dlen < (plen + sizeof(struct ipv6_comp_hdr))) { + err = -EINVAL; + goto out; + } + + err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); + if (err) { + goto out; + } + + skb_put(skb, dlen - plen); + memcpy(skb->data, scratch, dlen); + + iph = skb->nh.ipv6h; + iph->payload_len = htons(skb->len); + + ip6_found_nexthdr(skb, &prevhdr); + *prevhdr = nexthdr; +out: + if (tmp_hdr) + kfree(tmp_hdr); + if (err) + goto error_out; + return nexthdr; +error_out: + return err; +} + +static int ipcomp6_output(struct sk_buff *skb) +{ + int err; + struct dst_entry *dst = skb->dst; + struct xfrm_state *x = dst->xfrm; + struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph; + int hdr_len = 0; + struct ipv6_comp_hdr *ipch; + struct ipcomp_data *ipcd = x->data; + u8 *prevhdr; + u8 nexthdr = 0; + int plen, dlen; + u8 *start, *scratch = ipcd->scratch; + + if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { + err = -EINVAL; + goto error_nolock; + } + + spin_lock_bh(&x->lock); + + err = xfrm_check_output(x, skb, AF_INET6); + if (err) + goto error; + + if (x->props.mode) { + hdr_len = sizeof(struct ipv6hdr); + nexthdr = IPPROTO_IPV6; + iph = skb->nh.ipv6h; + top_iph = (struct ipv6hdr *)skb_push(skb, sizeof(struct ipv6hdr)); + top_iph->version = 6; + top_iph->priority = iph->priority; + top_iph->flow_lbl[0] = iph->flow_lbl[0]; + top_iph->flow_lbl[1] = iph->flow_lbl[1]; + top_iph->flow_lbl[2] = iph->flow_lbl[2]; + top_iph->nexthdr = IPPROTO_IPV6; /* initial */ + top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); + top_iph->hop_limit = iph->hop_limit; + memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr)); + memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr)); + skb->nh.raw = skb->data; /* == top_iph */ + skb->h.raw = skb->nh.raw + hdr_len; + } else { + hdr_len = ip6_found_nexthdr(skb, &prevhdr); + nexthdr = *prevhdr; + } + + /* check whether datagram len is larger than threshold */ + if ((skb->len - hdr_len) < ipcd->threshold) { + goto out_ok; + } + + if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && + skb_linearize(skb, GFP_ATOMIC) != 0) { + err = -ENOMEM; + goto error; + } + + /* compression */ + plen = skb->len - hdr_len; + dlen = IPCOMP_SCRATCH_SIZE; + start = skb->data + hdr_len; + + err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); + if (err) { + goto error; + } + if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) { + goto out_ok; + } + memcpy(start, scratch, dlen); + pskb_trim(skb, hdr_len+dlen); + + /* insert ipcomp header and replace datagram */ + tmp_iph = kmalloc(hdr_len, GFP_ATOMIC); + if (!tmp_iph) { + err = -ENOMEM; + goto error; + } + memcpy(tmp_iph, skb->nh.raw, hdr_len); + top_iph = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6_comp_hdr)); + memcpy(top_iph, tmp_iph, hdr_len); + kfree(tmp_iph); + + top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); + skb->nh.raw = skb->data; /* top_iph */ + ip6_found_nexthdr(skb, &prevhdr); + *prevhdr = IPPROTO_COMP; + + ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len); + ipch->nexthdr = nexthdr; + ipch->flags = 0; + ipch->cpi = htons((u16 )ntohl(x->id.spi)); + + skb->h.raw = (unsigned char*)ipch; +out_ok: + x->curlft.bytes += skb->len; + x->curlft.packets++; + spin_unlock_bh(&x->lock); + + if ((skb->dst = dst_pop(dst)) == NULL) { + err = -EHOSTUNREACH; + goto error_nolock; + } + err = NET_XMIT_BYPASS; + +out_exit: + return err; +error: + spin_unlock_bh(&x->lock); +error_nolock: + kfree_skb(skb); + goto out_exit; +} + +static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + int type, int code, int offset, __u32 info) +{ + u32 spi; + struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; + struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset); + struct xfrm_state *x; + + if (type != ICMPV6_DEST_UNREACH || type != ICMPV6_PKT_TOOBIG) + return; + + spi = ntohl(ntohs(ipcomph->cpi)); + x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); + if (!x) + return; + + printk(KERN_DEBUG "pmtu discvovery on SA IPCOMP/%08x/" + "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + spi, NIP6(iph->daddr)); + xfrm_state_put(x); +} + +static void ipcomp6_free_data(struct ipcomp_data *ipcd) +{ + if (ipcd->tfm) + crypto_free_tfm(ipcd->tfm); + if (ipcd->scratch) + kfree(ipcd->scratch); +} + +static void ipcomp6_destroy(struct xfrm_state *x) +{ + struct ipcomp_data *ipcd = x->data; + ipcomp6_free_data(ipcd); + kfree(ipcd); +} + +static int ipcomp6_init_state(struct xfrm_state *x, void *args) +{ + int err = -ENOMEM; + struct ipcomp_data *ipcd; + struct xfrm_algo_desc *calg_desc; + + ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL); + if (!ipcd) + goto error; + + memset(ipcd, 0, sizeof(*ipcd)); + x->props.header_len = sizeof(struct ipv6_comp_hdr); + if (x->props.mode) + x->props.header_len += sizeof(struct ipv6hdr); + x->data = ipcd; + + ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL); + if (!ipcd->scratch) + goto error; + + ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0); + if (!ipcd->tfm) + goto error; + + calg_desc = xfrm_calg_get_byname(x->calg->alg_name); + BUG_ON(!calg_desc); + ipcd->threshold = calg_desc->uinfo.comp.threshold; + err = 0; +out: + return err; +error: + if (ipcd) { + ipcomp6_free_data(ipcd); + kfree(ipcd); + } + + goto out; +} + +static struct xfrm_type ipcomp6_type = +{ + .description = "IPCOMP6", + .owner = THIS_MODULE, + .proto = IPPROTO_COMP, + .init_state = ipcomp6_init_state, + .destructor = ipcomp6_destroy, + .input = ipcomp6_input, + .output = ipcomp6_output, +}; + +static struct inet6_protocol ipcomp6_protocol = +{ + .handler = xfrm6_rcv, + .err_handler = ipcomp6_err, + .flags = INET6_PROTO_NOPOLICY, +}; + +static int __init ipcomp6_init(void) +{ + if (xfrm_register_type(&ipcomp6_type, AF_INET6) < 0) { + printk(KERN_INFO "ipcomp6 init: can't add xfrm type\n"); + return -EAGAIN; + } + if (inet6_add_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) { + printk(KERN_INFO "ipcomp6 init: can't add protocol\n"); + xfrm_unregister_type(&ipcomp6_type, AF_INET6); + return -EAGAIN; + } + return 0; +} + +static void __exit ipcomp6_fini(void) +{ + if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) + printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n"); + if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0) + printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n"); +} + +module_init(ipcomp6_init); +module_exit(ipcomp6_fini); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173"); +MODULE_AUTHOR("Mitsuru KANDA "); + + Index: net/ipv6/ipv6_syms.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ipv6_syms.c,v retrieving revision 1.1.1.9 retrieving revision 1.1.1.9.4.1 diff -u -r1.1.1.9 -r1.1.1.9.4.1 --- net/ipv6/ipv6_syms.c 6 May 2003 12:43:55 -0000 1.1.1.9 +++ net/ipv6/ipv6_syms.c 16 May 2003 07:46:18 -0000 1.1.1.9.4.1 @@ -35,5 +35,6 @@ EXPORT_SYMBOL(in6addr_any); EXPORT_SYMBOL(in6addr_loopback); EXPORT_SYMBOL(in6_dev_finish_destroy); +EXPORT_SYMBOL(ip6_found_nexthdr); EXPORT_SYMBOL(xfrm6_rcv); EXPORT_SYMBOL(xfrm6_clear_mutable_options); Index: net/xfrm/xfrm_input.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/xfrm/xfrm_input.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.2.14.1 diff -u -r1.1.1.2 -r1.1.1.2.14.1 --- net/xfrm/xfrm_input.c 8 Apr 2003 08:57:59 -0000 1.1.1.2 +++ net/xfrm/xfrm_input.c 16 May 2003 07:40:01 -0000 1.1.1.2.14.1 @@ -34,7 +34,7 @@ offset_seq = offsetof(struct ip_esp_hdr, seq_no); break; case IPPROTO_COMP: - if (!pskb_may_pull(skb, 4)) + if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) return -EINVAL; *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2))); *seq = 0; From jmorris@intercode.com.au Fri May 16 06:41:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 06:41:26 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:1AYI8ux1FLA2+cJfRQj6EZKaZnS+2o/Y@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4GDfHFu031243 for ; Fri, 16 May 2003 06:41:21 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4GDeIr07525; Fri, 16 May 2003 23:40:19 +1000 Date: Fri, 16 May 2003 23:40:18 +1000 (EST) From: James Morris To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <87llx72imk.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2548 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Fri, 16 May 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > This patch is implementation of IPComp for IPv6. > I moved IPcompv4/v6 common definitions to net/ipcomp.h > and also moved IPcomp header structures to general header files > (linux/{ip.h,ipv6.h}). > > Attached diff is for linux-2.5.69 + CS1.1137 . > > Could you check it? > Looks good! A few issues: The crypto/Kconfig file needs to be updated so that the deflate module is enabled when ipcomp6 is. In a subsequent patch, it would be good to define single NIP6() in a header file, as local versions are spreading. With current bk, you need to attach internal ipip xfrms to allow reception of uncompressed ipcomp packets in tunnel mode. See the current ipv4 ipcomp code as an example. Any generic code for this should probably live in net/xfrm/xfrm_tunnel.c - James -- James Morris From mk@karaba.org Fri May 16 10:59:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 10:59:59 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4GHxkFu005085 for ; Fri, 16 May 2003 10:59:48 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19GjUQ-0001Tj-00; Sat, 17 May 2003 02:59:30 +0900 Date: Sat, 17 May 2003 02:59:30 +0900 Message-ID: <873cjebwn1.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: jmorris@intercode.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: References: <87llx72imk.wl@karaba.org> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2549 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev At Fri, 16 May 2003 23:40:18 +1000 (EST), James Morris wrote: ... > > Attached diff is for linux-2.5.69 + CS1.1137 . > > > > Could you check it? > > > > Looks good! Thank you! > A few issues: > > The crypto/Kconfig file needs to be updated so that the deflate module is > enabled when ipcomp6 is. OK, I will send a small patch after this ipcomp6 patch is committed. > In a subsequent patch, it would be good to define single NIP6() in a > header file, as local versions are spreading. Yes, this is a next issue for me. I have a plan to do various small cleanups w/r AH6/ESP6/IPComp6... > With current bk, you need to attach internal ipip xfrms to allow reception > of uncompressed ipcomp packets in tunnel mode. See the current ipv4 > ipcomp code as an example. Any generic code for this should probably live > in net/xfrm/xfrm_tunnel.c I think so, but it may take a time because currently ip6ip6 does not exist. Regards, -mk From davem@redhat.com Fri May 16 14:01:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 14:01:51 -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.9) with SMTP id h4GL1fFu008973 for ; Fri, 16 May 2003 14:01:42 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA25354; Fri, 16 May 2003 14:00:15 -0700 Date: Fri, 16 May 2003 14:00:14 -0700 (PDT) Message-Id: <20030516.140014.59676235.davem@redhat.com> To: mk@linux-ipv6.org Cc: jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp From: "David S. Miller" In-Reply-To: <873cjebwn1.wl@karaba.org> References: <87llx72imk.wl@karaba.org> <873cjebwn1.wl@karaba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2550 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 From: Mitsuru KANDA / $B?@ED(B $B=<(B Date: Sat, 17 May 2003 02:59:30 +0900 but it may take a time because currently ip6ip6 does not exist. Once you implement xfrm6_tunnel.c the problem is mostly solved. You do not need to have an ip6ip6 device-like tunnel first. I will integrate your patch, thanks. From pekkas@netcore.fi Fri May 16 14:36:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 14:36:34 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4GLaNFu009755 for ; Fri, 16 May 2003 14:36:26 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h4GLZhi22496; Sat, 17 May 2003 00:35:44 +0300 Date: Sat, 17 May 2003 00:35:43 +0300 (EEST) From: Pekka Savola To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , , Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <87llx72imk.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2551 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 Fri, 16 May 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 What?!? Such RFC does not exist :-) > + * > + * Copyright (C)2003 USAGI/WIDE Project > + * > + * Author Mitsuru KANDA > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > + */ > +/* > + * [Memo] > + * > + * Outbound: > + * The compression of IP datagram MUST be done before AH/ESP processing, > + * fragmentation, and the addition of Hop-by-Hop/Routing header. > + * > + * Inbound: > + * The decompression of IP datagram MUST be done after the reassembly, > + * AH/ESP processing. > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* XXX no ipv6 ipcomp specific */ > +#define NIP6(addr) \ > + ntohs((addr).s6_addr16[0]),\ > + ntohs((addr).s6_addr16[1]),\ > + ntohs((addr).s6_addr16[2]),\ > + ntohs((addr).s6_addr16[3]),\ > + ntohs((addr).s6_addr16[4]),\ > + ntohs((addr).s6_addr16[5]),\ > + ntohs((addr).s6_addr16[6]),\ > + ntohs((addr).s6_addr16[7]) > + > +static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) > +{ > + int err = 0; > + u8 nexthdr = 0; > + u8 *prevhdr; > + int hdr_len = skb->h.raw - skb->nh.raw; > + unsigned char *tmp_hdr = NULL; > + struct ipv6hdr *iph; > + int plen, dlen; > + struct ipcomp_data *ipcd = x->data; > + u8 *start, *scratch = ipcd->scratch; > + > + if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && > + skb_linearize(skb, GFP_ATOMIC) != 0) { > + err = -ENOMEM; > + goto out; > + } > + > + skb->ip_summed = CHECKSUM_NONE; > + > + /* Remove ipcomp header and decompress original payload */ > + iph = skb->nh.ipv6h; > + tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC); > + if (!tmp_hdr) > + goto out; > + memcpy(tmp_hdr, iph, hdr_len); > + nexthdr = *(u8 *)skb->data; > + skb_pull(skb, sizeof(struct ipv6_comp_hdr)); > + skb->nh.raw += sizeof(struct ipv6_comp_hdr); > + memcpy(skb->nh.raw, tmp_hdr, hdr_len); > + iph = skb->nh.ipv6h; > + iph->payload_len = htons(ntohs(iph->payload_len) - sizeof(struct ipv6_comp_hdr)); > + skb->h.raw = skb->data; > + > + /* decompression */ > + plen = skb->len; > + dlen = IPCOMP_SCRATCH_SIZE; > + start = skb->data; > + > + err = crypto_comp_decompress(ipcd->tfm, start, plen, scratch, &dlen); > + if (err) { > + err = -EINVAL; > + goto out; > + } > + > + if (dlen < (plen + sizeof(struct ipv6_comp_hdr))) { > + err = -EINVAL; > + goto out; > + } > + > + err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); > + if (err) { > + goto out; > + } > + > + skb_put(skb, dlen - plen); > + memcpy(skb->data, scratch, dlen); > + > + iph = skb->nh.ipv6h; > + iph->payload_len = htons(skb->len); > + > + ip6_found_nexthdr(skb, &prevhdr); > + *prevhdr = nexthdr; > +out: > + if (tmp_hdr) > + kfree(tmp_hdr); > + if (err) > + goto error_out; > + return nexthdr; > +error_out: > + return err; > +} > + > +static int ipcomp6_output(struct sk_buff *skb) > +{ > + int err; > + struct dst_entry *dst = skb->dst; > + struct xfrm_state *x = dst->xfrm; > + struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph; > + int hdr_len = 0; > + struct ipv6_comp_hdr *ipch; > + struct ipcomp_data *ipcd = x->data; > + u8 *prevhdr; > + u8 nexthdr = 0; > + int plen, dlen; > + u8 *start, *scratch = ipcd->scratch; > + > + if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { > + err = -EINVAL; > + goto error_nolock; > + } > + > + spin_lock_bh(&x->lock); > + > + err = xfrm_check_output(x, skb, AF_INET6); > + if (err) > + goto error; > + > + if (x->props.mode) { > + hdr_len = sizeof(struct ipv6hdr); > + nexthdr = IPPROTO_IPV6; > + iph = skb->nh.ipv6h; > + top_iph = (struct ipv6hdr *)skb_push(skb, sizeof(struct ipv6hdr)); > + top_iph->version = 6; > + top_iph->priority = iph->priority; > + top_iph->flow_lbl[0] = iph->flow_lbl[0]; > + top_iph->flow_lbl[1] = iph->flow_lbl[1]; > + top_iph->flow_lbl[2] = iph->flow_lbl[2]; > + top_iph->nexthdr = IPPROTO_IPV6; /* initial */ > + top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); > + top_iph->hop_limit = iph->hop_limit; > + memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr)); > + memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr)); > + skb->nh.raw = skb->data; /* == top_iph */ > + skb->h.raw = skb->nh.raw + hdr_len; > + } else { > + hdr_len = ip6_found_nexthdr(skb, &prevhdr); > + nexthdr = *prevhdr; > + } > + > + /* check whether datagram len is larger than threshold */ > + if ((skb->len - hdr_len) < ipcd->threshold) { > + goto out_ok; > + } > + > + if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && > + skb_linearize(skb, GFP_ATOMIC) != 0) { > + err = -ENOMEM; > + goto error; > + } > + > + /* compression */ > + plen = skb->len - hdr_len; > + dlen = IPCOMP_SCRATCH_SIZE; > + start = skb->data + hdr_len; > + > + err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); > + if (err) { > + goto error; > + } > + if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) { > + goto out_ok; > + } > + memcpy(start, scratch, dlen); > + pskb_trim(skb, hdr_len+dlen); > + > + /* insert ipcomp header and replace datagram */ > + tmp_iph = kmalloc(hdr_len, GFP_ATOMIC); > + if (!tmp_iph) { > + err = -ENOMEM; > + goto error; > + } > + memcpy(tmp_iph, skb->nh.raw, hdr_len); > + top_iph = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6_comp_hdr)); > + memcpy(top_iph, tmp_iph, hdr_len); > + kfree(tmp_iph); > + > + top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); > + skb->nh.raw = skb->data; /* top_iph */ > + ip6_found_nexthdr(skb, &prevhdr); > + *prevhdr = IPPROTO_COMP; > + > + ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len); > + ipch->nexthdr = nexthdr; > + ipch->flags = 0; > + ipch->cpi = htons((u16 )ntohl(x->id.spi)); > + > + skb->h.raw = (unsigned char*)ipch; > +out_ok: > + x->curlft.bytes += skb->len; > + x->curlft.packets++; > + spin_unlock_bh(&x->lock); > + > + if ((skb->dst = dst_pop(dst)) == NULL) { > + err = -EHOSTUNREACH; > + goto error_nolock; > + } > + err = NET_XMIT_BYPASS; > + > +out_exit: > + return err; > +error: > + spin_unlock_bh(&x->lock); > +error_nolock: > + kfree_skb(skb); > + goto out_exit; > +} > + > +static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, > + int type, int code, int offset, __u32 info) > +{ > + u32 spi; > + struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; > + struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset); > + struct xfrm_state *x; > + > + if (type != ICMPV6_DEST_UNREACH || type != ICMPV6_PKT_TOOBIG) > + return; > + > + spi = ntohl(ntohs(ipcomph->cpi)); > + x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); > + if (!x) > + return; > + > + printk(KERN_DEBUG "pmtu discvovery on SA IPCOMP/%08x/" > + "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", > + spi, NIP6(iph->daddr)); > + xfrm_state_put(x); > +} > + > +static void ipcomp6_free_data(struct ipcomp_data *ipcd) > +{ > + if (ipcd->tfm) > + crypto_free_tfm(ipcd->tfm); > + if (ipcd->scratch) > + kfree(ipcd->scratch); > +} > + > +static void ipcomp6_destroy(struct xfrm_state *x) > +{ > + struct ipcomp_data *ipcd = x->data; > + ipcomp6_free_data(ipcd); > + kfree(ipcd); > +} > + > +static int ipcomp6_init_state(struct xfrm_state *x, void *args) > +{ > + int err = -ENOMEM; > + struct ipcomp_data *ipcd; > + struct xfrm_algo_desc *calg_desc; > + > + ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL); > + if (!ipcd) > + goto error; > + > + memset(ipcd, 0, sizeof(*ipcd)); > + x->props.header_len = sizeof(struct ipv6_comp_hdr); > + if (x->props.mode) > + x->props.header_len += sizeof(struct ipv6hdr); > + x->data = ipcd; > + > + ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL); > + if (!ipcd->scratch) > + goto error; > + > + ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0); > + if (!ipcd->tfm) > + goto error; > + > + calg_desc = xfrm_calg_get_byname(x->calg->alg_name); > + BUG_ON(!calg_desc); > + ipcd->threshold = calg_desc->uinfo.comp.threshold; > + err = 0; > +out: > + return err; > +error: > + if (ipcd) { > + ipcomp6_free_data(ipcd); > + kfree(ipcd); > + } > + > + goto out; > +} > + > +static struct xfrm_type ipcomp6_type = > +{ > + .description = "IPCOMP6", > + .owner = THIS_MODULE, > + .proto = IPPROTO_COMP, > + .init_state = ipcomp6_init_state, > + .destructor = ipcomp6_destroy, > + .input = ipcomp6_input, > + .output = ipcomp6_output, > +}; > + > +static struct inet6_protocol ipcomp6_protocol = > +{ > + .handler = xfrm6_rcv, > + .err_handler = ipcomp6_err, > + .flags = INET6_PROTO_NOPOLICY, > +}; > + > +static int __init ipcomp6_init(void) > +{ > + if (xfrm_register_type(&ipcomp6_type, AF_INET6) < 0) { > + printk(KERN_INFO "ipcomp6 init: can't add xfrm type\n"); > + return -EAGAIN; > + } > + if (inet6_add_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) { > + printk(KERN_INFO "ipcomp6 init: can't add protocol\n"); > + xfrm_unregister_type(&ipcomp6_type, AF_INET6); > + return -EAGAIN; > + } > + return 0; > +} > + > +static void __exit ipcomp6_fini(void) > +{ > + if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) > + printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n"); > + if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0) > + printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n"); > +} > + > +module_init(ipcomp6_init); > +module_exit(ipcomp6_fini); > +MODULE_LICENSE("GPL"); > +MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173"); > +MODULE_AUTHOR("Mitsuru KANDA "); > + > + > Index: net/ipv6/ipv6_syms.c > =================================================================== > RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ipv6_syms.c,v > retrieving revision 1.1.1.9 > retrieving revision 1.1.1.9.4.1 > diff -u -r1.1.1.9 -r1.1.1.9.4.1 > --- net/ipv6/ipv6_syms.c 6 May 2003 12:43:55 -0000 1.1.1.9 > +++ net/ipv6/ipv6_syms.c 16 May 2003 07:46:18 -0000 1.1.1.9.4.1 > @@ -35,5 +35,6 @@ > EXPORT_SYMBOL(in6addr_any); > EXPORT_SYMBOL(in6addr_loopback); > EXPORT_SYMBOL(in6_dev_finish_destroy); > +EXPORT_SYMBOL(ip6_found_nexthdr); > EXPORT_SYMBOL(xfrm6_rcv); > EXPORT_SYMBOL(xfrm6_clear_mutable_options); > Index: net/xfrm/xfrm_input.c > =================================================================== > RCS file: /cvsroot/usagi/usagi-backport/linux25/net/xfrm/xfrm_input.c,v > retrieving revision 1.1.1.2 > retrieving revision 1.1.1.2.14.1 > diff -u -r1.1.1.2 -r1.1.1.2.14.1 > --- net/xfrm/xfrm_input.c 8 Apr 2003 08:57:59 -0000 1.1.1.2 > +++ net/xfrm/xfrm_input.c 16 May 2003 07:40:01 -0000 1.1.1.2.14.1 > @@ -34,7 +34,7 @@ > offset_seq = offsetof(struct ip_esp_hdr, seq_no); > break; > case IPPROTO_COMP: > - if (!pskb_may_pull(skb, 4)) > + if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) > return -EINVAL; > *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2))); > *seq = 0; > -- 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 Fri May 16 15:27:33 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 15:27: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.9) with SMTP id h4GMRVFu010751 for ; Fri, 16 May 2003 15:27:33 -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 h4GMRkBo018782; Sat, 17 May 2003 07:27:46 +0900 Date: Sat, 17 May 2003 07:27:45 +0900 (JST) Message-Id: <20030517.072745.05080928.yoshfuji@linux-ipv6.org> To: davem@redhat.com, kuznet@ms2.inr.ac.ru, jmorris@intercode.com.au, pekkas@netcore.fi Cc: mk@linux-ipv6.org, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: <87llx72imk.wl@karaba.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: 2552 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 Sat, 17 May 2003 00:35:43 +0300 (EEST)), Pekka Savola says: > > + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 > > What?!? Such RFC does not exist :-) Oops... :-p Index: net/ipv6/ipcomp6.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/Attic/ipcomp6.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- net/ipv6/ipcomp6.c 16 May 2003 10:51:00 -0000 1.1.2.3 +++ net/ipv6/ipcomp6.c 16 May 2003 22:11:25 -0000 1.1.2.4 @@ -1,5 +1,5 @@ /* - * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173 * * Copyright (C)2003 USAGI/WIDE Project * -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From davem@redhat.com Fri May 16 16:53:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 16:54: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.9) with SMTP id h4GNrtFu012153 for ; Fri, 16 May 2003 16:53:55 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA25669; Fri, 16 May 2003 16:52:32 -0700 Date: Fri, 16 May 2003 16:52:32 -0700 (PDT) Message-Id: <20030516.165232.23034665.davem@redhat.com> To: yoshfuji@linux-ipv6.org Cc: kuznet@ms2.inr.ac.ru, jmorris@intercode.com.au, pekkas@netcore.fi, mk@linux-ipv6.org, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp From: "David S. Miller" In-Reply-To: <20030517.072745.05080928.yoshfuji@linux-ipv6.org> References: <87llx72imk.wl@karaba.org> <20030517.072745.05080928.yoshfuji@linux-ipv6.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2553 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 From: YOSHIFUJI Hideaki / $B5HF#1QL@(B Date: Sat, 17 May 2003 07:27:45 +0900 (JST) In article (at Sat, 17 May 2003 00:35:43 +0300 (EEST)), Pekka Savola says: > > + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 > > What?!? Such RFC does not exist :-) Oops... :-p Fix applied, thanks :-) From jmorris@intercode.com.au Fri May 16 17:09:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 17:09:50 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:GuYC3MRkwZImXgowqVChbd+BQWW8kLfS@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4H09hFu012615 for ; Fri, 16 May 2003 17:09:46 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4H08tr09944; Sat, 17 May 2003 10:08:55 +1000 Date: Sat, 17 May 2003 10:08:55 +1000 (EST) From: James Morris To: "David S. Miller" cc: kuznet@ms2.inr.ac.ru, Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <20030516.165232.23034665.davem@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2554 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Fri, 16 May 2003, David S. Miller wrote: > Date: Sat, 17 May 2003 07:27:45 +0900 (JST) > > In article (at Sat, 17 May 2003 00:35:43 +0300 (EEST)), Pekka Savola says: > > > > + * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3713 > > > > What?!? Such RFC does not exist :-) > > Oops... :-p > > Fix applied, thanks :-) > IPv4 was using an RFC from the future as well. - James -- James Morris --- bk.pending/net/ipv4/ipcomp.c Thu May 15 15:55:41 2003 +++ bk.w1/net/ipv4/ipcomp.c Sat May 17 10:53:09 2003 @@ -1,5 +1,5 @@ /* - * IP Payload Compression Protocol (IPComp) - RFC3713. + * IP Payload Compression Protocol (IPComp) - RFC3173. * * Copyright (c) 2003 James Morris * @@ -433,6 +433,6 @@ module_exit(ipcomp4_fini); MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) - RFC3713"); +MODULE_DESCRIPTION("IP Payload Compression Protocol (IPComp) - RFC3173"); MODULE_AUTHOR("James Morris "); From davem@redhat.com Fri May 16 17:21:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 16 May 2003 17:21: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.9) with SMTP id h4H0LbFu013117 for ; Fri, 16 May 2003 17:21:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA25760; Fri, 16 May 2003 17:20:21 -0700 Date: Fri, 16 May 2003 17:20:21 -0700 (PDT) Message-Id: <20030516.172021.38692806.davem@redhat.com> To: jmorris@intercode.com.au Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: [PATCH] IPv6 IPComp From: "David S. Miller" In-Reply-To: References: <20030516.165232.23034665.davem@redhat.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2555 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 From: James Morris Date: Sat, 17 May 2003 10:08:55 +1000 (EST) IPv4 was using an RFC from the future as well. Thanks James, applied. From jgarzik@pobox.com Sat May 17 02:53:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 02:53:58 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4H9rj2x001015 for ; Sat, 17 May 2003 02:53:48 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19GCSX-0005qt-LJ; Thu, 15 May 2003 07:43:21 +0100 Message-ID: <3EC336FE.1030805@pobox.com> Date: Thu, 15 May 2003 02:43:10 -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: davej@codemonkey.org.uk CC: Linux Kernel Mailing List , netdev@oss.sgi.com Subject: Re: [PATCH] iphase fix. References: <200305150417.h4F4HTRA025809@hera.kernel.org> <3EC3359D.5050207@pobox.com> In-Reply-To: <3EC3359D.5050207@pobox.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2556 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 Jeff Garzik wrote: >> dev_kfree_skb(skb); >> - else >> - netif_wake_queue(dev); >> + netif_wake_queue(dev); >> LEAVE("iph5526_send_packet"); > > > > This appears to revert a fix. > > You only want to wake the queue if you have room to queue another skb. Actually, I'm wrong. But it could still use some looking-at. You don't want to stop_queue at the beginning of send_packet and wake_queue at the end. Instead, the queue should be awakened in the Tx completion routine, and the stop_queue should be moved from the beginning to the end of the function. Jeff From mk@karaba.org Sat May 17 03:08:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 03:08:11 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4HA832x001476 for ; Sat, 17 May 2003 03:08:06 -0700 Received: from [3ffe:501:1057:710::1] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19GsYL-0002aV-00; Sat, 17 May 2003 12:40:09 +0900 Date: Sat, 17 May 2003 12:40:08 +0900 Message-ID: <87y9169r6v.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: "David S. Miller" Cc: jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <20030516.140014.59676235.davem@redhat.com> References: <87llx72imk.wl@karaba.org> <873cjebwn1.wl@karaba.org> <20030516.140014.59676235.davem@redhat.com> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=ISO-2022-JP X-archive-position: 2557 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, At Fri, 16 May 2003 14:00:14 -0700 (PDT), "David S. Miller" wrote: > > From: Mitsuru KANDA / $B?@ED(B $B=<(B > Date: Sat, 17 May 2003 02:59:30 +0900 > > but it may take a time because currently ip6ip6 does not exist. > > Once you implement xfrm6_tunnel.c the problem is mostly solved. > You do not need to have an ip6ip6 device-like tunnel first. OK, we will do this. > I will integrate your patch, thanks. Thank you. Regards, -mk From mk@karaba.org Sat May 17 09:15:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 09:15:54 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4HGFW2x007690 for ; Sat, 17 May 2003 09:15:41 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19H4Kx-0008VE-00; Sun, 18 May 2003 01:15:07 +0900 Date: Sun, 18 May 2003 01:15:05 +0900 Message-ID: <87u1bta6t2.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: jmorris@intercode.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <873cjebwn1.wl@karaba.org> References: <87llx72imk.wl@karaba.org> <873cjebwn1.wl@karaba.org> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=ISO-2022-JP X-archive-position: 2558 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, At Sat, 17 May 2003 02:59:30 +0900, Mitsuru KANDA / $B?@ED(B $B=<(B wrote: > > > At Fri, 16 May 2003 23:40:18 +1000 (EST), > James Morris wrote: ... > > A few issues: > > > > The crypto/Kconfig file needs to be updated so that the deflate module is > > enabled when ipcomp6 is. > OK, I will send a small patch after this ipcomp6 patch is committed. Please apply this diff. Thank you, -mk ===== Kconfig 1.13 vs edited ===== --- 1.13/crypto/Kconfig Tue May 13 06:05:32 2003 +++ edited/Kconfig Sun May 18 01:04:13 2003 @@ -138,7 +138,7 @@ config CRYPTO_DEFLATE tristate "Deflate compression algorithm" depends on CRYPTO - default y if INET_IPCOMP=y || INET_IPCOMP=m + default y if INET_IPCOMP=y || INET_IPCOMP=m || INET6_IPCOMP=y || INET6_IPCOMP=m help This is the Deflate algorithm (RFC1951), specified for use in IPSec with the IPCOMP protocol (RFC3173, RFC2394). From mk@karaba.org Sat May 17 10:00:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 10:00:26 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4HH0E2x008744 for ; Sat, 17 May 2003 10:00:15 -0700 Received: from [3ffe:501:1057:710::1] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19H52R-0003yt-00; Sun, 18 May 2003 02:00:03 +0900 Date: Sun, 18 May 2003 02:00:01 +0900 Message-ID: <87smrda4q6.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: jmorris@intercode.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: [PATCH] IPV4 IPComp : threshold comparison MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2559 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, I'm not sure how exactly we should check threshold. In IPsec tunnel mode, the original comparison code seems to be including IP header length. Could you check it? Regards, -mk ===== ipcomp.c 1.6 vs edited ===== --- 1.6/net/ipv4/ipcomp.c Tue May 13 05:58:03 2003 +++ edited/ipcomp.c Sun May 18 01:42:22 2003 @@ -168,6 +168,7 @@ struct iphdr iph; char buf[60]; } tmp_iph; + int hdr_len = 0; if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { err = -EINVAL; @@ -180,7 +181,11 @@ goto error; /* Don't bother compressing */ - if (skb->len < ipcd->threshold) { + if (!x->props.mode) { + iph = skb->nh.iph; + hdr_len = iph->ihl * 4; + } + if ((skb->len - hdr_len) < ipcd->threshold) { if (x->props.mode) { ipcomp_tunnel_encap(x, skb); iph = skb->nh.iph; From davem@redhat.com Sat May 17 15:32:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 15:32:14 -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.9) with SMTP id h4HMW82x014613 for ; Sat, 17 May 2003 15:32:09 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id PAA27606; Sat, 17 May 2003 15:30:26 -0700 Date: Sat, 17 May 2003 15:30:26 -0700 (PDT) Message-Id: <20030517.153026.85390141.davem@redhat.com> To: mk@linux-ipv6.org Cc: jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPv6 IPComp From: "David S. Miller" In-Reply-To: <87u1bta6t2.wl@karaba.org> References: <873cjebwn1.wl@karaba.org> <87u1bta6t2.wl@karaba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2560 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 From: Mitsuru KANDA / $B?@ED(B $B=<(B Date: Sun, 18 May 2003 01:15:05 +0900 Please apply this diff. Applied, thanks. From jmorris@intercode.com.au Sat May 17 18:08:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 18:08:18 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:Lkyv5K90DAIaq0MPiQSgiIDQAm2yo7kV@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4I18A2x017381 for ; Sat, 17 May 2003 18:08:12 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4I17Ar20681; Sun, 18 May 2003 11:07:11 +1000 Date: Sun, 18 May 2003 11:07:10 +1000 (EST) From: James Morris To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , Subject: Re: [PATCH] IPV4 IPComp : threshold comparison In-Reply-To: <87smrda4q6.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2561 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Sun, 18 May 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > I'm not sure how exactly we should check threshold. We should check the length of the IP payload, which the current code is only currently doing for tunnel mode. > In IPsec tunnel mode, the original comparison code > seems to be including IP header length. It is counting the inner IP header, which is correct, as it is part of the final IP payload. The transport mode calculation is incorrect. > Could you check it? Your patch fixes the calculation for transport mode, and looks correct. - James -- James Morris From jmorris@intercode.com.au Sat May 17 19:30:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 19:30:50 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:+VHaKBvdAmLInFZT+/uiAMWX7eHQLqbT@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4I2Ug2x019358 for ; Sat, 17 May 2003 19:30:44 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4I2Trr20864; Sun, 18 May 2003 12:29:54 +1000 Date: Sun, 18 May 2003 12:29:53 +1000 (EST) From: James Morris To: "David S. Miller" cc: =?iso-2022-jp?Q?YOSHIFUJI_Hideaki_=2F_=1B$B5HF#1QL=40=1B=28B?= , , Subject: [PATCH][IPV6] compile fix for net/ipv6/route.c in current bk Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2562 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev This version of the ip6_null_entry initializer is needed for complation to succeed with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110). - James -- James Morris --- bk.pending/net/ipv6/route.c Sun May 18 11:51:40 2003 +++ bk.w1/net/ipv6/route.c Sun May 18 13:26:28 2003 @@ -108,7 +108,7 @@ .dev = &loopback_dev, .obsolete = -1, .error = -ENETUNREACH, - .metrics[RTAX_HOPLIMIT-1] = 255, + .metrics = {[RTAX_HOPLIMIT-1] = 255}, .input = ip6_pkt_discard, .output = ip6_pkt_discard, .ops = &ip6_dst_ops, From acme@conectiva.com.br Sat May 17 20:00:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 20:00:53 -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.9) with SMTP id h4I30k2x020204 for ; Sat, 17 May 2003 20:00:47 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19HEXN-0000Wx-00; Sun, 18 May 2003 00:08:37 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 4193E1966C; Sun, 18 May 2003 03:02:31 +0000 (UTC) Date: Sun, 18 May 2003 00:02:31 -0300 From: Arnaldo Carvalho de Melo To: James Morris Cc: "David S. Miller" , "YOSHIFUJI Hideaki / ?$B5HF#1QL@" , kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: [PATCH][IPV6] compile fix for net/ipv6/route.c in current bk Message-ID: <20030518030230.GN20240@conectiva.com.br> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2563 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 Sun, May 18, 2003 at 12:29:53PM +1000, James Morris escreveu: > This version of the ip6_null_entry initializer is needed for complation to > succeed with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110). Already in davem's tree and submitted to Linus 8) - Arnaldo From davem@redhat.com Sat May 17 22:15:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 22:15: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.9) with SMTP id h4I5FU2x023729 for ; Sat, 17 May 2003 22:15:31 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id WAA28110; Sat, 17 May 2003 22:13:56 -0700 Date: Sat, 17 May 2003 22:13:56 -0700 (PDT) Message-Id: <20030517.221356.88501530.davem@redhat.com> To: jmorris@intercode.com.au Cc: yoshfuji@linux-ipv6.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: [PATCH][IPV6] compile fix for net/ipv6/route.c in current bk From: "David S. Miller" In-Reply-To: References: X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2564 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 From: James Morris Date: Sun, 18 May 2003 12:29:53 +1000 (EST) This version of the ip6_null_entry initializer is needed for complation to succeed with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110). I know, thanks. I have a fix in my tree from Arnaldo. Aparently only gcc-3.x eats this construct I used :-) From davem@redhat.com Sat May 17 22:35:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 17 May 2003 22:36: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.9) with SMTP id h4I5Zs2x024344 for ; Sat, 17 May 2003 22:35:55 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id WAA28206; Sat, 17 May 2003 22:34:23 -0700 Date: Sat, 17 May 2003 22:34:23 -0700 (PDT) Message-Id: <20030517.223423.26296484.davem@redhat.com> To: mk@linux-ipv6.org Cc: jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: Re: [PATCH] IPV4 IPComp : threshold comparison From: "David S. Miller" In-Reply-To: <87smrda4q6.wl@karaba.org> References: <87smrda4q6.wl@karaba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2565 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 From: Mitsuru KANDA / $B?@ED(B $B=<(B Date: Sun, 18 May 2003 02:00:01 +0900 ===== ipcomp.c 1.6 vs edited ===== --- 1.6/net/ipv4/ipcomp.c Tue May 13 05:58:03 2003 +++ edited/ipcomp.c Sun May 18 01:42:22 2003 I am applying this, but please you USAGI guys start to generate properly rooted patched for me ok? I want something of the form: --- a/net/ipv4/ipcomp.c Tue May 13 05:58:03 2003 +++ b/net/ipv4/ipcomp.c Sun May 18 01:42:22 2003 Almost everyone sends me patches like this, USAGI are the one exception. If everyone sends me patches this way, then all of my patch applying scripts know they can simply use "patch -p1" when sitting at top of kernel tree. Probably all of the USAGI patches look this way because of CVS or something like that. Thank you. From davem@redhat.com Sun May 18 02:33:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 18 May 2003 02:33: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.9) with SMTP id h4I9XQ2x030525 for ; Sun, 18 May 2003 02:33:29 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA28638; Sun, 18 May 2003 02:31:52 -0700 Date: Sun, 18 May 2003 02:31:51 -0700 (PDT) Message-Id: <20030518.023151.77034834.davem@redhat.com> To: fw@deneb.enyo.de Cc: linux-kernel@vger.kernel.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <87iss87gqd.fsf@deneb.enyo.de> References: <87d6iit4g7.fsf@deneb.enyo.de> <20030517.150933.74723581.davem@redhat.com> <87iss87gqd.fsf@deneb.enyo.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2566 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 From: Florian Weimer Date: Sun, 18 May 2003 11:21:14 +0200 [ Please don't CC: sim@netnation.org any more, his address bounces at least for me (maybe his site rejects ECN, it is the most likely problem if it works for other people) ] "David S. Miller" writes: > I think your criticism of the routing cache is not well > founded. Well, what would change your mind? I'll start to listen when you start to demonstrate that you understand why the input routing cache is there and what problems it solves. More people will also start to listen when you acutally discuss this matter on the proper list(s) (which isn't linux-kernel, since linux-net and netdev@oss.sgi.com are the proper places). Most of the net hackers have zero time to follow the enourmous amount of traffic that exists on linux-kernel and picking out the networking bits. Frankly, I /dev/null linux-kernel from time to time as well. The fact is, our routing cache slow path is _FAST_. And we garbage collect routing cache entries, so the attacker's entries are deleted quickly while the entries for legitimate flows stick around. And especially during an attack you want your legitimate traffic using the routing cache. I've never seen you mention this attribute of how the routing cache works, nor have I seen you say anything which even suggests that you are aware of this. You could even make this apparent by proposing a replacement for the input routing cache. But remember, it has to provide all of the functionality that is there today. Nobody has demonstrated that there is a performance problem due to the input routing cache once the hashing DoS is eliminated, which it is in current kernels. Take this as my challenge to you. :-) using FreeBSD is not always an option Yeah, that dinosaur :-) From hch@verein.lst.de Sun May 18 10:04:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 18 May 2003 10:04:34 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4IH4P2x014532 for ; Sun, 18 May 2003 10:04:28 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4IH4Oj28841 for netdev@oss.sgi.com; Sun, 18 May 2003 19:04:24 +0200 Date: Sun, 18 May 2003 19:04:24 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] switch comx over to initcalls Message-ID: <20030518190423.A28834@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2567 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 The link order already is the same as the old init order. Note that the drivers are still full of crap, I don't have the hardware so I refuse to poke deeper into the shite.. --- 1.10/drivers/net/setup.c Sat May 10 09:07:26 2003 +++ edited/drivers/net/setup.c Sat May 17 21:12:09 2003 @@ -16,7 +16,6 @@ extern int fec_enet_init(void); extern int sdla_setup(void); extern int sdla_c_setup(void); -extern int comx_init(void); extern int lmc_setup(void); extern int madgemc_probe(void); @@ -52,10 +51,6 @@ #if defined(CONFIG_FEC_ENET) {fec_enet_init, 0}, #endif -#if defined(CONFIG_COMX) - {comx_init, 0}, -#endif - #if defined(CONFIG_LANMEDIA) {lmc_setup, 0}, #endif ===== drivers/net/wan/comx-hw-comx.c 1.10 vs edited ===== --- 1.10/drivers/net/wan/comx-hw-comx.c Mon Apr 28 05:36:20 2003 +++ edited/drivers/net/wan/comx-hw-comx.c Sat May 17 20:35:54 2003 @@ -1427,24 +1427,20 @@ NULL }; -#ifdef MODULE -#define comx_hw_comx_init init_module -#endif - -int __init comx_hw_comx_init(void) +static int __init comx_hw_comx_init(void) { comx_register_hardware(&comx_hw); comx_register_hardware(&cmx_hw); comx_register_hardware(&hicomx_hw); - memset(memory_used, 0, sizeof(memory_used)); return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit comx_hw_comx_exit(void) { comx_unregister_hardware("comx"); comx_unregister_hardware("cmx"); comx_unregister_hardware("hicomx"); } -#endif + +module_init(comx_hw_comx_init); +module_exit(comx_hw_comx_exit); ===== drivers/net/wan/comx-hw-locomx.c 1.6 vs edited ===== --- 1.6/drivers/net/wan/comx-hw-locomx.c Thu Nov 21 23:06:12 2002 +++ edited/drivers/net/wan/comx-hw-locomx.c Sat May 17 20:37:07 2003 @@ -479,20 +479,16 @@ NULL }; -#ifdef MODULE -#define comx_hw_locomx_init init_module -#endif - -int __init comx_hw_locomx_init(void) +static int __init comx_hw_locomx_init(void) { comx_register_hardware(&locomx_hw); return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit comx_hw_locomx_exit(void) { comx_unregister_hardware("locomx"); - return; } -#endif + +module_init(comx_hw_locomx_init); +module_exit(comx_hw_locomx_exit); ===== drivers/net/wan/comx-hw-mixcom.c 1.9 vs edited ===== --- 1.9/drivers/net/wan/comx-hw-mixcom.c Mon Apr 28 05:36:20 2003 +++ edited/drivers/net/wan/comx-hw-mixcom.c Sat May 17 20:38:51 2003 @@ -944,21 +944,15 @@ NULL }; -/* Module management */ - -#ifdef MODULE -#define comx_hw_mixcom_init init_module -#endif - -int __init comx_hw_mixcom_init(void) +static int __init comx_hw_mixcom_init(void) { - return(comx_register_hardware(&mixcomhw)); + return comx_register_hardware(&mixcomhw); } -#ifdef MODULE -void -cleanup_module(void) +static void __exit comx_hw_mixcom_exit(void) { comx_unregister_hardware("mixcom"); } -#endif + +module_init(comx_hw_mixcom_init); +module_exit(comx_hw_mixcom_exit); ===== drivers/net/wan/comx-proto-fr.c 1.10 vs edited ===== --- 1.10/drivers/net/wan/comx-proto-fr.c Thu Nov 21 23:06:12 2002 +++ edited/drivers/net/wan/comx-proto-fr.c Sat May 17 20:46:48 2003 @@ -988,11 +988,7 @@ .hw_dump = dlci_dump, }; -#ifdef MODULE -#define comx_proto_fr_init init_module -#endif - -int __init comx_proto_fr_init(void) +static int __init comx_proto_fr_init(void) { int ret; @@ -1005,12 +1001,12 @@ return comx_register_protocol(&fr_slave_protocol); } -#ifdef MODULE -void cleanup_module(void) +static void __exit comx_proto_fr_exit(void) { comx_unregister_hardware(fr_dlci.name); comx_unregister_protocol(fr_master_protocol.name); comx_unregister_protocol(fr_slave_protocol.name); } -#endif /* MODULE */ +module_init(comx_proto_fr_init); +module_exit(comx_proto_fr_exit); ===== drivers/net/wan/comx-proto-lapb.c 1.5 vs edited ===== --- 1.5/drivers/net/wan/comx-proto-lapb.c Tue Feb 5 08:45:17 2002 +++ edited/drivers/net/wan/comx-proto-lapb.c Sat May 17 20:45:55 2003 @@ -523,7 +523,7 @@ NULL }; -int __init comx_proto_lapb_init(void) +static int __init comx_proto_lapb_init(void) { int ret; @@ -539,9 +539,7 @@ comx_unregister_protocol(comx25_protocol.name); } -#ifdef MODULE module_init(comx_proto_lapb_init); -#endif module_exit(comx_proto_lapb_exit); MODULE_LICENSE("GPL"); ===== drivers/net/wan/comx-proto-ppp.c 1.4 vs edited ===== --- 1.4/drivers/net/wan/comx-proto-ppp.c Wed May 22 20:16:37 2002 +++ edited/drivers/net/wan/comx-proto-ppp.c Sat May 17 20:45:20 2003 @@ -247,26 +247,24 @@ NULL }; - -#ifdef MODULE -#define comx_proto_ppp_init init_module -#endif - -int __init comx_proto_ppp_init(void) +static int __init comx_proto_ppp_init(void) { int ret; - if(0!=(ret=comx_register_protocol(&hdlc_protocol))) { - return ret; + ret = comx_register_protocol(&hdlc_protocol); + if (!ret) { + ret = comx_register_protocol(&syncppp_protocol); + if (ret) + comx_unregister_protocol(hdlc_protocol.name); } - return comx_register_protocol(&syncppp_protocol); + return ret; } -#ifdef MODULE -void cleanup_module(void) +static void __exit comx_proto_ppp_exit(void) { comx_unregister_protocol(syncppp_protocol.name); comx_unregister_protocol(hdlc_protocol.name); } -#endif /* MODULE */ +module_init(comx_proto_ppp_init); +module_exit(comx_proto_ppp_exit); ===== drivers/net/wan/comx.c 1.17 vs edited ===== --- 1.17/drivers/net/wan/comx.c Sat May 17 21:39:13 2003 +++ edited/drivers/net/wan/comx.c Sat May 17 20:48:05 2003 @@ -81,15 +81,6 @@ MODULE_DESCRIPTION("Common code for the COMX synchronous serial adapters"); MODULE_LICENSE("GPL"); -extern int comx_hw_comx_init(void); -extern int comx_hw_locomx_init(void); -extern int comx_hw_mixcom_init(void); -extern int comx_proto_hdlc_init(void); -extern int comx_proto_ppp_init(void); -extern int comx_proto_syncppp_init(void); -extern int comx_proto_lapb_init(void); -extern int comx_proto_fr_init(void); - static struct comx_hardware *comx_channels = NULL; static struct comx_protocol *comx_lines = NULL; @@ -1078,11 +1069,7 @@ return -1; } -#ifdef MODULE -#define comx_init init_module -#endif - -int __init comx_init(void) +static int __init comx_init(void) { struct proc_dir_entry *new_file; @@ -1115,42 +1102,18 @@ printk(KERN_INFO "COMX: driver version %s (C) 1995-1999 ITConsult-Pro Co. \n", VERSION); - -#ifndef MODULE -#ifdef CONFIG_COMX_HW_COMX - comx_hw_comx_init(); -#endif -#ifdef CONFIG_COMX_HW_LOCOMX - comx_hw_locomx_init(); -#endif -#ifdef CONFIG_COMX_HW_MIXCOM - comx_hw_mixcom_init(); -#endif -#ifdef CONFIG_COMX_PROTO_HDLC - comx_proto_hdlc_init(); -#endif -#ifdef CONFIG_COMX_PROTO_PPP - comx_proto_ppp_init(); -#endif -#ifdef CONFIG_COMX_PROTO_LAPB - comx_proto_lapb_init(); -#endif -#ifdef CONFIG_COMX_PROTO_FR - comx_proto_fr_init(); -#endif -#endif - return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit comx_exit(void) { remove_proc_entry(FILENAME_HARDWARELIST, comx_root_dir); remove_proc_entry(FILENAME_PROTOCOLLIST, comx_root_dir); remove_proc_entry(comx_root_dir->name, &proc_root); } -#endif + +module_init(comx_init); +module_exit(comx_exit); EXPORT_SYMBOL(comx_register_hardware); EXPORT_SYMBOL(comx_unregister_hardware); From rddunlap@osdl.org Sun May 18 17:45:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 18 May 2003 17:45:13 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4J0j82x022722 for ; Sun, 18 May 2003 17:45:08 -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 h4J0iwW04057; Sun, 18 May 2003 17:44:58 -0700 Date: Sun, 18 May 2003 17:40:24 -0700 From: "Randy.Dunlap" To: Felipe Massia Pereira Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: mtu_expires variable Message-Id: <20030518174024.014cb734.rddunlap@osdl.org> In-Reply-To: References: Organization: OSDL X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i586-pc-linux-gnu) X-Face: +5V?h'hZQPB9kW Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2568 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 On Fri, 16 May 2003 23:16:03 -0300 (EST) Felipe Massia Pereira wrote: [on LKML] | Hello, | | I've been searching for the exact meaning of this variable through | Documentation and I've found just empty descriptions (to be filled in, in | Advanced Linux Routing HOWTO, and nothing also in | Documentation/networking/ip-sysctl.txt). I've tried also to read the | kernel source code (net/ipv4/route.c) but I could not figure out what they | mean. What kernel version? And this question would be better asked/answered on either linux-net or netdev mailing lists, so I've replied to those. It (ip_rt_mtu_expires variable) appears not to be used very much. | I've came accross this var because we want to do some experiments in class | with Path MTU discovery. But it happens that MTU is recorded between | experiments (and it's what we expect: that the stack does not do a PMTU | every time). BTW where is the PMTU value kept? Is MTU value recorded for | each destination or for each route? | | So it would be nice if we could make the value found in a experiment to be | forgotten by the kernel so the students could execute the ping several | times. (ping -c 2 -m want ...) Is mtu_expires what we're looking for? Maybe someone else can answer this... | We tried to "echo 1 > /proc/sys/net/ipv4/route/mtu_expires" considering | that it's expressed in seconds. The usual value is 600. But I've read that | it's expressed in jiffies. Jiffies occur 100 times per sec on a PC, is it? | So the value 600 on a PC means 6 seconds? In 2.4.x there are 100 jiffies / second on a PC (x86 arch). However, /proc/sys/net/ipv4/route/mtu_expires is hiding this HZ conversion factor from us, so that the value is expressed in seconds and not in jiffies, so 600 is 600 seconds = 10 minutes. -- ~Randy From davem@redhat.com Sun May 18 18:33:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 18 May 2003 18:33:27 -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.9) with SMTP id h4J1XL2x024364 for ; Sun, 18 May 2003 18:33:22 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA03676; Sun, 18 May 2003 18:32:14 -0700 Date: Sun, 18 May 2003 18:32:14 -0700 (PDT) Message-Id: <20030518.183214.08324647.davem@redhat.com> To: rddunlap@osdl.org Cc: massia@ic.unicamp.br, linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: mtu_expires variable From: "David S. Miller" In-Reply-To: <20030518174024.014cb734.rddunlap@osdl.org> References: <20030518174024.014cb734.rddunlap@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2569 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 From: "Randy.Dunlap" Date: Sun, 18 May 2003 17:40:24 -0700 On Fri, 16 May 2003 23:16:03 -0300 (EST) Felipe Massia Pereira wrote: [on LKML] | I've came accross this var because we want to do some experiments in class | with Path MTU discovery. But it happens that MTU is recorded between | experiments (and it's what we expect: that the stack does not do a PMTU | every time). BTW where is the PMTU value kept? Is MTU value recorded for | each destination or for each route? | | So it would be nice if we could make the value found in a experiment to be | forgotten by the kernel so the students could execute the ping several | times. (ping -c 2 -m want ...) Is mtu_expires what we're looking for? Maybe someone else can answer this... PMTU is stored at routing cache entries (inside of the dst_entry part of the rtable). If routing cache entry is flushed, this information is forgotten. Also, PMTUs are expired periodically, and this is controlled by calling dst_set_expires() which expires the entry at ip_rt_mtu_expires jiffies into the future. You can use a hammer to force all PMTU information to be forgotten by flushing entire routing cache, this is done via: echo "0" >/proc/sys/net/ipv4/route/flush | We tried to "echo 1 > /proc/sys/net/ipv4/route/mtu_expires" considering | that it's expressed in seconds. The usual value is 600. But I've read that | it's expressed in jiffies. Jiffies occur 100 times per sec on a PC, is it? | So the value 600 on a PC means 6 seconds? In 2.4.x there are 100 jiffies / second on a PC (x86 arch). However, /proc/sys/net/ipv4/route/mtu_expires is hiding this HZ conversion factor from us, so that the value is expressed in seconds and not in jiffies, so 600 is 600 seconds = 10 minutes. This is correct, the user's value is converted into jiffies and stored into ip_rt_mtu_expires. BUT! This only takes effect for NEW pmtu information gathered. It does not apply to existing ones. Best idea is to flush the routing cache after such a change. From davem@redhat.com Sun May 18 20:01:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 18 May 2003 20:01:56 -0700 (PDT) Received: from rth.ninka.net (rth.ninka.net [216.101.162.244]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4J31i2x026682 for ; Sun, 18 May 2003 20:01:45 -0700 Received: from rth.ninka.net (localhost.localdomain [127.0.0.1]) by rth.ninka.net (8.12.8/8.12.8) with ESMTP id h4J31hQE004441; Sun, 18 May 2003 20:01:43 -0700 Received: (from davem@localhost) by rth.ninka.net (8.12.8/8.12.8/Submit) id h4J31dvP004439; Sun, 18 May 2003 20:01:39 -0700 X-Authentication-Warning: rth.ninka.net: davem set sender to davem@redhat.com using -f Subject: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] From: "David S. Miller" To: linux-net@vger.kernel.org Cc: netdev@oss.sgi.com, sommere@ethanet.com Content-Type: multipart/mixed; boundary="=-GEIn1Y6uCsLvcyGp3lfQ" Organization: Message-Id: <1053313298.3909.5.camel@rth.ninka.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 18 May 2003 20:01:39 -0700 X-archive-position: 2570 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 --=-GEIn1Y6uCsLvcyGp3lfQ Content-Type: text/plain Content-Transfer-Encoding: 7bit I'm forwarding Ethan's announcement here. Ethan, you'll get better reception to your ideas if you post them to the correct place. Most networking hackers do not read linux-kernel due to the sheer volume of traffic there :-) -- David S. Miller --=-GEIn1Y6uCsLvcyGp3lfQ Content-Disposition: inline Content-Description: Forwarded message - [ANNOUNCE] Layer-7 Filter for Linux QoS Content-Type: message/rfc822 Return-Path: Received: from vger.kernel.org (vger.kernel.org [209.116.70.75]) by rth.ninka.net (8.12.8/8.12.8) with ESMTP id h4J2QDQH004381 for ; Sun, 18 May 2003 19:26:16 -0700 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262306AbTESCKg (ORCPT ); Sun, 18 May 2003 22:10:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262307AbTESCKf (ORCPT ); Sun, 18 May 2003 22:10:35 -0400 Received: from Kona.Carleton.edu ([137.22.93.220]:29371 "EHLO kona.carleton.edu") by vger.kernel.org with ESMTP id S262306AbTESCKe (ORCPT ); Sun, 18 May 2003 22:10:34 -0400 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF4003313Z6NS@carleton.edu> for linux-kernel@vger.kernel.org; Sun, 18 May 2003 21:23:30 -0500 (CDT) Date: Sun, 18 May 2003 21:23:45 -0500 From: Ethan Sommer Subject: [ANNOUNCE] Layer-7 Filter for Linux QoS To: linux-kernel@vger.kernel.org Message-id: <3EC84031.90300@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org We have written a filter for the QoS infrastructure that looks at the data segment of packets and uses regular expressions to identify the protocol of a stream of traffic regardless of port number. Many peer-to-peer programs (such as Kazaa and Gnucleus) will change to use a different port (including well known ports such as, say, 80) if they find that they can get better throughput there. That means that the port based filtering is no longer sufficient. However, by analyzing the application layer data, we can differentiate Kazaa from non-Kazaa HTTP, and lower the priority of whichever we deem to be less important. :) It is a filter in the existing QoS infrastructure, so it can be used in conjunction with u32 filters, HTB or CBQ scheduling, SFQ queueing etc, etc... Commercial companies sell devices which do layer-7 classification for anywhere from $6000-$80,000 depending on the bandwidth required. If we can build a comprehensive set of patterns I don't see any reason why Linux can't beat the pants off the commercial devices; we already have excellent queueing, and scheduling. Our home page is http://l7-filter.sourceforge.net/ but if you want to skip right to the downloads go to http://sourceforge.net/projects/l7-filter/ (there is a kernel patch, a patched version of tc, and some sample patterns for HTTP, POP3, IMAP, SSH, Kazaa, and FTP.) You'll notice the patch is a somewhat large, most of that is regexp code. We're still working on it. It currently only does TCP for example... Do you guys/gals have any comments/suggestions/etc? I suspect that this is a post 2.6 thing, but it is very non-invasive (it only adds approx. 2 lines of code that would affect anything if the user were not using the layer-7 filters,) so I still have a little bit of hope. Ethan Sommer Matt Strait Justin Levandoski - 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/ --=-GEIn1Y6uCsLvcyGp3lfQ-- From hadi@shell.cyberus.ca Mon May 19 00:01:48 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 00:01:55 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4J71k2x031895 for ; Mon, 19 May 2003 00:01:47 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19FuM8-000651-Sp; Wed, 14 May 2003 07:23:32 -0400 Date: Wed, 14 May 2003 07:23:32 -0400 (EDT) From: Jamal Hadi To: Stephen Hemminger cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Network packet type using RCU In-Reply-To: <20030509142538.548cbd71.shemminger@osdl.org> Message-ID: <20030514072006.D23367@shell.cyberus.ca> References: <20030509142538.548cbd71.shemminger@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2571 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Apologies i was offline for a bit so dont know the history here. I see a lot of move to rcu. There are benefits to using RCU in certain cases (example occasional list edit with a lot more reads). Why does there seem to be a massive migration it seems to RCU? Something wrong with the linked lists? cheers, jamal On Fri, 9 May 2003, Stephen Hemminger wrote: > Convert network packet type list from using brlock to RCU based list. > Some collataral changes to af_packet were necessary since it needs to > unregister packet types without sleeping. > > Summary: > * packet type converted from linked list to list_macro > * writer lock replaced with spin lock, readers use RCU > * add __dev_remove_pack for callers that can't sleep. > * af_packet changes to handle and sleeping requirements, and possible > races that could cause. > > Tested on 8-way SMP running 2.5.69 latest. > > Dave, please wait till Monday to apply this in case there are any > comments. > > diff -urNp -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-nbr/include/linux/netdevice.h > --- linux-2.5/include/linux/netdevice.h 2003-04-14 13:32:21.000000000 -0700 > +++ linux-2.5-nbr/include/linux/netdevice.h 2003-05-02 15:07:06.000000000 -0700 > @@ -456,7 +456,7 @@ struct packet_type > int (*func) (struct sk_buff *, struct net_device *, > struct packet_type *); > void *data; /* Private to the packet type */ > - struct packet_type *next; > + struct list_head list; > }; > > > @@ -472,6 +472,7 @@ extern int netdev_boot_setup_check(st > extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); > extern void dev_add_pack(struct packet_type *pt); > extern void dev_remove_pack(struct packet_type *pt); > +extern void __dev_remove_pack(struct packet_type *pt); > extern int dev_get(const char *name); > extern struct net_device *dev_get_by_flags(unsigned short flags, > unsigned short mask); > diff -urNp -X dontdiff linux-2.5/net/core/dev.c linux-2.5-nbr/net/core/dev.c > --- linux-2.5/net/core/dev.c 2003-05-05 09:41:03.000000000 -0700 > +++ linux-2.5-nbr/net/core/dev.c 2003-05-05 09:44:36.000000000 -0700 > @@ -90,7 +90,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -170,8 +169,9 @@ const char *if_port_text[] = { > * 86DD IPv6 > */ > > -static struct packet_type *ptype_base[16]; /* 16 way hashed list */ > -static struct packet_type *ptype_all; /* Taps */ > +static spinlock_t ptype_lock = SPIN_LOCK_UNLOCKED; > +static struct list_head ptype_base[16]; /* 16 way hashed list */ > +static struct list_head ptype_all; /* Taps */ > > #ifdef OFFLINE_SAMPLE > static void sample_queue(unsigned long dummy); > @@ -239,14 +239,17 @@ int netdev_nit; > * Add a protocol handler to the networking stack. The passed &packet_type > * is linked into kernel lists and may not be freed until it has been > * removed from the kernel lists. > + * > + * This call does not sleep therefore it can not > + * guarantee all CPU's that are in middle of receiving packets > + * will see the new packet type (until the next received packet). > */ > > void dev_add_pack(struct packet_type *pt) > { > int hash; > > - br_write_lock_bh(BR_NETPROTO_LOCK); > - > + spin_lock_bh(&ptype_lock); > #ifdef CONFIG_NET_FASTROUTE > /* Hack to detect packet socket */ > if (pt->data && (long)(pt->data) != 1) { > @@ -256,52 +259,76 @@ void dev_add_pack(struct packet_type *pt > #endif > if (pt->type == htons(ETH_P_ALL)) { > netdev_nit++; > - pt->next = ptype_all; > - ptype_all = pt; > + list_add_rcu(&pt->list, &ptype_all); > } else { > hash = ntohs(pt->type) & 15; > - pt->next = ptype_base[hash]; > - ptype_base[hash] = pt; > + list_add_rcu(&pt->list, &ptype_base[hash]); > } > - br_write_unlock_bh(BR_NETPROTO_LOCK); > + spin_unlock_bh(&ptype_lock); > } > > extern void linkwatch_run_queue(void); > > + > + > /** > - * dev_remove_pack - remove packet handler > + * __dev_remove_pack - remove packet handler > * @pt: packet type declaration > * > * Remove a protocol handler that was previously added to the kernel > * protocol handlers by dev_add_pack(). The passed &packet_type is removed > * from the kernel lists and can be freed or reused once this function > - * returns. > + * returns. > + * > + * The packet type might still be in use by receivers > + * and must not be freed until after all the CPU's have gone > + * through a quiescent state. > */ > -void dev_remove_pack(struct packet_type *pt) > +void __dev_remove_pack(struct packet_type *pt) > { > - struct packet_type **pt1; > + struct list_head *head; > + struct packet_type *pt1; > > - br_write_lock_bh(BR_NETPROTO_LOCK); > + spin_lock_bh(&ptype_lock); > > if (pt->type == htons(ETH_P_ALL)) { > netdev_nit--; > - pt1 = &ptype_all; > + head = &ptype_all; > } else > - pt1 = &ptype_base[ntohs(pt->type) & 15]; > + head = &ptype_base[ntohs(pt->type) & 15]; > > - for (; *pt1; pt1 = &((*pt1)->next)) { > - if (pt == *pt1) { > - *pt1 = pt->next; > + list_for_each_entry(pt1, head, list) { > + if (pt == pt1) { > #ifdef CONFIG_NET_FASTROUTE > if (pt->data) > netdev_fastroute_obstacles--; > #endif > + list_del_rcu(&pt->list); > goto out; > } > } > + > printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt); > out: > - br_write_unlock_bh(BR_NETPROTO_LOCK); > + spin_unlock_bh(&ptype_lock); > +} > +/** > + * dev_remove_pack - remove packet handler > + * @pt: packet type declaration > + * > + * Remove a protocol handler that was previously added to the kernel > + * protocol handlers by dev_add_pack(). The passed &packet_type is removed > + * from the kernel lists and can be freed or reused once this function > + * returns. > + * > + * This call sleeps to guarantee that no CPU is looking at the packet > + * type after return. > + */ > +void dev_remove_pack(struct packet_type *pt) > +{ > + __dev_remove_pack(pt); > + > + synchronize_net(); > } > > /****************************************************************************** > @@ -943,8 +970,8 @@ void dev_queue_xmit_nit(struct sk_buff * > struct packet_type *ptype; > do_gettimeofday(&skb->stamp); > > - br_read_lock(BR_NETPROTO_LOCK); > - for (ptype = ptype_all; ptype; ptype = ptype->next) { > + rcu_read_lock(); > + list_for_each_entry_rcu(ptype, &ptype_all, list) { > /* Never send packets back to the socket > * they originated from - MvS (miquels@drinkel.ow.org) > */ > @@ -974,7 +1001,7 @@ void dev_queue_xmit_nit(struct sk_buff * > ptype->func(skb2, skb->dev, ptype); > } > } > - br_read_unlock(BR_NETPROTO_LOCK); > + rcu_read_unlock(); > } > > /* Calculate csum in the case, when packet is misrouted. > @@ -1488,7 +1515,8 @@ int netif_receive_skb(struct sk_buff *sk > skb->h.raw = skb->nh.raw = skb->data; > > pt_prev = NULL; > - for (ptype = ptype_all; ptype; ptype = ptype->next) { > + rcu_read_lock(); > + list_for_each_entry_rcu(ptype, &ptype_all, list) { > if (!ptype->dev || ptype->dev == skb->dev) { > if (pt_prev) { > if (!pt_prev->data) { > @@ -1511,17 +1539,15 @@ int netif_receive_skb(struct sk_buff *sk > > #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) > if (skb->dev->br_port) { > - int ret; > - > ret = handle_bridge(skb, pt_prev); > if (br_handle_frame_hook(skb) == 0) > - return ret; > + goto out; > > pt_prev = NULL; > } > #endif > > - for (ptype = ptype_base[ntohs(type) & 15]; ptype; ptype = ptype->next) { > + list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { > if (ptype->type == type && > (!ptype->dev || ptype->dev == skb->dev)) { > if (pt_prev) { > @@ -1552,6 +1578,8 @@ int netif_receive_skb(struct sk_buff *sk > ret = NET_RX_DROP; > } > > + out: > + rcu_read_unlock(); > return ret; > } > > @@ -1625,7 +1653,8 @@ static void net_rx_action(struct softirq > unsigned long start_time = jiffies; > int budget = netdev_max_backlog; > > - br_read_lock(BR_NETPROTO_LOCK); > + > + preempt_disable(); > local_irq_disable(); > > while (!list_empty(&queue->poll_list)) { > @@ -1654,7 +1683,7 @@ static void net_rx_action(struct softirq > } > out: > local_irq_enable(); > - br_read_unlock(BR_NETPROTO_LOCK); > + preempt_enable(); > return; > > softnet_break: > @@ -1995,9 +2024,9 @@ int netdev_set_master(struct net_device > dev_hold(master); > } > > - br_write_lock_bh(BR_NETPROTO_LOCK); > slave->master = master; > - br_write_unlock_bh(BR_NETPROTO_LOCK); > + > + synchronize_net(); > > if (old) > dev_put(old); > @@ -2661,8 +2690,8 @@ int netdev_finish_unregister(struct net_ > /* Synchronize with packet receive processing. */ > void synchronize_net(void) > { > - br_write_lock_bh(BR_NETPROTO_LOCK); > - br_write_unlock_bh(BR_NETPROTO_LOCK); > + might_sleep(); > + synchronize_kernel(); > } > > /** > @@ -2846,6 +2875,10 @@ static int __init net_dev_init(void) > > subsystem_register(&net_subsys); > > + INIT_LIST_HEAD(&ptype_all); > + for (i = 0; i < 16; i++) > + INIT_LIST_HEAD(&ptype_base[i]); > + > #ifdef CONFIG_NET_DIVERT > dv_init(); > #endif /* CONFIG_NET_DIVERT */ > diff -urNp -X dontdiff linux-2.5/net/netsyms.c linux-2.5-nbr/net/netsyms.c > --- linux-2.5/net/netsyms.c 2003-05-05 09:41:03.000000000 -0700 > +++ linux-2.5-nbr/net/netsyms.c 2003-05-05 09:44:36.000000000 -0700 > @@ -577,6 +577,7 @@ EXPORT_SYMBOL(netif_rx); > EXPORT_SYMBOL(netif_receive_skb); > EXPORT_SYMBOL(dev_add_pack); > EXPORT_SYMBOL(dev_remove_pack); > +EXPORT_SYMBOL(__dev_remove_pack); > EXPORT_SYMBOL(dev_get); > EXPORT_SYMBOL(dev_alloc); > EXPORT_SYMBOL(dev_alloc_name); > diff -urNp -X dontdiff linux-2.5/net/packet/af_packet.c linux-2.5-nbr/net/packet/af_packet.c > --- linux-2.5/net/packet/af_packet.c 2003-05-05 09:41:03.000000000 -0700 > +++ linux-2.5-nbr/net/packet/af_packet.c 2003-05-05 11:14:52.000000000 -0700 > @@ -774,6 +774,7 @@ static int packet_release(struct socket > */ > dev_remove_pack(&po->prot_hook); > po->running = 0; > + po->num = 0; > __sock_put(sk); > } > > @@ -819,9 +820,12 @@ static int packet_do_bind(struct sock *s > > spin_lock(&po->bind_lock); > if (po->running) { > - dev_remove_pack(&po->prot_hook); > __sock_put(sk); > po->running = 0; > + po->num = 0; > + spin_unlock(&po->bind_lock); > + dev_remove_pack(&po->prot_hook); > + spin_lock(&po->bind_lock); > } > > po->num = protocol; > @@ -1374,7 +1378,7 @@ static int packet_notifier(struct notifi > if (dev->ifindex == po->ifindex) { > spin_lock(&po->bind_lock); > if (po->running) { > - dev_remove_pack(&po->prot_hook); > + __dev_remove_pack(&po->prot_hook); > __sock_put(sk); > po->running = 0; > sk->err = ENETDOWN; > @@ -1618,9 +1622,14 @@ static int packet_set_ring(struct sock * > > /* Detach socket from network */ > spin_lock(&po->bind_lock); > - if (po->running) > - dev_remove_pack(&po->prot_hook); > + if (po->running) { > + __dev_remove_pack(&po->prot_hook); > + po->num = 0; > + po->running = 0; > + } > spin_unlock(&po->bind_lock); > + > + synchronize_net(); > > err = -EBUSY; > if (closing || atomic_read(&po->mapped) == 0) { > > > From davem@redhat.com Mon May 19 00:57:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 00:57:26 -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.9) with SMTP id h4J7vE2x000755 for ; Mon, 19 May 2003 00:57:17 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA04264; Mon, 19 May 2003 00:22:20 -0700 Date: Mon, 19 May 2003 00:22:19 -0700 (PDT) Message-Id: <20030519.002219.02298937.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] Network packet type using RCU From: "David S. Miller" In-Reply-To: <20030514072006.D23367@shell.cyberus.ca> References: <20030509142538.548cbd71.shemminger@osdl.org> <20030514072006.D23367@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2572 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 From: Jamal Hadi Date: Wed, 14 May 2003 07:23:32 -0400 (EDT) Apologies i was offline for a bit so dont know the history here. I see a lot of move to rcu. There are benefits to using RCU in certain cases (example occasional list edit with a lot more reads). Why does there seem to be a massive migration it seems to RCU? Something wrong with the linked lists? If you only need one of two synchronization primitives, why have two? :-) From mk@karaba.org Mon May 19 01:24:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 01:24:49 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4J8Od2x002081 for ; Mon, 19 May 2003 01:24:40 -0700 Received: from [3ffe:501:1057:710::1] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19Hfwg-0008G5-00; Mon, 19 May 2003 17:24:34 +0900 Date: Mon, 19 May 2003 17:24:31 +0900 Message-ID: <871xyvqr7k.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <20030516.140014.59676235.davem@redhat.com> References: <87llx72imk.wl@karaba.org> <873cjebwn1.wl@karaba.org> <20030516.140014.59676235.davem@redhat.com> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=ISO-2022-JP X-archive-position: 2573 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev At Fri, 16 May 2003 14:00:14 -0700 (PDT), "David S. Miller" wrote: > > From: Mitsuru KANDA / $B?@ED(B $B=<(B > Date: Sat, 17 May 2003 02:59:30 +0900 > > but it may take a time because currently ip6ip6 does not exist. > > Once you implement xfrm6_tunnel.c the problem is mostly solved. > You do not need to have an ip6ip6 device-like tunnel first. Sorry just a novice question, I would like to try to configure xfrm4 ipip tunnel for testing. What is the suitable tool?, setkey??? Regards, -mk From hadi@shell.cyberus.ca Mon May 19 10:36:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 10:36:59 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4JHan2x022010 for ; Mon, 19 May 2003 10:36:50 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19HoYQ-000A6I-4x; Mon, 19 May 2003 13:36:06 -0400 Date: Mon, 19 May 2003 13:36:06 -0400 (EDT) From: Jamal Hadi To: "David S. Miller" cc: fw@deneb.enyo.de, linux-kernel@vger.kernel.org, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress In-Reply-To: <20030518.023151.77034834.davem@redhat.com> Message-ID: <20030519132819.S38814@shell.cyberus.ca> References: <87d6iit4g7.fsf@deneb.enyo.de> <20030517.150933.74723581.davem@redhat.com> <87iss87gqd.fsf@deneb.enyo.de> <20030518.023151.77034834.davem@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2574 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Florian, I actually asked you to run some tests last time you showed up on netdev but never heard back. Maybe we can get some results now that the complaining is still continuing. Note, we cant just invent things because "CISCO is doing it like that". That doesnt cut it. What we need is data to substantiate things and then we move from there. And oh, i am pretty sure we can beat any of the BSDs forwarding rate. Anyone wants a duel, lets meet at the water fountain by the town hall at sunrise. cheers, jamal From hadi@shell.cyberus.ca Mon May 19 12:46:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 12:47:10 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4JJkr2x025570 for ; Mon, 19 May 2003 12:46:56 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19Hqah-000A9f-BI; Mon, 19 May 2003 15:46:35 -0400 Date: Mon, 19 May 2003 15:46:35 -0400 (EDT) From: Jamal Hadi To: Stephen Hemminger cc: "David S. Miller" , Patrick Mochel , netdev@oss.sgi.com, greg@kroah.com, jkenisto@us.ibm.com, lkessler@us.ibm.com, Daniel Stekloff Subject: Re: [PATCH 0/2] Sysfs net class . In-Reply-To: <20030515162712.61cd153e.shemminger@osdl.org> Message-ID: <20030519154502.D39024@shell.cyberus.ca> References: <20030513150303.A2406@DYN318281.beaverton.ibm.com> <200305131657.03508.dsteklof@us.ibm.com> <20030514142023.0e411f34.shemminger@osdl.org> <200305141443.57169.dsteklof@us.ibm.com> <20030515162712.61cd153e.shemminger@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2575 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Hi Stephen, Not too familiar with sysfs but make sure it doesnt break netlink or even ioctl. BTW, did i misread that or are you allowing restoring things like ifindex in that patch? cheers, jamal From ralph@istop.com Mon May 19 12:52:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 12:53:15 -0700 (PDT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4JJqV2x026075 for ; Mon, 19 May 2003 12:52:32 -0700 Received: from ns.istop.com (ns.istop.com [66.11.168.199]) by smtp.istop.com (Postfix) with ESMTP id 8280436943; Mon, 19 May 2003 15:17:44 -0400 (EDT) Date: Mon, 19 May 2003 15:18:14 -0400 (EDT) From: Ralph Doncaster Reply-To: ralph+d@istop.com To: Jamal Hadi Cc: "David S. Miller" , "fw@deneb.enyo.de" , "linux-kernel@vger.kernel.org" , "kuznet@ms2.inr.ac.ru" , "netdev@oss.sgi.com" , "linux-net@vger.kernel.org" Subject: Re: Route cache performance under stress In-Reply-To: <20030519132819.S38814@shell.cyberus.ca> Message-ID: References: <87d6iit4g7.fsf@deneb.enyo.de> <20030517.150933.74723581.davem@redhat.com> <87iss87gqd.fsf@deneb.enyo.de> <20030518.023151.77034834.davem@redhat.com> <20030519132819.S38814@shell.cyberus.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2576 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ralph@istop.com Precedence: bulk X-list: netdev When I looked at the route-cache code, efficient wasn't the word the came to mind. Whether the problem is in the route-cache or not, getting >100kpps out of a linux router with <= 1Ghz of CPU is not at all an easy task. I've tried 2.2 and 2.4 (up to 2.4.20) with 3c905CX cards, with and without NAPI, on a 750Mhz AMD. I've never reached 100kpps without userland (zebra) getting starved. I've even tried the e1000 with 2.4.20, and it still doesn't cut it (about 50% better performance than the 3Com). This is always with a full routing table (~110K routes). If I actually had the time to do the code, I'd try dumping the route-cache altogether and keep the forwarding table as an r-tree (probably 2 levels of 2048 entries since average prefix size is /22). Frequently-used routes would lookup faster due to CPU cache hits. I'd have all the crap for source-based routing ifdef'd out when firewalling is not compiled in. My next try will be with FreeBSD, using device polling and the e1000 cards (since it seems there are no polling patches for the 3c905CX under FreeBSD). From the description of how polling under FreeBSD works http://info.iet.unipi.it/~luigi/polling/ vs NAPI under linux, polling sounds better due to the ability to configure the polling cycle and CPU load triggers. From the testing and reading I've done so far, NAPI doesn't seem to kick in until after 75-80% CPU load. With less than 25kpps coming into the box zebra seems to take almost 10x longer to bring up a session with full routes than it does with no packet load. Since CPU load before zebra becomes active is 70-75%, it would seem a lot of cycles is being wasted on context switching when zebra gets busy. If there is a way to get the routing performance I'm looking for in Linux, I'd really like to know. I've been searching an asking for over a year now. When I initially talked to Jamal about it, he told me NAPI was the answer. It does help, but from my experience it's not the answer. I get the impression nobody involved in the code has has tested under real-world conditions. If that is, in fact, the problem then I can provide an ebgp multihop full feed and a synflood utility for stress testing. If the linux routing and ethernet driver code is improved so I can handle 50kpps of inbound regular traffic, a 50kpps random-source DOS, and still have 50% CPU left for Zebra then Cisco might have something to worry about... Ralph Doncaster, president 6042147 Canada Inc. o/a IStop.com On Mon, 19 May 2003, Jamal Hadi wrote: > > Florian, > I actually asked you to run some tests last time you showed up > on netdev but never heard back. Maybe we can get some results now > that the complaining is still continuing. Note, we cant just invent > things because "CISCO is doing it like that". That doesnt cut it. > What we need is data to substantiate things and then we move from there. > > And oh, i am pretty sure we can beat any of the BSDs forwarding rate. > Anyone wants a duel, lets meet at the water fountain by the town > hall at sunrise. > > cheers, > jamal > > > From bdschuym@pandora.be Mon May 19 13:22:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 13:22:37 -0700 (PDT) Received: from eos.telenet-ops.be (eos.telenet-ops.be [195.130.132.40]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4JKLp2x027151 for ; Mon, 19 May 2003 13:21:52 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by eos.telenet-ops.be (Postfix) with SMTP id 64B6D20155; Mon, 19 May 2003 21:46:34 +0200 (CEST) Received: from linux (D5763FCE.kabel.telenet.be [213.118.63.206]) by eos.telenet-ops.be (Postfix) with ESMTP id 64AA72004A; Mon, 19 May 2003 21:46:33 +0200 (CEST) Content-Type: text/plain; charset="us-ascii" From: Bart De Schuymer To: Stephen Hemminger Subject: the change from spinlock to rcu_read_lock in the bridge code Date: Mon, 19 May 2003 21:46:35 +0200 X-Mailer: KMail [version 1.4] Cc: netdev MIME-Version: 1.0 Message-Id: <200305192146.35133.bdschuym@pandora.be> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h4JKLp2x027151 X-archive-position: 2577 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 Hello, The 2.5 bridge code now uses (as you ofcourse know) rcu_read_lock to protect a function's local data. The use of a bridge r/w spinlock had the advantage that all netfilter modules registered on a bridge hook were guaranteed that the bridge ports wouldn't vanish while the code was executed. If I understand things correctly, the del_nbp() function can now put the br_port member of a net_device on NULL any time while another processor is bridging a frame. If so, then all bridge netfilter modules will have to check on NULL and use smp_read_barrier_depends() when they want to read the struct net_bridge_port. For example, br_netfilter.c will need extra code to deal with this. Also, what about this hypothetical situation: the user removes eth0 from br0 and adds eth0 as a port of br1. If this is done fast enough, the same skb can have a different input bridge device on different times. Is using rcu really that much faster in the bridge case, considering extra checking code will have to be added? -- cheers, Bart From hadi@shell.cyberus.ca Mon May 19 15:38:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 15:38:45 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4JMcV2x032297 for ; Mon, 19 May 2003 15:38:32 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19HtGK-000AE7-0l; Mon, 19 May 2003 18:37:44 -0400 Date: Mon, 19 May 2003 18:37:43 -0400 (EDT) From: Jamal Hadi To: ralph+d@istop.com cc: "David S. Miller" , "fw@deneb.enyo.de" , "kuznet@ms2.inr.ac.ru" , "netdev@oss.sgi.com" , "linux-net@vger.kernel.org" Subject: Re: Route cache performance under stress In-Reply-To: Message-ID: <20030519154852.I39024@shell.cyberus.ca> References: <87d6iit4g7.fsf@deneb.enyo.de> <20030517.150933.74723581.davem@redhat.com> <87iss87gqd.fsf@deneb.enyo.de> <20030518.023151.77034834.davem@redhat.com> <20030519132819.S38814@shell.cyberus.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2578 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Took Linux kernel off the cc list. On Mon, 19 May 2003, Ralph Doncaster wrote: > When I looked at the route-cache code, efficient wasn't the word the came > to mind. Whether the problem is in the route-cache or not, getting > 100kpps out of a linux router with <= 1Ghz of CPU is not at all an easy > task. I've tried 2.2 and 2.4 (up to 2.4.20) with 3c905CX cards, with and > without NAPI, on a 750Mhz AMD. I've never reached 100kpps without > userland (zebra) getting starved. I've even tried the e1000 with 2.4.20, > and it still doesn't cut it (about 50% better performance than the 3Com). > This is always with a full routing table (~110K routes). > I just tested a small userland apps which does some pseudo routing in userland. With NAPI i am able to do 148Kpps without it same hardware, about 32Kpps. I cant test beyond 148Kpps because thats the max pps a 100Mbps card can do. The point i am making is i dont see the user space starvation. Granted this is not the same thing you are testing. > If I actually had the time to do the code, I'd try dumping the route-cache > altogether and keep the forwarding table as an r-tree (probably 2 levels > of 2048 entries since average prefix size is /22). Frequently-used routes > would lookup faster due to CPU cache hits. I'd have all the crap for > source-based routing ifdef'd out when firewalling is not compiled in. > I think theres definete benefit to flow/dst cache as is. Modern routing really should not be just about destination address lookup. Thats whats practical today (as opposed to the 80s). I agree that we should be flexible enough to not enforce that everybody use the complexity of looking up via 5 tuples and maintaining flows at that level - if the cache lookup is the bottleneck. Theres a recent patch that made it into 2.5.69 which resolves (or so it seems - havent tried it myself) the cache bucket distribution. This was a major problem before. The second level issue is on cache misses how fast can you lookup. So far we are saying "fast enough". Someone needs to prove it is not. > My next try will be with FreeBSD, using device polling and the e1000 cards > (since it seems there are no polling patches for the 3c905CX under > FreeBSD). From the description of how polling under FreeBSD works > http://info.iet.unipi.it/~luigi/polling/ > vs NAPI under linux, polling sounds better due to the ability to configure > the polling cycle and CPU load triggers. From the testing and reading > I've done so far, NAPI doesn't seem to kick in until after 75-80% CPU > load. With less than 25kpps coming into the box zebra seems to take > almost 10x longer to bring up a session with full routes than it does with > no packet load. Since CPU load before zebra becomes active is 70-75%, it > would seem a lot of cycles is being wasted on context switching when zebra > gets busy. > Not interested in BSD. When they can beat Linuxs numbers i'll be interested. > If there is a way to get the routing performance I'm looking for in Linux, > I'd really like to know. I've been searching an asking for over a year > now. When I initially talked to Jamal about it, he told me NAPI was the > answer. It does help, but from my experience it's not the answer. I get > the impression nobody involved in the code has has tested under real-world > conditions. If that is, in fact, the problem then I can provide an ebgp > multihop full feed and a synflood utility for stress testing. If the > linux routing and ethernet driver code is improved so I can handle 50kpps > of inbound regular traffic, a 50kpps random-source DOS, and still have 50% > CPU left for Zebra then Cisco might have something to worry about... > I think we could do 50Kpps in a DOS environment. We live in the same city. I may be able to spare half a weekend day and meet up with you for some testing. cheers, jamal From hadi@shell.cyberus.ca Mon May 19 17:38:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 17:38:42 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K0cM2x003593 for ; Mon, 19 May 2003 17:38:23 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19Hv8m-000AHJ-0p; Mon, 19 May 2003 20:38:04 -0400 Date: Mon, 19 May 2003 20:38:03 -0400 (EDT) From: Jamal Hadi To: "David S. Miller" cc: linux-net@vger.kernel.org, netdev@oss.sgi.com, sommere@ethanet.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <1053313298.3909.5.camel@rth.ninka.net> Message-ID: <20030519202756.I39498@shell.cyberus.ca> References: <1053313298.3909.5.camel@rth.ninka.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2579 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev Hi, The concept could be improved in my opinion. _All_ filters could use the regex (finally cnews regex in the kernel, yiiha). So what we need is this to be an extension to _all_ filters. i.e define u32 filter then a regexp on a match with a start offset to start scanning etc. I think we need to have extended matches in general regardless of this. I have been thinking of it for sometime and even implemented some simple prototype (u32 followed by a fwmark). This is one of the nice concepts netfilter introduced in my opinion. BTW, i am not sure how efficient the stuff that Henry spencer wrote is in comparison to newer research on variants of boyer-moore for regex searches. comment? The code also does seem inefficient but thats beside the point at the moment (ex you seem to malloc for every incoming packet so you can do a regex). cheers, jamal On Sun, 18 May 2003, David S. Miller wrote: > I'm forwarding Ethan's announcement here. Ethan, you'll get > better reception to your ideas if you post them to the correct > place. Most networking hackers do not read linux-kernel due to > the sheer volume of traffic there :-) > > -- > David S. Miller > From sim@peace.netnation.com Mon May 19 18:10:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 18:10:58 -0700 (PDT) Received: from peace.netnation.com (newpeace.netnation.com [204.174.223.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K1Ar2x004788 for ; Mon, 19 May 2003 18:10:53 -0700 Received: from sim by peace.netnation.com with local (Exim 4.20) id 19HveX-0005BY-2n; Mon, 19 May 2003 18:10:53 -0700 Date: Mon, 19 May 2003 18:10:53 -0700 From: Simon Kirby To: Jamal Hadi Cc: "netdev@oss.sgi.com" , "linux-net@vger.kernel.org" Subject: Re: Route cache performance under stress Message-ID: <20030520011053.GB10419@netnation.com> References: <87d6iit4g7.fsf@deneb.enyo.de> <20030517.150933.74723581.davem@redhat.com> <87iss87gqd.fsf@deneb.enyo.de> <20030518.023151.77034834.davem@redhat.com> <20030519132819.S38814@shell.cyberus.ca> <20030519154852.I39024@shell.cyberus.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030519154852.I39024@shell.cyberus.ca> User-Agent: Mutt/1.5.4i X-archive-position: 2580 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sim@netnation.com Precedence: bulk X-list: netdev On Mon, May 19, 2003 at 06:37:43PM -0400, Jamal Hadi wrote: > cache bucket distribution. This was a major problem before. Was the hash distribution broken before even in the truly random case? If so, the patch would likely help. If not, it shouldn't really affect the DoS case or the normal traffic case, because I doubt we have been the target of any hashing-specific attacks. I've been looking through the patch and there seem to be quite a few changes, including some that may optimize it. I'm about to test it out on a test machine and do some benchmarks. I'll post my results in the next day or so. Thanks, Simon- From davem@redhat.com Mon May 19 18:15:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 18:15: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.9) with SMTP id h4K1FJ2x005200 for ; Mon, 19 May 2003 18:15:20 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA06653; Mon, 19 May 2003 18:14:06 -0700 Date: Mon, 19 May 2003 18:14:05 -0700 (PDT) Message-Id: <20030519.181405.35017608.davem@redhat.com> To: sim@netnation.com Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030520011053.GB10419@netnation.com> References: <20030519154852.I39024@shell.cyberus.ca> <20030520011053.GB10419@netnation.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2581 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 From: Simon Kirby Date: Mon, 19 May 2003 18:10:53 -0700 I doubt we have been the target of any hashing-specific attacks. I bet you have been, the weakness in the hash has been very well publicized and the script kiddies aren't using the truly random version of the attacks anymore. Just google for juno-z.101f.c, this (or some derivative) is the DoS people attack program are actually using. It was the only major place where the routing cache was weak performance wise. From hadi@shell.cyberus.ca Mon May 19 18:23:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 18:23:23 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K1NI2x005706 for ; Mon, 19 May 2003 18:23:19 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19HvqO-000AIb-AD; Mon, 19 May 2003 21:23:08 -0400 Date: Mon, 19 May 2003 21:23:08 -0400 (EDT) From: Jamal Hadi To: "David S. Miller" cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress In-Reply-To: <20030519.181405.35017608.davem@redhat.com> Message-ID: <20030519212209.P39592@shell.cyberus.ca> References: <20030519154852.I39024@shell.cyberus.ca> <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2582 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Mon, 19 May 2003, David S. Miller wrote: > I bet you have been, the weakness in the hash has been very well > publicized and the script kiddies aren't using the truly random > version of the attacks anymore. Just google for juno-z.101f.c, this > (or some derivative) is the DoS people attack program are actually > using. Also used to attack CISCOs by them kiddies btw. We stand much better than any CISCO doing caching. cheers, jamal From davem@redhat.com Mon May 19 18:25:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 18:25: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.9) with SMTP id h4K1PN2x006082 for ; Mon, 19 May 2003 18:25:24 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA06750; Mon, 19 May 2003 18:24:10 -0700 Date: Mon, 19 May 2003 18:24:10 -0700 (PDT) Message-Id: <20030519.182410.10302536.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030519212209.P39592@shell.cyberus.ca> References: <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> <20030519212209.P39592@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2583 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 From: Jamal Hadi Date: Mon, 19 May 2003 21:23:08 -0400 (EDT) Also used to attack CISCOs by them kiddies btw. We stand much better than any CISCO doing caching. I have to assume that the source address selection operates differently for attacking cisco equiptment, our hashes being identical would really be unbelievable :-) From pekkas@netcore.fi Mon May 19 22:02:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 22:02:30 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K52M2x014340 for ; Mon, 19 May 2003 22:02:23 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h4K51WI26866; Tue, 20 May 2003 08:01:32 +0300 Date: Tue, 20 May 2003 08:01:32 +0300 (EEST) From: Pekka Savola To: Jamal Hadi cc: "David S. Miller" , , , Subject: Re: Route cache performance under stress In-Reply-To: <20030519220409.V39658@shell.cyberus.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2584 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, 19 May 2003, Jamal Hadi wrote: > I dont think the hashes are similar - its the effect into the > slow path. I was told by someone who tested this on a priicey CISCO > that they simply die unless capable of a feature called CEF. Yes, but pretty much nobody is using Cisco without CEF, except in the last mile, low-end devices. > On Mon, 19 May 2003, David S. Miller wrote: > > > From: Jamal Hadi > > Date: Mon, 19 May 2003 21:23:08 -0400 (EDT) > > > > Also used to attack CISCOs by them kiddies btw. We stand much better > > than any CISCO doing caching. > > > > I have to assume that the source address selection operates > > differently for attacking cisco equiptment, our hashes being > > identical would really be unbelievable :-) > > > > > > > - > To unsubscribe from this list: send the line "unsubscribe linux-net" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- 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 sommere@ethanet.com Mon May 19 22:07:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 22:07:26 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K57J2x014825 for ; Mon, 19 May 2003 22:07:20 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF600GAD683L3@carleton.edu> for netdev@oss.sgi.com; Tue, 20 May 2003 00:07:16 -0500 (CDT) Date: Tue, 20 May 2003 00:07:33 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: <20030519202756.I39498@shell.cyberus.ca> To: Jamal Hadi Cc: "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3EC9B815.4000504@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> X-archive-position: 2585 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Jamal Hadi wrote: >Hi, > ... >BTW, i am not sure how efficient the stuff that Henry spencer >wrote is in comparison to newer research on variants of boyer-moore >for regex searches. comment? > > I picked Spencer's mainly because it was a pain to port the glibc version into kernel space. They are both basically the posix regexp interface, so if someone wants to get another version working in kernel space we can test and see which one performs better with real load pretty easily. >The code also does seem inefficient but thats beside the point at the >moment (ex you seem to malloc for every incoming packet so you can do a >regex). > > Yep. We haven't spent a lot of time on optimizations. Obviously that example can be fixed pretty quickly... except I'm not sure we can avoid it and stay thread safe? (linux can route multiple packets at the same time on an smp box right? so we can't just use a staically defined buffer...) Ethan Sommer http://l7-filter.sf.net From davem@redhat.com Mon May 19 23:36:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 23:36: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.9) with SMTP id h4K6am2x017458 for ; Mon, 19 May 2003 23:36:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA07425; Mon, 19 May 2003 23:35:33 -0700 Date: Mon, 19 May 2003 23:35:32 -0700 (PDT) Message-Id: <20030519.233532.42779243.davem@redhat.com> To: mk@linux-ipv6.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH] IPv6 IPComp From: "David S. Miller" In-Reply-To: <871xyvqr7k.wl@karaba.org> References: <873cjebwn1.wl@karaba.org> <20030516.140014.59676235.davem@redhat.com> <871xyvqr7k.wl@karaba.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2586 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 From: Mitsuru KANDA / $B?@ED(B $B=<(B Date: Mon, 19 May 2003 17:24:31 +0900 I would like to try to configure xfrm4 ipip tunnel for testing. What is the suitable tool?, setkey??? Unfortunately setkey is not powerful enough to do this currently. Only the netlink based ipsec configuration can set these things up. However, all of the testing we did was via tunnel mode IPCOMP. Note that for xfrm6_tunnel.c you will need to use some kind of "u32 --> in6_addr" mapping table. You can do this with a simple hash table of some kind. Then you can use xfrm_state_lookup() just like xfrm4_tunnel.c does. From davem@redhat.com Mon May 19 23:47:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 23:47: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.9) with SMTP id h4K6le2x018011 for ; Mon, 19 May 2003 23:47:41 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA07496; Mon, 19 May 2003 23:46:25 -0700 Date: Mon, 19 May 2003 23:46:24 -0700 (PDT) Message-Id: <20030519.234624.123976229.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030519220409.V39658@shell.cyberus.ca> References: <20030519212209.P39592@shell.cyberus.ca> <20030519.182410.10302536.davem@redhat.com> <20030519220409.V39658@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2587 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 From: Jamal Hadi Date: Mon, 19 May 2003 22:13:33 -0400 (EDT) I dont think the hashes are similar - its the effect into the slow path. I was told by someone who tested this on a priicey CISCO that they simply die unless capable of a feature called CEF. I found a description of this thing on Cisco's web site. Amusingly it seems to contradict itself, it says that the CEF FIB is fully populated and has a 1-to-1 correspondance to the routing table yet it says that the first access to some destination is what creates CEF entries. Go figure! :-) From davem@redhat.com Mon May 19 23:58:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 19 May 2003 23:58:54 -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.9) with SMTP id h4K6wo2x018656 for ; Mon, 19 May 2003 23:58:50 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA07545; Mon, 19 May 2003 23:57:34 -0700 Date: Mon, 19 May 2003 23:57:34 -0700 (PDT) Message-Id: <20030519.235734.55835721.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch comx over to initcalls From: "David S. Miller" In-Reply-To: <20030518190423.A28834@lst.de> References: <20030518190423.A28834@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2588 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 From: Christoph Hellwig Date: Sun, 18 May 2003 19:04:24 +0200 The link order already is the same as the old init order. Note that the drivers are still full of crap, I don't have the hardware so I refuse to poke deeper into the shite.. Applied, thanks. From mk@karaba.org Tue May 20 00:44:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 00:44:26 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K7i62x021095 for ; Tue, 20 May 2003 00:44:08 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19I1n0-0003HF-00; Tue, 20 May 2003 16:44:02 +0900 Date: Tue, 20 May 2003 16:44:00 +0900 Message-ID: <87iss6f4fz.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] IPv6 IPComp In-Reply-To: <20030519.233532.42779243.davem@redhat.com> References: <873cjebwn1.wl@karaba.org> <20030516.140014.59676235.davem@redhat.com> <871xyvqr7k.wl@karaba.org> <20030519.233532.42779243.davem@redhat.com> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2589 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev > Unfortunately setkey is not powerful enough to do this > currently. Only the netlink based ipsec configuration can > set these things up. > > However, all of the testing we did was via tunnel mode IPCOMP. OK, I'll also do test. > Note that for xfrm6_tunnel.c you will need to use some kind > of "u32 --> in6_addr" mapping table. You can do this with > a simple hash table of some kind. Then you can use > xfrm_state_lookup() just like xfrm4_tunnel.c does. I see, thank you. Regards, -mk From Eric.Lemoine@Sun.COM Tue May 20 01:22:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 01:22:41 -0700 (PDT) Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K8ML2x023438 for ; Tue, 20 May 2003 01:22:22 -0700 Received: from esunmail ([129.147.58.120]) by brmea-mail-4.sun.com (8.12.9/8.12.9) with ESMTP id h4K8MKpd000566 for ; Tue, 20 May 2003 02:22:21 -0600 (MDT) Received: from xpa-fe2 ([129.147.58.198]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HF6005UBF986T@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Tue, 20 May 2003 02:22:20 -0600 (MDT) Received: from udine ([140.77.13.119]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HF600CPNF96E4@mail.sun.net> for netdev@oss.sgi.com; Tue, 20 May 2003 02:22:20 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Tue, 20 May 2003 10:22:17 +0200 Date: Tue, 20 May 2003 10:22:17 +0200 From: Eric Lemoine Subject: simple change to qdisc_restart() To: netdev Cc: Eric.Lemoine@Sun.COM Message-id: <20030520082217.GC978@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 2590 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev Hi, Any comments regarding the following patch? Thx. --- sch_generic.c.old Tue May 20 09:11:25 2003 +++ sch_generic.c Tue May 20 10:16:11 2003 @@ -77,6 +77,7 @@ int qdisc_restart(struct net_device *dev) { struct Qdisc *q = dev->qdisc; + int sched_flag = 1; struct sk_buff *skb; /* Dequeue packet */ @@ -120,6 +121,12 @@ printk(KERN_DEBUG "Dead loop on netdevice %s, fix it urgently!\n", dev->name); return -1; } + + /* At this point we know for sure that someone + * is taking care of this Qdisc for us so we + * do not need to schedule tx softirq. + */ + sched_flag = 0; netdev_rx_stat[smp_processor_id()].cpu_collision++; } @@ -134,7 +141,8 @@ */ q->ops->requeue(skb, q); - netif_schedule(dev); + if (sched_flag) + netif_schedule(dev); return 1; } return q->q.qlen -- Eric From davem@redhat.com Tue May 20 01:29:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 01:29: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.9) with SMTP id h4K8Te2x024105 for ; Tue, 20 May 2003 01:29:40 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA07829; Tue, 20 May 2003 01:28:24 -0700 Date: Tue, 20 May 2003 01:28:24 -0700 (PDT) Message-Id: <20030520.012824.85398613.davem@redhat.com> To: Eric.Lemoine@Sun.COM Cc: netdev@oss.sgi.com Subject: Re: simple change to qdisc_restart() From: "David S. Miller" In-Reply-To: <20030520082217.GC978@udine> References: <20030520082217.GC978@udine> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2591 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 From: Eric Lemoine Date: Tue, 20 May 2003 10:22:17 +0200 Any comments regarding the following patch? I understand why it is valid, etc., but why do we even want to do this? It is not like this dead-loop detection stuff is a hot-path or anything like that. From Eric.Lemoine@Sun.COM Tue May 20 01:58:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 01:58:44 -0700 (PDT) Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4K8wb2x026000 for ; Tue, 20 May 2003 01:58:37 -0700 Received: from esunmail ([129.147.58.120]) by brmea-mail-4.sun.com (8.12.9/8.12.9) with ESMTP id h4K8wapd011836 for ; Tue, 20 May 2003 02:58:36 -0600 (MDT) Received: from xpa-fe2 (esunmail [129.147.58.120]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HF600E49GVSZG@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Tue, 20 May 2003 02:57:28 -0600 (MDT) Received: from udine ([140.77.13.119]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HF600CWOGVPEF@mail.sun.net> for netdev@oss.sgi.com; Tue, 20 May 2003 02:57:28 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Tue, 20 May 2003 10:57:25 +0200 Date: Tue, 20 May 2003 10:57:25 +0200 From: Eric Lemoine Subject: Re: simple change to qdisc_restart() In-reply-to: <20030520.012824.85398613.davem@redhat.com> To: "David S. Miller" Cc: Eric.Lemoine@Sun.COM, netdev@oss.sgi.com Message-id: <20030520085724.GD978@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> X-archive-position: 2592 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev > From: Eric Lemoine > Date: Tue, 20 May 2003 10:22:17 +0200 > > Any comments regarding the following patch? > > I understand why it is valid, etc., but why do we even want to do > this? It is not like this dead-loop detection stuff is a hot-path or > anything like that. I've implemented a prototype that uses per-CPU kernel threads for processing packets coming in from a single interface. The idea is to apply multiple CPUs to a single network interface to be able to have multiple CPUs simultaneously pumping data into the network. So in my case, I have lots of cpu_collisions and running the tx softirq to do nothing may lower the performances. Anyway, even though my patch may help me, it may indeed be irrelevant to the stock kernel. Thx. -- Eric From Robert.Olsson@data.slu.se Tue May 20 03:37:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 03:37:21 -0700 (PDT) Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KAbF2x003021 for ; Tue, 20 May 2003 03:37:17 -0700 Received: (from robert@localhost) by robur.slu.se (8.9.3p2/8.9.3) id MAA11343; Tue, 20 May 2003 12:36:43 +0200 From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16074.1339.3673.938923@robur.slu.se> Date: Tue, 20 May 2003 12:36:43 +0200 To: Eric Lemoine Cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: simple change to qdisc_restart() In-Reply-To: <20030520085724.GD978@udine> References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> X-Mailer: VM 6.92 under Emacs 19.34.1 X-archive-position: 2593 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Eric Lemoine writes: > > From: Eric Lemoine > > Date: Tue, 20 May 2003 10:22:17 +0200 > > > > Any comments regarding the following patch? I think it will make any use of "raw" dev->hard_start_xmit" impossible. Which is what pktgen uses. > > I understand why it is valid, etc., but why do we even want to do > > this? It is not like this dead-loop detection stuff is a hot-path or > > anything like that. > > I've implemented a prototype that uses per-CPU kernel threads for > processing packets coming in from a single interface. The idea is to > apply multiple CPUs to a single network interface to be able to have > multiple CPUs simultaneously pumping data into the network. So in my > case, I have lots of cpu_collisions and running the tx softirq to do > nothing may lower the performances. Anyway, even though my patch may > help me, it may indeed be irrelevant to the stock kernel. Sounds like a project at least having packet reordering and cache bouncing in mind. Cheers. --ro From Eric.Lemoine@Sun.COM Tue May 20 04:24:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 04:24:21 -0700 (PDT) Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KBO62x006157 for ; Tue, 20 May 2003 04:24:07 -0700 Received: from esunmail ([129.147.58.120]) by brmea-mail-4.sun.com (8.12.9/8.12.9) with ESMTP id h4KBO6pd022836 for ; Tue, 20 May 2003 05:24:06 -0600 (MDT) Received: from xpa-fe1 ([129.147.58.198]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HF600502NO56T@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Tue, 20 May 2003 05:24:06 -0600 (MDT) Received: from udine ([140.77.13.119]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HF6001T1NO3JY@mail.sun.net> for netdev@oss.sgi.com; Tue, 20 May 2003 05:24:05 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Tue, 20 May 2003 13:24:02 +0200 Date: Tue, 20 May 2003 13:24:02 +0200 From: Eric Lemoine Subject: Re: simple change to qdisc_restart() In-reply-to: <20030520112109.GE978@udine> To: Eric Lemoine Cc: Robert Olsson , "David S. Miller" , netdev@oss.sgi.com Message-id: <20030520112402.GF978@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> <16074.1339.3673.938923@robur.slu.se> <20030520112109.GE978@udine> X-archive-position: 2595 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev > Let me explain a bit more. > > I developped a kernel module that basically implements per-cpu kernel > threads, each being bound to a particular cpu. I also modified the > Myrinet NIC driver and firmware so that they implement per-cpu rx rings. > > The NIC makes sure that packets of the same connection are always > deposited in the same ring. Here's how it does it. For each incoming > pkt, the NIC computes the index of the ring into which the packet must > be placed [*], passes this index to the driver, and dmas the packet into > the appropriate ring. The driver uses the ring index to wake up the > appropriate kernel thread. Each kernel-thread behaves in a NAPI manner. Oops. I forgot to mention that: [*] Currently the NIC simply does ring_idx = IPsrc & (nr_rings-1). -- Eric From Eric.Lemoine@Sun.COM Tue May 20 04:23:33 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 04:23:42 -0700 (PDT) Received: from brmea-mail-2.sun.com (brmea-mail-2.Sun.COM [192.18.98.43]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KBNW2x006065 for ; Tue, 20 May 2003 04:23:33 -0700 Received: from esunmail ([129.147.58.120]) by brmea-mail-2.sun.com (8.12.9/8.12.9) with ESMTP id h4KBNWY9020709 for ; Tue, 20 May 2003 05:23:32 -0600 (MDT) Received: from xpa-fe2 ([129.147.58.198]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HF6005S4NJE6T@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Tue, 20 May 2003 05:21:15 -0600 (MDT) Received: from udine ([140.77.13.119]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HF600C6RNJAE7@mail.sun.net> for netdev@oss.sgi.com; Tue, 20 May 2003 05:21:14 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Tue, 20 May 2003 13:21:09 +0200 Date: Tue, 20 May 2003 13:21:09 +0200 From: Eric Lemoine Subject: Re: simple change to qdisc_restart() In-reply-to: <16074.1339.3673.938923@robur.slu.se> To: Robert Olsson Cc: Eric Lemoine , "David S. Miller" , netdev@oss.sgi.com Message-id: <20030520112109.GE978@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> <16074.1339.3673.938923@robur.slu.se> X-archive-position: 2594 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev > > > Any comments regarding the following patch? > > I think it will make any use of "raw" dev->hard_start_xmit" impossible. > Which is what pktgen uses. > > > > I understand why it is valid, etc., but why do we even want to do > > > this? It is not like this dead-loop detection stuff is a hot-path or > > > anything like that. > > > > I've implemented a prototype that uses per-CPU kernel threads for > > processing packets coming in from a single interface. The idea is to > > apply multiple CPUs to a single network interface to be able to have > > multiple CPUs simultaneously pumping data into the network. So in my > > case, I have lots of cpu_collisions and running the tx softirq to do > > nothing may lower the performances. Anyway, even though my patch may > > help me, it may indeed be irrelevant to the stock kernel. > > Sounds like a project at least having packet reordering and cache bouncing > in mind. Let me explain a bit more. I developped a kernel module that basically implements per-cpu kernel threads, each being bound to a particular cpu. I also modified the Myrinet NIC driver and firmware so that they implement per-cpu rx rings. The NIC makes sure that packets of the same connection are always deposited in the same ring. Here's how it does it. For each incoming pkt, the NIC computes the index of the ring into which the packet must be placed [*], passes this index to the driver, and dmas the packet into the appropriate ring. The driver uses the ring index to wake up the appropriate kernel thread. Each kernel-thread behaves in a NAPI manner. -- Eric From hadi@shell.cyberus.ca Tue May 20 04:48:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 04:48:09 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KBm22x007375 for ; Tue, 20 May 2003 04:48:03 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19I5aq-000Ach-Vj; Tue, 20 May 2003 07:47:44 -0400 Date: Tue, 20 May 2003 07:47:44 -0400 (EDT) From: Jamal Hadi To: Pekka Savola cc: "David S. Miller" , sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress In-Reply-To: Message-ID: <20030520074352.N40831@shell.cyberus.ca> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2596 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, Pekka Savola wrote: > On Mon, 19 May 2003, Jamal Hadi wrote: > > I dont think the hashes are similar - its the effect into the > > slow path. I was told by someone who tested this on a priicey CISCO > > that they simply die unless capable of a feature called CEF. > > Yes, but pretty much nobody is using Cisco without CEF, except in the last > mile, low-end devices. > so not a GSR thing only feature. At the edges though, wouldnt it be important to do more sexy things than just route based on a destination address? cheers, jamal From pekkas@netcore.fi Tue May 20 04:56:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 04:56:06 -0700 (PDT) Received: from netcore.fi (netcore.fi [193.94.160.1]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KBu02x008070 for ; Tue, 20 May 2003 04:56:02 -0700 Received: from localhost (pekkas@localhost) by netcore.fi (8.11.6/8.11.6) with ESMTP id h4KBtBf30380; Tue, 20 May 2003 14:55:11 +0300 Date: Tue, 20 May 2003 14:55:10 +0300 (EEST) From: Pekka Savola To: Jamal Hadi cc: "David S. Miller" , , , Subject: Re: Route cache performance under stress In-Reply-To: <20030520074352.N40831@shell.cyberus.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2597 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, 20 May 2003, Jamal Hadi wrote: > On Tue, 20 May 2003, Pekka Savola wrote: > > On Mon, 19 May 2003, Jamal Hadi wrote: > > > I dont think the hashes are similar - its the effect into the > > > slow path. I was told by someone who tested this on a priicey CISCO > > > that they simply die unless capable of a feature called CEF. > > > > Yes, but pretty much nobody is using Cisco without CEF, except in the last > > mile, low-end devices. > > > > so not a GSR thing only feature. At the edges though, wouldnt it be > important to do more sexy things than just route based on a destination > address? Indeed. For example, policy-based routing (e.g. source address dependent routing) has been claimed to be in the CEF path now (previously it was in the slow path), but I certainly would "like" to be shown wrong. :-) By low-end edge devices I basically meant all DSL, ISDN, cablemodem etc. equipment. I don't know of "midrange" Cisco gear, but basically everything service providers use (at least 7xxx, 10xxx, and 12xxx series) do support CEF (or more complicated variations of it). -- 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 hadi@shell.cyberus.ca Tue May 20 05:04:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 05:04:21 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KC4A2x008749 for ; Tue, 20 May 2003 05:04:11 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19I5qa-000AdD-Mo; Tue, 20 May 2003 08:04:00 -0400 Date: Tue, 20 May 2003 08:04:00 -0400 (EDT) From: Jamal Hadi To: "David S. Miller" cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress In-Reply-To: <20030519.234624.123976229.davem@redhat.com> Message-ID: <20030520074848.U40843@shell.cyberus.ca> References: <20030519212209.P39592@shell.cyberus.ca> <20030519.182410.10302536.davem@redhat.com> <20030519220409.V39658@shell.cyberus.ca> <20030519.234624.123976229.davem@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2598 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Mon, 19 May 2003, David S. Miller wrote: > I found a description of this thing on Cisco's web site. Amusingly it > seems to contradict itself, it says that the CEF FIB is fully > populated and has a 1-to-1 correspondance to the routing table yet it > says that the first access to some destination is what creates > CEF entries. > It seems to be done at interupt level sort of like Linux fast switching (not to be confused with CISCO fast switching); however, unlike Linux fast switching which looks up based on dst cache, they do lookups on a FIB with already nexthop entries (sort of like the hh cache we have). Theres something akin to a user land process which makes sure the neighbors are resolved all the time - most routing protocols stacks already do this today with BGP. I dont think Zebra does. What i am wondering is what if they have to do more than routing? Dont they end up with same (if not worse) effect? Having said all the above, i think it would be worth seeing what the effect of improving the slow path is (make it a multi-way trie). Actually before that someone needs to prove slow path is slow ;-> Note: It may make sense that we have options to totaly remove the cache lookups if necessary - noone has proved a need for it at this point. cheers, jamal From hadi@shell.cyberus.ca Tue May 20 05:15:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 05:15:09 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KCEx2x009427 for ; Tue, 20 May 2003 05:15:00 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19I60y-000AdZ-3M; Tue, 20 May 2003 08:14:44 -0400 Date: Tue, 20 May 2003 08:14:44 -0400 (EDT) From: Jamal Hadi To: Ethan Sommer cc: "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <3EC9B815.4000504@ethanet.com> Message-ID: <20030520080940.E40885@shell.cyberus.ca> References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2599 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, Ethan Sommer wrote: > I picked Spencer's mainly because it was a pain to port the glibc > version into kernel space. They are both basically the posix regexp > interface, so if someone wants to get another version working in kernel > space we can test and see which one performs better with real load > pretty easily. > Take a look at snorts implementation. I think snort is GPL so you may just be able to borrow it. > > Yep. We haven't spent a lot of time on optimizations. Obviously that > example can be fixed pretty quickly... except I'm not sure we can avoid > it and stay thread safe? (linux can route multiple packets at the same > time on an smp box right? so we can't just use a staically defined > buffer...) > Your problem seesm to be the regexp scheme used. You dont need a static buffer i think. You should be able to operate on an incoming packet itself. cheers, jamal From Robert.Olsson@data.slu.se Tue May 20 05:24:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 05:24:49 -0700 (PDT) Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KCOh2x010198 for ; Tue, 20 May 2003 05:24:44 -0700 Received: (from robert@localhost) by robur.slu.se (8.9.3p2/8.9.3) id OAA13045; Tue, 20 May 2003 14:24:12 +0200 From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16074.7787.988583.56689@robur.slu.se> Date: Tue, 20 May 2003 14:24:11 +0200 To: Eric Lemoine Cc: Robert Olsson , "David S. Miller" , netdev@oss.sgi.com Subject: Re: simple change to qdisc_restart() In-Reply-To: <20030520112109.GE978@udine> References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> <16074.1339.3673.938923@robur.slu.se> <20030520112109.GE978@udine> X-Mailer: VM 6.92 under Emacs 19.34.1 X-archive-position: 2600 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Eric Lemoine writes: > I developped a kernel module that basically implements per-cpu kernel > threads, each being bound to a particular cpu. I also modified the > Myrinet NIC driver and firmware so that they implement per-cpu rx rings. > > The NIC makes sure that packets of the same connection are always > deposited in the same ring. Here's how it does it. For each incoming > pkt, the NIC computes the index of the ring into which the packet must > be placed [*], passes this index to the driver, and dmas the packet into > the appropriate ring. The driver uses the ring index to wake up the > appropriate kernel thread. Each kernel-thread behaves in a NAPI manner. OK! Sounds interesting... So reordering should be guaranteed within "connections" but not per interface. And if you can repeat the trick with per-cpu rings for tx you can eventually eliminate cache bouncing when sending/freeing skb's. We tried to tag with cpu-owner in tx-ring when doing hard_xmit and having same cpu sending it to do kfree but the complexity balanced the win... The thinking was that per-cpu tx rings could help. Cheers. --ro From hadi@shell.cyberus.ca Tue May 20 05:34:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 05:34:10 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KCY52x011177 for ; Tue, 20 May 2003 05:34:06 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19I6JS-000AeC-9M; Tue, 20 May 2003 08:33:50 -0400 Date: Tue, 20 May 2003 08:33:50 -0400 (EDT) From: Jamal Hadi To: Robert Olsson cc: Eric Lemoine , "David S. Miller" , netdev@oss.sgi.com Subject: Re: simple change to qdisc_restart() In-Reply-To: <16074.7787.988583.56689@robur.slu.se> Message-ID: <20030520083020.N40924@shell.cyberus.ca> References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> <16074.1339.3673.938923@robur.slu.se> <20030520112109.GE978@udine> <16074.7787.988583.56689@robur.slu.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2601 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, Robert Olsson wrote: > > Sounds interesting... > So reordering should be guaranteed within "connections" but not per interface. > > And if you can repeat the trick with per-cpu rings for tx you can eventually > eliminate cache bouncing when sending/freeing skb's. > > We tried to tag with cpu-owner in tx-ring when doing hard_xmit and having same > cpu sending it to do kfree but the complexity balanced the win... The thinking > was that per-cpu tx rings could help. > His patch should be interesting. I have seen NICs showing up in the market with multiple DMA rings/channels and you can map flows to channels. Locking the device on egress just because one of the rings is full doesnt make sense. Such boards maybe the perfect pktgen board for you, btw ;-> Can you post your patch Eric? cheers, jamal From mator@gsib.sl.ru Tue May 20 07:01:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 07:01:52 -0700 (PDT) Received: from gsib.sl.ru (SYSTEM@gsib.sl.ru [217.171.66.34]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KE1f2x016362 for ; Tue, 20 May 2003 07:01:45 -0700 Received: from gsib.sl.ru (mator@localhost [127.0.0.1]) by gsib.sl.ru (8.12.9/8.12.8/1.0) with ESMTP id h4KE3f39029874 for ; Tue, 20 May 2003 18:03:41 +0400 Received: (from mator@localhost) by gsib.sl.ru (8.12.9/8.12.9/Submit) id h4KE3fhV029872 for netdev@oss.sgi.com; Tue, 20 May 2003 18:03:41 +0400 Date: Tue, 20 May 2003 18:03:41 +0400 From: Anatoly Pugachev To: netdev@oss.sgi.com Subject: small e100 ethernet driver problem -> %d Message-ID: <20030520140341.GY30683@gsib.sl.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.4i X-Accept-Language: en,ru X-archive-position: 2602 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mator@gsib.ru Precedence: bulk X-list: netdev Hello! using linux kernel 2.5.69 trying to load e100 driver, gives me following in logs: May 20 16:47:56 p4 kernel: Intel(R) PRO/100 Network Driver - version 2.2.21-k1 May 20 16:47:56 p4 kernel: Copyright (c) 2003 Intel Corporation May 20 16:47:56 p4 kernel: May 20 16:47:56 p4 kernel: e100: selftest OK. May 20 16:47:59 p4 kernel: Freeing alive device d2c43800, eth%%d May 20 16:47:59 p4 kernel: e100: eth1: Intel(R) PRO/100 Network Connection May 20 16:47:59 p4 kernel: Hardware receive checksums enabled May 20 16:47:59 p4 kernel: cpu cycle saver enabled module works fine, but notice %%d in the output, should be missprint and easy to fix. -- /mator From sommere@ethanet.com Tue May 20 07:39:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 07:39:27 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KEdL2x019385 for ; Tue, 20 May 2003 07:39:22 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF6002JQWPK7W@carleton.edu> for netdev@oss.sgi.com; Tue, 20 May 2003 09:39:21 -0500 (CDT) Date: Tue, 20 May 2003 09:39:40 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: <20030520080940.E40885@shell.cyberus.ca> To: Jamal Hadi Cc: "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3ECA3E2C.20805@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> X-archive-position: 2603 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Jamal Hadi wrote: >On Tue, 20 May 2003, Ethan Sommer wrote: > > > > >>Yep. We haven't spent a lot of time on optimizations. Obviously that >>example can be fixed pretty quickly... except I'm not sure we can avoid >>it and stay thread safe? (linux can route multiple packets at the same >>time on an smp box right? so we can't just use a staically defined >>buffer...) >> >> >> > >Your problem seesm to be the regexp scheme used. You dont need a static >buffer i think. You should be able to operate on an incoming packet >itself. > > > Nope. I need to strip out all the nulls from the packet, or any posix regex parser will think the string ends at the first null. (so protocols which use null's will be difficult/impossible to identify) I could modify the regexec function to take a length, but then it wouldn't be the posix regexec prototype and I was hopeing someone would add those to the common library of kernel functions, so others could use them. (and hence make it easier to maintain.) Ethan From hadi@shell.cyberus.ca Tue May 20 08:00:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 08:00:55 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KF0f2x021467 for ; Tue, 20 May 2003 08:00:41 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19I8bI-000AiR-3x; Tue, 20 May 2003 11:00:24 -0400 Date: Tue, 20 May 2003 11:00:24 -0400 (EDT) From: Jamal Hadi To: Ethan Sommer cc: "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <3ECA3E2C.20805@ethanet.com> Message-ID: <20030520105356.U41173@shell.cyberus.ca> References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> <3ECA3E2C.20805@ethanet.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2604 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, Ethan Sommer wrote: > Nope. I need to strip out all the nulls from the packet, or any posix > regex parser will think the string ends at the first null. (so protocols > which use null's will be difficult/impossible to identify) Ok, i see your dilema. How does snort do it? I dont think copying the packet is the right way to do it. Could the null NOT be considered as something speacial unless explicitly stated? > > I could modify the regexec function to take a length, but then it > wouldn't be the posix regexec prototype and I was hopeing someone would > add those to the common library of kernel functions, so others could use > them. (and hence make it easier to maintain.) > This would be the first start. Check with the netfilter folks who are famous for creating bread slicers - they may already have something along these lines. I am actually interested in the kernel variant of such a library. Actually once you have the library (which is efficient) we could work together. I have some stuff cooking (and lotsa opinions on what i would like to see in it that you could consider as requirements). cheers, jamal From gandalf@wlug.westbo.se Tue May 20 08:15:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 08:15:20 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KFF92x022959 for ; Tue, 20 May 2003 08:15:10 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id D1A6F36FE0; Tue, 20 May 2003 17:15:03 +0200 (CEST) Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] From: Martin Josefsson To: Jamal Hadi Cc: Ethan Sommer , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com In-Reply-To: <20030520105356.U41173@shell.cyberus.ca> References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> <3ECA3E2C.20805@ethanet.com> <20030520105356.U41173@shell.cyberus.ca> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053443703.17386.138.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 20 May 2003 17:15:03 +0200 X-archive-position: 2605 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Tue, 2003-05-20 at 17:00, Jamal Hadi wrote: > On Tue, 20 May 2003, Ethan Sommer wrote: > > > Nope. I need to strip out all the nulls from the packet, or any posix > > regex parser will think the string ends at the first null. (so protocols > > which use null's will be difficult/impossible to identify) > > Ok, i see your dilema. How does snort do it? I dont think copying the > packet is the right way to do it. Could the null NOT be considered as > something speacial unless explicitly stated? Maybe make it take a length parameter and if it's zero treat null's like all other algorithms do and it's non-zero use the length instead. Then you can hide it in a wrapper function for the "normal" case that just calls the actual search-function but with 0 as length. > > > > I could modify the regexec function to take a length, but then it > > wouldn't be the posix regexec prototype and I was hopeing someone would > > add those to the common library of kernel functions, so others could use > > them. (and hence make it easier to maintain.) > > > > This would be the first start. Check with the netfilter folks who are > famous for creating bread slicers - they may already have something along > these lines. > I am actually interested in the kernel variant of such a > library. Actually once you have the library (which is efficient) we could > work together. I have some stuff cooking (and lotsa opinions on what i > would like to see in it that you could consider as requirements). Well we don't have a that big bread slicer (yet) but take a look at libqsearch, it is a library for searching and has been ported to the linux kernel by the author. It has support for various algorithms that have diffrent capabilities, unfortunately I don't think it has an algorithm that has support for regexp yet (the framework is there, ie the flag that says an algorithm supports regexp). It's modular and I don't think it should be that hard to add an regexp algorithm. It looks quite nice and it can search for multiple strings at the same time and call diffrent callbacks depending on which string matched. -- /Martin From hch@verein.lst.de Tue May 20 08:30:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 08:31:02 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KFUs2x024361 for ; Tue, 20 May 2003 08:30:57 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4KFUiP21118; Tue, 20 May 2003 17:30:44 +0200 Date: Tue, 20 May 2003 17:30:44 +0200 From: Christoph Hellwig To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] clean up the divert ifdef mess Message-ID: <20030520173044.A21103@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2606 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 With some stubs in divert.h this looks a lot nicer. Compile-tested with and without CONFIG_NET_DIVERT. --- 1.19/drivers/net/Space.c Fri Mar 7 05:30:51 2003 +++ edited/drivers/net/Space.c Mon May 19 19:16:24 2003 @@ -131,26 +131,20 @@ { struct devprobe *p = plist; unsigned long base_addr = dev->base_addr; -#ifdef CONFIG_NET_DIVERT int ret; -#endif /* CONFIG_NET_DIVERT */ while (p->probe != NULL) { if (base_addr && p->probe(dev) == 0) { /* probe given addr */ -#ifdef CONFIG_NET_DIVERT ret = alloc_divert_blk(dev); if (ret) return ret; -#endif /* CONFIG_NET_DIVERT */ return 0; } else if (p->status == 0) { /* has autoprobe failed yet? */ p->status = p->probe(dev); /* no, try autoprobe */ if (p->status == 0) { -#ifdef CONFIG_NET_DIVERT ret = alloc_divert_blk(dev); if (ret) return ret; -#endif /* CONFIG_NET_DIVERT */ return 0; } } --- 1.1/include/linux/divert.h Tue Feb 5 18:39:43 2002 +++ edited/include/linux/divert.h Mon May 19 19:25:29 2003 @@ -107,11 +107,24 @@ /* diverter functions */ #include + +#ifdef CONFIG_NET_DIVERT int alloc_divert_blk(struct net_device *); void free_divert_blk(struct net_device *); int divert_ioctl(unsigned int cmd, struct divert_cf *arg); void divert_frame(struct sk_buff *skb); +static inline void handle_diverter(struct sk_buff *skb) +{ + /* if diversion is supported on device, then divert */ + if (skb->dev->divert && skb->dev->divert->divert) + divert_frame(skb); +} +#else +# define alloc_divert_blk(dev) (0) +# define free_divert_blk(dev) do {} while (0) +# define divert_ioctl(cmd, arg) (-ENOPKG) +# define handle_diverter(skb) do {} while (0) +#endif #endif - #endif /* _LINUX_DIVERT_H */ --- 1.61/net/socket.c Sat May 17 21:39:14 2003 +++ edited/net/socket.c Mon May 19 19:25:12 2003 @@ -821,11 +821,7 @@ case SIOCGIFDIVERT: case SIOCSIFDIVERT: /* Convert this to call through a hook */ -#ifdef CONFIG_NET_DIVERT err = divert_ioctl(cmd, (struct divert_cf *)arg); -#else - err = -ENOPKG; -#endif /* CONFIG_NET_DIVERT */ break; case SIOCADDDLCI: case SIOCDELDLCI: ===== net/core/dev.c 1.74 vs edited ===== --- 1.74/net/core/dev.c Sat May 17 21:39:13 2003 +++ edited/net/core/dev.c Mon May 19 19:23:05 2003 @@ -1482,15 +1482,6 @@ #endif -static inline void handle_diverter(struct sk_buff *skb) -{ -#ifdef CONFIG_NET_DIVERT - /* if diversion is supported on device, then divert */ - if (skb->dev->divert && skb->dev->divert->divert) - divert_frame(skb); -#endif -} - static inline int __handle_bridge(struct sk_buff *skb, struct packet_type **pt_prev, int *ret) { @@ -2590,11 +2581,9 @@ dev->fastpath_lock = RW_LOCK_UNLOCKED; #endif -#ifdef CONFIG_NET_DIVERT ret = alloc_divert_blk(dev); if (ret) goto out; -#endif /* CONFIG_NET_DIVERT */ dev->iflink = -1; @@ -2660,9 +2649,7 @@ out: return ret; out_err: -#ifdef CONFIG_NET_DIVERT free_divert_blk(dev); -#endif goto out; } @@ -2769,9 +2756,7 @@ /* Notifier chain MUST detach us from master device. */ BUG_TRAP(!dev->master); -#ifdef CONFIG_NET_DIVERT free_divert_blk(dev); -#endif if (dev->destructor != NULL) { #ifdef NET_REFCNT_DEBUG From acme@conectiva.com.br Tue May 20 08:55:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 08:56:04 -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.9) with SMTP id h4KFti2x026571 for ; Tue, 20 May 2003 08:55:54 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19I9ae-0002PZ-00; Tue, 20 May 2003 13:03:48 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id A48381966C; Tue, 20 May 2003 15:57:45 +0000 (UTC) Date: Tue, 20 May 2003 12:57:45 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Linux Networking Development Mailing List Subject: is sk->reuse truly a boolean? Message-ID: <20030520155744.GE801@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: 2607 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 From what I see in the code and from references in, for instance, Unix Network Programming (W. Richard Stevens) it is, but then how can this work? net/ipv4/tcp_ipv4.c, line 265 if (sk->reuse > 1) goto success; In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug in tcp_ipv4 or in core/sock.c 8) Comments? - Arnaldo From Robert.Olsson@data.slu.se Tue May 20 09:13:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 09:13:45 -0700 (PDT) Received: from robur.slu.se (robur.slu.se [130.238.98.12]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KGDQ2x029017 for ; Tue, 20 May 2003 09:13:32 -0700 Received: (from robert@localhost) by robur.slu.se (8.9.3p2/8.9.3) id SAA16928; Tue, 20 May 2003 18:12:57 +0200 From: Robert Olsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16074.21513.492796.943255@robur.slu.se> Date: Tue, 20 May 2003 18:12:57 +0200 To: netdev@oss.sgi.com cc: Robert.Olsson@data.slu.se Subject: Route hash code comparison X-Mailer: VM 6.92 under Emacs 19.34.1 X-archive-position: 2608 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Robert.Olsson@data.slu.se Precedence: bulk X-list: netdev Hello! Route hash code comparison on fairly loaded router at Uppsala Universitet. Router is loaded both in terms of packet load but also in IP-flows from (tens) of thousands of users. The hash table was modified to count linear search in the cache which was printed with rtstat (in_search). Router has 32 k hash buckets which is where the GC starts. This point is choosen for hash algorithm comparison as well. Old hash: 107694/41990 ==> 2.6 linear searches for a packet look-up at 32 k entries New hash: 33334/38927 ==> 0.86 linear searches for a packet look-up at 32 k entries The new hash have random keys but seems to be pretty consistent in term of hashing at least from observerations. No DoS experiments done. [rstat: Table is edited] size == route cache size hit == IN: total number of cache hits per sec tot == IN: total number of cache misses per sec GC == GC: garbage collection calls per sec in_search == HASH: input hash list search per sec Linux 2.5.66 size IN: hit tot GC in_search ============================================== 1467 39622 1255 0 80331 7034 38195 268 0 19382 9743 51429 129 0 32903 11633 50069 91 0 40124 13316 48456 83 0 41458 14846 45883 75 0 47253 16233 44672 65 0 52647 17574 43786 65 0 57167 18855 43227 61 0 61784 20106 43341 59 0 65187 21316 43389 57 0 68505 22481 43386 55 0 73778 23694 42748 58 0 77601 24819 42549 54 0 83328 26180 41474 65 0 82393 27331 41754 53 0 90068 28408 41626 50 0 94326 29415 40731 47 0 97407 30424 42193 47 0 102571 31382 41313 46 0 102311 32348 41990 46 0 107694 * Analys1 33524 42104 57 377 108611 34527 42170 48 501 118257 34148 44107 45 468 120707 35196 43345 50 524 116961 36064 42004 42 434 119295 35868 41805 49 504 119121 36838 42299 45 487 116961 Linux 2.5.66 with hash code from 2.5.69. size IN: hit tot GC in_search ============================================== 6031 34776 0 0 7150 8517 38168 119 0 5455 10395 38431 86 0 6501 11954 37002 73 0 8972 13546 37776 74 0 10742 14948 38595 65 0 12585 16406 37981 67 0 13827 17802 38479 64 0 15437 18984 38392 54 0 17684 20155 37989 54 0 18733 21210 39508 48 0 20084 22466 40834 57 0 21299 23622 39226 52 0 23221 24836 40965 56 0 24183 26157 39683 63 0 24764 27291 40309 54 0 27793 28417 38468 54 0 25867 29358 39199 44 0 29093 30302 39159 45 0 29722 31477 38284 56 0 31246 32449 38927 46 0 33334 * Analys2 33386 39031 44 308 31837 34300 39432 42 457 35057 34117 38106 48 522 33129 35155 37887 48 519 32823 36187 37222 48 516 31986 36326 37125 50 539 33914 37257 38814 44 465 35457 Cheers. --ro From yoshfuji@linux-ipv6.org Tue May 20 09:15:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 09:15:08 -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.9) with SMTP id h4KGF02x029415 for ; Tue, 20 May 2003 09:15:02 -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 h4KGFLBo008851; Wed, 21 May 2003 01:15:21 +0900 Date: Wed, 21 May 2003 01:15:20 +0900 (JST) Message-Id: <20030521.011520.49126007.yoshfuji@linux-ipv6.org> To: acme@conectiva.com.br Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030520155744.GE801@conectiva.com.br> References: <20030520155744.GE801@conectiva.com.br> 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: 2609 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 <20030520155744.GE801@conectiva.com.br> (at Tue, 20 May 2003 12:57:45 -0300), Arnaldo Carvalho de Melo says: > From what I see in the code and from references in, for instance, Unix > Network Programming (W. Richard Stevens) it is, but then how can this work? > > net/ipv4/tcp_ipv4.c, line 265 > > if (sk->reuse > 1) > goto success; > > In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace > passes > 1 it becomes 1, is this the intended behaviour? I think we have a > bug in tcp_ipv4 or in core/sock.c 8) Good point. However, SO_REUSEADDR works because we have tcp_bind_conflict(). -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From acme@conectiva.com.br Tue May 20 09:27:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 09:27:08 -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.9) with SMTP id h4KGR02x030996 for ; Tue, 20 May 2003 09:27:03 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IA50-0002Tk-00; Tue, 20 May 2003 13:35:10 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 2DA261966C; Tue, 20 May 2003 16:29:07 +0000 (UTC) Date: Tue, 20 May 2003 13:29:07 -0300 From: Arnaldo Carvalho de Melo To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? Message-ID: <20030520162906.GF801@conectiva.com.br> References: <20030520155744.GE801@conectiva.com.br> <20030521.011520.49126007.yoshfuji@linux-ipv6.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521.011520.49126007.yoshfuji@linux-ipv6.org> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2610 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 Wed, May 21, 2003 at 01:15:20AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu: > In article <20030520155744.GE801@conectiva.com.br> (at Tue, 20 May 2003 12:57:45 -0300), Arnaldo Carvalho de Melo says: > > > From what I see in the code and from references in, for instance, Unix > > Network Programming (W. Richard Stevens) it is, but then how can this work? > > > > net/ipv4/tcp_ipv4.c, line 265 > > > > if (sk->reuse > 1) > > goto success; > > > > In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace > > passes > 1 it becomes 1, is this the intended behaviour? I think we have a > > bug in tcp_ipv4 or in core/sock.c 8) > > Good point. However, SO_REUSEADDR works because we have tcp_bind_conflict(). mmmkay, so we have to fix it by changing the test to: if (sk->reuse) goto success; Isn't it? Another one I found in this audit: sk->no_check, as per setsockopt is a boolean, but sunrpc code wants tree values, does that need receiving this three values from userspace? if so we have a bug in setsockopt, but without looking at sunrpc code I guess this is only internal... - Arnaldo From yoshfuji@linux-ipv6.org Tue May 20 09:52:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 09:52:59 -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.9) with SMTP id h4KGqs2x001391 for ; Tue, 20 May 2003 09:52:55 -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 h4KGrHBo009061; Wed, 21 May 2003 01:53:17 +0900 Date: Wed, 21 May 2003 01:53:17 +0900 (JST) Message-Id: <20030521.015317.125867074.yoshfuji@linux-ipv6.org> To: acme@conectiva.com.br Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030520162906.GF801@conectiva.com.br> References: <20030520155744.GE801@conectiva.com.br> <20030521.011520.49126007.yoshfuji@linux-ipv6.org> <20030520162906.GF801@conectiva.com.br> 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: 2611 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 <20030520162906.GF801@conectiva.com.br> (at Tue, 20 May 2003 13:29:07 -0300), Arnaldo Carvalho de Melo says: > > > In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace > > > passes > 1 it becomes 1, is this the intended behaviour? I think we have a > > > bug in tcp_ipv4 or in core/sock.c 8) > > > > Good point. However, SO_REUSEADDR works because we have tcp_bind_conflict(). > > mmmkay, so we have to fix it by changing the test to: > > if (sk->reuse) > goto success; > > Isn't it? I don't think so. Above modification will break current reasonable bind(2) behavior. Well, it would be dead code, which would be used for (still unsupported) SO_REUSEPORT. -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From acme@conectiva.com.br Tue May 20 09:56:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 09:56:28 -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.9) with SMTP id h4KGuM2x002044 for ; Tue, 20 May 2003 09:56:24 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IAXT-0002Ww-00; Tue, 20 May 2003 14:04:35 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 942B31966C; Tue, 20 May 2003 16:58:32 +0000 (UTC) Date: Tue, 20 May 2003 13:58:31 -0300 From: Arnaldo Carvalho de Melo To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? Message-ID: <20030520165831.GG801@conectiva.com.br> References: <20030520155744.GE801@conectiva.com.br> <20030521.011520.49126007.yoshfuji@linux-ipv6.org> <20030520162906.GF801@conectiva.com.br> <20030521.015317.125867074.yoshfuji@linux-ipv6.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521.015317.125867074.yoshfuji@linux-ipv6.org> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2612 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 Wed, May 21, 2003 at 01:53:17AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu: > In article <20030520162906.GF801@conectiva.com.br> (at Tue, 20 May 2003 13:29:07 -0300), Arnaldo Carvalho de Melo says: > > > > > In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace > > > > passes > 1 it becomes 1, is this the intended behaviour? I think we have a > > > > bug in tcp_ipv4 or in core/sock.c 8) > > > > > > Good point. However, SO_REUSEADDR works because we have tcp_bind_conflict(). > > > > mmmkay, so we have to fix it by changing the test to: > > > > if (sk->reuse) > > goto success; > > > > Isn't it? > > I don't think so. Above modification will break current > reasonable bind(2) behavior. > > Well, it would be dead code, which would be used for (still > unsupported) SO_REUSEPORT. So just delete the test? - Arnaldo From yoshfuji@linux-ipv6.org Tue May 20 10:02:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 10:02: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.9) with SMTP id h4KH2n2x003556 for ; Tue, 20 May 2003 10:02:50 -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 h4KH2gBo009143; Wed, 21 May 2003 02:02:42 +0900 Date: Wed, 21 May 2003 02:02:42 +0900 (JST) Message-Id: <20030521.020242.16237776.yoshfuji@linux-ipv6.org> To: acme@conectiva.com.br Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <20030520165831.GG801@conectiva.com.br> References: <20030520162906.GF801@conectiva.com.br> <20030521.015317.125867074.yoshfuji@linux-ipv6.org> <20030520165831.GG801@conectiva.com.br> 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: 2613 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 <20030520165831.GG801@conectiva.com.br> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo says: > > I don't think so. Above modification will break current > > reasonable bind(2) behavior. > > > > Well, it would be dead code, which would be used for (still > > unsupported) SO_REUSEPORT. > > So just delete the test? Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? David? -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From acme@conectiva.com.br Tue May 20 10:06:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 10:06:33 -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.9) with SMTP id h4KH6R2x004315 for ; Tue, 20 May 2003 10:06:29 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IAhD-0002Xk-00; Tue, 20 May 2003 14:14:39 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 60F581966C; Tue, 20 May 2003 17:08:37 +0000 (UTC) Date: Tue, 20 May 2003 14:08:36 -0300 From: Arnaldo Carvalho de Melo To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? Message-ID: <20030520170836.GH801@conectiva.com.br> References: <20030520162906.GF801@conectiva.com.br> <20030521.015317.125867074.yoshfuji@linux-ipv6.org> <20030520165831.GG801@conectiva.com.br> <20030521.020242.16237776.yoshfuji@linux-ipv6.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521.020242.16237776.yoshfuji@linux-ipv6.org> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2614 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 Wed, May 21, 2003 at 02:02:42AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu: > In article <20030520165831.GG801@conectiva.com.br> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo says: > > > > I don't think so. Above modification will break current > > > reasonable bind(2) behavior. > > > > > > Well, it would be dead code, which would be used for (still > > > unsupported) SO_REUSEPORT. > > > > So just delete the test? > > Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? > David? Sounds good to me. From shemminger@osdl.org Tue May 20 11:24:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 11:24:20 -0700 (PDT) Received: from mail.osdl.org ([208.186.192.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KIOB2x012289 for ; Tue, 20 May 2003 11:24:13 -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 h4KINtW29951; Tue, 20 May 2003 11:23:56 -0700 Date: Tue, 20 May 2003 11:23:55 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.69++] fixup for latest netdev change. Message-Id: <20030520112355.6d40d98b.shemminger@osdl.org> In-Reply-To: <20030519.232133.45877480.davem@redhat.com> References: <20030519.212814.26529040.davem@redhat.com> <20030520050238.D5BEF2C208@lists.samba.org> <20030519.232133.45877480.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2615 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 One driver was setting owner directly, so won't build now. This should fix it. diff -urNp -X dontdiff linux-2.5/drivers/net/ns83820.c linux-2.5-sysfs/drivers/net/ns83820.c --- linux-2.5/drivers/net/ns83820.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ns83820.c 2003-05-20 11:15:01.000000000 -0700 @@ -1788,7 +1788,7 @@ static int __devinit ns83820_init_one(st dev->ee.cache = &dev->MEAR_cache; dev->ee.lock = &dev->misc_lock; - dev->net_dev.owner = THIS_MODULE; + SET_MODULE_OWNER(dev->net_dev); dev->net_dev.priv = dev; INIT_WORK(&dev->tq_refill, queue_refill, dev); From kumarkr@us.ibm.com Tue May 20 11:53:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 11:53:58 -0700 (PDT) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.132]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KIrj2x014828 for ; Tue, 20 May 2003 11:53:52 -0700 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e34.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4KIrcYp221006; Tue, 20 May 2003 14:53:38 -0400 Received: from d03nm801.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay02.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4KIrbHx057792; Tue, 20 May 2003 12:53:38 -0600 Subject: Patch for NETLINK_TCPDIAG To: "David S. Miller" , Alexey Kuznetsov Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: Krishna Kumar Date: Tue, 20 May 2003 11:49:43 -0700 X-MIMETrack: Serialize by Router on D03NM801/03/M/IBM(Release 6.0.1 [IBM]|April 28, 2003) at 05/20/2003 12:51:48 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-archive-position: 2616 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kumarkr@us.ibm.com Precedence: bulk X-list: netdev Hi, I am not sure if there is a reason why ACK cannot be set for NETLINK_TCPDIAG. If it is settable, please apply following patch. thanks, - KK diff -ruN linux-2.5.68.org/net/ipv4/tcp_diag.c linux-2.5.68/net/ipv4/tcp_diag.c --- linux-2.5.68.org/net/ipv4/tcp_diag.c 2003-05-20 11:38:06.000000000 -0700 +++ linux-2.5.68/net/ipv4/tcp_diag.c 2003-05-20 11:39:48.000000000 -0700 @@ -609,7 +609,7 @@ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) return; err = tcpdiag_rcv_msg(skb, nlh); - if (err) + if (err || nlh->nlmsg_flags & NLM_F_ACK) netlink_ack(skb, nlh, err); } } From sommere@ethanet.com Tue May 20 12:50:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 12:50:18 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KJo82x019818 for ; Tue, 20 May 2003 12:50:11 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF700CGRB3J70@carleton.edu> for netdev@oss.sgi.com; Tue, 20 May 2003 14:50:07 -0500 (CDT) Date: Tue, 20 May 2003 14:50:07 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: <20030520105356.U41173@shell.cyberus.ca> To: Jamal Hadi Cc: "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3ECA86EF.2030001@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> <3ECA3E2C.20805@ethanet.com> <20030520105356.U41173@shell.cyberus.ca> X-archive-position: 2617 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Jamal Hadi wrote: >On Tue, 20 May 2003, Ethan Sommer wrote: > > > >>Nope. I need to strip out all the nulls from the packet, or any posix >>regex parser will think the string ends at the first null. (so protocols >>which use null's will be difficult/impossible to identify) >> >> > >Ok, i see your dilema. How does snort do it? I dont think copying the >packet is the right way to do it. Could the null NOT be considered as >something speacial unless explicitly stated? > > > One thing I should have pointed out earlier, it only copies that memory/does regex stuff until it finds a match or the first 8 packets, whichever is less. So, at least based on my tests, it doesn't seem to slow down 100BT much from what it would be otherwise. We might run into trouble if we look at GB or 10GB, but until we find a problem with speed, I think it is probably more important to make this as simple and easy to maintain as possible. If we see a need to make it more complicated due to speed issues, _then_ we should think about trying to get rid of that copy. Ethan http://l7-filter.sf.net From shemminger@osdl.org Tue May 20 14:12:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 14:13:11 -0700 (PDT) Received: from mail.osdl.org ([208.186.192.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KLCq2x028650 for ; Tue, 20 May 2003 14:12:56 -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 h4KLCUW13769; Tue, 20 May 2003 14:12:35 -0700 Date: Tue, 20 May 2003 14:12:30 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com, greg@kroah.com, mochel@osdl.org, jkenisto@us.ibm.com, lkessler@us.ibm.com, dsteklof@us.ibm.com Subject: [PATCH] sysfs support of network devices Message-Id: <20030520141230.04db8dec.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2618 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev This is the network core infrastructure changes for network device support of sysfs. The changes from the earlier patch are: - sysfs support is not a config option. - updated to latest 2.5.69 including latest net device changes - only mtu, tx_queue_len and flags are writeable. Please apply. Comments and extensions are always welcome. diff -urNp -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-sysfs/include/linux/netdevice.h --- linux-2.5/include/linux/netdevice.h 2003-05-20 10:52:48.000000000 -0700 +++ linux-2.5-sysfs/include/linux/netdevice.h 2003-05-20 11:01:24.000000000 -0700 @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -441,11 +441,22 @@ struct net_device struct divert_blk *divert; #endif /* CONFIG_NET_DIVERT */ - /* generic object representation */ - struct kobject kobj; + /* generic device structure used in constructing class */ + struct device *dev; + + /* class/net/name entry */ + struct class_device class_dev; + + /* statistics sub-directory */ + struct kobject stats_kobj; }; #define SET_MODULE_OWNER(dev) do { } while (0) +/* Set the sysfs physical device reference for the network logical device + * if set prior to registration will cause a symlink during initialization. + */ +#define SET_NETDEV_DEV(net, pdev) ((net)->dev = (pdev)) + struct packet_type { @@ -561,12 +572,12 @@ static inline void netif_stop_queue(stru set_bit(__LINK_STATE_XOFF, &dev->state); } -static inline int netif_queue_stopped(struct net_device *dev) +static inline int netif_queue_stopped(const struct net_device *dev) { return test_bit(__LINK_STATE_XOFF, &dev->state); } -static inline int netif_running(struct net_device *dev) +static inline int netif_running(const struct net_device *dev) { return test_bit(__LINK_STATE_START, &dev->state); } @@ -606,7 +617,9 @@ extern int netif_rx(struct sk_buff *skb #define HAVE_NETIF_RECEIVE_SKB 1 extern int netif_receive_skb(struct sk_buff *skb); extern int dev_ioctl(unsigned int cmd, void *); +extern unsigned dev_get_flags(const struct net_device *); extern int dev_change_flags(struct net_device *, unsigned); +extern int dev_set_mtu(struct net_device *, int); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); extern void dev_init(void); @@ -642,7 +655,7 @@ static inline void dev_put(struct net_de extern void linkwatch_fire_event(struct net_device *dev); -static inline int netif_carrier_ok(struct net_device *dev) +static inline int netif_carrier_ok(const struct net_device *dev) { return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); } diff -urNp -X dontdiff linux-2.5/net/core/dev.c linux-2.5-sysfs/net/core/dev.c --- linux-2.5/net/core/dev.c 2003-05-20 10:52:48.000000000 -0700 +++ linux-2.5-sysfs/net/core/dev.c 2003-05-20 13:46:33.000000000 -0700 @@ -131,16 +131,6 @@ extern int plip_init(void); NET_PROFILE_DEFINE(dev_queue_xmit) NET_PROFILE_DEFINE(softnet_process) -const char *if_port_text[] = { - "unknown", - "BNC", - "10baseT", - "AUI", - "100baseT", - "100baseTX", - "100baseFX" -}; - /* * The list of packet types we will receive (as opposed to discard) * and the routines to invoke. @@ -203,7 +193,9 @@ int netdev_fastroute; int netdev_fastroute_obstacles; #endif -static struct subsystem net_subsys; +extern int netdev_sysfs_init(void); +extern int netdev_register_sysfs(struct net_device *); +extern void netdev_unregister_sysfs(struct net_device *); /******************************************************************************* @@ -2084,6 +2076,22 @@ void dev_set_allmulti(struct net_device dev_mc_upload(dev); } +unsigned dev_get_flags(const struct net_device *dev) +{ + unsigned flags; + + flags = (dev->flags & ~(IFF_PROMISC | + IFF_ALLMULTI | + IFF_RUNNING)) | + (dev->gflags & (IFF_PROMISC | + IFF_ALLMULTI)); + + if (netif_running(dev) && netif_carrier_ok(dev)) + flags |= IFF_RUNNING; + + return flags; +} + int dev_change_flags(struct net_device *dev, unsigned flags) { int ret; @@ -2146,6 +2154,32 @@ int dev_change_flags(struct net_device * return ret; } +int dev_set_mtu(struct net_device *dev, int new_mtu) +{ + int err; + + if (new_mtu == dev->mtu) + return 0; + + /* MTU must be positive. */ + if (new_mtu < 0) + return -EINVAL; + + if (!netif_device_present(dev)) + return -ENODEV; + + err = 0; + if (dev->change_mtu) + err = dev->change_mtu(dev, new_mtu); + else + dev->mtu = new_mtu; + if (!err && dev->flags & IFF_UP) + notifier_call_chain(&netdev_chain, + NETDEV_CHANGEMTU, dev); + return err; +} + + /* * Perform the SIOCxIFxxx calls. */ @@ -2159,13 +2193,7 @@ static int dev_ifsioc(struct ifreq *ifr, switch (cmd) { case SIOCGIFFLAGS: /* Get interface flags */ - ifr->ifr_flags = (dev->flags & ~(IFF_PROMISC | - IFF_ALLMULTI | - IFF_RUNNING)) | - (dev->gflags & (IFF_PROMISC | - IFF_ALLMULTI)); - if (netif_running(dev) && netif_carrier_ok(dev)) - ifr->ifr_flags |= IFF_RUNNING; + ifr->ifr_flags = dev_get_flags(dev); return 0; case SIOCSIFFLAGS: /* Set interface flags */ @@ -2185,27 +2213,7 @@ static int dev_ifsioc(struct ifreq *ifr, return 0; case SIOCSIFMTU: /* Set the MTU of a device */ - if (ifr->ifr_mtu == dev->mtu) - return 0; - - /* - * MTU must be positive. - */ - if (ifr->ifr_mtu < 0) - return -EINVAL; - - if (!netif_device_present(dev)) - return -ENODEV; - - err = 0; - if (dev->change_mtu) - err = dev->change_mtu(dev, ifr->ifr_mtu); - else - dev->mtu = ifr->ifr_mtu; - if (!err && dev->flags & IFF_UP) - notifier_call_chain(&netdev_chain, - NETDEV_CHANGEMTU, dev); - return err; + return dev_set_mtu(dev, ifr->ifr_mtu); case SIOCGIFHWADDR: memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, @@ -2293,6 +2301,7 @@ static int dev_ifsioc(struct ifreq *ifr, return -EEXIST; memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); dev->name[IFNAMSIZ - 1] = 0; + snprintf(dev->class_dev.class_id, BUS_ID_SIZE, dev->name); notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); return 0; @@ -2591,11 +2600,10 @@ int register_netdevice(struct net_device if (d == dev || !strcmp(d->name, dev->name)) goto out_err; } - snprintf(dev->kobj.name,KOBJ_NAME_LEN,dev->name); - kobj_set_kset_s(dev,net_subsys); - if ((ret = kobject_register(&dev->kobj))) - goto out_err; + if ((ret = netdev_register_sysfs(dev))) + goto out_err; + /* Fix illegal SG+CSUM combinations. */ if ((dev->features & NETIF_F_SG) && !(dev->features & (NETIF_F_IP_CSUM | @@ -2848,8 +2856,7 @@ int unregister_netdevice(struct net_devi #ifdef CONFIG_NET_DIVERT free_divert_blk(dev); #endif - - kobject_unregister(&dev->kobj); + netdev_unregister_sysfs(dev); spin_lock(&unregister_todo_lock); dev->next = unregister_todo; @@ -2874,8 +2881,6 @@ extern void ip_auto_config(void); extern void dv_init(void); #endif /* CONFIG_NET_DIVERT */ -static decl_subsys(net,NULL,NULL); - /* * This is called single threaded during boot, so no need @@ -2891,7 +2896,8 @@ static int __init net_dev_init(void) if (dev_proc_init()) goto out; - subsystem_register(&net_subsys); + if (netdev_sysfs_init()) + goto out; INIT_LIST_HEAD(&ptype_all); for (i = 0; i < 16; i++) @@ -2965,7 +2971,8 @@ static int __init net_dev_init(void) */ netdev_boot_setup_check(dev); - if (dev->init && dev->init(dev)) { + if ( (dev->init && dev->init(dev)) || + netdev_register_sysfs(dev) ) { /* * It failed to come up. It will be unhooked later. * dev_alloc_name can now advance to next suitable diff -urNp -X dontdiff linux-2.5/net/core/Makefile linux-2.5-sysfs/net/core/Makefile --- linux-2.5/net/core/Makefile 2003-05-19 11:40:20.000000000 -0700 +++ linux-2.5-sysfs/net/core/Makefile 2003-05-19 12:52:54.000000000 -0700 @@ -10,7 +10,8 @@ obj-y += sysctl_net_core.o endif endif -obj-$(CONFIG_NET) += flow.o dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o +obj-$(CONFIG_NET) += flow.o dev.o net-sysfs.o dev_mcast.o dst.o neighbour.o \ + rtnetlink.o utils.o link_watch.o filter.o obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NET_DIVERT) += dv.o diff -urNp -X dontdiff linux-2.5/net/core/net-sysfs.c linux-2.5-sysfs/net/core/net-sysfs.c --- linux-2.5/net/core/net-sysfs.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5-sysfs/net/core/net-sysfs.c 2003-05-20 10:30:01.000000000 -0700 @@ -0,0 +1,344 @@ +/* + * net-sysfs.c - network device class and attributes + * + * Copyright (c) 2003 Stephen Hemminber + * + * + * TODO: + * last_tx + * last_rx + */ + +#include +#include +#include +#include +#include +#include + +const char *if_port_text[] = { + [IF_PORT_UNKNOWN] = "unknown", + [IF_PORT_10BASE2] = "BNC", + [IF_PORT_10BASET] = "10baseT", + [IF_PORT_AUI] = "AUI", + [IF_PORT_100BASET] = "100baseT", + [IF_PORT_100BASETX] = "100baseTX", + [IF_PORT_100BASEFX] = "100baseFX" +}; + +#define to_net_dev(class) container_of((class), struct net_device, class_dev) + +/* generate a show function for simple field */ +#define NETDEVICE_SHOW(field, format_string) \ +static ssize_t show_##field(struct class_device *dev, char *buf) \ +{ \ + return sprintf(buf, format_string, to_net_dev(dev)->field); \ +} + +/* generate a store function for a field with locking */ +#define NETDEVICE_STORE(field) \ +static ssize_t \ +store_##field(struct class_device *dev, const char *buf, size_t len) \ +{ \ + char *endp; \ + long new = simple_strtol(buf, &endp, 16); \ + \ + if (endp == buf || new < 0) \ + return -EINVAL; \ + \ + if (!capable(CAP_NET_ADMIN)) \ + return -EPERM; \ + \ + rtnl_lock(); \ + to_net_dev(dev)->field = new; \ + rtnl_unlock(); \ + return len; \ +} + +/* generate a read-only network device class attribute */ +#define NETDEVICE_ATTR(field, format_string) \ +NETDEVICE_SHOW(field, format_string) \ +static CLASS_DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) \ + +NETDEVICE_ATTR(addr_len, "%d\n"); +NETDEVICE_ATTR(iflink, "%d\n"); +NETDEVICE_ATTR(ifindex, "%d\n"); +NETDEVICE_ATTR(features, "%#x\n"); +NETDEVICE_ATTR(type, "%d\n"); + +/* TODO: only a few devices set this now should fix others. */ +static ssize_t show_port(struct class_device *dev, char *buf) +{ + unsigned char port = to_net_dev(dev)->if_port; + char *cp = buf; + + cp += sprintf(cp, "%d", port); + if (port < ARRAY_SIZE(if_port_text)) + cp += sprintf(cp, " (%s)", if_port_text[port]); + *cp++ ='\n'; + return cp - buf; +} +static CLASS_DEVICE_ATTR(if_port, S_IRUGO, show_port, NULL); + +static ssize_t format_addr(char *buf, const unsigned char *addr, int len) +{ + int i; + char *cp = buf; + + read_lock(&dev_base_lock); + for (i = 0; i < len; i++) + cp += sprintf(cp, "%02x%c", addr[i], + i == (len - 1) ? '\n' : ':'); + read_unlock(&dev_base_lock); + return cp - buf; +} + +static ssize_t show_address(struct class_device *dev, char *buf) +{ + struct net_device *net = to_net_dev(dev); + return format_addr(buf, net->dev_addr, net->addr_len); +} + +static ssize_t show_broadcast(struct class_device *dev, char *buf) +{ + struct net_device *net = to_net_dev(dev); + return format_addr(buf, net->broadcast, net->addr_len); +} + +static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL); +static CLASS_DEVICE_ATTR(broadcast, S_IRUGO, show_broadcast, NULL); + +/* read-write attributes */ +NETDEVICE_SHOW(mtu, "%d\n"); + +static ssize_t store_mtu(struct class_device *dev, const char *buf, size_t len) +{ + char *endp; + int new_mtu; + int err; + + new_mtu = simple_strtoul(buf, &endp, 10); + if (endp == buf) + return -EINVAL; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + rtnl_lock(); + err = dev_set_mtu(to_net_dev(dev), new_mtu); + rtnl_unlock(); + + return err == 0 ? len : err; +} + +static CLASS_DEVICE_ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu); + +NETDEVICE_SHOW(flags, "%#x\n"); + +static ssize_t store_flags(struct class_device *dev, const char *buf, size_t len) +{ + unsigned long new_flags; + char *endp; + int err = 0; + + new_flags = simple_strtoul(buf, &endp, 16); + if (endp == buf) + return -EINVAL; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + rtnl_lock(); + err = dev_change_flags(to_net_dev(dev), new_flags); + rtnl_unlock(); + + return err ? err : len; +} + +static CLASS_DEVICE_ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags); + +NETDEVICE_SHOW(tx_queue_len, "%lu\n"); +NETDEVICE_STORE(tx_queue_len); +static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, + store_tx_queue_len); + +static struct class net_class = { + .name = "net", +}; + + +static struct class_device_attribute *net_class_attributes[] = { + &class_device_attr_ifindex, + &class_device_attr_iflink, + &class_device_attr_addr_len, + &class_device_attr_tx_queue_len, + &class_device_attr_features, + &class_device_attr_mtu, + &class_device_attr_flags, + &class_device_attr_if_port, + &class_device_attr_type, + &class_device_attr_address, + &class_device_attr_broadcast, + NULL +}; + +struct netstat_fs_entry { + struct attribute attr; + ssize_t (*show)(const struct net_device_stats *, char *); + ssize_t (*store)(struct net_device_stats *, const char *, size_t); +}; + +static ssize_t net_device_stat_show(unsigned long var, char *buf) +{ + return sprintf(buf, "%ld\n", var); +} + +/* generate a read-only statistics attribute */ +#define NETDEVICE_STAT(_NAME) \ +static ssize_t show_stat_##_NAME(const struct net_device_stats *stats, \ + char *buf) \ +{ \ + return net_device_stat_show(stats->_NAME, buf); \ +} \ +static struct netstat_fs_entry net_stat_##_NAME = { \ + .attr = {.name = __stringify(_NAME), .mode = S_IRUGO }, \ + .show = show_stat_##_NAME, \ +} + +NETDEVICE_STAT(rx_packets); +NETDEVICE_STAT(tx_packets); +NETDEVICE_STAT(rx_bytes); +NETDEVICE_STAT(tx_bytes); +NETDEVICE_STAT(rx_errors); +NETDEVICE_STAT(tx_errors); +NETDEVICE_STAT(rx_dropped); +NETDEVICE_STAT(tx_dropped); +NETDEVICE_STAT(multicast); +NETDEVICE_STAT(collisions); +NETDEVICE_STAT(rx_length_errors); +NETDEVICE_STAT(rx_over_errors); +NETDEVICE_STAT(rx_crc_errors); +NETDEVICE_STAT(rx_frame_errors); +NETDEVICE_STAT(rx_fifo_errors); +NETDEVICE_STAT(rx_missed_errors); +NETDEVICE_STAT(tx_aborted_errors); +NETDEVICE_STAT(tx_carrier_errors); +NETDEVICE_STAT(tx_fifo_errors); +NETDEVICE_STAT(tx_heartbeat_errors); +NETDEVICE_STAT(tx_window_errors); +NETDEVICE_STAT(rx_compressed); +NETDEVICE_STAT(tx_compressed); + +static struct attribute *default_attrs[] = { + &net_stat_rx_packets.attr, + &net_stat_tx_packets.attr, + &net_stat_rx_bytes.attr, + &net_stat_tx_bytes.attr, + &net_stat_rx_errors.attr, + &net_stat_tx_errors.attr, + &net_stat_rx_dropped.attr, + &net_stat_tx_dropped.attr, + &net_stat_multicast.attr, + &net_stat_collisions.attr, + &net_stat_rx_length_errors.attr, + &net_stat_rx_over_errors.attr, + &net_stat_rx_crc_errors.attr, + &net_stat_rx_frame_errors.attr, + &net_stat_rx_fifo_errors.attr, + &net_stat_rx_missed_errors.attr, + &net_stat_tx_aborted_errors.attr, + &net_stat_tx_carrier_errors.attr, + &net_stat_tx_fifo_errors.attr, + &net_stat_tx_heartbeat_errors.attr, + &net_stat_tx_window_errors.attr, + &net_stat_rx_compressed.attr, + &net_stat_tx_compressed.attr, + NULL +}; + + +static ssize_t +netstat_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct netstat_fs_entry *entry + = container_of(attr, struct netstat_fs_entry, attr); + struct class_device *class_dev + = container_of(kobj->parent, struct class_device, kobj); + struct net_device *dev + = to_net_dev(class_dev); + struct net_device_stats *stats + = dev->get_stats ? dev->get_stats(dev) : NULL; + + if (stats && entry->show) + return entry->show(stats, buf); + return -EINVAL; +} + +static struct sysfs_ops netstat_sysfs_ops = { + .show = netstat_attr_show, +}; + +static struct kobj_type netstat_ktype = { + .sysfs_ops = &netstat_sysfs_ops, + .default_attrs = default_attrs, +}; + +/* Create sysfs entries for network device. */ +int netdev_register_sysfs(struct net_device *net) +{ + struct class_device *class_dev = &(net->class_dev); + int i; + struct class_device_attribute *attr; + int ret; + + memset(class_dev, 0, sizeof(struct class_device)); + class_dev->class = &net_class; + class_dev->dev = net->dev; + class_dev->class_data = net; + + snprintf(class_dev->class_id, BUS_ID_SIZE, net->name); + if ((ret = class_device_register(class_dev))) + goto out; + + for (i = 0; (attr = net_class_attributes[i]); i++) { + if ((ret = class_device_create_file(class_dev, attr))) + goto out_unreg; + } + + if (net->get_stats) { + struct kobject *k = &net->stats_kobj; + + memset(k, 0, sizeof(*k)); + k->parent = kobject_get(&class_dev->kobj); + if (!k->parent) { + ret = -EBUSY; + goto out_unreg; + } + + snprintf(k->name, KOBJ_NAME_LEN, "%s", "statistics"); + k->ktype = &netstat_ktype; + + if((ret = kobject_register(k))) + goto out_unreg; + } + +out: + return ret; +out_unreg: + printk(KERN_WARNING "%s: sysfs attribute registration failed %d\n", + net->name, ret); + class_device_unregister(class_dev); + goto out; +} + +void netdev_unregister_sysfs(struct net_device *net) +{ + if (net->get_stats) + kobject_del(&net->stats_kobj); + class_device_unregister(&net->class_dev); +} + +int netdev_sysfs_init(void) +{ + return class_register(&net_class); +} From shemminger@osdl.org Tue May 20 14:18:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 14:18:32 -0700 (PDT) Received: from mail.osdl.org ([208.186.192.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4KLIG2x029505 for ; Tue, 20 May 2003 14:18:17 -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 h4KLI3W16626; Tue, 20 May 2003 14:18:03 -0700 Date: Tue, 20 May 2003 14:18:03 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] Sysfs net device device link Message-Id: <20030520141803.09c75d5b.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2619 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev This is the second part of the net devices sysfs patch. It changes most network drivers to set the generic device entry up in the net device structure prior to registration. No functional changes from last version, just kept up to date with latest 2.5 bk tree (post 2.5.69) diff -urNp -X dontdiff linux-2.5/drivers/net/3c59x.c linux-2.5-sysfs/drivers/net/3c59x.c --- linux-2.5/drivers/net/3c59x.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/3c59x.c 2003-05-20 11:01:23.000000000 -0700 @@ -1115,6 +1115,7 @@ static int __devinit vortex_probe1(struc goto out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, gendev); vp = dev->priv; option = global_options; diff -urNp -X dontdiff linux-2.5/drivers/net/8139cp.c linux-2.5-sysfs/drivers/net/8139cp.c --- linux-2.5/drivers/net/8139cp.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/8139cp.c 2003-05-15 16:08:47.000000000 -0700 @@ -1801,6 +1801,8 @@ static int __devinit cp_init_one (struct if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + cp = dev->priv; cp->pdev = pdev; cp->board_type = board_type; diff -urNp -X dontdiff linux-2.5/drivers/net/8139too.c linux-2.5-sysfs/drivers/net/8139too.c --- linux-2.5/drivers/net/8139too.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/8139too.c 2003-05-20 11:01:23.000000000 -0700 @@ -768,6 +768,8 @@ static int __devinit rtl8139_init_board return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + tp = dev->priv; tp->pci_dev = pdev; diff -urNp -X dontdiff linux-2.5/drivers/net/acenic.c linux-2.5-sysfs/drivers/net/acenic.c --- linux-2.5/drivers/net/acenic.c 2003-05-09 09:33:37.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/acenic.c 2003-05-15 16:08:47.000000000 -0700 @@ -188,6 +188,9 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl) #define ACE_MOD_DEC_USE_COUNT do{} while(0) #endif +#ifndef SET_NETDEV_DEV +#define SET_NETDEV_DEV(net, pdev) do{} while(0) +#endif #if LINUX_VERSION_CODE >= 0x2051c #define ace_sync_irq(irq) synchronize_irq(irq) @@ -651,6 +654,7 @@ int __devinit acenic_probe (ACE_PROBE_AR } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (!dev->priv) dev->priv = kmalloc(sizeof(*ap), GFP_KERNEL); diff -urNp -X dontdiff linux-2.5/drivers/net/amd8111e.c linux-2.5-sysfs/drivers/net/amd8111e.c --- linux-2.5/drivers/net/amd8111e.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/amd8111e.c 2003-05-15 16:08:47.000000000 -0700 @@ -1542,6 +1542,7 @@ static int __devinit amd8111e_probe_one( } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); #if AMD8111E_VLAN_TAG_USED dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; diff -urNp -X dontdiff linux-2.5/drivers/net/defxx.c linux-2.5-sysfs/drivers/net/defxx.c --- linux-2.5/drivers/net/defxx.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/defxx.c 2003-05-15 16:08:47.000000000 -0700 @@ -443,6 +443,7 @@ static int __devinit dfx_init_one_pci_or } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); bp = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/dl2k.c linux-2.5-sysfs/drivers/net/dl2k.c --- linux-2.5/drivers/net/dl2k.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/dl2k.c 2003-05-15 16:08:47.000000000 -0700 @@ -154,6 +154,7 @@ rio_probe1 (struct pci_dev *pdev, const goto err_out_res; } SET_MODULE_OWNER (dev); + SET_NETDEV_DEV(dev, &pdev->dev); #ifdef MEM_MAPPING ioaddr = pci_resource_start (pdev, 1); diff -urNp -X dontdiff linux-2.5/drivers/net/e100/e100_main.c linux-2.5-sysfs/drivers/net/e100/e100_main.c --- linux-2.5/drivers/net/e100/e100_main.c 2003-04-21 08:58:19.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e100/e100_main.c 2003-05-15 16:08:48.000000000 -0700 @@ -591,6 +591,7 @@ e100_found1(struct pci_dev *pcid, const bdp->device = dev; pci_set_drvdata(pcid, dev); + SET_NETDEV_DEV(dev, &pcid->dev); if ((rc = e100_alloc_space(bdp)) != 0) { goto err_dev; diff -urNp -X dontdiff linux-2.5/drivers/net/e1000/e1000_main.c linux-2.5-sysfs/drivers/net/e1000/e1000_main.c --- linux-2.5/drivers/net/e1000/e1000_main.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e1000/e1000_main.c 2003-05-15 16:08:48.000000000 -0700 @@ -391,6 +391,7 @@ e1000_probe(struct pci_dev *pdev, goto err_alloc_etherdev; SET_MODULE_OWNER(netdev); + SET_NETDEV_DEV(netdev, &pdev->dev); pci_set_drvdata(pdev, netdev); adapter = netdev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/eepro100.c linux-2.5-sysfs/drivers/net/eepro100.c --- linux-2.5/drivers/net/eepro100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/eepro100.c 2003-05-15 16:08:47.000000000 -0700 @@ -678,6 +678,7 @@ static int __devinit speedo_found1(struc } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (dev->mem_start > 0) option = dev->mem_start; @@ -829,6 +830,7 @@ static int __devinit speedo_found1(struc pci_set_power_state(pdev, acpi_idle_state); pci_set_drvdata (pdev, dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/epic100.c linux-2.5-sysfs/drivers/net/epic100.c --- linux-2.5/drivers/net/epic100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/epic100.c 2003-05-15 16:08:47.000000000 -0700 @@ -409,6 +409,7 @@ static int __devinit epic_init_one (stru return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_free_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/fealnx.c linux-2.5-sysfs/drivers/net/fealnx.c --- linux-2.5/drivers/net/fealnx.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/fealnx.c 2003-05-15 16:08:47.000000000 -0700 @@ -539,6 +539,7 @@ static int __devinit fealnx_init_one(str goto err_out_unmap; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); /* read ethernet id */ for (i = 0; i < 6; ++i) diff -urNp -X dontdiff linux-2.5/drivers/net/hamachi.c linux-2.5-sysfs/drivers/net/hamachi.c --- linux-2.5/drivers/net/hamachi.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/hamachi.c 2003-05-15 16:08:47.000000000 -0700 @@ -613,6 +613,7 @@ static int __init hamachi_init_one (stru goto err_out_iounmap; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); #ifdef TX_CHECKSUM printk("check that skbcopy in ip_queue_xmit isn't happening\n"); diff -urNp -X dontdiff linux-2.5/drivers/net/hp100.c linux-2.5-sysfs/drivers/net/hp100.c --- linux-2.5/drivers/net/hp100.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/hp100.c 2003-05-15 16:08:47.000000000 -0700 @@ -776,6 +776,7 @@ static int __init hp100_probe1(struct ne hp100_clear_stats(lp, ioaddr); SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pci_dev->dev); ether_setup(dev); /* If busmaster mode is wanted, a dma-capable memory area is needed for diff -urNp -X dontdiff linux-2.5/drivers/net/ioc3-eth.c linux-2.5-sysfs/drivers/net/ioc3-eth.c --- linux-2.5/drivers/net/ioc3-eth.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ioc3-eth.c 2003-05-15 16:08:47.000000000 -0700 @@ -1532,6 +1532,8 @@ static int __devinit ioc3_probe(struct p goto out_free; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + ip = dev->priv; ip->dev = dev; diff -urNp -X dontdiff linux-2.5/drivers/net/ixgb/ixgb_main.c linux-2.5-sysfs/drivers/net/ixgb/ixgb_main.c --- linux-2.5/drivers/net/ixgb/ixgb_main.c 2003-04-29 10:17:00.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ixgb/ixgb_main.c 2003-05-15 16:08:49.000000000 -0700 @@ -333,6 +333,7 @@ ixgb_probe(struct pci_dev *pdev, const s } SET_MODULE_OWNER(netdev); + SET_NETDEV_DEV(netdev, &pdev->dev); pci_set_drvdata(pdev, netdev); adapter = netdev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/natsemi.c linux-2.5-sysfs/drivers/net/natsemi.c --- linux-2.5/drivers/net/natsemi.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/natsemi.c 2003-05-20 11:01:23.000000000 -0700 @@ -762,6 +762,7 @@ static int __devinit natsemi_probe1 (str if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); i = pci_request_regions(pdev, dev->name); if (i) { diff -urNp -X dontdiff linux-2.5/drivers/net/ne2k-pci.c linux-2.5-sysfs/drivers/net/ne2k-pci.c --- linux-2.5/drivers/net/ne2k-pci.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ne2k-pci.c 2003-05-15 16:08:47.000000000 -0700 @@ -265,6 +265,7 @@ static int __devinit ne2k_pci_init_one ( goto err_out_free_res; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); /* Reset card. Who knows what dain-bramaged state it was left in. */ { diff -urNp -X dontdiff linux-2.5/drivers/net/ns83820.c linux-2.5-sysfs/drivers/net/ns83820.c --- linux-2.5/drivers/net/ns83820.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/ns83820.c 2003-05-20 13:47:52.000000000 -0700 @@ -1788,7 +1788,8 @@ static int __devinit ns83820_init_one(st dev->ee.cache = &dev->MEAR_cache; dev->ee.lock = &dev->misc_lock; - dev->net_dev.owner = THIS_MODULE; + SET_MODULE_OWNER(dev->net_dev); + SET_NETDEV_DEV(dev->net_dev, &pcid->dev); dev->net_dev.priv = dev; INIT_WORK(&dev->tq_refill, queue_refill, dev); diff -urNp -X dontdiff linux-2.5/drivers/net/pci-skeleton.c linux-2.5-sysfs/drivers/net/pci-skeleton.c --- linux-2.5/drivers/net/pci-skeleton.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/pci-skeleton.c 2003-05-15 16:08:47.000000000 -0700 @@ -610,6 +610,7 @@ static int __devinit netdrv_init_board ( return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); tp = dev->priv; /* enable device (incl. PCI PM wakeup), and bus-mastering */ diff -urNp -X dontdiff linux-2.5/drivers/net/pcnet32.c linux-2.5-sysfs/drivers/net/pcnet32.c --- linux-2.5/drivers/net/pcnet32.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/pcnet32.c 2003-05-15 16:08:47.000000000 -0700 @@ -638,6 +638,7 @@ pcnet32_probe1(unsigned long ioaddr, uns release_region(ioaddr, PCNET32_TOTAL_SIZE); return -ENOMEM; } + SET_NETDEV_DEV(dev, &pdev->dev); printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); @@ -718,6 +719,7 @@ pcnet32_probe1(unsigned long ioaddr, uns spin_lock_init(&lp->lock); SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->priv = lp; lp->name = chipname; lp->shared_irq = shared; diff -urNp -X dontdiff linux-2.5/drivers/net/r8169.c linux-2.5-sysfs/drivers/net/r8169.c --- linux-2.5/drivers/net/r8169.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/r8169.c 2003-05-15 16:08:47.000000000 -0700 @@ -373,6 +373,7 @@ rtl8169_init_board(struct pci_dev *pdev, } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); tp = dev->priv; // enable device (incl. PCI PM wakeup and hotplug setup) diff -urNp -X dontdiff linux-2.5/drivers/net/rcpci45.c linux-2.5-sysfs/drivers/net/rcpci45.c --- linux-2.5/drivers/net/rcpci45.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/rcpci45.c 2003-05-15 16:08:47.000000000 -0700 @@ -179,6 +179,7 @@ rcpci45_init_one (struct pci_dev *pdev, goto err_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); error = pci_enable_device (pdev); if (error) { diff -urNp -X dontdiff linux-2.5/drivers/net/rrunner.c linux-2.5-sysfs/drivers/net/rrunner.c --- linux-2.5/drivers/net/rrunner.c 2003-04-29 09:57:40.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/rrunner.c 2003-05-15 16:08:47.000000000 -0700 @@ -114,6 +114,7 @@ static int __devinit rr_init_one(struct rrpriv = (struct rr_private *)dev->priv; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, "rrunner")) { ret = -EIO; diff -urNp -X dontdiff linux-2.5/drivers/net/sb1000.c linux-2.5-sysfs/drivers/net/sb1000.c --- linux-2.5/drivers/net/sb1000.c 2003-05-16 11:09:33.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sb1000.c 2003-05-16 11:40:37.000000000 -0700 @@ -190,6 +190,7 @@ sb1000_probe_one(struct pnp_dev *pdev, c dev->flags = IFF_POINTOPOINT|IFF_NOARP; SET_MODULE_OWNER(dev); + set_netdev_dev(dev, &pdev->dev); if (sb1000_debug > 0) printk(KERN_NOTICE "%s", version); diff -urNp -X dontdiff linux-2.5/drivers/net/sis900.c linux-2.5-sysfs/drivers/net/sis900.c --- linux-2.5/drivers/net/sis900.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sis900.c 2003-05-15 16:08:47.000000000 -0700 @@ -397,6 +397,7 @@ static int __devinit sis900_probe (struc if (!net_dev) return -ENOMEM; SET_MODULE_OWNER(net_dev); + SET_NETDEV_DEV(net_dev, &pci_dev->dev); /* We do a request_region() to register /proc/ioports info. */ ioaddr = pci_resource_start(pci_dev, 0); diff -urNp -X dontdiff linux-2.5/drivers/net/sk98lin/skge.c linux-2.5-sysfs/drivers/net/sk98lin/skge.c --- linux-2.5/drivers/net/sk98lin/skge.c 2003-05-09 09:33:37.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sk98lin/skge.c 2003-05-15 16:08:49.000000000 -0700 @@ -460,6 +460,7 @@ static int __init skge_probe (void) dev->irq = pdev->irq; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = &SkGeOpen; dev->stop = &SkGeClose; dev->hard_start_xmit = &SkGeXmit; diff -urNp -X dontdiff linux-2.5/drivers/net/smc-mca.c linux-2.5-sysfs/drivers/net/smc-mca.c --- linux-2.5/drivers/net/smc-mca.c 2003-04-14 13:32:01.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/smc-mca.c 2003-05-15 16:08:47.000000000 -0700 @@ -207,6 +207,7 @@ int __init ultramca_probe(struct device return -ENODEV; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, gen_dev); if((i = register_netdev(dev)) != 0) return i; diff -urNp -X dontdiff linux-2.5/drivers/net/starfire.c linux-2.5-sysfs/drivers/net/starfire.c --- linux-2.5/drivers/net/starfire.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/starfire.c 2003-05-15 16:08:47.000000000 -0700 @@ -876,6 +876,7 @@ static int __devinit starfire_init_one(s return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/sundance.c linux-2.5-sysfs/drivers/net/sundance.c --- linux-2.5/drivers/net/sundance.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sundance.c 2003-05-15 16:08:47.000000000 -0700 @@ -548,6 +548,7 @@ static int __devinit sundance_probe1 (st if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/sungem.c linux-2.5-sysfs/drivers/net/sungem.c --- linux-2.5/drivers/net/sungem.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sungem.c 2003-05-20 11:01:23.000000000 -0700 @@ -2703,6 +2703,7 @@ static int __devinit gem_init_one(struct return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); gp = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/sunhme.c linux-2.5-sysfs/drivers/net/sunhme.c --- linux-2.5/drivers/net/sunhme.c 2003-05-19 11:40:20.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/sunhme.c 2003-05-19 12:52:54.000000000 -0700 @@ -3025,6 +3025,7 @@ static int __init happy_meal_pci_init(st if (!dev) goto err_out; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (hme_version_printed++ == 0) printk(KERN_INFO "%s", version); diff -urNp -X dontdiff linux-2.5/drivers/net/tg3.c linux-2.5-sysfs/drivers/net/tg3.c --- linux-2.5/drivers/net/tg3.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tg3.c 2003-05-15 16:08:47.000000000 -0700 @@ -6764,6 +6764,7 @@ static int __devinit tg3_init_one(struct } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_using_dac) dev->features |= NETIF_F_HIGHDMA; diff -urNp -X dontdiff linux-2.5/drivers/net/tlan.c linux-2.5-sysfs/drivers/net/tlan.c --- linux-2.5/drivers/net/tlan.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tlan.c 2003-05-15 16:08:47.000000000 -0700 @@ -521,6 +521,7 @@ static int __devinit TLan_probe1(struct return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); priv = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/de2104x.c linux-2.5-sysfs/drivers/net/tulip/de2104x.c --- linux-2.5/drivers/net/tulip/de2104x.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/de2104x.c 2003-05-20 11:01:23.000000000 -0700 @@ -2006,6 +2006,7 @@ static int __init de_init_one (struct pc return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = de_open; dev->stop = de_close; dev->set_multicast_list = de_set_rx_mode; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/de4x5.c linux-2.5-sysfs/drivers/net/tulip/de4x5.c --- linux-2.5/drivers/net/tulip/de4x5.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/de4x5.c 2003-05-15 16:08:50.000000000 -0700 @@ -1350,6 +1350,7 @@ de4x5_hw_init(struct net_device *dev, u_ /* The DE4X5-specific entries in the device structure. */ SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->open = &de4x5_open; dev->hard_start_xmit = &de4x5_queue_pkt; dev->stop = &de4x5_close; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/dmfe.c linux-2.5-sysfs/drivers/net/tulip/dmfe.c --- linux-2.5/drivers/net/tulip/dmfe.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/dmfe.c 2003-05-15 16:08:50.000000000 -0700 @@ -348,6 +348,7 @@ static int __devinit dmfe_init_one (stru if (dev == NULL) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_set_dma_mask(pdev, 0xffffffff)) { printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/tulip_core.c linux-2.5-sysfs/drivers/net/tulip/tulip_core.c --- linux-2.5/drivers/net/tulip/tulip_core.c 2003-05-12 09:35:52.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/tulip_core.c 2003-05-15 16:08:50.000000000 -0700 @@ -1360,6 +1360,7 @@ static int __devinit tulip_init_one (str } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { printk (KERN_ERR PFX "%s: I/O region (0x%lx@0x%lx) too small, " "aborting\n", pdev->slot_name, diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/winbond-840.c linux-2.5-sysfs/drivers/net/tulip/winbond-840.c --- linux-2.5/drivers/net/tulip/winbond-840.c 2003-05-20 10:52:47.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/winbond-840.c 2003-05-20 11:01:23.000000000 -0700 @@ -423,6 +423,7 @@ static int __devinit w840_probe1 (struct if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, DRV_NAME)) goto err_out_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/xircom_cb.c linux-2.5-sysfs/drivers/net/tulip/xircom_cb.c --- linux-2.5/drivers/net/tulip/xircom_cb.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/xircom_cb.c 2003-05-15 16:08:50.000000000 -0700 @@ -276,6 +276,7 @@ static int __devinit xircom_probe(struct return -ENODEV; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq); private->dev = dev; diff -urNp -X dontdiff linux-2.5/drivers/net/tulip/xircom_tulip_cb.c linux-2.5-sysfs/drivers/net/tulip/xircom_tulip_cb.c --- linux-2.5/drivers/net/tulip/xircom_tulip_cb.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/tulip/xircom_tulip_cb.c 2003-05-15 16:08:50.000000000 -0700 @@ -560,6 +560,7 @@ static int __devinit xircom_init_one(str return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); dev->base_addr = ioaddr; dev->irq = pdev->irq; diff -urNp -X dontdiff linux-2.5/drivers/net/typhoon.c linux-2.5-sysfs/drivers/net/typhoon.c --- linux-2.5/drivers/net/typhoon.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/typhoon.c 2003-05-15 16:08:47.000000000 -0700 @@ -2266,6 +2266,7 @@ typhoon_init_one(struct pci_dev *pdev, c goto error_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); err = pci_enable_device(pdev); if(err < 0) { diff -urNp -X dontdiff linux-2.5/drivers/net/via-rhine.c linux-2.5-sysfs/drivers/net/via-rhine.c --- linux-2.5/drivers/net/via-rhine.c 2003-04-26 21:10:38.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/via-rhine.c 2003-05-15 16:08:47.000000000 -0700 @@ -660,6 +660,7 @@ static int __devinit via_rhine_init_one goto err_out; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); if (pci_request_regions(pdev, shortname)) goto err_out_free_netdev; diff -urNp -X dontdiff linux-2.5/drivers/net/yellowfin.c linux-2.5-sysfs/drivers/net/yellowfin.c --- linux-2.5/drivers/net/yellowfin.c 2003-04-24 16:02:05.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/yellowfin.c 2003-05-15 16:08:47.000000000 -0700 @@ -444,6 +444,7 @@ static int __devinit yellowfin_init_one( return -ENOMEM; } SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); np = dev->priv; diff -urNp -X dontdiff linux-2.5/drivers/usb/net/usbnet.c linux-2.5-sysfs/drivers/usb/net/usbnet.c --- linux-2.5/drivers/usb/net/usbnet.c 2003-05-01 11:19:59.000000000 -0700 +++ linux-2.5-sysfs/drivers/usb/net/usbnet.c 2003-05-15 16:08:57.000000000 -0700 @@ -2597,7 +2597,8 @@ usbnet_probe (struct usb_interface *udev return status; } dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); - + + SET_NETDEV_DEV(&dev->net, &dev->udev->dev); register_netdev (&dev->net); devinfo (dev, "register usbnet at usb-%s-%s, %s", xdev->bus->bus_name, xdev->devpath, From sim@peace.netnation.com Tue May 20 17:09:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 17:10:12 -0700 (PDT) Received: from peace.netnation.com (newpeace.netnation.com [204.174.223.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L09a2x014189 for ; Tue, 20 May 2003 17:09:37 -0700 Received: from sim by peace.netnation.com with local (Exim 4.20) id 19IHAm-0005ku-6L; Tue, 20 May 2003 17:09:36 -0700 Date: Tue, 20 May 2003 17:09:36 -0700 From: Simon Kirby To: "David S. Miller" Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress Message-ID: <20030521000936.GA19077@netnation.com> References: <20030519154852.I39024@shell.cyberus.ca> <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030519.181405.35017608.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 2620 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sim@netnation.com Precedence: bulk X-list: netdev On Mon, May 19, 2003 at 06:14:05PM -0700, David S. Miller wrote: > I bet you have been, the weakness in the hash has been very well > publicized and the script kiddies aren't using the truly random > version of the attacks anymore. Just google for juno-z.101f.c, this > (or some derivative) is the DoS people attack program are actually > using. Hmm, I see no difference. I've been using juno-z.101f.c to spam a test box (PIII 800 Mhz, 3C996B/BCM5701), and the box easily chokes when I hit it with my pimpin' 466 MHz Celery (running at 542 MHz) with an eepro100. NAPI is definitely impressive, though. When hitting it with my "udpspam" program which doesn't quite saturate the CPU (and doesn't spoof the source), it does about 80k interrupts/sec and behaves normally. When I run "juno" on it, eth0 interrupts stop entirely and it works nicely in polling mode. Userspace still works on the console, but remote SSH is a bit dodgy because it still drops about half of the rx packets due to CPU saturation. Juno reports sending 4,272,266 bytes/second, which is 34,178,128 bits/second. It's rather difficult to follow, but I don't see any "h4r h4r, expl0it th3 L1nux h4sh" comments or anything in the code that seems to attempt to exploit the hash algorithms in (older) Linux. It seems to be using very crappy psuedo-random code to generate source IPs. Perhaps another variant actually attempts to exploit the hash. Once I figure out a good way of getting near but not quite saturation, I will attempt to compare -rc1 and -rc2 to see if the (crappy) random source handling capacity has increased at all. Simon- From davem@redhat.com Tue May 20 17:15:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 17:15:56 -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.9) with SMTP id h4L0FN2x014816 for ; Tue, 20 May 2003 17:15:23 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA09855; Tue, 20 May 2003 17:13:59 -0700 Date: Tue, 20 May 2003 17:13:58 -0700 (PDT) Message-Id: <20030520.171358.28794219.davem@redhat.com> To: sim@netnation.com Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030521000936.GA19077@netnation.com> References: <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> <20030521000936.GA19077@netnation.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2621 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 From: Simon Kirby Date: Tue, 20 May 2003 17:09:36 -0700 It's rather difficult to follow, but I don't see any "h4r h4r, expl0it th3 L1nux h4sh" comments or anything in the code that seems to attempt to exploit the hash algorithms in (older) Linux. Look at the vc[] table and how it uses this in rndip(). From davem@redhat.com Tue May 20 17:37:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 17:38: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.9) with SMTP id h4L0bW2x016427 for ; Tue, 20 May 2003 17:37:35 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA09921; Tue, 20 May 2003 17:36:08 -0700 Date: Tue, 20 May 2003 17:36:07 -0700 (PDT) Message-Id: <20030520.173607.88482742.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030520074848.U40843@shell.cyberus.ca> References: <20030519220409.V39658@shell.cyberus.ca> <20030519.234624.123976229.davem@redhat.com> <20030520074848.U40843@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2622 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 From: Jamal Hadi Date: Tue, 20 May 2003 08:04:00 -0400 (EDT) Note: It may make sense that we have options to totaly remove the cache lookups if necessary - noone has proved a need for it at this point. There is a need, thinking otherwise is quite a narrow viewpoint :-) Let me explain. Forward looking, Alexey and myself plan to extend the per-cpu flow cache we designed for IPSEC policy lookups to apply to routing and socket lookup. There are two reasons to make this: 1) Per-cpu'ness. 2) Input route lookup turns into a "flow" lookup and thus may give you a TCP socket, for example. It is the most exciting part of this work. It can even be applied to netfilter entries. It really is the grand unified theory of flow handling :-) You can look to net/core/flow.c, it is the initial prototype and it is working and being used already for IPSEC policies. There are only minor adjustments necessary before we can begin trying to apply it to other things, but Alexey and myself know how to make them. So the real argument: Eliminating sourced based keying of input routes is a flawed idea. Firstly, independant of POLICY based routing (which is what it was originally made for) being able to block by source address on input is a useful feature. Secondly, if one must make "fib_validate_source()" on each input packet, it destroys all the posibility to make per-cpu flow caching a reality. This is because fib_validate_source() must walk the inetdev list and thus grab a shared SMP lock. Note that any attempt to remove source based keying of routing cache entries on input (or eliminating the cache entirely) has this problem. It also becomes quite cumbersome to move all of this logic over to ip_input() or similar. And because it will always use a shared SMP lock it is guarenteed to be slower than the cache especially for well-behaved flows. So keep in mind that not all traffic is DoS :-) (As a side note, and interesting area of discourse would be to see if DoS traffic can be somehow patternized, either explicitly in the kernel or via descriptions from the user. People do this today via netfilter, but I feel we might be able to do something more powerful at the flow caching level, ie. do not build cache entries for things looking like unary-packet DoS flow) None of this means that slowpath should not be improved if necessary. On the contrary, I would welcome good kernel profiling output from someone such as sim@netnation during such stress tests. From davem@redhat.com Tue May 20 17:57:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 17:58:00 -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.9) with SMTP id h4L0vo2x017913 for ; Tue, 20 May 2003 17:57:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA09982; Tue, 20 May 2003 17:55:53 -0700 Date: Tue, 20 May 2003 17:55:53 -0700 (PDT) Message-Id: <20030520.175553.35669773.davem@redhat.com> To: rmk@arm.linux.org.uk CC: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: Mail delivery failed: returning message to sender From: "David S. Miller" In-Reply-To: <20030521012148.P10585@flint.arm.linux.org.uk> References: <20030521012148.P10585@flint.arm.linux.org.uk> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2623 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 From: Russell King Date: Wed, 21 May 2003 01:21:48 +0100 fragheaderlen 20 maxfraglen 1802201956 mtu 1802201963 fragheaderlen 20 maxfraglen 1802201956 mtu 1802201963 The 1802201956 number is rather interesting. It's 0x6b6b6b6b, which seems to be the slab poison-after. Russel, thanks for the report. Alexey, when IP redirect happens during UDP sendfile, all things go to shit. These messages above were generated by a printk in ip_append_data() right after maxfraglen is computed. I STRONGLY suspect the *rt = *rth assignment in route.c:ip_rt_redirect(). In particular this results in rt->u.dst.path pointing to the old &rth->u.dst, oops. Russel, please retest using this patch. This piece of code needs to be audited further. --- net/ipv4/route.c.~1~ Tue May 20 17:53:55 2003 +++ net/ipv4/route.c Tue May 20 17:54:12 2003 @@ -964,6 +964,7 @@ rt->u.dst.neighbour = NULL; rt->u.dst.hh = NULL; rt->u.dst.obsolete = 0; + rt->u.dst.path = &rt->u.dst; rt->rt_flags |= RTCF_REDIRECTED; From davem@redhat.com Tue May 20 18:57:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 18:57: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.9) with SMTP id h4L1vr2x021607 for ; Tue, 20 May 2003 18:57:54 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA10132; Tue, 20 May 2003 18:56:29 -0700 Date: Tue, 20 May 2003 18:56:28 -0700 (PDT) Message-Id: <20030520.185628.116357405.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] clean up the divert ifdef mess From: "David S. Miller" In-Reply-To: <20030520173044.A21103@lst.de> References: <20030520173044.A21103@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2624 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 From: Christoph Hellwig Date: Tue, 20 May 2003 17:30:44 +0200 With some stubs in divert.h this looks a lot nicer. Compile-tested with and without CONFIG_NET_DIVERT. Applied, thanks. From davem@redhat.com Tue May 20 19:02:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:02: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.9) with SMTP id h4L22U2x022180 for ; Tue, 20 May 2003 19:02:30 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA10159; Tue, 20 May 2003 19:01:07 -0700 Date: Tue, 20 May 2003 19:01:06 -0700 (PDT) Message-Id: <20030520.190106.68043856.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69++] fixup for latest netdev change. From: "David S. Miller" In-Reply-To: <20030520112355.6d40d98b.shemminger@osdl.org> References: <20030520050238.D5BEF2C208@lists.samba.org> <20030519.232133.45877480.davem@redhat.com> <20030520112355.6d40d98b.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2625 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 From: Stephen Hemminger Date: Tue, 20 May 2003 11:23:55 -0700 One driver was setting owner directly, so won't build now. This should fix it. Applied, thanks. From kuznet@ms2.inr.ac.ru Tue May 20 19:22:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:22:38 -0700 (PDT) Received: from dub.inr.ac.ru (dub.inr.ac.ru [193.233.7.105]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L2MS2x023110 for ; Tue, 20 May 2003 19:22:29 -0700 Received: (from kuznet@localhost) by dub.inr.ac.ru (8.6.13/ANK) id GAA13659; Wed, 21 May 2003 06:22:10 +0400 From: kuznet@ms2.inr.ac.ru Message-Id: <200305210222.GAA13659@dub.inr.ac.ru> Subject: Re: Mail delivery failed: returning message to sender To: davem@redhat.com (David S. Miller) Date: Wed, 21 May 2003 06:22:10 +0400 (MSD) Cc: rmk@arm.linux.org.uk, netdev@oss.sgi.com In-Reply-To: <20030520.175553.35669773.davem@redhat.com> from "David S. Miller" at May 20, 2003 05:55:53 PM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2626 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > I STRONGLY suspect the *rt = *rth assignment in > route.c:ip_rt_redirect(). In particular this results in > rt->u.dst.path pointing to the old &rth->u.dst, oops. Oops, indeed. > Russel, please retest using this patch. This piece of > code needs to be audited further. Relax, it is right now. I hope it is the only place where route is copied as whole. Alexey From kuznet@ms2.inr.ac.ru Tue May 20 19:26:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:26:31 -0700 (PDT) Received: from dub.inr.ac.ru (dub.inr.ac.ru [193.233.7.105]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L2QN2x023437 for ; Tue, 20 May 2003 19:26:25 -0700 Received: (from kuznet@localhost) by dub.inr.ac.ru (8.6.13/ANK) id GAA13667; Wed, 21 May 2003 06:26:15 +0400 From: kuznet@ms2.inr.ac.ru Message-Id: <200305210226.GAA13667@dub.inr.ac.ru> Subject: Re: Patch for NETLINK_TCPDIAG To: kumarkr@us.ibm.com (Krishna Kumar) Date: Wed, 21 May 2003 06:26:15 +0400 (MSD) Cc: davem@redhat.com, netdev@oss.sgi.com, linux-net@vger.kernel.org In-Reply-To: from "Krishna Kumar" at May 20, 2003 11:49:43 AM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2627 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kuznet@ms2.inr.ac.ru Precedence: bulk X-list: netdev Hello! > I am not sure if there is a reason why ACK cannot be set for > NETLINK_TCPDIAG. No reasons, indeed. > If it is settable, please apply following patch. OK. > diff -ruN linux-2.5.68.org/net/ipv4/tcp_diag.c linux-2.5.68/net/ipv4/tcp_diag.c > --- linux-2.5.68.org/net/ipv4/tcp_diag.c 2003-05-20 11:38:06.000000000 -0700 > +++ linux-2.5.68/net/ipv4/tcp_diag.c 2003-05-20 11:39:48.000000000 -0700 > @@ -609,7 +609,7 @@ > if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) > return; > err = tcpdiag_rcv_msg(skb, nlh); > - if (err) > + if (err || nlh->nlmsg_flags & NLM_F_ACK) > netlink_ack(skb, nlh, err); > } > } > From davem@redhat.com Tue May 20 19:33:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:33:21 -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.9) with SMTP id h4L2XH2x023965 for ; Tue, 20 May 2003 19:33:17 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA10226; Tue, 20 May 2003 19:31:19 -0700 Date: Tue, 20 May 2003 19:31:19 -0700 (PDT) Message-Id: <20030520.193119.55733737.davem@redhat.com> To: kuznet@ms2.inr.ac.ru Cc: rmk@arm.linux.org.uk, netdev@oss.sgi.com Subject: Re: Mail delivery failed: returning message to sender From: "David S. Miller" In-Reply-To: <200305210222.GAA13659@dub.inr.ac.ru> References: <20030520.175553.35669773.davem@redhat.com> <200305210222.GAA13659@dub.inr.ac.ru> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2628 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 From: kuznet@ms2.inr.ac.ru Date: Wed, 21 May 2003 06:22:10 +0400 (MSD) > Russel, please retest using this patch. This piece of > code needs to be audited further. Relax, it is right now. I hope it is the only place where route is copied as whole. I explicitly zeroed out child and xfrm in my final version. These should never be non-NULL, it is pure paranoia on my part :-) IP6 makes this more intelligently using ip6_route_copy() function. We should probably make similar beast for ipv4 just for clarity's sake. From davem@redhat.com Tue May 20 19:35:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:35: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.9) with SMTP id h4L2Z72x024423 for ; Tue, 20 May 2003 19:35:07 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA10239; Tue, 20 May 2003 19:33:12 -0700 Date: Tue, 20 May 2003 19:33:12 -0700 (PDT) Message-Id: <20030520.193312.10304523.davem@redhat.com> To: kumarkr@us.ibm.com Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Patch for NETLINK_TCPDIAG From: "David S. Miller" In-Reply-To: References: X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2629 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 From: Krishna Kumar Date: Tue, 20 May 2003 11:49:43 -0700 I am not sure if there is a reason why ACK cannot be set for NETLINK_TCPDIAG. If it is settable, please apply following patch. Your patch does not apply, Lotus NOTES changes tabs into spaces making the patch unusable. I've added the fix by hand... but please be mindful of this in the future. From davem@redhat.com Tue May 20 19:44:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 19:44: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.9) with SMTP id h4L2i82x025285 for ; Tue, 20 May 2003 19:44:08 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA10288; Tue, 20 May 2003 19:42:44 -0700 Date: Tue, 20 May 2003 19:42:43 -0700 (PDT) Message-Id: <20030520.194243.68152249.davem@redhat.com> To: Robert.Olsson@data.slu.se Cc: netdev@oss.sgi.com Subject: Re: Route hash code comparison From: "David S. Miller" In-Reply-To: <16074.21513.492796.943255@robur.slu.se> References: <16074.21513.492796.943255@robur.slu.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2630 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 From: Robert Olsson Date: Tue, 20 May 2003 18:12:57 +0200 The new hash have random keys but seems to be pretty consistent in term of hashing at least from observerations. No DoS experiments done. Thank you for posting these test results Robert. From davem@redhat.com Tue May 20 20:05:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 20 May 2003 20:05: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.9) with SMTP id h4L3552x026692 for ; Tue, 20 May 2003 20:05:05 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA10345; Tue, 20 May 2003 20:03:39 -0700 Date: Tue, 20 May 2003 20:03:38 -0700 (PDT) Message-Id: <20030520.200338.77050981.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH] Sysfs net device device link From: "David S. Miller" In-Reply-To: <20030520141803.09c75d5b.shemminger@osdl.org> References: <20030520141803.09c75d5b.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2631 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 From: Stephen Hemminger Date: Tue, 20 May 2003 14:18:03 -0700 This is the second part of the net devices sysfs patch. It changes most network drivers to set the generic device entry up in the net device structure prior to registration. I've applied both of your patches, thanks. I did have to fix up two things though: 1) One driver used lower-case set_netdev_dev(), easy to fix. 2) Patch conflict with ns83820.c SET_MODULE_OWNER() fix you also sent me today, also easily resolved. Thanks again. From hch@verein.lst.de Wed May 21 01:11:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 01:12:06 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L8BR2x012070 for ; Wed, 21 May 2003 01:11:28 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4L8BQ730262 for netdev@oss.sgi.com; Wed, 21 May 2003 10:11:26 +0200 Date: Wed, 21 May 2003 10:11:26 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] switch sdla to initcalls Message-ID: <20030521101126.A30197@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2632 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 Wow, on driver that had it's dirt fingers in both Space.c and setup.c :) --- 1.20/drivers/net/Space.c Wed May 21 03:56:26 2003 +++ edited/drivers/net/Space.c Tue May 20 11:50:12 2003 @@ -453,17 +453,6 @@ #define NEXT_DEV (&tap0_dev) #endif -#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) -#endif - #if defined(CONFIG_LTPC) extern int ltpc_probe(struct net_device *); static struct net_device dev_ltpc = { --- 1.11/drivers/net/setup.c Tue May 20 08:57:38 2003 +++ edited/drivers/net/setup.c Tue May 20 11:56:00 2003 @@ -14,8 +14,6 @@ extern int arcnet_init(void); extern int scc_enet_init(void); extern int fec_enet_init(void); -extern int sdla_setup(void); -extern int sdla_c_setup(void); extern int lmc_setup(void); extern int madgemc_probe(void); @@ -39,9 +37,6 @@ #if defined(CONFIG_DMASCC) {dmascc_init, 0}, #endif -#if defined(CONFIG_SDLA) - {sdla_c_setup, 0}, -#endif #if defined(CONFIG_ARCNET) {arcnet_init, 0}, #endif --- 1.10/drivers/net/wan/sdla.c Sun May 18 17:18:07 2003 +++ edited/drivers/net/wan/sdla.c Tue May 20 11:52:15 2003 @@ -1655,32 +1655,25 @@ return(0); } -int __init sdla_c_setup(void) -{ - printk("%s.\n", version); - register_frad(devname); - return 0; -} - -#ifdef MODULE static struct net_device sdla0 = { .name = "sdla0", .init = sdla_init }; -MODULE_LICENSE("GPL"); -int init_module(void) +static int __init init_sdla(void) { int result; - sdla_c_setup(); + printk("%s.\n", version); + register_frad(devname); + if ((result = register_netdev(&sdla0)) != 0) return result; return 0; } -void cleanup_module(void) +static void __exit exit_sdla(void) { unregister_netdev(&sdla0); if (sdla0.priv) @@ -1688,4 +1681,8 @@ if (sdla0.irq) free_irq(sdla0.irq, &sdla0); } -#endif /* MODULE */ + +MODULE_LICENSE("GPL"); + +module_init(init_sdla); +module_exit(exit_sdla); From ak@suse.de Wed May 21 01:19:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 01:20:20 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L8Ji2x012645 for ; Wed, 21 May 2003 01:19:45 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 4F97314D36; Wed, 21 May 2003 10:19:39 +0200 (MEST) Date: Wed, 21 May 2003 10:19:39 +0200 From: Andi Kleen To: Christoph Hellwig Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls Message-ID: <20030521081938.GD22869@wotan.suse.de> References: <20030521101126.A30197@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521101126.A30197@lst.de> X-archive-position: 2633 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 Wed, May 21, 2003 at 10:11:26AM +0200, Christoph Hellwig wrote: > Wow, on driver that had it's dirt fingers in both Space.c and setup.c :) Are you sure this won't change probe order? The normal reason to keep calls in Space.c is that they're ISA or other non discoverable devices and require a specific ISA probe order, otherwise bad things happen at boot. The card appears to be non PCI. -Andi From hch@verein.lst.de Wed May 21 01:25:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 01:25:49 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L8PD2x013169 for ; Wed, 21 May 2003 01:25:14 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4L8PCZ30391; Wed, 21 May 2003 10:25:12 +0200 Date: Wed, 21 May 2003 10:25:12 +0200 From: Christoph Hellwig To: Andi Kleen Cc: Christoph Hellwig , netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls Message-ID: <20030521102512.A30373@lst.de> References: <20030521101126.A30197@lst.de> <20030521081938.GD22869@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20030521081938.GD22869@wotan.suse.de>; from ak@suse.de on Wed, May 21, 2003 at 10:19:39AM +0200 X-archive-position: 2634 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 On Wed, May 21, 2003 at 10:19:39AM +0200, Andi Kleen wrote: > On Wed, May 21, 2003 at 10:11:26AM +0200, Christoph Hellwig wrote: > > Wow, on driver that had it's dirt fingers in both Space.c and setup.c :) > > Are you sure this won't change probe order? The normal reason > to keep calls in Space.c is that they're ISA or other non discoverable > devices and require a specific ISA probe order, otherwise bad things > happen at boot. > > The card appears to be non PCI. Yes, it's a ISA device. But it has the sdla%d namespace for it's own and support only a single card anyway. There's not much chance of changing any probe order here. From ak@suse.de Wed May 21 01:26:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 01:27:15 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L8Qa2x013446 for ; Wed, 21 May 2003 01:26:36 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id C13C4149AD; Wed, 21 May 2003 10:26:30 +0200 (MEST) Date: Wed, 21 May 2003 10:26:30 +0200 From: Andi Kleen To: Christoph Hellwig Cc: Andi Kleen , netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls Message-ID: <20030521082630.GF22869@wotan.suse.de> References: <20030521101126.A30197@lst.de> <20030521081938.GD22869@wotan.suse.de> <20030521102512.A30373@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521102512.A30373@lst.de> X-archive-position: 2635 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 Wed, May 21, 2003 at 10:25:12AM +0200, Christoph Hellwig wrote: > On Wed, May 21, 2003 at 10:19:39AM +0200, Andi Kleen wrote: > > On Wed, May 21, 2003 at 10:11:26AM +0200, Christoph Hellwig wrote: > > > Wow, on driver that had it's dirt fingers in both Space.c and setup.c :) > > > > Are you sure this won't change probe order? The normal reason > > to keep calls in Space.c is that they're ISA or other non discoverable > > devices and require a specific ISA probe order, otherwise bad things > > happen at boot. > > > > The card appears to be non PCI. > > Yes, it's a ISA device. But it has the sdla%d namespace for it's own > and support only a single card anyway. There's not much chance of > changing any probe order here. ISA probe order has nothing to do with namespaces or single cards. It works by reading values from specific registers and completely different devices can conflict. -Andi > From davem@redhat.com Wed May 21 01:36:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 01:37:02 -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.9) with SMTP id h4L8aN2x014225 for ; Wed, 21 May 2003 01:36:24 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA11055; Wed, 21 May 2003 01:34:53 -0700 Date: Wed, 21 May 2003 01:34:53 -0700 (PDT) Message-Id: <20030521.013453.118618445.davem@redhat.com> To: ak@suse.de Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls From: "David S. Miller" In-Reply-To: <20030521082630.GF22869@wotan.suse.de> References: <20030521081938.GD22869@wotan.suse.de> <20030521102512.A30373@lst.de> <20030521082630.GF22869@wotan.suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2636 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 From: Andi Kleen Date: Wed, 21 May 2003 10:26:30 +0200 ISA probe order has nothing to do with namespaces or single cards. It works by reading values from specific registers and completely different devices can conflict. Correct. However, this sdla thing seems to want to be probed after ethif_probe() runs. And moving this to initcalls preserves that relative relationship. I have to admit that I must feign ignorance here. And that someone who really understands the EISA/ISA probe ordering requirements should document them as best as possible in Space.c From rmk@arm.linux.org.uk Wed May 21 02:07:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 02:08:13 -0700 (PDT) Received: from caramon.arm.linux.org.uk (caramon.arm.linux.org.uk [212.18.232.186]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4L97X2x015998 for ; Wed, 21 May 2003 02:07:35 -0700 Received: from flint.arm.linux.org.uk ([3ffe:8260:2002:1:201:2ff:fe14:8fad]) by caramon.arm.linux.org.uk with asmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.14) id 19IPZG-000374-6E; Wed, 21 May 2003 10:07:26 +0100 Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.14) id 19IPZF-000578-BA; Wed, 21 May 2003 10:07:25 +0100 Date: Wed, 21 May 2003 10:07:25 +0100 From: Russell King To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: Mail delivery failed: returning message to sender Message-ID: <20030521100725.A17709@flint.arm.linux.org.uk> References: <20030521012148.P10585@flint.arm.linux.org.uk> <20030520.175553.35669773.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: <20030520.175553.35669773.davem@redhat.com>; from davem@redhat.com on Tue, May 20, 2003 at 05:55:53PM -0700 X-Message-Flag: Your copy of Microsoft Outlook is vulnerable to viruses. See www.mutt.org for more details. X-archive-position: 2637 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rmk@arm.linux.org.uk Precedence: bulk X-list: netdev On Tue, May 20, 2003 at 05:55:53PM -0700, David S. Miller wrote: > Russel, please retest using this patch. This piece of > code needs to be audited further. This appears to fix the problem, thanks. > --- net/ipv4/route.c.~1~ Tue May 20 17:53:55 2003 > +++ net/ipv4/route.c Tue May 20 17:54:12 2003 > @@ -964,6 +964,7 @@ > rt->u.dst.neighbour = NULL; > rt->u.dst.hh = NULL; > rt->u.dst.obsolete = 0; > + rt->u.dst.path = &rt->u.dst; > > rt->rt_flags |= RTCF_REDIRECTED; > -- Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html From ak@suse.de Wed May 21 03:31:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 03:32:03 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LAVU2x026813 for ; Wed, 21 May 2003 03:31:30 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id A664C14AD6; Wed, 21 May 2003 12:31:24 +0200 (MEST) Date: Wed, 21 May 2003 12:31:23 +0200 From: Andi Kleen To: "David S. Miller" Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls Message-Id: <20030521123123.40924dce.ak@suse.de> In-Reply-To: <20030521.013453.118618445.davem@redhat.com> References: <20030521081938.GD22869@wotan.suse.de> <20030521102512.A30373@lst.de> <20030521082630.GF22869@wotan.suse.de> <20030521.013453.118618445.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: 2638 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 Wed, 21 May 2003 01:34:53 -0700 (PDT) "David S. Miller" wrote: > I have to admit that I must feign ignorance here. And that someone > who really understands the EISA/ISA probe ordering requirements > should document them as best as possible in Space.c I doubt anybody understands it. It is just lots of hard earned ad-hoc experience distilled in these files. It's basically untestable/unknown because you'll likely have a hard time to find such a card anymore. And even if you had you would need the other ISA cards that could possible conflicts to test all combinations - impossible task. For such unsolvable problems it is best to leave it untouched because it cannot be tested. Either that or remove the driver completely. -Andi From davem@redhat.com Wed May 21 03:35:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 03:35: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.9) with SMTP id h4LAZ42x027387 for ; Wed, 21 May 2003 03:35:05 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id DAA11260; Wed, 21 May 2003 03:33:37 -0700 Date: Wed, 21 May 2003 03:33:36 -0700 (PDT) Message-Id: <20030521.033336.55842349.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls From: "David S. Miller" In-Reply-To: <20030521101126.A30197@lst.de> References: <20030521101126.A30197@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2639 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 From: Christoph Hellwig Date: Wed, 21 May 2003 10:11:26 +0200 Wow, on driver that had it's dirt fingers in both Space.c and setup.c :) Since I think Andi's arguments are totally valid I'm not going to apply this, sorry. From hadi@shell.cyberus.ca Wed May 21 05:39:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 05:40:32 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LCdn2x003298 for ; Wed, 21 May 2003 05:39:53 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19ISsR-000BKE-87; Wed, 21 May 2003 08:39:27 -0400 Date: Wed, 21 May 2003 08:39:27 -0400 (EDT) From: Jamal Hadi To: Martin Josefsson cc: Ethan Sommer , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com, biondi@cartel-securite.fr Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <1053443703.17386.138.camel@tux.rsn.bth.se> Message-ID: <20030521075617.N43477@shell.cyberus.ca> References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> <3ECA3E2C.20805@ethanet.com> <20030520105356.U41173@shell.cyberus.ca> <1053443703.17386.138.camel@tux.rsn.bth.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2640 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, Martin Josefsson wrote: > Maybe make it take a length parameter and if it's zero treat null's like > all other algorithms do and it's non-zero use the length instead. > Then you can hide it in a wrapper function for the "normal" case that > just calls the actual search-function but with 0 as length. > Actually, the library that you pointed to seems to have callbacks associated with every match - so it could be used on string matches. The author is on the cc. > Well we don't have a that big bread slicer (yet) but take a look at > libqsearch, it is a library for searching and has been ported to the > linux kernel by the author. It has support for various algorithms that Didnt see anything kernel related in my quick scan. The library certainly appears sane. > have diffrent capabilities, unfortunately I don't think it has an > algorithm that has support for regexp yet (the framework is there, ie > the flag that says an algorithm supports regexp). > It's modular and I don't think it should be that hard to add an regexp > algorithm. it does seems to imply regexp is available but wasnt anywhere i could find. > It looks quite nice and it can search for multiple strings at the same > time and call diffrent callbacks depending on which string matched. > yep, can sed that packet easily with those callbacks ;-> s/val/val2/g On Tue, 20 May 2003, Ethan Sommer wrote: > One thing I should have pointed out earlier, it only copies that > memory/does regex stuff until it finds a match or the first 8 packets, > whichever is less. So, at least based on my tests, it doesn't seem to > slow down 100BT much from what it would be otherwise. We might run into > trouble if we look at GB or 10GB, but until we find a problem with > speed, I think it is probably more important to make this as simple and > easy to maintain as possible. If we see a need to make it more > complicated due to speed issues, _then_ we should think about trying to > get rid of that copy. > I think you should do some measurements - "it doesnt slow 100Mbps" and "lets worry about it when we get to 1 or 10Gbps" are handwaving at best. Infact i would strongly recommend looking at the libqpsearch above. cheers, jamal From hadi@shell.cyberus.ca Wed May 21 06:03:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 06:04:06 -0700 (PDT) Received: from shell.cyberus.ca (shell.cyberus.ca [216.191.236.4]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LD3U2x004880 for ; Wed, 21 May 2003 06:03:31 -0700 Received: from hadi (helo=localhost) by shell.cyberus.ca with local-esmtp (Exim 4.14) id 19ITFX-000BKz-OF; Wed, 21 May 2003 09:03:19 -0400 Date: Wed, 21 May 2003 09:03:19 -0400 (EDT) From: Jamal Hadi To: "David S. Miller" cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress In-Reply-To: <20030520.173607.88482742.davem@redhat.com> Message-ID: <20030521084023.Y43543@shell.cyberus.ca> References: <20030519220409.V39658@shell.cyberus.ca> <20030519.234624.123976229.davem@redhat.com> <20030520074848.U40843@shell.cyberus.ca> <20030520.173607.88482742.davem@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2641 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hadi@shell.cyberus.ca Precedence: bulk X-list: netdev On Tue, 20 May 2003, David S. Miller wrote: > From: Jamal Hadi > Date: Tue, 20 May 2003 08:04:00 -0400 (EDT) > > Note: It may make sense that we have options to totaly remove > the cache lookups if necessary - noone has proved a need for it at > this point. > > There is a need, thinking otherwise is quite a narrow viewpoint :-) > Let me explain. > > Forward looking, Alexey and myself plan to extend the per-cpu flow > cache we designed for IPSEC policy lookups to apply to routing > and socket lookup. There are two reasons to make this: > > 1) Per-cpu'ness. IPIs to synchronize? > 2) Input route lookup turns into a "flow" lookup and thus may > give you a TCP socket, for example. It is the most exciting > part of this work. > For packets that are being forwarded or even host bound, why start at routing? This should be done much further below. Not sure how to deal with packets originating from the host. For example i moved the ingress qdisc to way down before IP is hit (I can post the patch) and it works quiet well at the moment only with the u32 classifier (you could use the route classifier for ip packets). I have a packet editor action so i can do some form of ARP/MAC address aliasing ;-> This also gives you opportunity to drop early. A flow index could be created there that could be used to index into the route table for example. Maybe routing by fwmark would then make sense. > It can even be applied to netfilter entries. It really is the > grand unified theory of flow handling :-) You can look to > net/core/flow.c, it is the initial prototype and it is working > and being used already for IPSEC policies. There are only minor > adjustments necessary before we can begin trying to apply it to > other things, but Alexey and myself know how to make them. > I did look at the code initially when it showed up. It does look sane. Infact i raised the issue about the same time whether pushing and popping these structures was the best way to go. Another approach would be to use a "hub and spoke" dispatch based scheme which i use in the effort to get better traffic control actions. Also the structure itself had the grandiose view that routing is the mother of them all i.e you "fit everything around routing" not "fit routing around other things". Note: routing aint the only sexy thing these days, so unified theory based on one sexy thing may be unfair to other sexy things;-> > So the real argument: Eliminating sourced based keying of input > routes is a flawed idea. Firstly, independant of POLICY based routing > (which is what it was originally made for) being able to block by > source address on input is a useful feature. Secondly, if one must > make "fib_validate_source()" on each input packet, it destroys all > the posibility to make per-cpu flow caching a reality. This is > because fib_validate_source() must walk the inetdev list and thus > grab a shared SMP lock. > I think the flowi must be captured way before IP is hit and reused by IP and other sublayers. policy routing dropping or attempts to fib_validate_source() the packets should utilize that scheme (i.e install filters below ip) and tag(fwmark) or drop them on the floor before they hit IP. > Note that any attempt to remove source based keying of routing cache > entries on input (or eliminating the cache entirely) has this problem. > nod. > It also becomes quite cumbersome to move all of this logic over to > ip_input() or similar. And because it will always use a shared SMP > lock it is guarenteed to be slower than the cache especially for > well-behaved flows. So keep in mind that not all traffic is DoS :-) > true. I think post 2.6 we should just rip apart the infrastructure and rethink things ;-> (should i go into hiding now?;->) > (As a side note, and interesting area of discourse would be to see > if DoS traffic can be somehow patternized, either explicitly in > the kernel or via descriptions from the user. People do this today > via netfilter, but I feel we might be able to do something more > powerful at the flow caching level, ie. do not build cache entries > for things looking like unary-packet DoS flow) > Should be pretty easy to do with a filter framework at the lower layers such as the one i did with ingress qdisc. > None of this means that slowpath should not be improved if necessary. > On the contrary, I would welcome good kernel profiling output from > someone such as sim@netnation during such stress tests. > nod. cheers, jamal From sommere@ethanet.com Wed May 21 08:43:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 08:44:13 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LFhb2x012810 for ; Wed, 21 May 2003 08:43:38 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF800D9NUB4D9@carleton.edu> for netdev@oss.sgi.com; Wed, 21 May 2003 10:42:41 -0500 (CDT) Date: Wed, 21 May 2003 10:42:40 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: <20030521075617.N43477@shell.cyberus.ca> To: Jamal Hadi Cc: Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com, biondi@cartel-securite.fr Message-id: <3ECB9E70.8090101@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: <1053313298.3909.5.camel@rth.ninka.net> <20030519202756.I39498@shell.cyberus.ca> <3EC9B815.4000504@ethanet.com> <20030520080940.E40885@shell.cyberus.ca> <3ECA3E2C.20805@ethanet.com> <20030520105356.U41173@shell.cyberus.ca> <1053443703.17386.138.camel@tux.rsn.bth.se> <20030521075617.N43477@shell.cyberus.ca> X-archive-position: 2642 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Jamal Hadi wrote: >I think you should do some measurements - "it doesnt slow 100Mbps" and >"lets worry about it when we get to 1 or 10Gbps" are handwaving at best. >Infact i would strongly recommend looking at the libqpsearch above. > > Agreed. However, libqpsearch doesn't do regex yet, so we can't use it. From sommere@ethanet.com Wed May 21 08:47:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 08:47:57 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LFlL2x013190 for ; Wed, 21 May 2003 08:47:23 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF800DE1UI1FA@carleton.edu> for netdev@oss.sgi.com; Wed, 21 May 2003 10:46:50 -0500 (CDT) Date: Wed, 21 May 2003 10:46:50 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: To: Philippe Biondi Cc: Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3ECB9F6A.20004@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-15 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: X-archive-position: 2643 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Philippe Biondi wrote: >regexp support was planned but not done yet. (if someone know where I can >download more free time !). > >The implementation should not be that hard, once you have the compiler to >transform the string describing the regexp to an automaton. > >Note that to respect the framework, you have to deal with multiple >patterns (should not be that hard). If you have pat1 and pat2, searching >for (pat1|pat2) is not sufficient because for each match, you have to >point which pattern matched. > > We actually planned on doing that initially. You should note that if you want to generate one automaton for multiple patterns, that is not a regular language (and thus can not be represented by a FA or DFA.) You will have to try matching against the first pattern, then the next and so on. Ethan From kumarkr@us.ibm.com Wed May 21 09:29:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 09:30:30 -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.9) with SMTP id h4LGTi2x013935 for ; Wed, 21 May 2003 09:29:50 -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 h4LGTcXD308940; Wed, 21 May 2003 12:29:38 -0400 Received: from d03nm801.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay04.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4LGTWbl152802; Wed, 21 May 2003 10:29:35 -0600 Subject: Re: Patch for NETLINK_TCPDIAG To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, linux-net@vger.kernel.org, netdev@oss.sgi.com X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: Krishna Kumar Date: Wed, 21 May 2003 09:25:06 -0700 X-MIMETrack: Serialize by Router on D03NM801/03/M/IBM(Release 6.0.1 [IBM]|April 28, 2003) at 05/21/2003 10:27:42 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-archive-position: 2644 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kumarkr@us.ibm.com Precedence: bulk X-list: netdev Yes sure, will remember to use a different mailer next time :-) thanks, - KK |---------+----------------------------> | | "David S. Miller"| | | | | | | | | 05/20/2003 07:33 | | | PM | | | | |---------+----------------------------> >-----------------------------------------------------------------------------------------------------------------| | | | To: Krishna Kumar/Beaverton/IBM@IBMUS | | cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org | | Subject: Re: Patch for NETLINK_TCPDIAG | | | >-----------------------------------------------------------------------------------------------------------------| From: Krishna Kumar Date: Tue, 20 May 2003 11:49:43 -0700 I am not sure if there is a reason why ACK cannot be set for NETLINK_TCPDIAG. If it is settable, please apply following patch. Your patch does not apply, Lotus NOTES changes tabs into spaces making the patch unusable. I've added the fix by hand... but please be mindful of this in the future. From acme@conectiva.com.br Wed May 21 10:12:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 10:13:04 -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.9) with SMTP id h4LHCO2x014634 for ; Wed, 21 May 2003 10:12:25 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IXGa-00075Q-00; Wed, 21 May 2003 14:20:40 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id B4EC61966C; Wed, 21 May 2003 17:14:42 +0000 (UTC) Date: Wed, 21 May 2003 14:14:41 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: Linux Networking Development Mailing List Subject: [PATCH] wanrouter/wanmain: fix namespace, fixing the current problem with device_shutdown Message-ID: <20030521171441.GA10295@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: 2645 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 Hi David, Please pull from: bk://kernel.bkbits.net/acme/net-2.5 This makes wanrouter build again after device_shutdown was added to linux/device.h, that ends up clashing with the non-namespaced function in wanmain.c. - Arnaldo 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.1210, 2003-05-21 14:04:23-03:00, acme@conectiva.com.br o wanrouter/wanmain: fix namespace, fixing the current problem with device_shutdown wanmain.c | 119 +++++++++++++++++++++++++++++++++----------------------------- 1 files changed, 64 insertions(+), 55 deletions(-) diff -Nru a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c --- a/net/wanrouter/wanmain.c Wed May 21 14:09:10 2003 +++ b/net/wanrouter/wanmain.c Wed May 21 14:09:10 2003 @@ -127,18 +127,21 @@ * WAN device IOCTL handlers */ -static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf); -static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat); -static int device_shutdown(struct wan_device *wandev); -static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf); -static int device_del_if(struct wan_device *wandev, char *u_name); +static int wanrouter_device_setup(struct wan_device *wandev, + wandev_conf_t *u_conf); +static int wanrouter_device_stat(struct wan_device *wandev, + wandev_stat_t *u_stat); +static int wanrouter_device_shutdown(struct wan_device *wandev); +static int wanrouter_device_new_if(struct wan_device *wandev, + wanif_conf_t *u_conf); +static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name); /* * Miscellaneous */ -static struct wan_device *find_device (char *name); -static int delete_interface (struct wan_device *wandev, char *name); +static struct wan_device *wanrouter_find_device(char *name); +static int wanrouter_delete_interface(struct wan_device *wandev, char *name); void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); @@ -148,19 +151,18 @@ * Global Data */ -static char fullname[] = "Sangoma WANPIPE Router"; -static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc."; -static char modname[] = ROUTER_NAME; /* short module name */ -struct wan_device* router_devlist; /* list of registered devices */ -static int devcnt; +static char wanrouter_fullname[] = "Sangoma WANPIPE Router"; +static char wanrouter_copyright[] = "(c) 1995-2000 Sangoma Technologies Inc."; +static char wanrouter_modname[] = ROUTER_NAME; /* short module name */ +struct wan_device* wanrouter_router_devlist; /* list of registered devices */ /* * Organize Unique Identifiers for encapsulation/decapsulation */ -static unsigned char oui_ether[] = { 0x00, 0x00, 0x00 }; +static unsigned char wanrouter_oui_ether[] = { 0x00, 0x00, 0x00 }; #if 0 -static unsigned char oui_802_2[] = { 0x00, 0x80, 0xC2 }; +static unsigned char wanrouter_oui_802_2[] = { 0x00, 0x80, 0xC2 }; #endif #ifndef MODULE @@ -172,12 +174,13 @@ extern int sdladrv_init(void); printk(KERN_INFO "%s v%u.%u %s\n", - fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright); + wanrouter_fullname, ROUTER_VERSION, ROUTER_RELEASE, + wanrouter_copyright); err = wanrouter_proc_init(); - if (err){ - printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", modname); - } + if (err) + printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", + wanrouter_modname); /* * Initialise compiled in boards @@ -218,14 +221,14 @@ int err; printk(KERN_INFO "%s v%u.%u %s\n", - fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright); + wanrouter_fullname, ROUTER_VERSION, ROUTER_RELEASE, + wanrouter_copyright); err = wanrouter_proc_init(); - if (err){ - printk(KERN_INFO - "%s: can't create entry in proc filesystem!\n", modname); - } + if (err) + printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", + wanrouter_modname); return err; } @@ -274,12 +277,12 @@ if (!namelen || (namelen > WAN_DRVNAME_SZ)) return -EINVAL; - if (find_device(wandev->name) != NULL) + if (wanrouter_find_device(wandev->name)) return -EEXIST; #ifdef WANDEBUG printk(KERN_INFO "%s: registering WAN device %s\n", - modname, wandev->name); + wanrouter_modname, wandev->name); #endif /* @@ -289,7 +292,7 @@ if (err) { printk(KERN_INFO "%s: can't create /proc/net/router/%s entry!\n", - modname, wandev->name); + wanrouter_modname, wandev->name); return err; } @@ -300,9 +303,8 @@ wandev->ndev = 0; wandev->dev = NULL; - wandev->next = router_devlist; - router_devlist = wandev; - ++devcnt; + wandev->next = wanrouter_router_devlist; + wanrouter_router_devlist = wandev; MOD_INC_USE_COUNT; /* prevent module from unloading */ return 0; } @@ -327,7 +329,7 @@ if (name == NULL) return -EINVAL; - for (wandev = router_devlist, prev = NULL; + for (wandev = wanrouter_router_devlist, prev = NULL; wandev && strcmp(wandev->name, name); prev = wandev, wandev = wandev->next) ; @@ -335,18 +337,18 @@ return -ENODEV; #ifdef WANDEBUG - printk(KERN_INFO "%s: unregistering WAN device %s\n", modname, name); + printk(KERN_INFO "%s: unregistering WAN device %s\n", + wanrouter_modname, name); #endif if (wandev->state != WAN_UNCONFIGURED) - device_shutdown(wandev); + wanrouter_device_shutdown(wandev); if (prev) prev->next = wandev->next; else - router_devlist = wandev->next; + wanrouter_router_devlist = wandev->next; - --devcnt; wanrouter_proc_delete(wandev); MOD_DEC_USE_COUNT; return 0; @@ -381,14 +383,15 @@ skb_push(skb, 7); skb->data[0] = 0; skb->data[1] = NLPID_SNAP; - memcpy(&skb->data[2], oui_ether, sizeof(oui_ether)); + memcpy(&skb->data[2], wanrouter_oui_ether, + sizeof(wanrouter_oui_ether)); *((unsigned short*)&skb->data[5]) = htons(type); break; default: /* Unknown packet type */ printk(KERN_INFO "%s: unsupported Ethertype 0x%04X on interface %s!\n", - modname, type, dev->name); + wanrouter_modname, type, dev->name); hdr_len = -EINVAL; } return hdr_len; @@ -418,10 +421,11 @@ break; case NLPID_SNAP: /* SNAP encapsulation */ - if (memcmp(&skb->data[cnt + 1], oui_ether, sizeof(oui_ether))){ + if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether, + sizeof(wanrouter_oui_ether))){ printk(KERN_INFO "%s: unsupported SNAP OUI %02X-%02X-%02X " - "on interface %s!\n", modname, + "on interface %s!\n", wanrouter_modname, skb->data[cnt+1], skb->data[cnt+2], skb->data[cnt+3], dev->name); return 0; @@ -435,7 +439,7 @@ default: printk(KERN_INFO "%s: unsupported NLPID 0x%02X on interface %s!\n", - modname, skb->data[cnt], dev->name); + wanrouter_modname, skb->data[cnt], dev->name); return 0; } skb->protocol = ethertype; @@ -475,23 +479,23 @@ switch (cmd) { case ROUTER_SETUP: - err = device_setup(wandev, (void*)arg); + err = wanrouter_device_setup(wandev, (void*)arg); break; case ROUTER_DOWN: - err = device_shutdown(wandev); + err = wanrouter_device_shutdown(wandev); break; case ROUTER_STAT: - err = device_stat(wandev, (void*)arg); + err = wanrouter_device_stat(wandev, (void*)arg); break; case ROUTER_IFNEW: - err = device_new_if(wandev, (void*)arg); + err = wanrouter_device_new_if(wandev, (void*)arg); break; case ROUTER_IFDEL: - err = device_del_if(wandev, (void*)arg); + err = wanrouter_device_del_if(wandev, (void*)arg); break; case ROUTER_IFSTAT: @@ -519,7 +523,8 @@ * o call driver's setup() entry point */ -static int device_setup(struct wan_device *wandev, wandev_conf_t *u_conf) +static int wanrouter_device_setup(struct wan_device *wandev, + wandev_conf_t *u_conf) { void *data = NULL; wandev_conf_t *conf; @@ -595,7 +600,7 @@ * o call driver's shutdown() entry point */ -static int device_shutdown(struct wan_device *wandev) +static int wanrouter_device_shutdown(struct wan_device *wandev) { struct net_device *dev; int err=0; @@ -606,7 +611,8 @@ printk(KERN_INFO "\n%s: Shutting Down!\n",wandev->name); for (dev = wandev->dev; dev;) { - if ((err=delete_interface(wandev, dev->name)) != 0) + err = wanrouter_delete_interface(wandev, dev->name); + if (err) return err; /* The above function deallocates the current dev * structure. Therefore, we cannot use dev->priv @@ -628,7 +634,8 @@ * Get WAN device status & statistics. */ -static int device_stat(struct wan_device *wandev, wandev_stat_t *u_stat) +static int wanrouter_device_stat(struct wan_device *wandev, + wandev_stat_t *u_stat) { wandev_stat_t stat; @@ -658,7 +665,8 @@ * o register network interface */ -static int device_new_if(struct wan_device *wandev, wanif_conf_t *u_conf) +static int wanrouter_device_new_if(struct wan_device *wandev, + wanif_conf_t *u_conf) { wanif_conf_t conf; struct net_device *dev = NULL; @@ -718,7 +726,7 @@ #ifdef WANDEBUG printk(KERN_INFO "%s: registering interface %s...\n", - modname, dev->name); + wanrouter_modname, dev->name); #endif err = register_netdev(dev); @@ -775,7 +783,7 @@ * o copy configuration data to kernel address space */ -static int device_del_if(struct wan_device *wandev, char *u_name) +static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name) { char name[WAN_IFNAME_SZ + 1]; int err = 0; @@ -788,7 +796,7 @@ if (copy_from_user(name, u_name, WAN_IFNAME_SZ)) return -EFAULT; - err = delete_interface(wandev, name); + err = wanrouter_delete_interface(wandev, name); if (err) return err; @@ -816,11 +824,12 @@ * Return pointer to the WAN device data space or NULL if device not found. */ -static struct wan_device *find_device(char *name) +static struct wan_device *wanrouter_find_device(char *name) { struct wan_device *wandev; - for (wandev = router_devlist;wandev && strcmp(wandev->name, name); + for (wandev = wanrouter_router_devlist; + wandev && strcmp(wandev->name, name); wandev = wandev->next); return wandev; } @@ -842,7 +851,7 @@ * sure that opened interfaces are not removed! */ -static int delete_interface(struct wan_device *wandev, char *name) +static int wanrouter_delete_interface(struct wan_device *wandev, char *name) { struct net_device *dev = NULL, *prev = NULL; unsigned long smp_flags=0; =================================================================== This BitKeeper patch contains the following changesets: 1.1210 ## Wrapped with gzip_uu ## M'XL( +:RRSX ]58;7/:1A#^C'[%UIFFX/!R=Y*0A(=,W$!;3US;@^/V0YIA M9'& QDABI,..&_K?NWENGWV_7?P"KC*>MDI^$''C!?R6 M9*)5"I*8!R*\]>M!$M6O4]SH)0EN-,9)Q!O7-XV8BQJKVP;N7/@B&,,M3[-6 MB=;-Y1MQ/^6M4J_[Z]7I<<\PVFUX._;C$;_D MIM0R3IK3\99&]\,9XD<5VD M?IQ%7"B9\^71.2.$X:]-'9/8S3EM$LN9!W1 J6]1/B#,P5THQC#@MV' ^]EX)@;)76R\ ]/RB''Q$ .C]H4_AD%\8KS>8S F1N.1 M^O5@U7S/]N9-YE)O[C/'=9M#.K"IR8D9;'?U+DP53NH02KPY8RYQ5*(5,.Q/ MNV=I;WR-]A3UMQAQYJ9%;%,GH[V>BK1%O-VIV+2@9MO_HV34H3J'6GJG_C"[ M+HJB]A6)VJ$F =LXH:8%KI$)7X0!A*C6$KZ_T(F+V;2Y*_+&BR'*M!K MP@7OXTN>#C%=]ZNV5,RF*HEL&ZP%MCJQHLIL,I''/WP$:,/!)=97$OGPY_'9 MQ]H]ONQ6M_ N8ZDRQW'!1#DN05(*AU#F:5K!JIJFF('NF]YC#\@H-\&J=\.P>G1W]\%=\ M( OSD>0\[%(N8RH"DGQ7^QB3)8%RW/_8/L=1]BFBY&Z_%70]UUXKO@KRN4SQ M*5(HH0IK?%*>I_D4P2OQ"2PF,67HL:W*$"QW^2<<>HNKRR@5;6DN?)#8V-50 M'4U*PR2%W-(=T%7TLSIP=G5ZJC!%*_;;':Q8O*ERV=;S,\C*''S,=I&(/ M+MU@*<]ILNJXS1ZV;%C(XF@69X.EP"':JXK10XZ.Z5J*'PE:5HIX%$SORR^S MF^O:ZX$O_ _L8W7;#;22=%GX-T^&Y2V'*DI#3Y67)MO307[IJ<):1EBZ*"U= ME"IKI6[1=%6W 'O6*Z#%&I;VJ%?Y+"596I*E]2L=)#$L&Q]&3]78EK AJTX+ M3;:;MJ;LQTTC')PW.*IJ MQN9.1CF-%4CV5%EI4@B0#TU%$-KSGK4+(I^-MD/83-DO"?M^(RO*\52D-'GF MF&ETFD36WHDD;*OA&\/7PO;5Y"D]=)!.TU3%(LD>+WS]=(U2]*0BR6XISYN4 MC8ZC:U^3TO:Z6JLC1]>1)M]PSD9D?7EI\O1 +13#+[R279-G3.F(Q-14)PE[ M:A<[RGM.?O#E2RE;7J&K[7=%64O->9I\RV\%#__O"L8\N,EF4=NBOD\LRHQ_ ) 8:MM=)*$P From rask@sygehus.dk Wed May 21 10:39:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 10:40:00 -0700 (PDT) Received: from user6.cybercity.dk (fxp0.user6.ip.cybercity.dk [212.242.41.54]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LHdJ2x015622 for ; Wed, 21 May 2003 10:39:22 -0700 Received: from privat.webmail.cybercity.dk (localhost [127.0.0.1]) by user6.cybercity.dk (8.12.9/8.12.9) with ESMTP id h4LHdH7n077048 for ; Wed, 21 May 2003 19:39:18 +0200 (CEST) (envelope-from rask@sygehus.dk) From: "Rask Ingemann Lambertsen" To: netdev@oss.sgi.com Subject: Re: A better way to get driver stats than parsing /proc/net/dev ? Date: Wed, 21 May 2003 18:39:17 +0100 Message-Id: <20030521173554.M92611@sygehus.dk> In-Reply-To: <3E96FAE1.7030302@candelatech.com> References: <3E967535.2000409@candelatech.com> <3E96FAE1.7030302@candelatech.com> X-Mailer: Cybercity Webmail 2.01 20030425 X-OriginatingIP: 152.95.52.86 (ccc94453) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-archive-position: 2646 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rask@sygehus.dk Precedence: bulk X-list: netdev On Fri, 11 Apr 2003 10:26:57 -0700, Ben Greear wrote > Jason Lunz wrote: > > greearb@candelatech.com said: > > > >>Is there an ioctl or some other binary means of getting the info that > >>/proc/net/dev provides? > > > > You can do it with netlink sockets. See print_linkinfo() in the iproute2 > > code. > > Seems that a lot of code is needed just to read the stats :( Maybe it is easier to parse the output from "ip -s -s link show [iface]". At least you get all the counters, which you don't from /proc/net/dev. -- Regards, Rask Ingemann Lambertsen From niv@us.ibm.com Wed May 21 11:07:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 11:08:04 -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.9) with SMTP id h4LI7k2x017026 for ; Wed, 21 May 2003 11:07:55 -0700 Received: from westrelay03.boulder.ibm.com (westrelay03.boulder.ibm.com [9.17.195.12]) by e33.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4LI7NXD292636; Wed, 21 May 2003 14:07:23 -0400 Received: from us.ibm.com (d03av03.boulder.ibm.com [9.17.193.83]) by westrelay03.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4LI7L49050568; Wed, 21 May 2003 12:07:23 -0600 Message-ID: <3ECBB522.9080101@us.ibm.com> Date: Wed, 21 May 2003 10:19:30 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: James Morris CC: Martin Josefsson , netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2647 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev James Morris wrote: >>- There are those mysterious TCP hangs of established state sockets. >> Someone has to get a good log in order for us to effectively debug this. >> >>I think this is what I've seen a few times when using distcc. > > Does anyone know if the other hangs are seen when the app is using > TCP_CORK (like distcc does) ? We had observed some hangs during SpecWeb99 benchmark runs. Unfortunately, we managed to burn down the machine and have yet to rerun the benchmark. No other workload seems to be observing them. I'm trying to excavate the one incomplete trace I had of that hang, if possible. IIRC it was using sendfile(), so probably also using TCP_CORK, though dont know that for sure. Can anyone tell me what to do to reproduce this? Also, I'd like to have this tracked in bugzilla, if noone objects (DaveM?), so we dont lose it..I had dropped some earlier reports of hangs. I'll file in BUGME.. thanks, Nivedita From gandalf@wlug.westbo.se Wed May 21 12:39:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 12:39:58 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LJdI2x018652 for ; Wed, 21 May 2003 12:39:19 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 4D1E636FED; Wed, 21 May 2003 21:39:16 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: Nivedita Singhvi Cc: James Morris , netdev@oss.sgi.com In-Reply-To: <1053545510.9476.9.camel@tux.rsn.bth.se> References: <3ECBB522.9080101@us.ibm.com> <1053545510.9476.9.camel@tux.rsn.bth.se> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053545955.15182.12.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 21 May 2003 21:39:16 +0200 X-archive-position: 2648 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Wed, 2003-05-21 at 21:31, Martin Josefsson wrote: > I've now tried my distcc stuff again. With TCP_CORK enabled I don't have > any problem reproducing the hangs, 1 in 3 shows at least one hang. But > so far I havn't been able to reproduce it with TCP_CORK disabled. I'll > keep compiling a few more times, I've only run 10 compilations so far. And of course I just got a hang without TCP_CORK just after sending the mail.... sigh. I'll see if I can get my tcpdump working with mmap-enabled libpcap again... -- /Martin From niv@us.ibm.com Wed May 21 12:46:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 12:46:47 -0700 (PDT) Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.133]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LJkg2x019012 for ; Wed, 21 May 2003 12:46:42 -0700 Received: from westrelay03.boulder.ibm.com (westrelay03.boulder.ibm.com [9.17.195.12]) by e35.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4LJkRuT273366; Wed, 21 May 2003 15:46:27 -0400 Received: from us.ibm.com (d03av03.boulder.ibm.com [9.17.193.83]) by westrelay03.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4LJkP49144520; Wed, 21 May 2003 13:46:26 -0600 Message-ID: <3ECBCC5A.6090406@us.ibm.com> Date: Wed, 21 May 2003 11:58:34 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Josefsson CC: James Morris , netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state References: <3ECBB522.9080101@us.ibm.com> <1053545510.9476.9.camel@tux.rsn.bth.se> In-Reply-To: <1053545510.9476.9.camel@tux.rsn.bth.se> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2649 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev Martin Josefsson wrote: >>Can anyone tell me what to do to reproduce this? > > I've now tried my distcc stuff again. With TCP_CORK enabled I don't have > any problem reproducing the hangs, 1 in 3 shows at least one hang. But > so far I havn't been able to reproduce it with TCP_CORK disabled. I'll > keep compiling a few more times, I've only run 10 compilations so far. > > When using distcc you know you have a hang when it stops at the > object-linking for a while waiting for one process to finish. > Thanks, Martin.. Which kernels are you currently using? Were you able to reproduce this with 2.5.69 at both ends? I just took a look at your previous trace. I'n not absolutely sure my previous report of a hang is the same issue, only because in that case the connection did not revive, whereas in your case after the 1 second approximate stall, it continues.. (havent stepped through everything yet). thanks, Nivedita From gandalf@wlug.westbo.se Wed May 21 12:46:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 12:47:18 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LJkX2x019011 for ; Wed, 21 May 2003 12:46:34 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 6F60636FD1; Wed, 21 May 2003 21:31:51 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: Nivedita Singhvi Cc: James Morris , netdev@oss.sgi.com In-Reply-To: <3ECBB522.9080101@us.ibm.com> References: <3ECBB522.9080101@us.ibm.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053545510.9476.9.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 21 May 2003 21:31:51 +0200 X-archive-position: 2650 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Wed, 2003-05-21 at 19:19, Nivedita Singhvi wrote: > >>I think this is what I've seen a few times when using distcc. > > > > Does anyone know if the other hangs are seen when the app is using > > TCP_CORK (like distcc does) ? > > We had observed some hangs during SpecWeb99 benchmark runs. > Unfortunately, we managed to burn down the machine and have > yet to rerun the benchmark. No other workload seems to > be observing them. > > I'm trying to excavate the one incomplete trace I had of > that hang, if possible. IIRC it was using sendfile(), so > probably also using TCP_CORK, though dont know that for > sure. > > Can anyone tell me what to do to reproduce this? I've now tried my distcc stuff again. With TCP_CORK enabled I don't have any problem reproducing the hangs, 1 in 3 shows at least one hang. But so far I havn't been able to reproduce it with TCP_CORK disabled. I'll keep compiling a few more times, I've only run 10 compilations so far. When using distcc you know you have a hang when it stops at the object-linking for a while waiting for one process to finish. -- /Martin From gandalf@wlug.westbo.se Wed May 21 12:54:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 12:55:01 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LJsP2x019684 for ; Wed, 21 May 2003 12:54:25 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 1ED5936FD1; Wed, 21 May 2003 21:54:23 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: Nivedita Singhvi Cc: James Morris , netdev@oss.sgi.com In-Reply-To: <3ECBCC5A.6090406@us.ibm.com> References: <3ECBB522.9080101@us.ibm.com> <1053545510.9476.9.camel@tux.rsn.bth.se> <3ECBCC5A.6090406@us.ibm.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053546862.9483.18.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 21 May 2003 21:54:22 +0200 X-archive-position: 2651 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Wed, 2003-05-21 at 20:58, Nivedita Singhvi wrote: > Martin Josefsson wrote: > > >>Can anyone tell me what to do to reproduce this? > > > > I've now tried my distcc stuff again. With TCP_CORK enabled I don't have > > any problem reproducing the hangs, 1 in 3 shows at least one hang. But > > so far I havn't been able to reproduce it with TCP_CORK disabled. I'll > > keep compiling a few more times, I've only run 10 compilations so far. > > > > When using distcc you know you have a hang when it stops at the > > object-linking for a while waiting for one process to finish. > > > > Thanks, Martin.. > > Which kernels are you currently using? > Were you able to reproduce this with 2.5.69 at both > ends? I'm using 2.5.69-mm5 on the client and 2.4.20 and 2.4.21-rc1 on the servers. Also seen with 2.5.67 and earlier on the client. I did run 2.4.19 on the client and never saw this problem with that kernel. I can't test 2.5 kernels on the servers since they are actually routers located a fair bit away from here so I do not want to test 2.5 on them just yet. > I just took a look at your previous trace. I'n not absolutely > sure my previous report of a hang is the same issue, only because > in that case the connection did not revive, whereas in your > case after the 1 second approximate stall, it continues.. > (havent stepped through everything yet). I don't get a 1 second stall, I get a long stall, around 2 minutes and then when the timer (seen with netstat -o) on the clientside expires it continues like nothing happened. So it's not fatal, just very irritating when using distcc to speed up compiles and then you end up having to wait :) -- /Martin From niv@us.ibm.com Wed May 21 12:59:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 12:59:29 -0700 (PDT) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.130]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LJxM2x020016 for ; Wed, 21 May 2003 12:59:24 -0700 Received: from westrelay03.boulder.ibm.com (westrelay03.boulder.ibm.com [9.17.195.12]) by e32.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4LJx7kc285282; Wed, 21 May 2003 15:59:07 -0400 Received: from us.ibm.com (d03av03.boulder.ibm.com [9.17.193.83]) by westrelay03.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4LJx649189074; Wed, 21 May 2003 13:59:07 -0600 Message-ID: <3ECBDA88.2030906@us.ibm.com> Date: Wed, 21 May 2003 12:59:04 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Josefsson CC: James Morris , netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state References: <3ECBB522.9080101@us.ibm.com> <1053545510.9476.9.camel@tux.rsn.bth.se> <3ECBCC5A.6090406@us.ibm.com> <1053546862.9483.18.camel@tux.rsn.bth.se> In-Reply-To: <1053546862.9483.18.camel@tux.rsn.bth.se> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2652 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev Martin Josefsson wrote: > I don't get a 1 second stall, I get a long stall, around 2 minutes and yep, that was a typo on my part..meant 1 min.. :) thanks, Nivedita From hch@verein.lst.de Wed May 21 13:16:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 13:17:21 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LKGe2x020525 for ; Wed, 21 May 2003 13:16:41 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4LKGcq07592 for netdev@oss.sgi.com; Wed, 21 May 2003 22:16:38 +0200 Date: Wed, 21 May 2003 22:16:38 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] switch arcnet over to initcalls Message-ID: <20030521221638.A7575@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2653 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 Link order already equals the old init order. arcnet init/registration code still is more than fishy, maybe I'll look into that later. --- 1.11/drivers/net/setup.c Tue May 20 08:57:38 2003 +++ edited/drivers/net/setup.c Tue May 20 23:21:48 2003 @@ -11,7 +11,6 @@ extern int dmascc_init(void); -extern int arcnet_init(void); extern int scc_enet_init(void); extern int fec_enet_init(void); extern int sdla_setup(void); @@ -41,9 +40,6 @@ #endif #if defined(CONFIG_SDLA) {sdla_c_setup, 0}, -#endif -#if defined(CONFIG_ARCNET) - {arcnet_init, 0}, #endif #if defined(CONFIG_SCC_ENET) {scc_enet_init, 0}, --- 1.3/drivers/net/arcnet/arc-rawmode.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/arc-rawmode.c Wed May 21 00:06:42 2003 @@ -53,10 +53,12 @@ }; -void arcnet_raw_init(void) +static int __init arcnet_raw_init(void) { int count; + printk(VERSION); + for (count = 0; count < 256; count++) if (arc_proto_map[count] == arc_proto_default) arc_proto_map[count] = &rawmode_proto; @@ -66,26 +68,18 @@ arc_bcast_proto = &rawmode_proto; arc_proto_default = &rawmode_proto; -} - - -#ifdef MODULE - -int __init init_module(void) -{ - printk(VERSION); - arcnet_raw_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_raw_exit(void) { arcnet_unregister_proto(&rawmode_proto); } -MODULE_LICENSE("GPL"); -#endif /* MODULE */ +module_init(arcnet_raw_init); +module_exit(arcnet_raw_exit); +MODULE_LICENSE("GPL"); /* packet receiver */ --- 1.10/drivers/net/arcnet/arcnet.c Fri May 16 02:23:26 2003 +++ edited/drivers/net/arcnet/arcnet.c Wed May 21 00:04:26 2003 @@ -106,13 +106,15 @@ static struct net_device_stats *arcnet_get_stats(struct net_device *dev); static int go_tx(struct net_device *dev); -void __init arcnet_init(void) +static int debug = ARCNET_DEBUG; +MODULE_PARM(debug, "i"); +MODULE_LICENSE("GPL"); + +static int __init arcnet_init(void) { - static int arcnet_inited; int count; - if (arcnet_inited++) - return; + arcnet_debug = debug; printk(VERSION); @@ -138,47 +140,15 @@ sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap), sizeof(struct archdr)); -#ifdef CONFIG_ARCNET /* We're not built as a module */ - printk("arcnet: Available protocols:"); -#ifdef CONFIG_ARCNET_1201 - printk(" RFC1201"); - arcnet_rfc1201_init(); -#endif -#ifdef CONFIG_ARCNET_1051 - printk(" RFC1051"); - arcnet_rfc1051_init(); -#endif -#ifdef CONFIG_ARCNET_RAW - printk(" RAW"); - arcnet_raw_init(); -#endif - printk("\n"); -#ifdef CONFIG_ARCNET_COM90xx - com90xx_probe(NULL); -#endif -#endif -} - - -#ifdef MODULE - -static int debug = ARCNET_DEBUG; -MODULE_PARM(debug, "i"); -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - arcnet_debug = debug; - arcnet_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_exit(void) { } -#endif - +module_init(arcnet_init); +module_exit(arcnet_exit); /* * Dump the contents of an sk_buff --- 1.4/drivers/net/arcnet/com20020-isa.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com20020-isa.c Tue May 20 12:13:20 2003 @@ -54,10 +54,6 @@ unsigned long airqmask; struct arcnet_local *lp = dev->priv; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); ioaddr = dev->base_addr; --- 1.12/drivers/net/arcnet/com20020-pci.c Sat Feb 15 00:22:15 2003 +++ edited/drivers/net/arcnet/com20020-pci.c Tue May 20 12:13:36 2003 @@ -183,9 +183,6 @@ static int __init com20020pci_init(void) { BUGLVL(D_NORMAL) printk(VERSION); -#ifndef MODULE - arcnet_init(); -#endif return pci_module_init(&com20020pci_driver); } --- 1.6/drivers/net/arcnet/com90io.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com90io.c Tue May 20 12:13:01 2003 @@ -151,10 +151,6 @@ int ioaddr = dev->base_addr, status; unsigned long airqmask; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n"); --- 1.6/drivers/net/arcnet/com90xx.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com90xx.c Wed May 21 00:08:10 2003 @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -100,7 +99,7 @@ static int com90xx_skip_probe __initdata = 0; -int __init com90xx_probe(struct net_device *dev) +static int __init com90xx_probe(struct net_device *dev) { int count, status, ioaddr, numprint, airq, retval = -ENODEV, openparen = 0; @@ -115,10 +114,6 @@ if (!dev && com90xx_skip_probe) return -ENODEV; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); /* set up the arrays where we'll store the possible probe addresses */ @@ -603,9 +598,6 @@ } - -#ifdef MODULE - /* Module parameters */ static int io; /* use the insmod io= irq= shmem= options */ @@ -619,7 +611,7 @@ MODULE_PARM(device, "s"); MODULE_LICENSE("GPL"); -int init_module(void) +static int __init com90xx_init(void) { struct net_device *dev; int err; @@ -642,8 +634,7 @@ return 0; } - -void cleanup_module(void) +static void __exit com90xx_exit(void) { struct net_device *dev; struct arcnet_local *lp; @@ -663,44 +654,38 @@ } } -#else +module_init(com90xx_init); +module_exit(com90xx_exit); +#ifndef MODULE static int __init com90xx_setup(char *s) { - struct net_device *dev; int ints[8]; - com90xx_skip_probe = 1; - s = get_options(s, 8, ints); if (!ints[0] && !*s) { printk("com90xx: Disabled.\n"); return 1; } - dev = alloc_bootmem(sizeof(struct net_device)); - memset(dev, 0, sizeof(struct net_device)); - dev->init = com90xx_probe; switch (ints[0]) { default: /* ERROR */ printk("com90xx: Too many arguments.\n"); case 3: /* Mem address */ - dev->mem_start = ints[3]; + shmem = ints[3]; case 2: /* IRQ */ - dev->irq = ints[2]; + irq = ints[2]; case 1: /* IO address */ - dev->base_addr = ints[1]; + io = ints[1]; } + if (*s) - strncpy(dev->name, s, 9); + strncpy(device, s, 9); else - strcpy(dev->name, "arc%d"); - if (register_netdev(dev)) - printk(KERN_ERR "com90xx: Cannot register arcnet device\n"); + strcpy(device, "arc%d"); return 1; } __setup("com90xx=", com90xx_setup); - -#endif /* MODULE */ +#endif --- 1.3/drivers/net/arcnet/rfc1051.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/rfc1051.c Wed May 21 00:05:52 2003 @@ -53,8 +53,10 @@ }; -void __init arcnet_rfc1051_init(void) +static int __init arcnet_rfc1051_init(void) { + printk(VERSION); + arc_proto_map[ARC_P_IP_RFC1051] = arc_proto_map[ARC_P_ARP_RFC1051] = &rfc1051_proto; @@ -63,27 +65,18 @@ if (arc_bcast_proto == arc_proto_default) arc_bcast_proto = &rfc1051_proto; -} - - -#ifdef MODULE - -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - printk(VERSION); - arcnet_rfc1051_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_rfc1051_exit(void) { arcnet_unregister_proto(&rfc1051_proto); } -#endif /* MODULE */ +module_init(arcnet_rfc1051_init); +module_exit(arcnet_rfc1051_exit); +MODULE_LICENSE("GPL"); /* * Determine a packet's protocol ID. --- 1.4/drivers/net/arcnet/rfc1201.c Fri May 16 02:23:26 2003 +++ edited/drivers/net/arcnet/rfc1201.c Wed May 21 00:04:43 2003 @@ -53,8 +53,10 @@ }; -void __init arcnet_rfc1201_init(void) +static int __init arcnet_rfc1201_init(void) { + printk(VERSION); + arc_proto_map[ARC_P_IP] = arc_proto_map[ARC_P_IPV6] = arc_proto_map[ARC_P_ARP] @@ -66,27 +68,17 @@ /* if someone else already owns the broadcast, we won't take it */ if (arc_bcast_proto == arc_proto_default) arc_bcast_proto = &rfc1201_proto; -} - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - printk(VERSION); - arcnet_rfc1201_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_rfc1201_exit(void) { arcnet_unregister_proto(&rfc1201_proto); } -#endif /* MODULE */ - +module_init(arcnet_rfc1201_init); +module_exit(arcnet_rfc1201_exit); /* * Determine a packet's protocol ID. --- 1.1/include/linux/arcdevice.h Tue Feb 5 18:39:40 2002 +++ edited/include/linux/arcdevice.h Tue May 20 23:55:24 2003 @@ -333,14 +333,5 @@ void arcdev_setup(struct net_device *dev); void arcnet_rx(struct net_device *dev, int bufnum); -void arcnet_init(void); - -void arcnet_rfc1201_init(void); -void arcnet_rfc1051_init(void); -void arcnet_raw_init(void); - -int com90xx_probe(struct net_device *dev); - #endif /* __KERNEL__ */ - #endif /* _LINUX_ARCDEVICE_H */ From daniel@osdl.org Wed May 21 13:48:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 13:49:30 -0700 (PDT) Received: from mail.osdl.org ([208.186.192.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LKmo2x021021 for ; Wed, 21 May 2003 13:48:53 -0700 Received: from ibm-c.pdx.osdl.net (ibm-c.pdx.osdl.net [172.20.1.54]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h4LKmWW25148; Wed, 21 May 2003 13:48:34 -0700 Subject: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT From: Daniel McNeil To: ncorbic@sangoma.com, dm@sangoma.com, "davem@redhat.com" Cc: "netdev@oss.sgi.com" Content-Type: multipart/mixed; boundary="=-LOjW0tMMXQfMwmLDlQfh" Organization: Message-Id: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 21 May 2003 13:48:32 -0700 X-archive-position: 2654 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: daniel@osdl.org Precedence: bulk X-list: netdev --=-LOjW0tMMXQfMwmLDlQfh Content-Type: text/plain Content-Transfer-Encoding: 7bit Here is simple patch to remove MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT. The wanrouter module will get a reference when another module uses its exported symbols. -- Daniel McNeil --=-LOjW0tMMXQfMwmLDlQfh Content-Disposition: attachment; filename=patch-2.5.69-wan Content-Type: text/x-patch; name=patch-2.5.69-wan; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit diff -rupN -X /home/daniel/dontdiff linux-2.5.69/net/wanrouter/wanmain.c linux-2.5.69.wan/net/wanrouter/wanmain.c --- linux-2.5.69/net/wanrouter/wanmain.c Sun May 4 16:53:35 2003 +++ linux-2.5.69.wan/net/wanrouter/wanmain.c Wed May 21 11:37:50 2003 @@ -303,7 +303,6 @@ int register_wan_device(wan_device_t *wa wandev->next = router_devlist; router_devlist = wandev; ++devcnt; - MOD_INC_USE_COUNT; /* prevent module from unloading */ return 0; } @@ -348,7 +347,6 @@ int unregister_wan_device(char *name) --devcnt; wanrouter_proc_delete(wandev); - MOD_DEC_USE_COUNT; return 0; } --=-LOjW0tMMXQfMwmLDlQfh-- From biondi@cartel-securite.fr Wed May 21 16:11:44 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:12:17 -0700 (PDT) Received: from mwinf0201.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.29]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LNBg2x023775 for ; Wed, 21 May 2003 16:11:43 -0700 Received: from phil.home.phil (unknown [81.53.159.254]) by mwinf0201.wanadoo.fr (SMTP Server) with ESMTP id 2F79F3000419; Thu, 22 May 2003 01:11:36 +0200 (CEST) Date: Thu, 22 May 2003 01:11:35 +0200 (CEST) From: Philippe Biondi X-X-Sender: biondi@phil.home.phil To: Ethan Sommer Cc: Jamal Hadi , Martin Josefsson , "David S. Miller" , , Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <3ECB9F6A.20004@ethanet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by oss.sgi.com id h4LNBg2x023775 X-archive-position: 2655 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: biondi@cartel-securite.fr Precedence: bulk X-list: netdev On Wed, 21 May 2003, Ethan Sommer wrote: > Philippe Biondi wrote: > > >regexp support was planned but not done yet. (if someone know where I can > >download more free time !). > > > >The implementation should not be that hard, once you have the compiler to > >transform the string describing the regexp to an automaton. > > > >Note that to respect the framework, you have to deal with multiple > >patterns (should not be that hard). If you have pat1 and pat2, searching > >for (pat1|pat2) is not sufficient because for each match, you have to > >point which pattern matched. > > > > > > We actually planned on doing that initially. You should note that if you > want to generate one automaton for multiple patterns, that is not a > regular language (and thus can not be represented by a FA or DFA.) You > will have to try matching against the first pattern, then the next and > so on. If P and Q are regexps, P|Q is a regexp, so you do can. So detection is clearly not a problem. But to fit in the libqsearch model, you have to know which of the parterns matched. This is theorically possible, but need a bit of work in comparison with using an off-the-shelf regexp compiler on (Pat1|Pat2|..|Patn). -- Philippe Biondi Cartel Sécurité Security Consultant/R&D http://www.cartel-securite.fr Phone: +33 1 44 06 97 94 Fax: +33 1 44 06 97 99 PGP KeyID:3D9A43E2 FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2 From davem@redhat.com Wed May 21 16:11:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:12: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.9) with SMTP id h4LNBq2x023784 for ; Wed, 21 May 2003 16:11:52 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA12886; Wed, 21 May 2003 16:10:09 -0700 Date: Wed, 21 May 2003 16:10:09 -0700 (PDT) Message-Id: <20030521.161009.59667010.davem@redhat.com> To: niv@us.ibm.com Cc: jmorris@intercode.com.au, gandalf@wlug.westbo.se, netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state From: "David S. Miller" In-Reply-To: <3ECBB522.9080101@us.ibm.com> References: <3ECBB522.9080101@us.ibm.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2656 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 From: Nivedita Singhvi Date: Wed, 21 May 2003 10:19:30 -0700 Also, I'd like to have this tracked in bugzilla, if noone objects (DaveM?), It won't get lost, I maintain a web page privately amongst the main net developers that I use to track TODO items, and it is there. Please don't make a bugzilla for this. From davem@redhat.com Wed May 21 16:22:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:23:01 -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.9) with SMTP id h4LNMQ2x024513 for ; Wed, 21 May 2003 16:22:26 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA12962; Wed, 21 May 2003 16:20:53 -0700 Date: Wed, 21 May 2003 16:20:52 -0700 (PDT) Message-Id: <20030521.162052.08332261.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls From: "David S. Miller" In-Reply-To: <20030521221638.A7575@lst.de> References: <20030521221638.A7575@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2657 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 From: Christoph Hellwig Date: Wed, 21 May 2003 22:16:38 +0200 Link order already equals the old init order. arcnet init/registration code still is more than fishy, maybe I'll look into that later. ISA device init ordering again Christoph, com90xx is an ISA driver... From davem@redhat.com Wed May 21 16:24:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:24:54 -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.9) with SMTP id h4LNOK2x024853 for ; Wed, 21 May 2003 16:24:20 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA12969; Wed, 21 May 2003 16:22:17 -0700 Date: Wed, 21 May 2003 16:22:16 -0700 (PDT) Message-Id: <20030521.162216.21916460.davem@redhat.com> To: daniel@osdl.org Cc: ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT From: "David S. Miller" In-Reply-To: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2658 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 From: Daniel McNeil Date: 21 May 2003 13:48:32 -0700 Here is simple patch to remove MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT. The wanrouter module will get a reference when another module uses its exported symbols. What if that other module doesn't get loaded? The things registered in procfs need to have their ->owner field set. From sommere@ethanet.com Wed May 21 16:27:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:28:02 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4LNRS2x025253 for ; Wed, 21 May 2003 16:27:29 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HF900341FRN6B@carleton.edu> for netdev@oss.sgi.com; Wed, 21 May 2003 18:26:12 -0500 (CDT) Date: Wed, 21 May 2003 18:26:12 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: To: Philippe Biondi Cc: Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3ECC0B14.7020105@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: X-archive-position: 2659 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Philippe Biondi wrote: >On Wed, 21 May 2003, Ethan Sommer wrote: > > > >>Philippe Biondi wrote: >> >> >> >>>regexp support was planned but not done yet. (if someone know where I can >>>download more free time !). >>> >>>The implementation should not be that hard, once you have the compiler to >>>transform the string describing the regexp to an automaton. >>> >>>Note that to respect the framework, you have to deal with multiple >>>patterns (should not be that hard). If you have pat1 and pat2, searching >>>for (pat1|pat2) is not sufficient because for each match, you have to >>>point which pattern matched. >>> >>> >>> >>> >>We actually planned on doing that initially. You should note that if you >>want to generate one automaton for multiple patterns, that is not a >>regular language (and thus can not be represented by a FA or DFA.) You >>will have to try matching against the first pattern, then the next and >>so on. >> >> > >If P and Q are regexps, P|Q is a regexp, so you do can. >So detection is clearly not a problem. But to fit in the libqsearch model, >you have to know which of the parterns matched. This is theorically >possible, but need a bit of work in comparison with using an >off-the-shelf regexp compiler on (Pat1|Pat2|..|Patn). > > I take it back, it is regular (kinda) but you can't to it with a deterministic finite atomaton. If there is a cycle in pattern1, off of which pattern2 has a branch, then you would need to count how many times you have gone around the cycle to know where to jump to in pattern2 if it fails to match pattern1 (which you can't do, pumping lemma and all that.) If you use a non-determistic FA, you should be able to just go through each pattern until both crash or one matches and declare that the winner. If your lib did that, it would work quite well for the layer-7 filter. Ethan From davem@redhat.com Wed May 21 16:30:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 16:30:57 -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.9) with SMTP id h4LNUM2x025599 for ; Wed, 21 May 2003 16:30:23 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA13020; Wed, 21 May 2003 16:27:07 -0700 Date: Wed, 21 May 2003 16:27:07 -0700 (PDT) Message-Id: <20030521.162707.88487215.davem@redhat.com> To: acme@conectiva.com.br Cc: daniel@osdl.org, ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT From: "David S. Miller" In-Reply-To: <20030521231801.GE10295@conectiva.com.br> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> <20030521231801.GE10295@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2660 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 From: Arnaldo Carvalho de Melo Date: Wed, 21 May 2003 20:18:01 -0300 Already submitted to DaveM, CCed netdev, I'll fix this later tonight. Note that, as I said in another email, these MOD_* calls can't just be deleted, the PROCFS registry etc. have to set ->owner fields correctly before this is valid. By just removing MOD_*(), I can load just wanrouter, open a proc file, unload the wanrouter module, and crash. From acme@conectiva.com.br Wed May 21 17:01:27 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 17:01:59 -0700 (PDT) Received: from perninha.conectiva.com.br (perninha.conectiva.com.br [200.250.58.156]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M01E2x026182 for ; Wed, 21 May 2003 17:01:15 -0700 Received: from brinquendo.conectiva.com.br (dhcp182.distro.conectiva [10.0.20.182]) by perninha.conectiva.com.br (Postfix) with ESMTP id BA76F47609; Wed, 21 May 2003 20:18:16 -0300 (BRT) Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 473C01966C; Wed, 21 May 2003 23:18:02 +0000 (UTC) Date: Wed, 21 May 2003 20:18:01 -0300 From: Arnaldo Carvalho de Melo To: Daniel McNeil Cc: ncorbic@sangoma.com, dm@sangoma.com, "davem@redhat.com" , "netdev@oss.sgi.com" Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Message-ID: <20030521231801.GE10295@conectiva.com.br> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2661 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 Wed, May 21, 2003 at 01:48:32PM -0700, Daniel McNeil escreveu: > Here is simple patch to remove MOD_INC_USE_COUNT and > MOD_DEC_USE_COUNT. The wanrouter module will get a reference > when another module uses its exported symbols. I have patches that will conflict with this one, fixing the namespace, i.e. device_shutdown now its a core function that ends up having its prototype included in wanmain compilation, causing compilation to fail. Already submitted to DaveM, CCed netdev, I'll fix this later tonight. - Arnaldo From niv@us.ibm.com Wed May 21 17:36:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 17:36:35 -0700 (PDT) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.129]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M0Zo2x026773 for ; Wed, 21 May 2003 17:36:01 -0700 Received: from westrelay05.boulder.ibm.com (westrelay05.boulder.ibm.com [9.17.193.33]) by e31.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4M0ZgQs267738; Wed, 21 May 2003 20:35:42 -0400 Received: from us.ibm.com (d03av03.boulder.ibm.com [9.17.193.83]) by westrelay05.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4M0Zbrb102096; Wed, 21 May 2003 18:35:37 -0600 Message-ID: <3ECC1B56.9090200@us.ibm.com> Date: Wed, 21 May 2003 17:35:34 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David S. Miller" CC: jmorris@intercode.com.au, gandalf@wlug.westbo.se, netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state References: <3ECBB522.9080101@us.ibm.com> <20030521.161009.59667010.davem@redhat.com> In-Reply-To: <20030521.161009.59667010.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2662 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev David S. Miller wrote: > It won't get lost, I maintain a web page privately amongst > the main net developers that I use to track TODO items, and it > is there. > > Please don't make a bugzilla for this. No problem :) thanks, Nivedita From acme@conectiva.com.br Wed May 21 17:38:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 17:38:37 -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.9) with SMTP id h4M0c02x027111 for ; Wed, 21 May 2003 17:38:04 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IeDo-0007yi-00; Wed, 21 May 2003 21:46:16 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id C21E31966C; Thu, 22 May 2003 00:40:19 +0000 (UTC) Date: Wed, 21 May 2003 21:40:18 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: daniel@osdl.org, ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Message-ID: <20030522004018.GA13028@conectiva.com.br> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> <20030521231801.GE10295@conectiva.com.br> <20030521.162707.88487215.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521.162707.88487215.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2663 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 Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu: > From: Arnaldo Carvalho de Melo > Date: Wed, 21 May 2003 20:18:01 -0300 > > Already submitted to DaveM, CCed netdev, I'll fix this later > tonight. > > Note that, as I said in another email, these MOD_* calls can't just be > deleted, the PROCFS registry etc. have to set ->owner fields correctly > before this is valid. Agreed. > By just removing MOD_*(), I can load just wanrouter, open a proc file, > unload the wanrouter module, and crash. yup. From acme@conectiva.com.br Wed May 21 17:44:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 17:45:31 -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.9) with SMTP id h4M0iv2x027496 for ; Wed, 21 May 2003 17:44:57 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IeKa-0007yu-00; Wed, 21 May 2003 21:53:16 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id A25FC1966C; Thu, 22 May 2003 00:47:19 +0000 (UTC) Date: Wed, 21 May 2003 21:47:18 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: daniel@osdl.org, ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Message-ID: <20030522004718.GB13028@conectiva.com.br> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> <20030521231801.GE10295@conectiva.com.br> <20030521.162707.88487215.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030521.162707.88487215.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2664 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 Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu: > From: Arnaldo Carvalho de Melo > Date: Wed, 21 May 2003 20:18:01 -0300 > > Already submitted to DaveM, CCed netdev, I'll fix this later > tonight. > > Note that, as I said in another email, these MOD_* calls can't just be > deleted, the PROCFS registry etc. have to set ->owner fields correctly > before this is valid. Yoshfuji-san has already done this in wanproc.c. From acme@conectiva.com.br Wed May 21 17:50:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 17:51:10 -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.9) with SMTP id h4M0oa2x027866 for ; Wed, 21 May 2003 17:50:37 -0700 Received: from [200.181.170.211] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19IeQ2-0007z8-00; Wed, 21 May 2003 21:58:54 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id B5E651966C; Thu, 22 May 2003 00:52:58 +0000 (UTC) Date: Wed, 21 May 2003 21:52:58 -0300 From: Arnaldo Carvalho de Melo To: Andi Kleen Cc: "David S. Miller" , olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030522005258.GC13028@conectiva.com.br> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514083236.GD8290@Wotan.suse.de> <20030514.121806.41651014.davem@redhat.com> <20030514192117.GA31303@Wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030514192117.GA31303@Wotan.suse.de> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2665 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 Wed, May 14, 2003 at 09:21:17PM +0200, Andi Kleen escreveu: > On Wed, May 14, 2003 at 12:18:06PM -0700, David S. Miller wrote: > > From: Andi Kleen > > Date: Wed, 14 May 2003 10:32:36 +0200 > > > > On Tue, May 13, 2003 at 04:31:50PM -0700, David S. Miller wrote: > > > It's documented in tcp.h already. > > > > Just not everybody changing sock.h also reads tcp.h :-( > > > > You assume that protocols in the tree are the only thing > > that might break if you edit struct sock. > > I'm not assuming anything and didn't even edit struct sock, just pointing > out that such a fragile hack as the current tw bucket is needs an explicit > comment on both places. > > Best would be to bite the bullet and give them a common structure. Ah if we could just use a unnamed struct... 8) - Arnaldo From hch@verein.lst.de Wed May 21 22:57:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 22:57:51 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M5vF2x012176 for ; Wed, 21 May 2003 22:57:17 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4M5vCm11768; Thu, 22 May 2003 07:57:12 +0200 Date: Thu, 22 May 2003 07:57:11 +0200 From: Christoph Hellwig To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls Message-ID: <20030522075711.A11759@lst.de> References: <20030521221638.A7575@lst.de> <20030521.162052.08332261.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20030521.162052.08332261.davem@redhat.com>; from davem@redhat.com on Wed, May 21, 2003 at 04:20:52PM -0700 X-archive-position: 2666 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 On Wed, May 21, 2003 at 04:20:52PM -0700, David S. Miller wrote: > From: Christoph Hellwig > Date: Wed, 21 May 2003 22:16:38 +0200 > > Link order already equals the old init order. arcnet init/registration > code still is more than fishy, maybe I'll look into that later. > > ISA device init ordering again Christoph, com90xx is an ISA > driver... It's not probed from Space.c so it's probed after most isa devices anyway. You can't just veto all initcall changes because they are isa devices - if it's the unlikely case that it actually breaks for someone he can still complain. From davem@redhat.com Wed May 21 23:03:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 23:04:21 -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.9) with SMTP id h4M63m2x012574 for ; Wed, 21 May 2003 23:03:49 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA13654; Wed, 21 May 2003 23:02:11 -0700 Date: Wed, 21 May 2003 23:02:11 -0700 (PDT) Message-Id: <20030521.230211.15256464.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls From: "David S. Miller" In-Reply-To: <20030522075711.A11759@lst.de> References: <20030521221638.A7575@lst.de> <20030521.162052.08332261.davem@redhat.com> <20030522075711.A11759@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2667 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 From: Christoph Hellwig Date: Thu, 22 May 2003 07:57:11 +0200 It's not probed from Space.c so it's probed after most isa devices anyway. Yes it is, because com90xx init was being done via arcnet init. Which in turn was being done in Space.c and looks to be SPECIFICALLY being invoked after ethernet ISA devices are probed. You can't just veto all initcall changes because they are isa devices I absolutely can. Until someone can document the dependencies I have every right to reject this change because it's effects are unknown to actual users. You can't even test your changes. From hch@verein.lst.de Wed May 21 23:10:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 23:10:41 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M6A72x012945 for ; Wed, 21 May 2003 23:10:08 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4M6A3J11859; Thu, 22 May 2003 08:10:03 +0200 Date: Thu, 22 May 2003 08:10:03 +0200 From: Christoph Hellwig To: "David S. Miller" Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls Message-ID: <20030522081002.A11850@lst.de> References: <20030521221638.A7575@lst.de> <20030521.162052.08332261.davem@redhat.com> <20030522075711.A11759@lst.de> <20030521.230211.15256464.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20030521.230211.15256464.davem@redhat.com>; from davem@redhat.com on Wed, May 21, 2003 at 11:02:11PM -0700 X-archive-position: 2668 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 On Wed, May 21, 2003 at 11:02:11PM -0700, David S. Miller wrote: > From: Christoph Hellwig > Date: Thu, 22 May 2003 07:57:11 +0200 > > It's not probed from Space.c so it's probed after most isa devices > anyway. > > Yes it is, because com90xx init was being done via arcnet init. > Which in turn was being done in Space.c it was done in setup.c From davem@redhat.com Wed May 21 23:22:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 23:23:19 -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.9) with SMTP id h4M6Mk2x013460 for ; Wed, 21 May 2003 23:22:47 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA13714; Wed, 21 May 2003 23:21:10 -0700 Date: Wed, 21 May 2003 23:21:09 -0700 (PDT) Message-Id: <20030521.232109.26287528.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls From: "David S. Miller" In-Reply-To: <20030522081002.A11850@lst.de> References: <20030522075711.A11759@lst.de> <20030521.230211.15256464.davem@redhat.com> <20030522081002.A11850@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2669 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 From: Christoph Hellwig Date: Thu, 22 May 2003 08:10:03 +0200 On Wed, May 21, 2003 at 11:02:11PM -0700, David S. Miller wrote: > com90xx init was being done via arcnet init. > Which in turn was being done in Space.c it was done in setup.c Yuck, it's in pci_probes[]. :( Ok, please resend your patch I'll apply it. From hch@verein.lst.de Wed May 21 23:25:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 21 May 2003 23:25:47 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M6PA2x014081 for ; Wed, 21 May 2003 23:25:11 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4M6P6A11935; Thu, 22 May 2003 08:25:06 +0200 Date: Thu, 22 May 2003 08:25:06 +0200 From: Christoph Hellwig To: "David S. Miller" Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] switch arcnet over to initcalls Message-ID: <20030522082506.A11926@lst.de> References: <20030522075711.A11759@lst.de> <20030521.230211.15256464.davem@redhat.com> <20030522081002.A11850@lst.de> <20030521.232109.26287528.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20030521.232109.26287528.davem@redhat.com>; from davem@redhat.com on Wed, May 21, 2003 at 11:21:09PM -0700 X-archive-position: 2670 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 On Wed, May 21, 2003 at 11:21:09PM -0700, David S. Miller wrote: > From: Christoph Hellwig > Date: Thu, 22 May 2003 08:10:03 +0200 > > On Wed, May 21, 2003 at 11:02:11PM -0700, David S. Miller wrote: > > com90xx init was being done via arcnet init. > > Which in turn was being done in Space.c > > it was done in setup.c > > Yuck, it's in pci_probes[]. :( > > Ok, please resend your patch I'll apply it. --- 1.11/drivers/net/setup.c Tue May 20 08:57:38 2003 +++ edited/drivers/net/setup.c Tue May 20 23:21:48 2003 @@ -11,7 +11,6 @@ extern int dmascc_init(void); -extern int arcnet_init(void); extern int scc_enet_init(void); extern int fec_enet_init(void); extern int sdla_setup(void); @@ -41,9 +40,6 @@ #endif #if defined(CONFIG_SDLA) {sdla_c_setup, 0}, -#endif -#if defined(CONFIG_ARCNET) - {arcnet_init, 0}, #endif #if defined(CONFIG_SCC_ENET) {scc_enet_init, 0}, --- 1.3/drivers/net/arcnet/arc-rawmode.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/arc-rawmode.c Wed May 21 00:06:42 2003 @@ -53,10 +53,12 @@ }; -void arcnet_raw_init(void) +static int __init arcnet_raw_init(void) { int count; + printk(VERSION); + for (count = 0; count < 256; count++) if (arc_proto_map[count] == arc_proto_default) arc_proto_map[count] = &rawmode_proto; @@ -66,26 +68,18 @@ arc_bcast_proto = &rawmode_proto; arc_proto_default = &rawmode_proto; -} - - -#ifdef MODULE - -int __init init_module(void) -{ - printk(VERSION); - arcnet_raw_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_raw_exit(void) { arcnet_unregister_proto(&rawmode_proto); } -MODULE_LICENSE("GPL"); -#endif /* MODULE */ +module_init(arcnet_raw_init); +module_exit(arcnet_raw_exit); +MODULE_LICENSE("GPL"); /* packet receiver */ --- 1.10/drivers/net/arcnet/arcnet.c Fri May 16 02:23:26 2003 +++ edited/drivers/net/arcnet/arcnet.c Wed May 21 00:04:26 2003 @@ -106,13 +106,15 @@ static struct net_device_stats *arcnet_get_stats(struct net_device *dev); static int go_tx(struct net_device *dev); -void __init arcnet_init(void) +static int debug = ARCNET_DEBUG; +MODULE_PARM(debug, "i"); +MODULE_LICENSE("GPL"); + +static int __init arcnet_init(void) { - static int arcnet_inited; int count; - if (arcnet_inited++) - return; + arcnet_debug = debug; printk(VERSION); @@ -138,47 +140,15 @@ sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap), sizeof(struct archdr)); -#ifdef CONFIG_ARCNET /* We're not built as a module */ - printk("arcnet: Available protocols:"); -#ifdef CONFIG_ARCNET_1201 - printk(" RFC1201"); - arcnet_rfc1201_init(); -#endif -#ifdef CONFIG_ARCNET_1051 - printk(" RFC1051"); - arcnet_rfc1051_init(); -#endif -#ifdef CONFIG_ARCNET_RAW - printk(" RAW"); - arcnet_raw_init(); -#endif - printk("\n"); -#ifdef CONFIG_ARCNET_COM90xx - com90xx_probe(NULL); -#endif -#endif -} - - -#ifdef MODULE - -static int debug = ARCNET_DEBUG; -MODULE_PARM(debug, "i"); -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - arcnet_debug = debug; - arcnet_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_exit(void) { } -#endif - +module_init(arcnet_init); +module_exit(arcnet_exit); /* * Dump the contents of an sk_buff --- 1.4/drivers/net/arcnet/com20020-isa.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com20020-isa.c Tue May 20 12:13:20 2003 @@ -54,10 +54,6 @@ unsigned long airqmask; struct arcnet_local *lp = dev->priv; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); ioaddr = dev->base_addr; --- 1.12/drivers/net/arcnet/com20020-pci.c Sat Feb 15 00:22:15 2003 +++ edited/drivers/net/arcnet/com20020-pci.c Tue May 20 12:13:36 2003 @@ -183,9 +183,6 @@ static int __init com20020pci_init(void) { BUGLVL(D_NORMAL) printk(VERSION); -#ifndef MODULE - arcnet_init(); -#endif return pci_module_init(&com20020pci_driver); } --- 1.6/drivers/net/arcnet/com90io.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com90io.c Tue May 20 12:13:01 2003 @@ -151,10 +151,6 @@ int ioaddr = dev->base_addr, status; unsigned long airqmask; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n"); --- 1.6/drivers/net/arcnet/com90xx.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/com90xx.c Wed May 21 00:08:10 2003 @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -100,7 +99,7 @@ static int com90xx_skip_probe __initdata = 0; -int __init com90xx_probe(struct net_device *dev) +static int __init com90xx_probe(struct net_device *dev) { int count, status, ioaddr, numprint, airq, retval = -ENODEV, openparen = 0; @@ -115,10 +114,6 @@ if (!dev && com90xx_skip_probe) return -ENODEV; -#ifndef MODULE - arcnet_init(); -#endif - BUGLVL(D_NORMAL) printk(VERSION); /* set up the arrays where we'll store the possible probe addresses */ @@ -603,9 +598,6 @@ } - -#ifdef MODULE - /* Module parameters */ static int io; /* use the insmod io= irq= shmem= options */ @@ -619,7 +611,7 @@ MODULE_PARM(device, "s"); MODULE_LICENSE("GPL"); -int init_module(void) +static int __init com90xx_init(void) { struct net_device *dev; int err; @@ -642,8 +634,7 @@ return 0; } - -void cleanup_module(void) +static void __exit com90xx_exit(void) { struct net_device *dev; struct arcnet_local *lp; @@ -663,44 +654,38 @@ } } -#else +module_init(com90xx_init); +module_exit(com90xx_exit); +#ifndef MODULE static int __init com90xx_setup(char *s) { - struct net_device *dev; int ints[8]; - com90xx_skip_probe = 1; - s = get_options(s, 8, ints); if (!ints[0] && !*s) { printk("com90xx: Disabled.\n"); return 1; } - dev = alloc_bootmem(sizeof(struct net_device)); - memset(dev, 0, sizeof(struct net_device)); - dev->init = com90xx_probe; switch (ints[0]) { default: /* ERROR */ printk("com90xx: Too many arguments.\n"); case 3: /* Mem address */ - dev->mem_start = ints[3]; + shmem = ints[3]; case 2: /* IRQ */ - dev->irq = ints[2]; + irq = ints[2]; case 1: /* IO address */ - dev->base_addr = ints[1]; + io = ints[1]; } + if (*s) - strncpy(dev->name, s, 9); + strncpy(device, s, 9); else - strcpy(dev->name, "arc%d"); - if (register_netdev(dev)) - printk(KERN_ERR "com90xx: Cannot register arcnet device\n"); + strcpy(device, "arc%d"); return 1; } __setup("com90xx=", com90xx_setup); - -#endif /* MODULE */ +#endif --- 1.3/drivers/net/arcnet/rfc1051.c Thu Apr 4 11:39:23 2002 +++ edited/drivers/net/arcnet/rfc1051.c Wed May 21 00:05:52 2003 @@ -53,8 +53,10 @@ }; -void __init arcnet_rfc1051_init(void) +static int __init arcnet_rfc1051_init(void) { + printk(VERSION); + arc_proto_map[ARC_P_IP_RFC1051] = arc_proto_map[ARC_P_ARP_RFC1051] = &rfc1051_proto; @@ -63,27 +65,18 @@ if (arc_bcast_proto == arc_proto_default) arc_bcast_proto = &rfc1051_proto; -} - - -#ifdef MODULE - -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - printk(VERSION); - arcnet_rfc1051_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_rfc1051_exit(void) { arcnet_unregister_proto(&rfc1051_proto); } -#endif /* MODULE */ +module_init(arcnet_rfc1051_init); +module_exit(arcnet_rfc1051_exit); +MODULE_LICENSE("GPL"); /* * Determine a packet's protocol ID. --- 1.4/drivers/net/arcnet/rfc1201.c Fri May 16 02:23:26 2003 +++ edited/drivers/net/arcnet/rfc1201.c Wed May 21 00:04:43 2003 @@ -53,8 +53,10 @@ }; -void __init arcnet_rfc1201_init(void) +static int __init arcnet_rfc1201_init(void) { + printk(VERSION); + arc_proto_map[ARC_P_IP] = arc_proto_map[ARC_P_IPV6] = arc_proto_map[ARC_P_ARP] @@ -66,27 +68,17 @@ /* if someone else already owns the broadcast, we won't take it */ if (arc_bcast_proto == arc_proto_default) arc_bcast_proto = &rfc1201_proto; -} - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int __init init_module(void) -{ - printk(VERSION); - arcnet_rfc1201_init(); return 0; } -void cleanup_module(void) +static void __exit arcnet_rfc1201_exit(void) { arcnet_unregister_proto(&rfc1201_proto); } -#endif /* MODULE */ - +module_init(arcnet_rfc1201_init); +module_exit(arcnet_rfc1201_exit); /* * Determine a packet's protocol ID. --- 1.1/include/linux/arcdevice.h Tue Feb 5 18:39:40 2002 +++ edited/include/linux/arcdevice.h Tue May 20 23:55:24 2003 @@ -333,14 +333,5 @@ void arcdev_setup(struct net_device *dev); void arcnet_rx(struct net_device *dev, int bufnum); -void arcnet_init(void); - -void arcnet_rfc1201_init(void); -void arcnet_rfc1051_init(void); -void arcnet_raw_init(void); - -int com90xx_probe(struct net_device *dev); - #endif /* __KERNEL__ */ - #endif /* _LINUX_ARCDEVICE_H */ From davem@redhat.com Thu May 22 00:03:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 00:04: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.9) with SMTP id h4M73o2x014745 for ; Thu, 22 May 2003 00:03:50 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA13792; Thu, 22 May 2003 00:01:55 -0700 Date: Thu, 22 May 2003 00:01:54 -0700 (PDT) Message-Id: <20030522.000154.68050329.davem@redhat.com> To: yoshfuji@linux-ipv6.org Cc: acme@conectiva.com.br, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? From: "David S. Miller" In-Reply-To: <20030521.020242.16237776.yoshfuji@linux-ipv6.org> References: <20030521.015317.125867074.yoshfuji@linux-ipv6.org> <20030520165831.GG801@conectiva.com.br> <20030521.020242.16237776.yoshfuji@linux-ipv6.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2671 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 From: YOSHIFUJI Hideaki / $B5HF#1QL@(B Date: Wed, 21 May 2003 02:02:42 +0900 (JST) In article <20030520165831.GG801@conectiva.com.br> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo says: > So just delete the test? Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? David? You may #if 0 this as long as you: 1) Add comment. 2) Add identical code block to tcp_ipv6.c From davem@redhat.com Thu May 22 00:12:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 00:12: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.9) with SMTP id h4M7C92x015182 for ; Thu, 22 May 2003 00:12:10 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA13809; Thu, 22 May 2003 00:10:28 -0700 Date: Thu, 22 May 2003 00:10:27 -0700 (PDT) Message-Id: <20030522.001027.55734466.davem@redhat.com> To: acme@conectiva.com.br Cc: yoshfuji@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: is sk->reuse truly a boolean? From: "David S. Miller" In-Reply-To: <20030520162906.GF801@conectiva.com.br> References: <20030520155744.GE801@conectiva.com.br> <20030521.011520.49126007.yoshfuji@linux-ipv6.org> <20030520162906.GF801@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2672 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 From: Arnaldo Carvalho de Melo Date: Tue, 20 May 2003 13:29:07 -0300 Another one I found in this audit: sk->no_check, as per setsockopt is a boolean, but sunrpc code wants tree values, does that need receiving this three values from userspace? if so we have a bug in setsockopt, but without looking at sunrpc code I guess this is only internal... This UDP_CSUM_NORCV value made sense when we did UDP checksumming at packet receive time, but now that we delay checksumming until user recvmsg() call runs it is quite useless. net/sunrpc/xprt.c:udp_data_ready() wants to see packets which have not been checksummed yet, so it may do this and copy at the same time. This is the only behavior made by UDP, it never checks sk->no_check value. So UDP_CSUM_NORCV and the sk->no_check setting in net/sunrpc/xprt.c can be both deleted. It is true for 2.4.x too, and you probably want to run this patch by the NFS guys first so they do not have a heart attack when they notice this hit the tree :-) From davem@redhat.com Thu May 22 00:55:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 00:56: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.9) with SMTP id h4M7tc2x017781 for ; Thu, 22 May 2003 00:55:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA13885; Thu, 22 May 2003 00:53:54 -0700 Date: Thu, 22 May 2003 00:53:54 -0700 (PDT) Message-Id: <20030522.005354.02291716.davem@redhat.com> To: acme@conectiva.com.br Cc: netdev@oss.sgi.com Subject: Re: [PATCH] wanrouter/wanmain: fix namespace, fixing the current problem with device_shutdown From: "David S. Miller" In-Reply-To: <20030521171441.GA10295@conectiva.com.br> References: <20030521171441.GA10295@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2673 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 From: Arnaldo Carvalho de Melo Date: Wed, 21 May 2003 14:14:41 -0300 bk://kernel.bkbits.net/acme/net-2.5 This makes wanrouter build again after device_shutdown was added to linux/device.h, that ends up clashing with the non-namespaced function in wanmain.c. Pulled, thanks Arnaldo. From davem@redhat.com Thu May 22 01:01:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 01:01:54 -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.9) with SMTP id h4M81K2x018244 for ; Thu, 22 May 2003 01:01:21 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA13897; Thu, 22 May 2003 00:59:31 -0700 Date: Thu, 22 May 2003 00:59:31 -0700 (PDT) Message-Id: <20030522.005931.68146729.davem@redhat.com> To: acme@conectiva.com.br Cc: daniel@osdl.org, ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT From: "David S. Miller" In-Reply-To: <20030522004718.GB13028@conectiva.com.br> References: <20030521231801.GE10295@conectiva.com.br> <20030521.162707.88487215.davem@redhat.com> <20030522004718.GB13028@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2674 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 From: Arnaldo Carvalho de Melo Date: Wed, 21 May 2003 21:47:18 -0300 Em Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu: > Note that, as I said in another email, these MOD_* calls can't just be > deleted, the PROCFS registry etc. have to set ->owner fields correctly > before this is valid. Yoshfuji-san has already done this in wanproc.c. That's true. But we need to check for other cases to make sure they are ok. For example, wanrouter_router_devlist. If you really think it's fine, just resend the change and I'll install it. From ak@suse.de Thu May 22 01:02:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 01:03:12 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M82c2x018402 for ; Thu, 22 May 2003 01:02:39 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 7B12D14871; Thu, 22 May 2003 10:02:33 +0200 (MEST) Date: Thu, 22 May 2003 10:02:32 +0200 From: Andi Kleen To: Arnaldo Carvalho de Melo Cc: Andi Kleen , "David S. Miller" , olh@suse.de, marcelo@conectiva.com.br, netdev@oss.sgi.com Subject: Re: comment about struct tcp_tw_bucket in struct sock Message-ID: <20030522080232.GE15275@wotan.suse.de> References: <20030513210541.GA4415@suse.de> <20030513.163150.28800008.davem@redhat.com> <20030514083236.GD8290@Wotan.suse.de> <20030514.121806.41651014.davem@redhat.com> <20030514192117.GA31303@Wotan.suse.de> <20030522005258.GC13028@conectiva.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030522005258.GC13028@conectiva.com.br> X-archive-position: 2675 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 > Ah if we could just use a unnamed struct... 8) Don't worry. Sometime someone will find a gcc 2.95 bug that prevents compilation of some new kernel code and is too hard to work around. Once that happens everybody will move to 3.2+ for the kernel (I don't think 3.0 is used anymore) -Andi From p_gortmaker@yahoo.com Thu May 22 01:03:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 01:03:37 -0700 (PDT) Received: from gold.muskoka.com (gold.muskoka.com [216.123.107.5]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M8312x018531 for ; Thu, 22 May 2003 01:03:02 -0700 Received: from yahoo.com (ppp99.muskoka.com [216.123.108.109]) by gold.muskoka.com (8.9.3/8.9.3) with ESMTP id EAA26191; Thu, 22 May 2003 04:02:54 -0400 X-Authentication-Warning: gold.muskoka.com: Host ppp99.muskoka.com [216.123.108.109] claimed to be yahoo.com Message-ID: <3ECC834B.E4045EB1@yahoo.com> Date: Thu, 22 May 2003 00:59:08 -0400 From: Paul Gortmaker X-Accept-Language: en MIME-Version: 1.0 To: Andi Kleen CC: "David S. Miller" , hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] switch sdla to initcalls References: <20030521081938.GD22869@wotan.suse.de> <20030521102512.A30373@lst.de> <20030521082630.GF22869@wotan.suse.de> <20030521.013453.118618445.davem@redhat.com> <20030521123123.40924dce.ak@suse.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2676 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: p_gortmaker@yahoo.com Precedence: bulk X-list: netdev Andi Kleen wrote: > > On Wed, 21 May 2003 01:34:53 -0700 (PDT) > "David S. Miller" wrote: > > > I have to admit that I must feign ignorance here. And that someone > > who really understands the EISA/ISA probe ordering requirements > > should document them as best as possible in Space.c > > I doubt anybody understands it. It is just lots of hard earned ad-hoc > experience distilled in these files. This used to be important many years ago when distribution kernels came with a bunch of compiled in ISA drivers. I don't think it is anything to get too worried about anymore. Now a distribution is going to have the ISA drivers as modules, and custom kernels with compiled in drivers (probing via Space.c) are going to have a very limited set of drivers. But regardless, the probe ordering was generally "newer before older", "more common before less common", and "invasive write before read type probes at the bottom". This was just common-sense ordering, there weren't that many cases where ordering was critical. The only one that comes to mind now was smc-ultra.c vs wd.c (required "newer before older"). Things like ISA SCSI drivers probing into ne2000 cards was more of a problem than net drivers screwing each other up back then. > It's basically untestable/unknown because you'll likely have a hard time > to find such a card anymore. And even if you had you would need the other > ISA cards that could possible conflicts to test all combinations - impossible Again, I wouldn't give too much weight to this issue -- it is safe to say that all combinations of all cards at all I/O locations with all drivers was never tested, and was never guaranteed to work either. In fact if you look back, the "reserve=0xNNN" was introduced specifically to handle corner cases where you had some other probe stomping on an ISA ethercard. Now this is a totally unused and mostly forgot about boot prompt. > task. For such unsolvable problems it is best to leave it untouched because it > cannot be tested. Either that or remove the driver completely. As an alternative to removal, you could always make the driver in question as module only, and then the burden of probing order is on the installer or end user, as it is with all other modules currently. Paul. > > -Andi From biondi@cartel-securite.fr Thu May 22 01:26:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 01:27:16 -0700 (PDT) Received: from mwinf0201.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.29]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M8Qb2x019592 for ; Thu, 22 May 2003 01:26:38 -0700 Received: from phil.home.phil (unknown [81.50.179.124]) by mwinf0201.wanadoo.fr (SMTP Server) with ESMTP id 00591300044A; Thu, 22 May 2003 10:26:31 +0200 (CEST) Date: Thu, 22 May 2003 10:26:30 +0200 (CEST) From: Philippe Biondi X-X-Sender: biondi@phil.home.phil To: Ethan Sommer Cc: Jamal Hadi , Martin Josefsson , "David S. Miller" , , Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-Reply-To: <3ECC0B14.7020105@ethanet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by oss.sgi.com id h4M8Qb2x019592 X-archive-position: 2677 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: biondi@cartel-securite.fr Precedence: bulk X-list: netdev > > > I take it back, it is regular (kinda) but you can't to it with a > deterministic finite atomaton. If there is a cycle in pattern1, off of > which pattern2 has a branch, then you would need to count how many times > you have gone around the cycle to know where to jump to in pattern2 if > it fails to match pattern1 (which you can't do, pumping lemma and all > that.) If you use a non-determistic FA, you should be able to just go > through each pattern until both crash or one matches and declare that > the winner. Strange way of reasoning... what if pattern1 is "(subpat1|subpat2)" ? regexp is a regular language so it is equivalent to a DFA. For every NDFA, there exist a DFA that recognize the same language. So, it is possible. The question is : will we have enough memory to store a DFA that recognize a big regexp ? The answer is : let loose some speed and use NDFA. > If your lib did that, it would work quite well for the layer-7 filter. Anyone here interested by doing a regexp compiler ? I can help for details or libqsearch internals, but I won't find enough time to do all that quickly enough. -- Philippe Biondi Cartel Sécurité Security Consultant/R&D http://www.cartel-securite.fr Phone: +33 1 44 06 97 94 Fax: +33 1 44 06 97 99 PGP KeyID:3D9A43E2 FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2 From sim@netnation.com Thu May 22 01:40:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 01:40:50 -0700 (PDT) Received: from peace.netnation.com (newpeace.netnation.com [204.174.223.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4M8e42x020060 for ; Thu, 22 May 2003 01:40:07 -0700 Received: from sim by peace.netnation.com with local (Exim 4.20) id 19IlcJ-0007Gu-5V; Thu, 22 May 2003 01:40:03 -0700 Date: Thu, 22 May 2003 01:40:03 -0700 From: Simon Kirby To: "David S. Miller" Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress Message-ID: <20030522084003.GA22613@netnation.com> References: <20030519220409.V39658@shell.cyberus.ca> <20030519.234624.123976229.davem@redhat.com> <20030520074848.U40843@shell.cyberus.ca> <20030520.173607.88482742.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030520.173607.88482742.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 2678 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sim@netnation.com Precedence: bulk X-list: netdev On Tue, May 20, 2003 at 05:36:07PM -0700, David S. Miller wrote: > None of this means that slowpath should not be improved if necessary. > On the contrary, I would welcome good kernel profiling output from > someone such as sim@netnation during such stress tests. I decided to try some profiling while waiting for kernel compiles. It seems that having a full BGP table is slowing thing down a lot. I put 2.4.21-rc2 (with the new hash) on the test box. I modified juno to include a busy delay loop (to try to avoid timer aliasing throwing off the remote profile and to be short enough to generate sufficient traffic), and tuned it to leave about 30% idle CPU on the testing box. I fired up juno, ran "readprofile -r", and let it sit for a while. readprofile results: 384 do_gettimeofday 2.6667 199 ipt_route_hook 3.1094 1092 fib_lookup 3.4125 1286 ip_packet_match 3.8274 248 fib_rule_put 3.8750 3209 rt_intern_hash 4.1784 852 dst_destroy 4.8409 1923 fn_hash_lookup 6.6771 1325 kmem_cache_free 8.2812 1387 dst_alloc 9.6319 3857 tg3_interrupt 11.4792 3848 do_softirq 16.0333 7354 ip_route_input 17.0231 8814 tg3_poll 28.9934 17370 handle_IRQ_event 108.5625 26413 default_idle 412.7031 I then faked a whole slew of routing table entries to look like normal BGP routes. "ip -o route | wc -l" shows 181012 entries, which is similar to the actual routers. readprofile results: 289 do_gettimeofday 2.0069 669 fib_lookup 2.0906 158 fib_rule_put 2.4688 367 tg3_recycle_rx 2.5486 889 ip_packet_match 2.6458 2375 rt_intern_hash 3.0924 636 dst_destroy 3.6136 868 dst_alloc 6.0278 2029 tg3_interrupt 6.0387 1037 kmem_cache_free 6.4813 5364 ip_route_input 12.4167 993 default_idle 15.5156 7593 tg3_poll 24.9770 9631 handle_IRQ_event 60.1938 26552 fn_hash_lookup 92.1944 Hmm! I guess the routing table size has a slight difference on performance there. Full readprofile output available here: http://blue.netnation.com/sim/ref/ I'm not sure if this is a "good" profile or not... I can try with oprofile or something instead if that gives more useful results. I think I wrote a loadable module to dump the hash distribution a while back, but I can't remember where I put it. I'll try writing something like that again and see if there's anything interesting. Simon- From davem@redhat.com Thu May 22 01:59:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 02:00: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.9) with SMTP id h4M8xq2x020535 for ; Thu, 22 May 2003 01:59:53 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA14096; Thu, 22 May 2003 01:58:16 -0700 Date: Thu, 22 May 2003 01:58:15 -0700 (PDT) Message-Id: <20030522.015815.91322249.davem@redhat.com> To: sim@netnation.com Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030522084003.GA22613@netnation.com> References: <20030520074848.U40843@shell.cyberus.ca> <20030520.173607.88482742.davem@redhat.com> <20030522084003.GA22613@netnation.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2679 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 From: Simon Kirby Date: Thu, 22 May 2003 01:40:03 -0700 9631 handle_IRQ_event 60.1938 Are you using APIC irqs? 26552 fn_hash_lookup 92.1944 Hmm! I guess the routing table size has a slight difference on performance there. I assume you have CONFIG_IP_ROUTE_LARGE_TABLES enabled. If not, try with that turned on. If you had it on or enabling it makes little difference, it is time to play with FZ_MAX_DIVISOR and fn_hash(). All of your BGP routes have the same prefix right? Yes, with ~181000 routes which you have fib zone hash in current state will fall to pieces I am afraid. (even with perfect hash, chain length would be on the order of ~180 entries :-((( ) I'm not sure if this is a "good" profile or not... I can try with oprofile or something instead if that gives more useful results. It is good, thanks. Alexey, I will try to make something... From davem@redhat.com Thu May 22 03:42:42 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 03:43:19 -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.9) with SMTP id h4MAgZ2x025465 for ; Thu, 22 May 2003 03:42:41 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id DAA14349; Thu, 22 May 2003 03:40:58 -0700 Date: Thu, 22 May 2003 03:40:58 -0700 (PDT) Message-Id: <20030522.034058.71558626.davem@redhat.com> To: sim@netnation.com Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030522.015815.91322249.davem@redhat.com> References: <20030520.173607.88482742.davem@redhat.com> <20030522084003.GA22613@netnation.com> <20030522.015815.91322249.davem@redhat.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2680 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 From: "David S. Miller" Date: Thu, 22 May 2003 01:58:15 -0700 (PDT) Alexey, I will try to make something... Simon (and others who want to benchmark :-), give this patch below a try. It applies cleanly to both 2.4.x and 2.5.x kernels. Alexey, note the funny inaccurate comment found here, it totally invalidates "fast computer" comment found a few lines below this. Actually, much of this code wants some major cleanups. It is even quite costly to do these "u32 struct" things, especially on RISC. Alexey no longer makes major surgery in this area, so they may be undone. :) Next experiment can be to reimplement fn_hash() as: #include static fn_hash_idx_t fn_hash(fn_key_t key, struct fn_zone *fz) { u32 h = ntohl(key.datum)>>(32 - fz->fz_order); jhash_1word(h, 0); h &= FZ_HASHMASK(fz); return *(fn_hash_idx_t*)&h; } or something like that. It is assuming we find some problems with hash distribution when using huge number of routes. Someone will need to add fib_hash lookup statistics in order to determine this. Anyways, testers please let us know the results. Note you must have CONFIG_IP_ROUTE_LARGE_TABLES (and thus CONFIG_IP_ADVANCED_ROUTER) in order to even make use of this stuff. Thanks. --- net/ipv4/fib_hash.c.~1~ Thu May 22 02:47:17 2003 +++ net/ipv4/fib_hash.c Thu May 22 03:27:12 2003 @@ -89,7 +89,7 @@ int fz_nent; /* Number of entries */ int fz_divisor; /* Hash divisor */ - u32 fz_hashmask; /* (1<fz_hashmask) int fz_order; /* Zone order */ @@ -149,7 +149,30 @@ static rwlock_t fib_hash_lock = RW_LOCK_UNLOCKED; -#define FZ_MAX_DIVISOR 1024 +#define FZ_MAX_DIVISOR ((PAGE_SIZE<= size) + break; + } + return order; +} + +static struct fib_node **fz_hash_alloc(int divisor) +{ + unsigned long size = divisor * sizeof(struct fib_node *); + + if (divisor <= 1024) { + return kmalloc(size, GFP_KERNEL); + } else { + return (struct fib_node **) + __get_free_pages(GFP_KERNEL, size_to_order(size)); + } +} #ifdef CONFIG_IP_ROUTE_LARGE_TABLES @@ -174,6 +197,15 @@ } } +static void fz_hash_free(struct fib_node **hash, int divisor) +{ + if (divisor <= 1024) + kfree(hash); + else + free_pages((unsigned long) hash, + size_to_order(divisor * sizeof(struct fib_node *))); +} + static void fn_rehash_zone(struct fn_zone *fz) { struct fib_node **ht, **old_ht; @@ -185,24 +217,30 @@ switch (old_divisor) { case 16: new_divisor = 256; - new_hashmask = 0xFF; break; case 256: new_divisor = 1024; - new_hashmask = 0x3FF; break; default: - printk(KERN_CRIT "route.c: bad divisor %d!\n", old_divisor); - return; + if ((old_divisor << 1) > FZ_MAX_DIVISOR) { + printk(KERN_CRIT "route.c: bad divisor %d!\n", old_divisor); + return; + } + new_divisor = (old_divisor << 1); + break; } + + new_hashmask = (new_divisor - 1); + #if RT_CACHE_DEBUG >= 2 printk("fn_rehash_zone: hash for zone %d grows from %d\n", fz->fz_order, old_divisor); #endif - ht = kmalloc(new_divisor*sizeof(struct fib_node*), GFP_KERNEL); + ht = fz_hash_alloc(new_divisor); if (ht) { memset(ht, 0, new_divisor*sizeof(struct fib_node*)); + write_lock_bh(&fib_hash_lock); old_ht = fz->fz_hash; fz->fz_hash = ht; @@ -210,7 +248,8 @@ fz->fz_divisor = new_divisor; fn_rebuild_zone(fz, old_ht, old_divisor); write_unlock_bh(&fib_hash_lock); - kfree(old_ht); + + fz_hash_free(old_ht, old_divisor); } } #endif /* CONFIG_IP_ROUTE_LARGE_TABLES */ @@ -233,12 +272,11 @@ memset(fz, 0, sizeof(struct fn_zone)); if (z) { fz->fz_divisor = 16; - fz->fz_hashmask = 0xF; } else { fz->fz_divisor = 1; - fz->fz_hashmask = 0; } - fz->fz_hash = kmalloc(fz->fz_divisor*sizeof(struct fib_node*), GFP_KERNEL); + fz->fz_hashmask = (fz->fz_divisor - 1); + fz->fz_hash = fz_hash_alloc(fz->fz_divisor); if (!fz->fz_hash) { kfree(fz); return NULL; @@ -468,7 +506,7 @@ return err; #ifdef CONFIG_IP_ROUTE_LARGE_TABLES - if (fz->fz_nent > (fz->fz_divisor<<2) && + if (fz->fz_nent > (fz->fz_divisor<<1) && fz->fz_divisor < FZ_MAX_DIVISOR && (z==32 || (1< fz->fz_divisor)) fn_rehash_zone(fz); From gandalf@wlug.westbo.se Thu May 22 04:15:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 04:16:24 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MBFh2x026385 for ; Thu, 22 May 2003 04:15:45 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 7C6D136FDD; Thu, 22 May 2003 13:15:39 +0200 (CEST) Subject: Re: Route cache performance under stress From: Martin Josefsson To: "David S. Miller" Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org In-Reply-To: <20030522.034058.71558626.davem@redhat.com> References: <20030520.173607.88482742.davem@redhat.com> <20030522084003.GA22613@netnation.com> <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053602138.9475.34.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 22 May 2003 13:15:39 +0200 X-archive-position: 2681 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Thu, 2003-05-22 at 12:40, David S. Miller wrote: > +static unsigned long size_to_order(unsigned long size) > +{ > + unsigned long order; > + > + for (order = 0; order < MAX_ORDER; order++) { > + if ((PAGE_SIZE << order) >= size) > + break; > + } > + return order; > +} Any reason you're not using get_order() ? -- /Martin From sim@netnation.com Thu May 22 04:44:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 04:45:14 -0700 (PDT) Received: from peace.netnation.com (newpeace.netnation.com [204.174.223.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MBie2x026930 for ; Thu, 22 May 2003 04:44:40 -0700 Received: from sim by peace.netnation.com with local (Exim 4.20) id 19IoUw-0005gw-KD; Thu, 22 May 2003 04:44:38 -0700 Date: Thu, 22 May 2003 04:44:38 -0700 From: Simon Kirby To: "David S. Miller" Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress Message-ID: <20030522114438.GD2961@netnation.com> References: <20030520.173607.88482742.davem@redhat.com> <20030522084003.GA22613@netnation.com> <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030522.034058.71558626.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 2682 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sim@netnation.com Precedence: bulk X-list: netdev On Thu, May 22, 2003 at 03:40:58AM -0700, David S. Miller wrote: > Simon (and others who want to benchmark :-), give this patch below a > try. Compiling it now... :) There's no APIC on this test box, so it's using the XT-PIC. Production has an APIC, so I assume the overhead would be less there. CONFIG_IP_ROUTE_LARGE_TABLES is and was enabled. My dumb route populator script was just creating /32 routes. > Anyways, testers please let us know the results. Note you must > have CONFIG_IP_ROUTE_LARGE_TABLES (and thus CONFIG_IP_ADVANCED_ROUTER) > in order to even make use of this stuff. Nice! I tested with 300,000 routing table entries and there is no discernable difference in performance from having an empty table. vmstat shows the same idle time as when the routing table is empty. I enabled the hash growing debug printk, and so I saw this while populating the route table: fn_rehash_zone: hash for zone 32 grows from 16 fn_rehash_zone: hash for zone 32 grows from 256 fn_rehash_zone: hash for zone 32 grows from 1024 fn_rehash_zone: hash for zone 32 grows from 2048 fn_rehash_zone: hash for zone 32 grows from 4096 fn_rehash_zone: hash for zone 32 grows from 8192 fn_rehash_zone: hash for zone 32 grows from 16384 fn_rehash_zone: hash for zone 32 grows from 32768 fn_rehash_zone: hash for zone 32 grows from 65536 fn_rehash_zone: hash for zone 32 grows from 131072 I had originally written a patch to try to extend it to 8192, but I think it was broken. This definitely seems to fix it. If you'd like I can try to regenerate a profile, but you probably already know what it will look like. Thanks! Simon- (Zzz...) From gandalf@wlug.westbo.se Thu May 22 06:03:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 06:03:46 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MD3A2x029294 for ; Thu, 22 May 2003 06:03:11 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 5B0D236FDD; Thu, 22 May 2003 15:03:07 +0200 (CEST) Subject: Re: Route cache performance under stress From: Martin Josefsson To: Simon Kirby Cc: "David S. Miller" , netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru In-Reply-To: <20030522114438.GD2961@netnation.com> References: <20030520.173607.88482742.davem@redhat.com> <20030522084003.GA22613@netnation.com> <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <20030522114438.GD2961@netnation.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1053608586.9475.60.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 22 May 2003 15:03:07 +0200 X-archive-position: 2683 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Thu, 2003-05-22 at 13:44, Simon Kirby wrote: > Nice! I tested with 300,000 routing table entries and there is no > discernable difference in performance from having an empty table. > vmstat shows the same idle time as when the routing table is empty. How much memory does a table that large use? -- /Martin From sommere@ethanet.com Thu May 22 07:40:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 07:41:05 -0700 (PDT) Received: from kona.carleton.edu (Kona.Carleton.edu [137.22.93.220]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MEeP2x032292 for ; Thu, 22 May 2003 07:40:26 -0700 Received: from ethanet.com (pcSommerE.Res.Carleton.edu [137.22.99.222]) by carleton.edu (PMDF V6.2 #30648) with ESMTPA id <0HFA00JJIM331H@carleton.edu> for netdev@oss.sgi.com; Thu, 22 May 2003 09:40:15 -0500 (CDT) Date: Thu, 22 May 2003 09:40:17 -0500 From: Ethan Sommer Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] In-reply-to: To: Philippe Biondi Cc: Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Message-id: <3ECCE151.8000903@ethanet.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030515 Thunderbird/0.1a References: X-archive-position: 2684 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sommere@ethanet.com Precedence: bulk X-list: netdev Philippe Biondi wrote: >>I take it back, it is regular (kinda) but you can't to it with a >>deterministic finite atomaton. If there is a cycle in pattern1, off of >>which pattern2 has a branch, then you would need to count how many times >>you have gone around the cycle to know where to jump to in pattern2 if >>it fails to match pattern1 (which you can't do, pumping lemma and all >>that.) If you use a non-determistic FA, you should be able to just go >>through each pattern until both crash or one matches and declare that >>the winner. >> >> > > >Strange way of reasoning... what if pattern1 is "(subpat1|subpat2)" ? >regexp is a regular language so it is equivalent to a DFA. >For every NDFA, there exist a DFA that recognize the same language. >So, it is possible. > That is true only if you only care if either are matched. Not if you care which is matched. By combining them you lose the ability to tell which matched. > >The question is : will we have enough memory to store a DFA that recognize >a big regexp ? The answer is : let loose some speed and use NDFA. > > you will have to for the reason above. From daniel@osdl.org Thu May 22 09:14:50 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 09:15:27 -0700 (PDT) Received: from mail.osdl.org ([208.186.192.194]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MGEl2x002237 for ; Thu, 22 May 2003 09:14:50 -0700 Received: from ibm-c.pdx.osdl.net (ibm-c.pdx.osdl.net [172.20.1.54]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h4MGEDW23713; Thu, 22 May 2003 09:14:14 -0700 Subject: Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT From: Daniel McNeil To: "David S. Miller" Cc: acme@conectiva.com.br, ncorbic@sangoma.com, dm@sangoma.com, netdev@oss.sgi.com In-Reply-To: <20030521.162707.88487215.davem@redhat.com> References: <1053550112.2444.35.camel@ibm-c.pdx.osdl.net> <20030521231801.GE10295@conectiva.com.br> <20030521.162707.88487215.davem@redhat.com> Content-Type: text/plain Organization: Message-Id: <1053620053.2441.56.camel@ibm-c.pdx.osdl.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 22 May 2003 09:14:14 -0700 Content-Transfer-Encoding: 7bit X-archive-position: 2685 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: daniel@osdl.org Precedence: bulk X-list: netdev On Wed, 2003-05-21 at 16:27, David S. Miller wrote: > From: Arnaldo Carvalho de Melo > Date: Wed, 21 May 2003 20:18:01 -0300 > > Already submitted to DaveM, CCed netdev, I'll fix this later > tonight. > > Note that, as I said in another email, these MOD_* calls can't just be > deleted, the PROCFS registry etc. have to set ->owner fields correctly > before this is valid. > > By just removing MOD_*(), I can load just wanrouter, open a proc file, > unload the wanrouter module, and crash. The proc file looked like a separate problem. The MOD_* calls I removed were in register_wan_device/unregister_wan_device, so these did not protect the procfs entries for wanrouter. If another module called register_wan_device, the wanrouter module couldn't be unloaded because of the symbol reference. Of course, the modules that call register_wan_device also need to kept from being unloaded until have unregister_wan_device. Again, I thought these were separate problems. Arnaldo, sorry about the conflicting patch. We in the middle of moving and I hadn't had a chance to catch up on the mailing list. -- Daniel McNeil From toml@us.ibm.com Thu May 22 11:16:55 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 11:17:28 -0700 (PDT) Received: from e1.ny.us.ibm.com (e1.ny.us.ibm.com [32.97.182.101]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4MIGl2x004089 for ; Thu, 22 May 2003 11:16:54 -0700 Received: from northrelay01.pok.ibm.com (northrelay01.pok.ibm.com [9.56.224.149]) by e1.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4MIG3Wn092606; Thu, 22 May 2003 14:16:03 -0400 Received: from d01ml072.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by northrelay01.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4MIG0Bi047930; Thu, 22 May 2003 14:16:01 -0400 Subject: IPSec: IPv6 random failures To: netdev@oss.sgi.com Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru X-Mailer: Lotus Notes Release 5.0.11 July 24, 2002 Message-ID: From: "Tom Lendacky" Date: Thu, 22 May 2003 13:15:58 -0500 X-MIMETrack: Serialize by Router on D01ML072/01/M/IBM(Release 5.0.11 +SPRs MIAS5EXFG4, MIAS5AUFPV and DHAG4Y6R7W, MATTEST |November 8th, 2002) at 05/22/2003 02:16:01 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-archive-position: 2686 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: toml@us.ibm.com Precedence: bulk X-list: netdev Every now and then I see some failures in the TAHI tests that I am running on IPv6. The scenario has to do with two tunnel SP entries and the corresponding SA entries on a system and sending an echo reply to each (unique) destination in each SP. The first echo reply is successfully processed, but the second one is not. After looking further, it appears that the following occurs: - For the first echo reply, during the xfrm_lookup a flow lookup is performed and a flow cache entry created. - For the second echo reply (to a different destination than the first one), during the xfrm_lookup a flow lookup is performed and matches the previously created flow cache entry, even though it shouldn't. It turns out that the flowi structure uses pointers to the IPv6 addresses (whereas IPv4 uses the actual address) and that even though the actual destination IPv6 addresses are different between the first and second echo reply, the pointers are not (actually the pointers to both the source and destination in6_addr structures are the same). Since the pointers are the same the flowi compare is successful and the cache entry is used, which, for the second echo reply, does not point to the correct policy. It would seem that the flowi structure should use the actual IPv6 addresses instead of pointers to them, like the IPv4 section does. Feedback? Thanks, Tom From davem@redhat.com Thu May 22 15:35:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 15:35:51 -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.9) with SMTP id h4MMZD2x007038 for ; Thu, 22 May 2003 15:35:16 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id PAA15549; Thu, 22 May 2003 15:33:31 -0700 Date: Thu, 22 May 2003 15:33:30 -0700 (PDT) Message-Id: <20030522.153330.74735095.davem@redhat.com> To: sim@netnation.com Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030522114438.GD2961@netnation.com> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <20030522114438.GD2961@netnation.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2687 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 From: Simon Kirby Date: Thu, 22 May 2003 04:44:38 -0700 If you'd like I can try to regenerate a profile, but you probably already know what it will look like. I obviously know some things that will change, but I am still very much interested in new profiles. From davem@redhat.com Thu May 22 15:55:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 15:56: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.9) with SMTP id h4MMtp2x007531 for ; Thu, 22 May 2003 15:55:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id PAA15635; Thu, 22 May 2003 15:54:08 -0700 Date: Thu, 22 May 2003 15:54:08 -0700 (PDT) Message-Id: <20030522.155408.85396915.davem@redhat.com> To: toml@us.ibm.com Cc: netdev@oss.sgi.com, kuznet@ms2.inr.ac.ru Subject: Re: IPSec: IPv6 random failures From: "David S. Miller" In-Reply-To: References: X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2688 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 From: "Tom Lendacky" Date: Thu, 22 May 2003 13:15:58 -0500 It would seem that the flowi structure should use the actual IPv6 addresses instead of pointers to them, like the IPv4 section does. Feedback? Yes, precisely, thanks for spotting this. I introduced this bug when I split out the policy flow cache into a generic spot. I'll see how much work it is to change all of ipv6 to store addresses directly into the flowi's instead of via pointers. From muizelaar@rogers.com Thu May 22 17:41:12 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 17:41:48 -0700 (PDT) Received: from fep01-mail.bloor.is.net.cable.rogers.com (fep01-mail.bloor.is.net.cable.rogers.com [66.185.86.71]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4N0fB2x008673 for ; Thu, 22 May 2003 17:41:11 -0700 Received: from rogers.com ([24.43.126.4]) by fep01-mail.bloor.is.net.cable.rogers.com (InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id <20030523004049.SQLV518358.fep01-mail.bloor.is.net.cable.rogers.com@rogers.com>; Thu, 22 May 2003 20:40:49 -0400 Message-ID: <3ECD6E2D.5090000@rogers.com> Date: Thu, 22 May 2003 20:41:17 -0400 From: Jeff Muizelaar User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030327 Debian/1.3-4 X-Accept-Language: en MIME-Version: 1.0 To: shemminger@osdl.org CC: netdev@oss.sgi.com Subject: [PATCH] post-sysfs netdev cleanup Content-Type: multipart/mixed; boundary="------------090507050505030501060708" X-Authentication-Info: Submitted using SMTP AUTH PLAIN at fep01-mail.bloor.is.net.cable.rogers.com from [24.43.126.4] using ID at Thu, 22 May 2003 20:40:49 -0400 X-archive-position: 2689 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: muizelaar@rogers.com Precedence: bulk X-list: netdev This is a multi-part message in MIME format. --------------090507050505030501060708 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit The attached patch removes the struct device from struct net_device and sets net_device.class_dev.dev directly. The class_dev memset is removed because all of struct net_device should already be memset to 0 or there will be other problems. -Jeff --------------090507050505030501060708 Content-Type: text/plain; name="netdev-cleanup.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="netdev-cleanup.patch" diff -urN linux-2.5.69-bk15/include/linux/netdevice.h linux-2.5.69-bk15-netdev-cleanup/include/linux/netdevice.h --- linux-2.5.69-bk15/include/linux/netdevice.h 2003-05-22 20:14:06.000000000 -0400 +++ linux-2.5.69-bk15-netdev-cleanup/include/linux/netdevice.h 2003-05-22 20:15:56.000000000 -0400 @@ -441,9 +441,6 @@ struct divert_blk *divert; #endif /* CONFIG_NET_DIVERT */ - /* generic device structure used in constructing class */ - struct device *dev; - /* class/net/name entry */ struct class_device class_dev; @@ -455,7 +452,7 @@ /* Set the sysfs physical device reference for the network logical device * if set prior to registration will cause a symlink during initialization. */ -#define SET_NETDEV_DEV(net, pdev) ((net)->dev = (pdev)) +#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) struct packet_type diff -urN linux-2.5.69-bk15/net/core/net-sysfs.c linux-2.5.69-bk15-netdev-cleanup/net/core/net-sysfs.c --- linux-2.5.69-bk15/net/core/net-sysfs.c 2003-05-22 20:14:08.000000000 -0400 +++ linux-2.5.69-bk15-netdev-cleanup/net/core/net-sysfs.c 2003-05-22 20:15:56.000000000 -0400 @@ -291,9 +291,7 @@ struct class_device_attribute *attr; int ret; - memset(class_dev, 0, sizeof(struct class_device)); class_dev->class = &net_class; - class_dev->dev = net->dev; class_dev->class_data = net; snprintf(class_dev->class_id, BUS_ID_SIZE, net->name); --------------090507050505030501060708-- From davem@redhat.com Thu May 22 17:45:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 17:45: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.9) with SMTP id h4N0j42x009021 for ; Thu, 22 May 2003 17:45:05 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA15929; Thu, 22 May 2003 17:43:18 -0700 Date: Thu, 22 May 2003 17:43:17 -0700 (PDT) Message-Id: <20030522.174317.21915853.davem@redhat.com> To: toml@us.ibm.com Cc: netdev@oss.sgi.com, kuznet@ms2.inr.ac.ru Subject: Re: IPSec: IPv6 random failures From: "David S. Miller" In-Reply-To: <20030522.155408.85396915.davem@redhat.com> References: <20030522.155408.85396915.davem@redhat.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2690 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 From: "David S. Miller" Date: Thu, 22 May 2003 15:54:08 -0700 (PDT) I'll see how much work it is to change all of ipv6 to store addresses directly into the flowi's instead of via pointers. Whoa, what a rats nest area of the ipv6 stack :-((( Ok, this cleaned up a LOT of crap. Silly kmalloc's of in6_addr objects and all sorts of junk like that (especially ip6_dst_lookup()). The rt0_hdr handling was a little tricky, but I think I got it all sorted out. Can someone review and stress test out this patch for me? One thing to look out for are not-fully initialized flowi structures. Ie. there are only two valid ways to setup such objects: struct flowi fl = { .foo = x, .bar = y, ... }; and struct flowi fl; memset(&fl, 0, sizeof(fl)); fl.foo = x; fl.bar = y; ... So if there are any cases left that don't do this correctly please let me know. --- ./include/net/flow.h.~1~ Thu May 22 15:58:19 2003 +++ ./include/net/flow.h Thu May 22 17:25:11 2003 @@ -7,6 +7,8 @@ #ifndef _NET_FLOW_H #define _NET_FLOW_H +#include + struct flowi { int oif; int iif; @@ -21,8 +23,8 @@ struct flowi { } ip4_u; struct { - struct in6_addr * daddr; - struct in6_addr * saddr; + struct in6_addr daddr; + struct in6_addr saddr; __u32 flowlabel; } ip6_u; --- ./include/net/xfrm.h.~1~ Thu May 22 16:00:14 2003 +++ ./include/net/xfrm.h Thu May 22 16:00:49 2003 @@ -315,14 +315,14 @@ static inline u32 __flow_hash4(struct fl static inline u32 __flow_hash6(struct flowi *fl) { - u32 hash = fl->fl6_src->s6_addr32[2] ^ - fl->fl6_src->s6_addr32[3] ^ + u32 hash = fl->fl6_src.s6_addr32[2] ^ + fl->fl6_src.s6_addr32[3] ^ fl->fl_ip_sport; hash = ((hash & 0xF0F0F0F0) >> 4) | ((hash & 0x0F0F0F0F) << 4); - hash ^= fl->fl6_dst->s6_addr32[2] ^ - fl->fl6_dst->s6_addr32[3] ^ + hash ^= fl->fl6_dst.s6_addr32[2] ^ + fl->fl6_dst.s6_addr32[3] ^ fl->fl_ip_dport; hash ^= (hash >> 10); hash ^= (hash >> 20); @@ -471,8 +471,8 @@ __xfrm4_selector_match(struct xfrm_selec static inline int __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl) { - return addr_match(fl->fl6_dst, &sel->daddr, sel->prefixlen_d) && - addr_match(fl->fl6_src, &sel->saddr, sel->prefixlen_s) && + return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) && + addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) && !((fl->fl_ip_dport^sel->dport)&sel->dport_mask) && !((fl->fl_ip_sport^sel->sport)&sel->sport_mask) && (fl->proto == sel->proto || !sel->proto) && @@ -654,7 +654,7 @@ xfrm_address_t *xfrm_flowi_daddr(struct case AF_INET: return (xfrm_address_t *)&fl->fl4_dst; case AF_INET6: - return (xfrm_address_t *)fl->fl6_dst; + return (xfrm_address_t *)&fl->fl6_dst; } return NULL; } @@ -666,7 +666,7 @@ xfrm_address_t *xfrm_flowi_saddr(struct case AF_INET: return (xfrm_address_t *)&fl->fl4_src; case AF_INET6: - return (xfrm_address_t *)fl->fl6_src; + return (xfrm_address_t *)&fl->fl6_src; } return NULL; } --- ./include/net/ipv6.h.~1~ Thu May 22 16:40:49 2003 +++ ./include/net/ipv6.h Thu May 22 16:41:00 2003 @@ -334,8 +334,7 @@ extern void ip6_flush_pending_frames(s extern int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, - struct flowi *fl, - struct in6_addr **saddr); + struct flowi *fl); /* * skb processing functions --- ./net/ipv6/datagram.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/datagram.c Thu May 22 16:01:17 2003 @@ -80,7 +80,7 @@ void ipv6_local_error(struct sock *sk, i iph = (struct ipv6hdr*)skb_put(skb, sizeof(struct ipv6hdr)); skb->nh.ipv6h = iph; - ipv6_addr_copy(&iph->daddr, fl->fl6_dst); + ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); serr = SKB_EXT_ERR(skb); serr->ee.ee_errno = err; @@ -297,7 +297,8 @@ int datagram_send_ctl(struct msghdr *msg goto exit_f; } - fl->fl6_src = &src_info->ipi6_addr; + ipv6_addr_copy(&fl->fl6_src, + &src_info->ipi6_addr); } break; --- ./net/ipv6/icmp.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/icmp.c Thu May 22 17:36:53 2003 @@ -223,9 +223,10 @@ int icmpv6_push_pending_frames(struct so if (skb_queue_len(&sk->write_queue) == 1) { skb->csum = csum_partial((char *)icmp6h, sizeof(struct icmp6hdr), skb->csum); - icmp6h->icmp6_cksum = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, - len, fl->proto, skb->csum); + icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, + len, fl->proto, + skb->csum); } else { u32 tmp_csum = 0; @@ -235,8 +236,8 @@ int icmpv6_push_pending_frames(struct so tmp_csum = csum_partial((char *)icmp6h, sizeof(struct icmp6hdr), tmp_csum); - tmp_csum = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, + tmp_csum = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, len, fl->proto, tmp_csum); icmp6h->icmp6_cksum = tmp_csum; } @@ -266,7 +267,7 @@ void icmpv6_send(struct sk_buff *skb, in struct ipv6hdr *hdr = skb->nh.ipv6h; struct sock *sk = icmpv6_socket->sk; struct ipv6_pinfo *np = inet6_sk(sk); - struct in6_addr *saddr = NULL, *tmp_saddr = NULL; + struct in6_addr *saddr = NULL; struct dst_entry *dst; struct icmp6hdr tmp_hdr; struct flowi fl; @@ -332,11 +333,12 @@ void icmpv6_send(struct sk_buff *skb, in return; } + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_ICMPV6; - fl.fl6_dst = &hdr->saddr; - fl.fl6_src = saddr; + ipv6_addr_copy(&fl.fl6_dst, &hdr->saddr); + if (saddr) + ipv6_addr_copy(&fl.fl6_src, saddr); fl.oif = iif; - fl.fl6_flowlabel = 0; fl.fl_icmp_type = type; fl.fl_icmp_code = code; @@ -350,14 +352,14 @@ void icmpv6_send(struct sk_buff *skb, in tmp_hdr.icmp6_cksum = 0; tmp_hdr.icmp6_pointer = htonl(info); - if (!fl.oif && ipv6_addr_is_multicast(fl.fl6_dst)) + if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) fl.oif = np->mcast_oif; - err = ip6_dst_lookup(sk, &dst, &fl, &tmp_saddr); + err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; if (hlimit < 0) { - if (ipv6_addr_is_multicast(fl.fl6_dst)) + if (ipv6_addr_is_multicast(&fl.fl6_dst)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; @@ -394,7 +396,6 @@ void icmpv6_send(struct sk_buff *skb, in if (likely(idev != NULL)) in6_dev_put(idev); out: - if (tmp_saddr) kfree(tmp_saddr); icmpv6_xmit_unlock(); } @@ -403,7 +404,7 @@ static void icmpv6_echo_reply(struct sk_ struct sock *sk = icmpv6_socket->sk; struct inet6_dev *idev; struct ipv6_pinfo *np = inet6_sk(sk); - struct in6_addr *saddr = NULL, *tmp_saddr = NULL; + struct in6_addr *saddr = NULL; struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; struct icmp6hdr tmp_hdr; struct flowi fl; @@ -420,25 +421,25 @@ static void icmpv6_echo_reply(struct sk_ memcpy(&tmp_hdr, icmph, sizeof(tmp_hdr)); tmp_hdr.icmp6_type = ICMPV6_ECHO_REPLY; + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_ICMPV6; - fl.fl6_dst = &skb->nh.ipv6h->saddr; - fl.fl6_src = saddr; + ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); + if (saddr) + ipv6_addr_copy(&fl.fl6_src, saddr); fl.oif = skb->dev->ifindex; - fl.fl6_flowlabel = 0; fl.fl_icmp_type = ICMPV6_ECHO_REPLY; - fl.fl_icmp_code = 0; icmpv6_xmit_lock(); - if (!fl.oif && ipv6_addr_is_multicast(fl.nl_u.ip6_u.daddr)) + if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) fl.oif = np->mcast_oif; - err = ip6_dst_lookup(sk, &dst, &fl, &tmp_saddr); + err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; if (hlimit < 0) { - if (ipv6_addr_is_multicast(fl.fl6_dst)) + if (ipv6_addr_is_multicast(&fl.fl6_dst)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; @@ -464,7 +465,6 @@ static void icmpv6_echo_reply(struct sk_ if (likely(idev != NULL)) in6_dev_put(idev); out: - if (tmp_saddr) kfree(tmp_saddr); icmpv6_xmit_unlock(); } --- ./net/ipv6/ip6_output.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/ip6_output.c Thu May 22 17:27:35 2003 @@ -152,15 +152,14 @@ int ip6_route_me_harder(struct sk_buff * { struct ipv6hdr *iph = skb->nh.ipv6h; struct dst_entry *dst; - struct flowi fl; - - fl.proto = iph->nexthdr; - fl.fl6_dst = &iph->daddr; - fl.fl6_src = &iph->saddr; - fl.oif = skb->sk ? skb->sk->bound_dev_if : 0; - fl.fl6_flowlabel = 0; - fl.fl_ip_dport = 0; - fl.fl_ip_sport = 0; + struct flowi fl = { + .oif = skb->sk ? skb->sk->bound_dev_if : 0, + .nl_u = + { .ip6_u = + { .daddr = iph->daddr, + .saddr = iph->saddr, } }, + .proto = iph->nexthdr, + }; dst = ip6_route_output(skb->sk, &fl); @@ -200,7 +199,7 @@ int ip6_xmit(struct sock *sk, struct sk_ struct ipv6_txoptions *opt) { struct ipv6_pinfo *np = sk ? inet6_sk(sk) : NULL; - struct in6_addr *first_hop = fl->fl6_dst; + struct in6_addr *first_hop = &fl->fl6_dst; struct dst_entry *dst = skb->dst; struct ipv6hdr *hdr; u8 proto = fl->proto; @@ -255,7 +254,7 @@ int ip6_xmit(struct sock *sk, struct sk_ hdr->nexthdr = proto; hdr->hop_limit = hlimit; - ipv6_addr_copy(&hdr->saddr, fl->fl6_src); + ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); ipv6_addr_copy(&hdr->daddr, first_hop); mtu = dst_pmtu(dst); @@ -320,8 +319,8 @@ static struct ipv6hdr * ip6_bld_1(struct hdr->hop_limit = hlimit; hdr->nexthdr = fl->proto; - ipv6_addr_copy(&hdr->saddr, fl->fl6_src); - ipv6_addr_copy(&hdr->daddr, fl->fl6_dst); + ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); + ipv6_addr_copy(&hdr->daddr, &fl->fl6_dst); return hdr; } @@ -526,19 +525,19 @@ int ip6_build_xmit(struct sock *sk, inet { struct inet_opt *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); - struct in6_addr *final_dst = NULL; + struct in6_addr final_dst_buf, *final_dst = NULL; struct dst_entry *dst; int err = 0; unsigned int pktlength, jumbolen, mtu; - struct in6_addr saddr; if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; - final_dst = fl->fl6_dst; - fl->fl6_dst = rt0->addr; + ipv6_addr_copy(&final_dst_buf, &fl->fl6_dst); + final_dst = &final_dst_buf; + ipv6_addr_copy(&fl->fl6_dst, rt0->addr); } - if (!fl->oif && ipv6_addr_is_multicast(fl->fl6_dst)) + if (!fl->oif && ipv6_addr_is_multicast(&fl->fl6_dst)) fl->oif = np->mcast_oif; dst = __sk_dst_check(sk, np->dst_cookie); @@ -564,9 +563,9 @@ int ip6_build_xmit(struct sock *sk, inet */ if (((rt->rt6i_dst.plen != 128 || - ipv6_addr_cmp(fl->fl6_dst, &rt->rt6i_dst.addr)) + ipv6_addr_cmp(&fl->fl6_dst, &rt->rt6i_dst.addr)) && (np->daddr_cache == NULL || - ipv6_addr_cmp(fl->fl6_dst, np->daddr_cache))) + ipv6_addr_cmp(&fl->fl6_dst, np->daddr_cache))) || (fl->oif && fl->oif != dst->dev->ifindex)) { dst = NULL; } else @@ -582,8 +581,8 @@ int ip6_build_xmit(struct sock *sk, inet return -ENETUNREACH; } - if (fl->fl6_src == NULL) { - err = ipv6_get_saddr(dst, fl->fl6_dst, &saddr); + if (ipv6_addr_any(&fl->fl6_src)) { + err = ipv6_get_saddr(dst, &fl->fl6_dst, &fl->fl6_src); if (err) { #if IP6_DEBUG >= 2 @@ -592,7 +591,6 @@ int ip6_build_xmit(struct sock *sk, inet #endif goto out; } - fl->fl6_src = &saddr; } pktlength = length; @@ -604,7 +602,7 @@ int ip6_build_xmit(struct sock *sk, inet } if (hlimit < 0) { - if (ipv6_addr_is_multicast(fl->fl6_dst)) + if (ipv6_addr_is_multicast(&fl->fl6_dst)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; @@ -715,7 +713,9 @@ int ip6_build_xmit(struct sock *sk, inet * cleanup */ out: - ip6_dst_store(sk, dst, fl->fl6_dst == &np->daddr ? &np->daddr : NULL); + ip6_dst_store(sk, dst, + !ipv6_addr_cmp(&fl->fl6_dst, &np->daddr) ? + &np->daddr : NULL); if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; return err; @@ -1135,7 +1135,7 @@ fail: return err; } -int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl, struct in6_addr **saddr) +int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) { struct ipv6_pinfo *np = inet6_sk(sk); int err = 0; @@ -1163,9 +1163,9 @@ int ip6_dst_lookup(struct sock *sk, stru */ if (((rt->rt6i_dst.plen != 128 || - ipv6_addr_cmp(fl->fl6_dst, &rt->rt6i_dst.addr)) + ipv6_addr_cmp(&fl->fl6_dst, &rt->rt6i_dst.addr)) && (np->daddr_cache == NULL || - ipv6_addr_cmp(fl->fl6_dst, np->daddr_cache))) + ipv6_addr_cmp(&fl->fl6_dst, np->daddr_cache))) || (fl->oif && fl->oif != (*dst)->dev->ifindex)) { *dst = NULL; } else @@ -1181,9 +1181,8 @@ int ip6_dst_lookup(struct sock *sk, stru return -ENETUNREACH; } - if (fl->fl6_src == NULL) { - *saddr = kmalloc(sizeof(struct in6_addr), GFP_ATOMIC); - err = ipv6_get_saddr(*dst, fl->fl6_dst, *saddr); + if (ipv6_addr_any(&fl->fl6_src)) { + err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src); if (err) { #if IP6_DEBUG >= 2 @@ -1192,7 +1191,6 @@ int ip6_dst_lookup(struct sock *sk, stru #endif return err; } - fl->fl6_src = *saddr; } if (*dst) { @@ -1415,7 +1413,7 @@ int ip6_push_pending_frames(struct sock { struct sk_buff *skb, *tmp_skb; struct sk_buff **tail_skb; - struct in6_addr *final_dst = NULL; + struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; struct inet_opt *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *hdr; @@ -1446,7 +1444,7 @@ int ip6_push_pending_frames(struct sock #endif } - final_dst = fl->fl6_dst; + ipv6_addr_copy(final_dst, &fl->fl6_dst); __skb_pull(skb, skb->h.raw - skb->nh.raw); if (opt && opt->opt_flen) ipv6_push_frag_opts(skb, opt, &proto); @@ -1463,7 +1461,7 @@ int ip6_push_pending_frames(struct sock hdr->payload_len = 0; hdr->hop_limit = np->hop_limit; hdr->nexthdr = proto; - ipv6_addr_copy(&hdr->saddr, fl->fl6_src); + ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); ipv6_addr_copy(&hdr->daddr, final_dst); skb->dst = dst_clone(&rt->u.dst); --- ./net/ipv6/raw.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/raw.c Thu May 22 16:57:18 2003 @@ -461,9 +461,9 @@ static int rawv6_push_pending_frames(str * Only one fragment on the socket. */ /* should be check HW csum miyazawa */ - *csum = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, - len, fl->proto, skb->csum); + *csum = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, + len, fl->proto, skb->csum); } else { u32 tmp_csum = 0; @@ -471,9 +471,9 @@ static int rawv6_push_pending_frames(str tmp_csum = csum_add(tmp_csum, skb->csum); } - tmp_csum = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, - len, fl->proto, tmp_csum); + tmp_csum = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, + len, fl->proto, tmp_csum); *csum = tmp_csum; } if (*csum == 0) @@ -540,7 +540,7 @@ static int rawv6_sendmsg(struct kiocb *i { struct ipv6_txoptions opt_space; struct sockaddr_in6 * sin6 = (struct sockaddr_in6 *) msg->msg_name; - struct in6_addr *daddr, *saddr = NULL; + struct in6_addr *daddr; struct inet_opt *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct raw6_opt *raw_opt = raw6_sk(sk); @@ -566,9 +566,7 @@ static int rawv6_sendmsg(struct kiocb *i /* * Get and verify the address. */ - - fl.fl6_flowlabel = 0; - fl.oif = 0; + memset(&fl, 0, sizeof(fl)); if (sin6) { if (addr_len < SIN6_LEN_RFC2133) @@ -628,7 +626,6 @@ static int rawv6_sendmsg(struct kiocb *i if (fl.oif == 0) fl.oif = sk->bound_dev_if; - fl.fl6_src = NULL; if (msg->msg_controllen) { opt = &opt_space; @@ -653,26 +650,25 @@ static int rawv6_sendmsg(struct kiocb *i opt = fl6_merge_options(&opt_space, flowlabel, opt); fl.proto = proto; - fl.fl6_dst = daddr; - if (fl.fl6_src == NULL && !ipv6_addr_any(&np->saddr)) - fl.fl6_src = &np->saddr; - fl.fl_icmp_type = 0; - fl.fl_icmp_code = 0; + ipv6_addr_copy(&fl.fl6_dst, daddr); + if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) + ipv6_addr_copy(&fl.fl6_src, &np->saddr); /* merge ip6_build_xmit from ip6_output */ if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } - if (!fl.oif && ipv6_addr_is_multicast(fl.nl_u.ip6_u.daddr)) + if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) fl.oif = np->mcast_oif; - err = ip6_dst_lookup(sk, &dst, &fl, &saddr); - if (err) goto out; + err = ip6_dst_lookup(sk, &dst, &fl); + if (err) + goto out; if (hlimit < 0) { - if (ipv6_addr_is_multicast(fl.fl6_dst)) + if (ipv6_addr_is_multicast(&fl.fl6_dst)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; @@ -702,14 +698,15 @@ back_from_confirm: } } done: - ip6_dst_store(sk, dst, fl.nl_u.ip6_u.daddr == &np->daddr ? &np->daddr : NULL); + ip6_dst_store(sk, dst, + !ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ? + &np->daddr : NULL); if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); out: fl6_sock_release(flowlabel); - if (saddr) kfree(saddr); return err<0?err:len; do_confirm: dst_confirm(dst); --- ./net/ipv6/udp.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/udp.c Thu May 22 17:15:56 2003 @@ -270,7 +270,7 @@ int udpv6_connect(struct sock *sk, struc if (usin->sin6_family != AF_INET6) return -EAFNOSUPPORT; - fl.fl6_flowlabel = 0; + memset(&fl, 0, sizeof(fl)); if (np->sndflow) { fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK; if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { @@ -350,8 +350,8 @@ ipv4_connected: */ fl.proto = IPPROTO_UDP; - fl.fl6_dst = &np->daddr; - fl.fl6_src = &saddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); + ipv6_addr_copy(&fl.fl6_src, &saddr); fl.oif = sk->bound_dev_if; fl.fl_ip_dport = inet->dport; fl.fl_ip_sport = inet->sport; @@ -362,11 +362,11 @@ ipv4_connected: if (flowlabel) { if (flowlabel->opt && flowlabel->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) flowlabel->opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } } else if (np->opt && np->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } dst = ip6_route_output(sk, &fl); @@ -377,7 +377,7 @@ ipv4_connected: return err; } - ip6_dst_store(sk, dst, fl.fl6_dst); + ip6_dst_store(sk, dst, &fl.fl6_dst); /* get the source address used in the appropriate device */ @@ -784,8 +784,8 @@ static int udp_v6_push_pending_frames(st if (skb_queue_len(&sk->write_queue) == 1) { skb->csum = csum_partial((char *)uh, sizeof(struct udphdr), skb->csum); - uh->check = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, + uh->check = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, up->len, fl->proto, skb->csum); } else { u32 tmp_csum = 0; @@ -795,8 +795,8 @@ static int udp_v6_push_pending_frames(st } tmp_csum = csum_partial((char *)uh, sizeof(struct udphdr), tmp_csum); - tmp_csum = csum_ipv6_magic(fl->fl6_src, - fl->fl6_dst, + tmp_csum = csum_ipv6_magic(&fl->fl6_src, + &fl->fl6_dst, up->len, fl->proto, tmp_csum); uh->check = tmp_csum; @@ -819,7 +819,7 @@ static int udpv6_sendmsg(struct kiocb *i struct inet_opt *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name; - struct in6_addr *daddr, *saddr = NULL; + struct in6_addr *daddr; struct ipv6_txoptions *opt = NULL; struct ip6_flowlabel *flowlabel = NULL; struct flowi fl; @@ -849,8 +849,7 @@ static int udpv6_sendmsg(struct kiocb *i } ulen += sizeof(struct udphdr); - fl.fl6_flowlabel = 0; - fl.oif = 0; + memset(&fl, 0, sizeof(fl)); if (sin6) { if (sin6->sin6_family == AF_INET) { @@ -919,7 +918,6 @@ static int udpv6_sendmsg(struct kiocb *i if (!fl.oif) fl.oif = sk->bound_dev_if; - fl.fl6_src = NULL; if (msg->msg_controllen) { opt = &opt_space; @@ -944,26 +942,27 @@ static int udpv6_sendmsg(struct kiocb *i opt = fl6_merge_options(&opt_space, flowlabel, opt); fl.proto = IPPROTO_UDP; - fl.fl6_dst = daddr; - if (fl.fl6_src == NULL && !ipv6_addr_any(&np->saddr)) - fl.fl6_src = &np->saddr; + ipv6_addr_copy(&fl.fl6_dst, daddr); + if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) + ipv6_addr_copy(&fl.fl6_src, &np->saddr); fl.fl_ip_dport = up->dport; fl.fl_ip_sport = inet->sport; /* merge ip6_build_xmit from ip6_output */ if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } - if (!fl.oif && ipv6_addr_is_multicast(fl.nl_u.ip6_u.daddr)) + if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) fl.oif = np->mcast_oif; - err = ip6_dst_lookup(sk, &dst, &fl, &saddr); - if (err) goto out; + err = ip6_dst_lookup(sk, &dst, &fl); + if (err) + goto out; if (hlimit < 0) { - if (ipv6_addr_is_multicast(fl.fl6_dst)) + if (ipv6_addr_is_multicast(&fl.fl6_dst)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; @@ -998,13 +997,14 @@ do_append_data: else if (!corkreq) err = udp_v6_push_pending_frames(sk, up); - ip6_dst_store(sk, dst, fl.nl_u.ip6_u.daddr == &np->daddr ? &np->daddr : NULL); + ip6_dst_store(sk, dst, + !ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ? + &np->daddr : NULL); if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); out: fl6_sock_release(flowlabel); - if (saddr) kfree(saddr); if (!err) { UDP6_INC_STATS_USER(UdpOutDatagrams); return len; --- ./net/ipv6/ndisc.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/ndisc.c Thu May 22 16:51:55 2003 @@ -405,8 +405,8 @@ static inline void ndisc_flow_init(struc struct in6_addr *saddr, struct in6_addr *daddr) { memset(fl, 0, sizeof(*fl)); - fl->fl6_src = saddr; - fl->fl6_dst = daddr; + ipv6_addr_copy(&fl->fl6_src, saddr); + ipv6_addr_copy(&fl->fl6_dst, daddr); fl->proto = IPPROTO_ICMPV6; fl->fl_icmp_type = type; fl->fl_icmp_code = 0; --- ./net/ipv6/route.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/route.c Thu May 22 16:58:35 2003 @@ -454,12 +454,12 @@ struct dst_entry * ip6_route_output(stru int strict; int attempts = 3; - strict = ipv6_addr_type(fl->fl6_dst) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL); + strict = ipv6_addr_type(&fl->fl6_dst) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL); relookup: read_lock_bh(&rt6_lock); - fn = fib6_lookup(&ip6_routing_table, fl->fl6_dst, fl->fl6_src); + fn = fib6_lookup(&ip6_routing_table, &fl->fl6_dst, &fl->fl6_src); restart: rt = fn->leaf; @@ -481,7 +481,7 @@ restart: if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) { read_unlock_bh(&rt6_lock); - rt = rt6_cow(rt, fl->fl6_dst, fl->fl6_src); + rt = rt6_cow(rt, &fl->fl6_dst, &fl->fl6_src); if (rt->u.dst.error != -EEXIST || --attempts <= 0) goto out2; @@ -1616,9 +1616,11 @@ int inet6_rtm_getroute(struct sk_buff *i memset(&fl, 0, sizeof(fl)); if (rta[RTA_SRC-1]) - fl.fl6_src = (struct in6_addr*)RTA_DATA(rta[RTA_SRC-1]); + ipv6_addr_copy(&fl.fl6_src, + (struct in6_addr*)RTA_DATA(rta[RTA_SRC-1])); if (rta[RTA_DST-1]) - fl.fl6_dst = (struct in6_addr*)RTA_DATA(rta[RTA_DST-1]); + ipv6_addr_copy(&fl.fl6_dst, + (struct in6_addr*)RTA_DATA(rta[RTA_DST-1])); if (rta[RTA_IIF-1]) memcpy(&iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int)); @@ -1642,7 +1644,7 @@ int inet6_rtm_getroute(struct sk_buff *i NETLINK_CB(skb).dst_pid = NETLINK_CB(in_skb).pid; err = rt6_fill_node(skb, rt, - fl.fl6_dst, fl.fl6_src, + &fl.fl6_dst, &fl.fl6_src, iif, RTM_NEWROUTE, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, nlh); --- ./net/ipv6/tcp_ipv6.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/tcp_ipv6.c Thu May 22 17:11:38 2003 @@ -571,7 +571,8 @@ static int tcp_v6_connect(struct sock *s if (usin->sin6_family != AF_INET6) return(-EAFNOSUPPORT); - fl.fl6_flowlabel = 0; + memset(&fl, 0, sizeof(fl)); + if (np->sndflow) { fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK; IP6_ECN_flow_init(fl.fl6_flowlabel); @@ -666,20 +667,18 @@ static int tcp_v6_connect(struct sock *s saddr = &np->rcv_saddr; fl.proto = IPPROTO_TCP; - fl.fl6_dst = &np->daddr; - fl.fl6_src = saddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); + ipv6_addr_copy(&fl.fl6_src, + (saddr ? saddr : &np->saddr)); fl.oif = sk->bound_dev_if; fl.fl_ip_dport = usin->sin6_port; fl.fl_ip_sport = inet->sport; if (np->opt && np->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } - if (!fl.fl6_src) - fl.fl6_src = &np->saddr; - dst = ip6_route_output(sk, &fl); if ((err = dst->error) != 0) { @@ -794,9 +793,10 @@ static void tcp_v6_err(struct sk_buff *s to handle rthdr case. Ignore this complexity for now. */ + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_TCP; - fl.fl6_dst = &np->daddr; - fl.fl6_src = &np->saddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); + ipv6_addr_copy(&fl.fl6_src, &np->saddr); fl.oif = sk->bound_dev_if; fl.fl_ip_dport = inet->dport; fl.fl_ip_sport = inet->sport; @@ -879,9 +879,10 @@ static int tcp_v6_send_synack(struct soc struct flowi fl; int err = -1; + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_TCP; - fl.fl6_dst = &req->af.v6_req.rmt_addr; - fl.fl6_src = &req->af.v6_req.loc_addr; + ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); + ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); fl.fl6_flowlabel = 0; fl.oif = req->af.v6_req.iif; fl.fl_ip_dport = req->rmt_port; @@ -900,7 +901,7 @@ static int tcp_v6_send_synack(struct soc if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } dst = ip6_route_output(sk, &fl); @@ -916,7 +917,7 @@ static int tcp_v6_send_synack(struct soc &req->af.v6_req.loc_addr, &req->af.v6_req.rmt_addr, csum_partial((char *)th, skb->len, skb->csum)); - fl.fl6_dst = &req->af.v6_req.rmt_addr; + ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); err = ip6_xmit(sk, skb, &fl, opt); if (err == NET_XMIT_CN) err = 0; @@ -1018,11 +1019,11 @@ static void tcp_v6_send_reset(struct sk_ buff->csum = csum_partial((char *)t1, sizeof(*t1), 0); - fl.fl6_dst = &skb->nh.ipv6h->saddr; - fl.fl6_src = &skb->nh.ipv6h->daddr; - fl.fl6_flowlabel = 0; + memset(&fl, 0, sizeof(fl)); + ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); + ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); - t1->check = csum_ipv6_magic(fl.fl6_src, fl.fl6_dst, + t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, sizeof(*t1), IPPROTO_TCP, buff->csum); @@ -1082,11 +1083,11 @@ static void tcp_v6_send_ack(struct sk_bu buff->csum = csum_partial((char *)t1, tot_len, 0); - fl.fl6_dst = &skb->nh.ipv6h->saddr; - fl.fl6_src = &skb->nh.ipv6h->daddr; - fl.fl6_flowlabel = 0; + memset(&fl, 0, sizeof(fl)); + ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); + ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); - t1->check = csum_ipv6_magic(fl.fl6_src, fl.fl6_dst, + t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, tot_len, IPPROTO_TCP, buff->csum); @@ -1261,7 +1262,6 @@ static struct sock * tcp_v6_syn_recv_soc { struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct tcp6_sock *newtcp6sk; - struct flowi fl; struct inet_opt *newinet; struct tcp_opt *newtp; struct sock *newsk; @@ -1330,14 +1330,16 @@ static struct sock * tcp_v6_syn_recv_soc } if (dst == NULL) { + struct flowi fl; + + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_TCP; - fl.fl6_dst = &req->af.v6_req.rmt_addr; + ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } - fl.fl6_src = &req->af.v6_req.loc_addr; - fl.fl6_flowlabel = 0; + ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); fl.oif = sk->bound_dev_if; fl.fl_ip_dport = req->rmt_port; fl.fl_ip_sport = inet_sk(sk)->sport; @@ -1725,9 +1727,10 @@ static int tcp_v6_rebuild_header(struct struct inet_opt *inet = inet_sk(sk); struct flowi fl; + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_TCP; - fl.fl6_dst = &np->daddr; - fl.fl6_src = &np->saddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); + ipv6_addr_copy(&fl.fl6_src, &np->saddr); fl.fl6_flowlabel = np->flow_label; fl.oif = sk->bound_dev_if; fl.fl_ip_dport = inet->dport; @@ -1735,7 +1738,7 @@ static int tcp_v6_rebuild_header(struct if (np->opt && np->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } dst = ip6_route_output(sk, &fl); @@ -1762,9 +1765,10 @@ static int tcp_v6_xmit(struct sk_buff *s struct flowi fl; struct dst_entry *dst; + memset(&fl, 0, sizeof(fl)); fl.proto = IPPROTO_TCP; - fl.fl6_dst = &np->daddr; - fl.fl6_src = &np->saddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); + ipv6_addr_copy(&fl.fl6_src, &np->saddr); fl.fl6_flowlabel = np->flow_label; IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); fl.oif = sk->bound_dev_if; @@ -1773,7 +1777,7 @@ static int tcp_v6_xmit(struct sk_buff *s if (np->opt && np->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; - fl.fl6_dst = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } dst = __sk_dst_check(sk, np->dst_cookie); @@ -1793,7 +1797,7 @@ static int tcp_v6_xmit(struct sk_buff *s skb->dst = dst_clone(dst); /* Restore final destination back after routing done */ - fl.fl6_dst = &np->daddr; + ipv6_addr_copy(&fl.fl6_dst, &np->daddr); return ip6_xmit(sk, skb, &fl, np->opt); } --- ./net/ipv6/xfrm6_policy.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/xfrm6_policy.c Thu May 22 17:17:59 2003 @@ -60,8 +60,8 @@ __xfrm6_find_bundle(struct flowi *fl, st read_lock_bh(&policy->lock); for (dst = policy->bundles; dst; dst = dst->next) { struct xfrm_dst *xdst = (struct xfrm_dst*)dst; - if (!ipv6_addr_cmp(&xdst->u.rt6.rt6i_dst.addr, fl->fl6_dst) && - !ipv6_addr_cmp(&xdst->u.rt6.rt6i_src.addr, fl->fl6_src) && + if (!ipv6_addr_cmp(&xdst->u.rt6.rt6i_dst.addr, &fl->fl6_dst) && + !ipv6_addr_cmp(&xdst->u.rt6.rt6i_src.addr, &fl->fl6_src) && __xfrm6_bundle_ok(xdst, fl)) { dst_clone(dst); break; @@ -82,8 +82,8 @@ __xfrm6_bundle_create(struct xfrm_policy struct dst_entry *dst, *dst_prev; struct rt6_info *rt0 = (struct rt6_info*)(*dst_p); struct rt6_info *rt = rt0; - struct in6_addr *remote = fl->fl6_dst; - struct in6_addr *local = fl->fl6_src; + struct in6_addr *remote = &fl->fl6_dst; + struct in6_addr *local = &fl->fl6_src; int i; int err = 0; int header_len = 0; @@ -116,13 +116,15 @@ __xfrm6_bundle_create(struct xfrm_policy trailer_len += xfrm[i]->props.trailer_len; } - if (ipv6_addr_cmp(remote, fl->fl6_dst)) { - struct flowi fl_tunnel = { .nl_u = { .ip6_u = - { .daddr = remote, - .saddr = local } - } - }; - err = xfrm_dst_lookup((struct xfrm_dst**)&rt, &fl_tunnel, AF_INET6); + if (ipv6_addr_cmp(remote, &fl->fl6_dst)) { + struct flowi fl_tunnel; + + memset(&fl_tunnel, 0, sizeof(fl_tunnel)); + ipv6_addr_copy(&fl_tunnel.fl6_dst, remote); + ipv6_addr_copy(&fl_tunnel.fl6_src, local); + + err = xfrm_dst_lookup((struct xfrm_dst **) &rt, + &fl_tunnel, AF_INET6); if (err) goto error; } else { @@ -175,8 +177,8 @@ _decode_session6(struct sk_buff *skb, st struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); u8 nexthdr = skb->nh.ipv6h->nexthdr; - fl->fl6_dst = &hdr->daddr; - fl->fl6_src = &hdr->saddr; + ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); + ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) { switch (nexthdr) { --- ./net/ipv6/xfrm6_state.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/ipv6/xfrm6_state.c Thu May 22 17:18:24 2003 @@ -25,8 +25,8 @@ __xfrm6_init_tempsel(struct xfrm_state * { /* Initialize temporary selector matching only * to current session. */ - ipv6_addr_copy((struct in6_addr *)&x->sel.daddr, fl->fl6_dst); - ipv6_addr_copy((struct in6_addr *)&x->sel.saddr, fl->fl6_src); + ipv6_addr_copy((struct in6_addr *)&x->sel.daddr, &fl->fl6_dst); + ipv6_addr_copy((struct in6_addr *)&x->sel.saddr, &fl->fl6_src); x->sel.dport = fl->fl_ip_dport; x->sel.dport_mask = ~0; x->sel.sport = fl->fl_ip_sport; --- ./net/sctp/ipv6.c.~1~ Thu May 22 16:00:14 2003 +++ ./net/sctp/ipv6.c Thu May 22 17:29:21 2003 @@ -144,17 +144,19 @@ static int sctp_v6_xmit(struct sk_buff * struct ipv6_pinfo *np = inet6_sk(sk); struct flowi fl; + memset(&fl, 0, sizeof(fl)); + fl.proto = sk->protocol; /* Fill in the dest address from the route entry passed with the skb * and the source address from the transport. */ - fl.fl6_dst = &transport->ipaddr.v6.sin6_addr; - fl.fl6_src = &transport->saddr.v6.sin6_addr; + ipv6_addr_copy(&fl.fl6_dst, &transport->ipaddr.v6.sin6_addr); + ipv6_addr_copy(&fl.fl6_src, &transport->saddr.v6.sin6_addr); fl.fl6_flowlabel = np->flow_label; IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); - if (ipv6_addr_type(fl.fl6_src) & IPV6_ADDR_LINKLOCAL) + if (ipv6_addr_type(&fl.fl6_src) & IPV6_ADDR_LINKLOCAL) fl.oif = transport->saddr.v6.sin6_scope_id; else fl.oif = sk->bound_dev_if; @@ -163,14 +165,14 @@ static int sctp_v6_xmit(struct sk_buff * if (np->opt && np->opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; - fl.nl_u.ip6_u.daddr = rt0->addr; + ipv6_addr_copy(&fl.fl6_dst, rt0->addr); } SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " "src:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x " "dst:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", __FUNCTION__, skb, skb->len, - NIP6(*fl.fl6_src), NIP6(*fl.fl6_dst)); + NIP6(fl.fl6_src), NIP6(fl.fl6_dst)); SCTP_INC_STATS(SctpOutSCTPPacks); @@ -185,17 +187,19 @@ struct dst_entry *sctp_v6_get_dst(struct union sctp_addr *saddr) { struct dst_entry *dst; - struct flowi fl = { - .nl_u = { .ip6_u = { .daddr = &daddr->v6.sin6_addr, } } }; + struct flowi fl; + + memset(&fl, 0, sizeof(fl)); + ipv6_addr_copy(&fl.fl6_dst, &daddr->v6.sin6_addr); SCTP_DEBUG_PRINTK("%s: DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", - __FUNCTION__, NIP6(*fl.fl6_dst)); + __FUNCTION__, NIP6(fl.fl6_dst)); if (saddr) { - fl.fl6_src = &saddr->v6.sin6_addr; + ipv6_addr_copy(&fl.fl6_src, &saddr->v6.sin6_addr); SCTP_DEBUG_PRINTK( "SRC=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x - ", - NIP6(*fl.fl6_src)); + NIP6(fl.fl6_src)); } dst = ip6_route_output(NULL, &fl); From davem@redhat.com Thu May 22 17:46:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 17:46: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.9) with SMTP id h4N0k42x009189 for ; Thu, 22 May 2003 17:46:05 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA15942; Thu, 22 May 2003 17:44:16 -0700 Date: Thu, 22 May 2003 17:44:15 -0700 (PDT) Message-Id: <20030522.174415.28799441.davem@redhat.com> To: muizelaar@rogers.com Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] post-sysfs netdev cleanup From: "David S. Miller" In-Reply-To: <3ECD6E2D.5090000@rogers.com> References: <3ECD6E2D.5090000@rogers.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2691 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 From: Jeff Muizelaar Date: Thu, 22 May 2003 20:41:17 -0400 The attached patch removes the struct device from struct net_device and sets net_device.class_dev.dev directly. The class_dev memset is removed because all of struct net_device should already be memset to 0 or there will be other problems. Looks fine to me, Stephen? From davem@redhat.com Thu May 22 17:57:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 17:58: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.9) with SMTP id h4N0vj2x009762 for ; Thu, 22 May 2003 17:57:45 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA15990; Thu, 22 May 2003 17:55:59 -0700 Date: Thu, 22 May 2003 17:55:59 -0700 (PDT) Message-Id: <20030522.175559.70205743.davem@redhat.com> To: gandalf@wlug.westbo.se Cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <1053608586.9475.60.camel@tux.rsn.bth.se> References: <20030522.034058.71558626.davem@redhat.com> <20030522114438.GD2961@netnation.com> <1053608586.9475.60.camel@tux.rsn.bth.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2692 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 From: Martin Josefsson Date: 22 May 2003 15:03:07 +0200 On Thu, 2003-05-22 at 13:44, Simon Kirby wrote: > Nice! I tested with 300,000 routing table entries and there is no > discernable difference in performance from having an empty table. > vmstat shows the same idle time as when the routing table is empty. How much memory does a table that large use? 300,000 * sizeof(struct fib_node) the second term is: (2 * sizeof_pointer_on_this_architecture) + /* 8 or 16 bytes */ sizeof(u32) + /* 4 bytes */ 4 * sizeof(u8)) /* 4 bytes */ So that's 16 bytes on 32-bit systems, and 24 bytes on 64-bit systems. Therefore 300,000 routes take up 4.8MB on 32-bit systems and 7.2MB on 64-bit ones. I cannot fathom a way to make these any smaller :-) From wyim@erd.epson.com Thu May 22 17:59:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 18:00:03 -0700 (PDT) Received: from ns2.erd.epson.com (ns2.erd.epson.com [206.86.159.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4N0xS2x009985 for ; Thu, 22 May 2003 17:59:30 -0700 Received: from erd.erd.epson.com (localhost [127.0.0.1]) by ns2.erd.epson.com (8.12.9/8.11.3a) with ESMTP id h4N1BKMS008568 for ; Thu, 22 May 2003 18:11:20 -0700 (PDT) Received: from erdexch1.erd.epson.com (erdexch1 [172.22.193.26]) by erd.erd.epson.com (8.9.1/8.9.1) with ESMTP id SAA21957 for ; Thu, 22 May 2003 18:02:19 -0700 (PDT) Received: by erdexch1.erd.epson.com with Internet Mail Service (5.5.2653.19) id ; Thu, 22 May 2003 18:02:40 -0700 Message-ID: From: Wai Yim To: "'netdev@oss.sgi.com'" Subject: Anyone having problem modify incoming IP packets at NetFilter Hoo k Module PREROUTING? Date: Thu, 22 May 2003 18:02:34 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-archive-position: 2693 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: wyim@erd.epson.com Precedence: bulk X-list: netdev Hi All, I am new to Linux and NetFilter. I am trying to write a NetFilter Hook Module that hooks to both POSTROUTING and PREROUTING filter. All I am trying to do is, if an IP packet is for certain dest IP address, I will add (POSTROUTING) and take-out (PREROUTING)certain number of bytes in the packet before I pass on the packet. The POSTROUTING NetFilter hook seems working fine. I can get all of the outgoing IP packets, and I can call skb_copy_expand + skb_push for the new data. From ethereal, I see correct outgoing packets onto the network. However, here is the problem, when I get a packet at the PREROUTING, and for certain packets that are about the size of the MTU, when I call skb_copy or skb_pull, my entire system freezes right the way! Upon further investigation, when the trouble packet arrives, even reading data from skb->data using memcpy will freeze the system. I have exhausted all combination of things that I can try... Any help, idea, or direction as what else I should try or where the problem may be will be deeply appreciated. Wai From davem@redhat.com Thu May 22 18:01:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 18:01:55 -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.9) with SMTP id h4N11L2x010463 for ; Thu, 22 May 2003 18:01:21 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA16022; Thu, 22 May 2003 17:59:38 -0700 Date: Thu, 22 May 2003 17:59:38 -0700 (PDT) Message-Id: <20030522.175938.38697866.davem@redhat.com> To: sim@netnation.com Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030522114438.GD2961@netnation.com> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <20030522114438.GD2961@netnation.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2694 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 From: Simon Kirby Date: Thu, 22 May 2003 04:44:38 -0700 There's no APIC on this test box, so it's using the XT-PIC. Production has an APIC, so I assume the overhead would be less there. It is absolutely critical for routing throughput. XT-PIC overhead severely limits your maximum packets/second switching rate. Another thing to watch out for are drivers still using PIO to access device registers (3c59x comes to mind). From davem@redhat.com Thu May 22 18:02:04 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 18:02: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.9) with SMTP id h4N1232x010560 for ; Thu, 22 May 2003 18:02:04 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA16029; Thu, 22 May 2003 18:00:18 -0700 Date: Thu, 22 May 2003 18:00:17 -0700 (PDT) Message-Id: <20030522.180017.35026357.davem@redhat.com> To: gandalf@wlug.westbo.se Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <1053602138.9475.34.camel@tux.rsn.bth.se> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <1053602138.9475.34.camel@tux.rsn.bth.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2695 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 From: Martin Josefsson Date: 22 May 2003 13:15:39 +0200 On Thu, 2003-05-22 at 12:40, David S. Miller wrote: > +static unsigned long size_to_order(unsigned long size) Any reason you're not using get_order() ? Because I'm stupid, I'll fix that thanks :-) From davem@redhat.com Thu May 22 18:03:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 18:04:12 -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.9) with SMTP id h4N13c2x011110 for ; Thu, 22 May 2003 18:03:38 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA16054; Thu, 22 May 2003 18:01:53 -0700 Date: Thu, 22 May 2003 18:01:52 -0700 (PDT) Message-Id: <20030522.180152.15252868.davem@redhat.com> To: gandalf@wlug.westbo.se Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <1053602138.9475.34.camel@tux.rsn.bth.se> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <1053602138.9475.34.camel@tux.rsn.bth.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2696 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 From: Martin Josefsson Date: 22 May 2003 13:15:39 +0200 On Thu, 2003-05-22 at 12:40, David S. Miller wrote: > +static unsigned long size_to_order(unsigned long size) Any reason you're not using get_order() ? Actually, get_order() aparently only works on powers of two, which 'size' is definitely not. From davem@redhat.com Thu May 22 22:44:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 22 May 2003 22:45:15 -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.9) with SMTP id h4N5ib2x015421 for ; Thu, 22 May 2003 22:44:37 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id WAA16450; Thu, 22 May 2003 22:42:49 -0700 Date: Thu, 22 May 2003 22:42:49 -0700 (PDT) Message-Id: <20030522.224249.52179344.davem@redhat.com> To: hadi@shell.cyberus.ca Cc: sim@netnation.com, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030521084023.Y43543@shell.cyberus.ca> References: <20030520074848.U40843@shell.cyberus.ca> <20030520.173607.88482742.davem@redhat.com> <20030521084023.Y43543@shell.cyberus.ca> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2697 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 From: Jamal Hadi Date: Wed, 21 May 2003 09:03:19 -0400 (EDT) On Tue, 20 May 2003, David S. Miller wrote: > Forward looking, Alexey and myself plan to extend the per-cpu flow > cache we designed for IPSEC policy lookups to apply to routing > and socket lookup. There are two reasons to make this: > > 1) Per-cpu'ness. IPIs to synchronize? It is a good question. IPIs are one way to coorindate a flush or state synchronization. But this method is perhaps overblown for things like netfilter and IPSEC policy configuration changes. One way we can deal with those is via a generation count. Any time you insert/delete a netfilter or IPSEC policy rule, it potentially affects each and every flow cache entry. So bumping the generation cound and checking this at flow lookup time is how we solve that problem. It is the same thing to do to handle routing table changes as well. Anyways, this is what net/core/flow.c supports now. Where this model does not fit is for sockets. They tend to change the state of exactly one flow. We will need mechanisms by which to handle this. But, there is a flaw with the generation count scheme... One thing Alexey has reminded me is that you can't defer cache flushing to lookup time, because if traffic stops then the whole engine deadlocks since nothing will release the references inside of the flow cache. This brings me to another topic which is attempting to even avoid the reference counting. This is a very difficult problem, but the benefits are large, it means that all the data can be shared by cpus read-only because no writes occur to grab the reference to the object the flow cache entry points to (socket, route, netfilter rule, IPSEC policy, etc.) > 2) Input route lookup turns into a "flow" lookup and thus may > give you a TCP socket, for example. It is the most exciting > part of this work. For packets that are being forwarded or even host bound, why start at routing? It is just how I describe where this occurs. It has nothing to do with routing. Route lookups just so happen to be the first thing we do when we receive an IPv4 packet :-) This should be done much further below. I don't understand, what I have described is as far into tbe basement as one can possibly go :-) If you go any deeper, you do not know how even to parse the packet. This also gives you opportunity to drop early. A flow index could be created there that could be used to index into the route table for example. Maybe routing by fwmark would then make sense. Flow is made up of protocol specific details. Please look to include/net/flow.h:struct flowi, it is how we describe the identity of what I am calling a flow. Also the structure itself had the grandiose view that routing is the mother of them all i.e you "fit everything around routing" not "fit routing around other things". Routing describes the virtual path a packet takes within the stack. It tells us what to do with packet, therefore it in fact is "mother of them all". It is all that networking stack does. :-) Show me some example where you are describing how the stack will handle a packet and that this is not some form of routing :-) I think the flowi must be captured way before IP is hit and reused by IP and other sublayers. policy routing dropping or attempts to fib_validate_source() the packets should utilize that scheme (i.e install filters below ip) and tag(fwmark) or drop them on the floor before they hit IP. If you do not yet know packet is IP, you have no way to even parse it into flowi. Our wires are crossed... Look, forget that I said that we will make flow determination where we make input route lookups right now. Replace this with "the first thing we will do with an IP packet is build a flowi (by parsing it) and then look up that flow matching this key". I think post 2.6 we should just rip apart the infrastructure and rethink things ;-> (should i go into hiding now?;->) I think we suggest very similar things. Look, for policy dropped flows they will not make it much further than the first few lines of ip_input.c:ip_rcv() It must be called by netif_receive_skb() anyways, and all calling it says is "this is ipv4 packet" and we must know this to be able to parse it. Should be pretty easy to do with a filter framework at the lower layers such as the one i did with ingress qdisc. Ok, publish this code so we can talk in a more precise language. :-) If it is some "if (proto == ETH_P_IP) { ... parse ipv4 header" I will be very disappointed. > None of this means that slowpath should not be improved if necessary. > On the contrary, I would welcome good kernel profiling output from > someone such as sim@netnation during such stress tests. nod. I note that we have aparently killed the worst of these daemons over the past 24 hours :-) From hch@verein.lst.de Fri May 23 00:19:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 00:19:36 -0700 (PDT) Received: from verein.lst.de (verein.lst.de [212.34.181.86]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4N7J02x017249 for ; Fri, 23 May 2003 00:19:01 -0700 Received: (from hch@localhost) by verein.lst.de (8.11.6/8.11.6) id h4N7IwA28112 for netdev@oss.sgi.com; Fri, 23 May 2003 09:18:58 +0200 Date: Fri, 23 May 2003 09:18:58 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] convert madgemc to initcalls Message-ID: <20030523091858.A28081@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-archive-position: 2698 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 This is a MCA driver so there should be no probe order issues. --- 1.13/drivers/net/tokenring/madgemc.c Mon Apr 28 05:36:20 2003 +++ edited/drivers/net/tokenring/madgemc.c Thu May 22 11:22:50 2003 @@ -63,7 +63,6 @@ static struct madgemc_card *madgemc_card_list; -int madgemc_probe(void); static int madgemc_open(struct net_device *dev); static int madgemc_close(struct net_device *dev); static int madgemc_chipset_init(struct net_device *dev); @@ -152,7 +151,7 @@ -int __init madgemc_probe(void) +static int __init madgemc_probe(void) { static int versionprinted; struct net_device *dev; @@ -773,19 +772,7 @@ return len; } -#ifdef MODULE - -int init_module(void) -{ - /* Probe for cards. */ - if (madgemc_probe()) { - printk(KERN_NOTICE "madgemc.c: No cards found.\n"); - } - /* lock_tms380_module(); */ - return (0); -} - -void cleanup_module(void) +static void __exit madgemc_exit(void) { struct net_device *dev; struct madgemc_card *this_card; @@ -801,9 +788,10 @@ madgemc_card_list = this_card->next; kfree(this_card); } - /* unlock_tms380_module(); */ } -#endif /* MODULE */ + +module_init(madgemc_probe); +module_exit(madgemc_exit); MODULE_LICENSE("GPL"); --- 1.12/drivers/net/setup.c Thu May 22 10:08:06 2003 +++ edited/drivers/net/setup.c Thu May 22 11:21:55 2003 @@ -17,8 +17,6 @@ extern int sdla_c_setup(void); extern int lmc_setup(void); -extern int madgemc_probe(void); - /* * Devices in this list must do new style probing. That is they must * allocate their own device objects and do their own bus scans. @@ -50,14 +48,6 @@ #if defined(CONFIG_LANMEDIA) {lmc_setup, 0}, #endif - -/* - * Token Ring Drivers - */ -#ifdef CONFIG_MADGEMC - {madgemc_probe, 0}, -#endif - {NULL, 0}, }; From davem@redhat.com Fri May 23 00:52:16 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 00:52: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.9) with SMTP id h4N7qF2x018177 for ; Fri, 23 May 2003 00:52:15 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA16735; Fri, 23 May 2003 00:50:27 -0700 Date: Fri, 23 May 2003 00:50:26 -0700 (PDT) Message-Id: <20030523.005026.54198701.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] convert madgemc to initcalls From: "David S. Miller" In-Reply-To: <20030523091858.A28081@lst.de> References: <20030523091858.A28081@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2699 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 From: Christoph Hellwig Date: Fri, 23 May 2003 09:18:58 +0200 This is a MCA driver so there should be no probe order issues. Applied, thanks. From ak@suse.de Fri May 23 01:21:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 01:21:59 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4N8LK2x019298 for ; Fri, 23 May 2003 01:21:21 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 5ADA615196; Fri, 23 May 2003 10:21:14 +0200 (MEST) Date: Fri, 23 May 2003 10:21:13 +0200 From: Andi Kleen To: "David S. Miller" Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress Message-Id: <20030523102113.4fe38159.ak@suse.de> In-Reply-To: <20030522.180152.15252868.davem@redhat.com> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <1053602138.9475.34.camel@tux.rsn.bth.se> <20030522.180152.15252868.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: 2700 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, 22 May 2003 18:01:52 -0700 (PDT) "David S. Miller" wrote: > From: Martin Josefsson > Date: 22 May 2003 13:15:39 +0200 > > On Thu, 2003-05-22 at 12:40, David S. Miller wrote: > > > +static unsigned long size_to_order(unsigned long size) > > Any reason you're not using get_order() ? > > Actually, get_order() aparently only works on powers of > two, which 'size' is definitely not. Are you sure? I always used it on all kinds of sizes. The algorithm looks for me like it works on any size. A quick test confirms that too. (i386 version) static __inline__ int get_order(unsigned long size) { int order; size = (size-1) >> (PAGE_SHIFT-1); order = -1; do { size >>= 1; order++; } while (size); return order; } -Andi > From davem@redhat.com Fri May 23 01:23:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 01:24: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.9) with SMTP id h4N8Nu2x019634 for ; Fri, 23 May 2003 01:23:57 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA16833; Fri, 23 May 2003 01:22:05 -0700 Date: Fri, 23 May 2003 01:22:05 -0700 (PDT) Message-Id: <20030523.012205.123984853.davem@redhat.com> To: ak@suse.de Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030523102113.4fe38159.ak@suse.de> References: <1053602138.9475.34.camel@tux.rsn.bth.se> <20030522.180152.15252868.davem@redhat.com> <20030523102113.4fe38159.ak@suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2701 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 From: Andi Kleen Date: Fri, 23 May 2003 10:21:13 +0200 On Thu, 22 May 2003 18:01:52 -0700 (PDT) "David S. Miller" wrote: > Actually, get_order() aparently only works on powers of > two, which 'size' is definitely not. Are you sure? I always used it on all kinds of sizes. The algorithm looks for me like it works on any size. A quick test confirms that too. I believe you. Then what does that comment above it mean? :-) From ak@suse.de Fri May 23 02:03:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 02:03:47 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4N9382x022469 for ; Fri, 23 May 2003 02:03:09 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id E6A8F151B5; Fri, 23 May 2003 11:03:02 +0200 (MEST) Date: Fri, 23 May 2003 11:03:01 +0200 From: Andi Kleen To: "David S. Miller" Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress Message-Id: <20030523110301.25b95026.ak@suse.de> In-Reply-To: <20030523.012205.123984853.davem@redhat.com> References: <1053602138.9475.34.camel@tux.rsn.bth.se> <20030522.180152.15252868.davem@redhat.com> <20030523102113.4fe38159.ak@suse.de> <20030523.012205.123984853.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: 2702 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 Fri, 23 May 2003 01:22:05 -0700 (PDT) "David S. Miller" wrote: > I believe you. > > Then what does that comment above it mean? :-) I guess it refers to the implementation, not the code. For pure 2^n you could implement it much more efficiently using ffz() (not that it really matters of course, most orders are 0) -Andi From davem@redhat.com Fri May 23 03:00:59 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 03:01: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.9) with SMTP id h4NA0w2x026255 for ; Fri, 23 May 2003 03:00:59 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA17002; Fri, 23 May 2003 02:59:07 -0700 Date: Fri, 23 May 2003 02:59:06 -0700 (PDT) Message-Id: <20030523.025906.108797803.davem@redhat.com> To: ak@suse.de Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030523110301.25b95026.ak@suse.de> References: <20030523102113.4fe38159.ak@suse.de> <20030523.012205.123984853.davem@redhat.com> <20030523110301.25b95026.ak@suse.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2703 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 From: Andi Kleen Date: Fri, 23 May 2003 11:03:01 +0200 On Fri, 23 May 2003 01:22:05 -0700 (PDT) "David S. Miller" wrote: > Then what does that comment above it mean? :-) I guess it refers to the implementation, not the code. Ok, I fixed the fib_hash.c stuff to use get_order(). From rask@sygehus.dk Fri May 23 06:30:05 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 06:30:26 -0700 (PDT) Received: from user6.cybercity.dk (fxp0.user6.ip.cybercity.dk [212.242.41.54]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4NDU32x031002 for ; Fri, 23 May 2003 06:30:04 -0700 Received: from privat.webmail.cybercity.dk (localhost [127.0.0.1]) by user6.cybercity.dk (8.12.9/8.12.9) with ESMTP id h4NDTx7n048705; Fri, 23 May 2003 15:30:00 +0200 (CEST) (envelope-from rask@sygehus.dk) From: "Rask Ingemann Lambertsen" To: Anatoly Pugachev Cc: netdev@oss.sgi.com Subject: Re: small e100 ethernet driver problem -> %d Date: Fri, 23 May 2003 14:29:59 +0100 Message-Id: <20030523132143.M3935@sygehus.dk> In-Reply-To: <20030520140341.GY30683@gsib.sl.ru> References: <20030520140341.GY30683@gsib.sl.ru> X-Mailer: Cybercity Webmail 2.01 20030425 X-OriginatingIP: 152.95.52.86 (ccc94453) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-archive-position: 2704 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: rask@sygehus.dk Precedence: bulk X-list: netdev On Tue, 20 May 2003 18:03:41 +0400, Anatoly Pugachev wrote > module works fine, but notice %%d in the output, should be missprint > and easy to fix. It is a misfeature (i.e. a deliberate bug) in the log daemon. Starting sometime in the 2.3 kernel series, the PIIX IDE code mistakenly used printk("... not 100% native mode ..."); which would then correctly log as "not 100 ative mode". It took a while before the printk() string was corrected to "100%% native" and unfortunately, the log daemon changed before the IDE code was fixed. eth%d is the result from not calling init_etherdev() or so. -- Regards, Rask Ingemann Lambertsen From toml@us.ibm.com Fri May 23 08:43:09 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 08:43:12 -0700 (PDT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.105]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4NFh82x005413 for ; Fri, 23 May 2003 08:43:09 -0700 Received: from northrelay01.pok.ibm.com (northrelay01.pok.ibm.com [9.56.224.149]) by e5.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4NFgUtd115596; Fri, 23 May 2003 11:42:30 -0400 Received: from d01ml072.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by northrelay01.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4NFgQAa103086; Fri, 23 May 2003 11:42:27 -0400 Subject: Re: IPSec: IPv6 random failures To: "David S. Miller" Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com X-Mailer: Lotus Notes Release 5.0.11 July 24, 2002 Message-ID: From: "Tom Lendacky" Date: Fri, 23 May 2003 10:42:25 -0500 X-MIMETrack: Serialize by Router on D01ML072/01/M/IBM(Release 5.0.11 +SPRs MIAS5EXFG4, MIAS5AUFPV and DHAG4Y6R7W, MATTEST |November 8th, 2002) at 05/23/2003 11:42:28 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-archive-position: 2705 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: toml@us.ibm.com Precedence: bulk X-list: netdev > Can someone review and stress test out this patch for me? I had been testing on 2.5.69 so I used the 2.5.69-bk16 patch to test out the fix. I was getting a hang at random times during my tests. I didn't know if it was the result of this fix or something else in the bk16 patch. So I got the bk15 patch (which doesn't have your fix) and tested on that and again received a hang at random times during my tests. Although both levels didn't consistently fail on the same test case, though both seemed to hang the system right after flushing the SPs and SAs. So while it doesn't appear that your fix is causing the hang, something is wrong. I'll try and do some debugging and see if I can find the problem. Thanks, Tom toml@us.ibm.com From krkumar@us.ibm.com Fri May 23 11:18:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 11:18:55 -0700 (PDT) Received: from e1.ny.us.ibm.com (e1.ny.us.ibm.com [32.97.182.101]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4NIId2x009808 for ; Fri, 23 May 2003 11:18:46 -0700 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e1.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4NIIWWn062202; Fri, 23 May 2003 14:18:32 -0400 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4NIINfD101900; Fri, 23 May 2003 14:18:24 -0400 Message-ID: <3ECE64F2.5000300@us.ibm.com> Date: Fri, 23 May 2003 11:14:10 -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: davem@redhat.com, kuznet@ms2.inr.ac.ru CC: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: [PATCH] - Wrong use of RTM_BASE in XFRM message types. Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2706 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, I am using 2.5.68 and found XFRM_MSG_BASE being defined, but RTM_BASE used for all XFRM messages, changed it. Current mailer (hopefully) shouldn't screw up the tabs. Thanks, - KK diff -ruN linux-2.5.68.org/include/linux/xfrm.h linux-2.5.68/include/linux/xfrm.h --- linux-2.5.68.org/include/linux/xfrm.h 2003-05-23 11:02:27.000000000 -0700 +++ linux-2.5.68/include/linux/xfrm.h 2003-05-23 11:04:02.000000000 -0700 @@ -104,17 +104,17 @@ /* Netlink configuration messages. */ #define XFRM_MSG_BASE 0x10 -#define XFRM_MSG_NEWSA (RTM_BASE + 0) -#define XFRM_MSG_DELSA (RTM_BASE + 1) -#define XFRM_MSG_GETSA (RTM_BASE + 2) - -#define XFRM_MSG_NEWPOLICY (RTM_BASE + 3) -#define XFRM_MSG_DELPOLICY (RTM_BASE + 4) -#define XFRM_MSG_GETPOLICY (RTM_BASE + 5) - -#define XFRM_MSG_ALLOCSPI (RTM_BASE + 6) -#define XFRM_MSG_ACQUIRE (RTM_BASE + 7) -#define XFRM_MSG_EXPIRE (RTM_BASE + 8) +#define XFRM_MSG_NEWSA (XFRM_MSG_BASE + 0) +#define XFRM_MSG_DELSA (XFRM_MSG_BASE + 1) +#define XFRM_MSG_GETSA (XFRM_MSG_BASE + 2) + +#define XFRM_MSG_NEWPOLICY (XFRM_MSG_BASE + 3) +#define XFRM_MSG_DELPOLICY (XFRM_MSG_BASE + 4) +#define XFRM_MSG_GETPOLICY (XFRM_MSG_BASE + 5) + +#define XFRM_MSG_ALLOCSPI (XFRM_MSG_BASE + 6) +#define XFRM_MSG_ACQUIRE (XFRM_MSG_BASE + 7) +#define XFRM_MSG_EXPIRE (XFRM_MSG_BASE + 8) #define XFRM_MSG_MAX (XFRM_MSG_EXPIRE+1) From davem@redhat.com Fri May 23 13:51:49 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 13:51:59 -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.9) with SMTP id h4NKpj2x013275 for ; Fri, 23 May 2003 13:51:49 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id NAA18299; Fri, 23 May 2003 13:50:55 -0700 Date: Fri, 23 May 2003 13:50:55 -0700 (PDT) Message-Id: <20030523.135055.104051001.davem@redhat.com> To: toml@us.ibm.com Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com Subject: Re: IPSec: IPv6 random failures From: "David S. Miller" In-Reply-To: References: X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2707 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 From: "Tom Lendacky" Date: Fri, 23 May 2003 10:42:25 -0500 I'll try and do some debugging and see if I can find the problem. Thanks. It is possible that I broke something while transferring the flow cache into a generic location... but you did not see these hangs with plain 2.5.69 which had that change already. I'll be away for the weekend, so don't be alarmed if I am silent during this time :-) From werner@almesberger.net Fri May 23 21:13:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 21:13:24 -0700 (PDT) Received: from host.almesberger.net (almesberger.net [63.105.73.239] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4O4DD2x016818 for ; Fri, 23 May 2003 21:13:14 -0700 Received: from almesberger.net (vpnwa-home [10.200.0.2]) by host.almesberger.net (8.11.6/8.9.3) with ESMTP id h4O4CXl28705; Fri, 23 May 2003 21:12:35 -0700 Received: (from werner@localhost) by almesberger.net (8.11.6/8.11.6) id h4O4Bnm15157; Sat, 24 May 2003 01:11:49 -0300 Date: Sat, 24 May 2003 01:11:48 -0300 From: Werner Almesberger To: Ethan Sommer Cc: Philippe Biondi , Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] Message-ID: <20030524011148.A29146@almesberger.net> References: <3ECC0B14.7020105@ethanet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ECC0B14.7020105@ethanet.com>; from sommere@ethanet.com on Wed, May 21, 2003 at 06:26:12PM -0500 X-archive-position: 2708 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: wa@almesberger.net Precedence: bulk X-list: netdev Ethan Sommer wrote: > I take it back, it is regular (kinda) but you can't to it with a > deterministic finite atomaton. If there is a cycle in pattern1, off of > which pattern2 has a branch, then you would need to count how many times > you have gone around the cycle to know where to jump to in pattern2 if > it fails to match pattern1 You mean things like a*b -> 1 ac -> 2 ? You can still express this with a DFA, i.e. a(c|a*b) Of course, if you have patterns that match the same string, you need to decide at some point whether you want longest or shortest match. For the idea of using regexps for all types of classification: this is definitely something I'd love to see. The problem I've encountered is that it seems prohibitively expensive to construct an efficient DFA from human-friendly input. I experimented a bit with this in tcng, but never got to a usable solution. (tcng can handle arbitrary expressions, but it does this by following a collection of rules for rewriting the expression into a canonical and possibly redundant form. Basically, it does what a human being would do if given the task of simplifying a Boolan expression. This is usually quick, but has very ugly worst-case overhead.) I never thought of viewing this as a regexp, though. For this, one would need to be able to introduce positions, e.g. through the ability of putting "^" in the middle of an expression. Example: ^(A|B|C)(^D)|^(E|D) where A ... E would be strings containing 0, 1, or . Example: ip_tos == 0xb8: ^........10111000 Now, how to turn such expressions with embedded ^ efficiently into a DFA ? - Werner -- _________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net / /_http://www.almesberger.net/____________________________________________/ From werner@almesberger.net Fri May 23 21:24:23 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 23 May 2003 21:24:26 -0700 (PDT) Received: from host.almesberger.net (almesberger.net [63.105.73.239] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4O4OM2x017184 for ; Fri, 23 May 2003 21:24:22 -0700 Received: from almesberger.net (vpnwa-home [10.200.0.2]) by host.almesberger.net (8.11.6/8.9.3) with ESMTP id h4O4O7l28779; Fri, 23 May 2003 21:24:08 -0700 Received: (from werner@localhost) by almesberger.net (8.11.6/8.11.6) id h4O4Not15186; Sat, 24 May 2003 01:23:50 -0300 Date: Sat, 24 May 2003 01:23:50 -0300 From: Werner Almesberger To: Ethan Sommer Cc: Philippe Biondi , Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] Message-ID: <20030524012350.A15179@almesberger.net> References: <3ECC0B14.7020105@ethanet.com> <20030524011148.A29146@almesberger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030524011148.A29146@almesberger.net>; from wa@almesberger.net on Sat, May 24, 2003 at 01:11:48AM -0300 X-archive-position: 2709 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: wa@almesberger.net Precedence: bulk X-list: netdev I wrote: > Now, how to turn such expressions with embedded ^ efficiently > into a DFA ? Well, that's too easy. The DFA should also test bits only in the order in which they appear in the packet. Constructing a DFA that jumps back and forth and tests the same bit over and over again wouldn't be much of a challenge :-) - Werner -- _________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net / /_http://www.almesberger.net/____________________________________________/ From werner@almesberger.net Sat May 24 00:23:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 24 May 2003 00:23:23 -0700 (PDT) Received: from host.almesberger.net (almesberger.net [63.105.73.239] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4O7ND2x019265 for ; Sat, 24 May 2003 00:23:13 -0700 Received: from almesberger.net (vpnwa-home [10.200.0.2]) by host.almesberger.net (8.11.6/8.9.3) with ESMTP id h4O7N6l29307; Sat, 24 May 2003 00:23:06 -0700 Received: (from werner@localhost) by almesberger.net (8.11.6/8.11.6) id h4O7MkO22350; Sat, 24 May 2003 04:22:46 -0300 Date: Sat, 24 May 2003 04:22:46 -0300 From: Werner Almesberger To: Ethan Sommer Cc: Philippe Biondi , Jamal Hadi , Martin Josefsson , "David S. Miller" , linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: [Fwd: [ANNOUNCE] Layer-7 Filter for Linux QoS] Message-ID: <20030524042246.B29146@almesberger.net> References: <3ECCE151.8000903@ethanet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ECCE151.8000903@ethanet.com>; from sommere@ethanet.com on Thu, May 22, 2003 at 09:40:17AM -0500 X-archive-position: 2710 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: wa@almesberger.net Precedence: bulk X-list: netdev Ethan Sommer wrote: > Philippe Biondi wrote: >> For every NDFA, there exist a DFA that recognize the same language. >> So, it is possible. >> > > That is true only if you only care if either are matched. Not if you > care which is matched. By combining them you lose the ability to tell > which matched. "exists a DFA" doesn't mean that there is only one :-) Typically, there are a lot of DFAs for each NFA, usually an infinite number of them. And among them are also those that don't combine states you don't want to combine. >> The question is : will we have enough memory to store a DFA that recognize >> a big regexp ? The answer is : let loose some speed and use NDFA. Also simpler DFAs would be interesting, e.g. acyclic ones. Size shouldn't be a problem for them. In fact, for "traditional" classification (i.e. well below layer 7), that's really all you need. - Werner -- _________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net / /_http://www.almesberger.net/____________________________________________/ From nalkunda@egr.msu.edu Sat May 24 16:30:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 24 May 2003 16:30:51 -0700 (PDT) Received: from sys08.mail.msu.edu (sys08.mail.msu.edu [35.9.75.108]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4ONU42x032699 for ; Sat, 24 May 2003 16:30:08 -0700 Received: from elans.cse.msu.edu ([35.9.43.164] helo=elans-pc.elans.cse.msu.edu) by sys08.mail.msu.edu with asmtp (Exim 4.10 #3) (TLSv1:RC4-MD5:128) (authenticated as nalkunda) id 19JiSh-000I7b-00 for netdev@oss.sgi.com; Sat, 24 May 2003 19:30:03 -0400 Content-Type: text/plain; charset="iso-8859-1" From: N N Ashok Organization: CSE, Michigan State University Subject: Resend: current bandwidth measurement Date: Sat, 24 May 2003 19:25:38 -0400 User-Agent: KMail/1.4.3 To: netdev@oss.sgi.com MIME-Version: 1.0 Message-Id: <200305241925.38061.nalkunda@egr.msu.edu> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h4ONU42x032699 X-archive-position: 2711 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nalkunda@egr.msu.edu Precedence: bulk X-list: netdev Seems like my first mail didnt show up on the list. Hi, I wanted to know how the current flow rate for an interface is maintained in the kernel. I studied the tc_stats structure (include/linux/pkt_sched.h) but its bps and pps fields are not used anywhere except in net/sched/police.c (used "stats.bps" to search for the files). Is it that the current bps and pps are maintained in the queue structures? If so, can you point me to the relevant files/structures/functions. Thanks in advance, Ashok From davem@redhat.com Sun May 25 19:22:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 25 May 2003 19:22:55 -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.9) with SMTP id h4Q2Mi2x024170 for ; Sun, 25 May 2003 19:22:46 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA27503; Sun, 25 May 2003 19:22:13 -0700 Date: Sun, 25 May 2003 19:22:12 -0700 (PDT) Message-Id: <20030525.192212.28810694.davem@redhat.com> To: muizelaar@rogers.com Cc: shemminger@osdl.org, netdev@oss.sgi.com Subject: Re: [PATCH] post-sysfs netdev cleanup From: "David S. Miller" In-Reply-To: <3ECD6E2D.5090000@rogers.com> References: <3ECD6E2D.5090000@rogers.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2712 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 From: Jeff Muizelaar Date: Thu, 22 May 2003 20:41:17 -0400 The attached patch removes the struct device from struct net_device and sets net_device.class_dev.dev directly. Applied, thanks. From davem@redhat.com Sun May 25 19:29:37 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 25 May 2003 19:29: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.9) with SMTP id h4Q2Tb2x024511 for ; Sun, 25 May 2003 19:29:37 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA27540; Sun, 25 May 2003 19:29:05 -0700 Date: Sun, 25 May 2003 19:29:04 -0700 (PDT) Message-Id: <20030525.192904.23037779.davem@redhat.com> To: akpm@digeo.com Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <20030523174156.210d7f94.akpm@digeo.com> References: <20030522.034058.71558626.davem@redhat.com> <1053602138.9475.34.camel@tux.rsn.bth.se> <20030523174156.210d7f94.akpm@digeo.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2713 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 From: Andrew Morton Date: Fri, 23 May 2003 17:41:56 -0700 a) mips64 and cris seem to have forgotten to implement it. I consider these platforms unmaintained in 2.5.x currently :-) Without it, several generic things simply don't build. SCSI tape is one. Admittedly the rest of the spots are in obscure or arch specific places. b) ppc and ia64 just had to sneak a bit of asm into their version These are just optimizations, and I'm surprised x86 doesn't use some clever instructions too. I get the feeling that we need just a single copy of this guy, in True, I really doubt this is worth optimizing except to be cute. From davem@redhat.com Sun May 25 19:49:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Sun, 25 May 2003 19:49: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.9) with SMTP id h4Q2nO2x025069 for ; Sun, 25 May 2003 19:49:25 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA27620; Sun, 25 May 2003 19:48:21 -0700 Date: Sun, 25 May 2003 19:48:20 -0700 (PDT) Message-Id: <20030525.194820.26298304.davem@redhat.com> To: krkumar@us.ibm.com Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: [PATCH] - Wrong use of RTM_BASE in XFRM message types. From: "David S. Miller" In-Reply-To: <3ECE64F2.5000300@us.ibm.com> References: <3ECE64F2.5000300@us.ibm.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2714 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 From: Krishna Kumar Date: Fri, 23 May 2003 11:14:10 -0700 I am using 2.5.68 and found XFRM_MSG_BASE being defined, but RTM_BASE used for all XFRM messages, changed it. Current mailer (hopefully) shouldn't screw up the tabs. Applied, thank you. From fw@deneb.enyo.de Mon May 26 00:19:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 00:19:09 -0700 (PDT) Received: from mail.enyo.de (gw.enyo.de [212.9.189.178] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4Q7Iw2x031523 for ; Mon, 26 May 2003 00:19:00 -0700 Received: from [212.9.189.171] (helo=deneb.enyo.de) by mail.enyo.de with esmtp (Exim 3.34 #2) id 19KCFQ-0003sY-00; Mon, 26 May 2003 09:18:20 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.14) id 19KCFP-0000sh-UV; Mon, 26 May 2003 09:18:19 +0200 To: Jamal Hadi Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress References: <20030519154852.I39024@shell.cyberus.ca> <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> <20030519212209.P39592@shell.cyberus.ca> From: Florian Weimer Date: Mon, 26 May 2003 09:18:19 +0200 In-Reply-To: <20030519212209.P39592@shell.cyberus.ca> (Jamal Hadi's message of "Mon, 19 May 2003 21:23:08 -0400 (EDT)") Message-ID: <87adda6uro.fsf@deneb.enyo.de> User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 2715 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: fw@deneb.enyo.de Precedence: bulk X-list: netdev Jamal Hadi writes: > Also used to attack CISCOs by them kiddies btw. We stand much better > than any CISCO doing caching. Cisco IOS doesn't have this hash collisions problem, they have moved away from hash tables ages ago. You are probably just seeing CPU starvation (Cisco routers aren't equipped with the fastest available CPUs *sigh*, and you lose if routing is not performed by other means). BTW, CEF is just a marketing term. There's a plethora of implementations, ranging from software-only to ASICs to special memory chips (associative arrays with wildcards). These implementations have vastly different implications for router performance. Most notably, CEF is not a cache (not even in the software case), the data structure are changed when updated routing information is encountered and not when packets are received which need to be routed. From davem@redhat.com Mon May 26 00:30:14 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 00:31:20 -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.9) with SMTP id h4Q7U92x032128 for ; Mon, 26 May 2003 00:30:13 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id AAA28432; Mon, 26 May 2003 00:29:35 -0700 Date: Mon, 26 May 2003 00:29:34 -0700 (PDT) Message-Id: <20030526.002934.132904126.davem@redhat.com> To: fw@deneb.enyo.de Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <87adda6uro.fsf@deneb.enyo.de> References: <20030519.181405.35017608.davem@redhat.com> <20030519212209.P39592@shell.cyberus.ca> <87adda6uro.fsf@deneb.enyo.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2716 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 From: Florian Weimer Date: Mon, 26 May 2003 09:18:19 +0200 Cisco IOS doesn't have this hash collisions problem, they have moved away from hash tables ages ago. Let their loss be our gain :-) No, I am serious, their solution to misbehaving flows seems to be just using slow path always and continually optimize the slow path. the data structure are changed when updated routing information is encountered and not when packets are received which need to be routed. Yes, they say this in the marketing literature too. :) Now, how about some real explanation about what they are actually doing? Are they replicating the routing table all over the place? That's one possibility, and would match up to their saying that more router memory is required when using CEF. The other possibility is that it's a faster-trie thing generated from the normal routing tables. Since CEF aparently works with QoS and other features, the key must be many bits wide. Probably similar in size to our flowi's. So some bit branching trie based upon flow parameters. There are hundreds of patented such schemes :-) Anyways, you keep saying that flow hashing is stupid, can you propose an alternative? Really, I don't mean to be rude, but you do a lot of complaining about how what we have now sucks and zero of actually suggesting a usable alternative. From Eric.Lemoine@Sun.COM Mon May 26 02:16:41 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 02:16:49 -0700 (PDT) Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4Q9Ge2x003226 for ; Mon, 26 May 2003 02:16:41 -0700 Received: from esunmail ([129.147.58.120]) by brmea-mail-4.sun.com (8.12.9/8.12.9) with ESMTP id h4Q9Geht021872 for ; Mon, 26 May 2003 03:16:40 -0600 (MDT) Received: from xpa-fe1 (esunmail [129.147.58.120]) by edgemail1.Central.Sun.COM (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HFH00AAXLPVY7@edgemail1.Central.Sun.COM> for netdev@oss.sgi.com; Mon, 26 May 2003 03:15:32 -0600 (MDT) Received: from udine ([195.78.31.10]) by mail.sun.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTPSA id <0HFH007N5LPNO9@mail.sun.net> for netdev@oss.sgi.com; Mon, 26 May 2003 03:15:31 -0600 (MDT) Received: by udine (sSMTP sendmail emulation); Mon, 26 May 2003 11:15:19 +0200 Date: Mon, 26 May 2003 11:15:19 +0200 From: Eric Lemoine Subject: Re: simple change to qdisc_restart() In-reply-to: <20030520083020.N40924@shell.cyberus.ca> To: Jamal Hadi Cc: netdev@oss.sgi.com Message-id: <20030526091519.GD343@udine> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.3.28i References: <20030520082217.GC978@udine> <20030520.012824.85398613.davem@redhat.com> <20030520085724.GD978@udine> <16074.1339.3673.938923@robur.slu.se> <20030520112109.GE978@udine> <16074.7787.988583.56689@robur.slu.se> <20030520083020.N40924@shell.cyberus.ca> X-archive-position: 2717 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Eric.Lemoine@Sun.COM Precedence: bulk X-list: netdev > His patch should be interesting. I have seen NICs showing up in the market > with multiple DMA rings/channels and you can map flows to channels. > Locking the device on egress just because one of the rings is full doesnt > make sense. Such boards maybe the perfect pktgen board for you, btw ;-> > Can you post your patch Eric? I'm working on being authorized to give out my code. It may take some time... -- Eric From fw@deneb.enyo.de Mon May 26 02:29:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 02:30:02 -0700 (PDT) Received: from mail.enyo.de (gw.enyo.de [212.9.189.178] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4Q9To2x005211 for ; Mon, 26 May 2003 02:29:51 -0700 Received: from [212.9.189.171] (helo=deneb.enyo.de) by mail.enyo.de with esmtp (Exim 3.34 #2) id 19KEHu-0003pz-00; Mon, 26 May 2003 11:29:02 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.14) id 19KEHu-0001I9-J5; Mon, 26 May 2003 11:29:02 +0200 To: "David S. Miller" Cc: sim@netnation.com, hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress References: <20030520011053.GB10419@netnation.com> <20030519.181405.35017608.davem@redhat.com> <20030521000936.GA19077@netnation.com> <20030520.171358.28794219.davem@redhat.com> From: Florian Weimer Date: Mon, 26 May 2003 11:29:02 +0200 In-Reply-To: <20030520.171358.28794219.davem@redhat.com> (David S. Miller's message of "Tue, 20 May 2003 17:13:58 -0700 (PDT)") Message-ID: <87y90u5a5d.fsf@deneb.enyo.de> User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 2718 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: fw@deneb.enyo.de Precedence: bulk X-list: netdev "David S. Miller" writes: > From: Simon Kirby > Date: Tue, 20 May 2003 17:09:36 -0700 > > It's rather difficult to follow, but I don't see any "h4r h4r, expl0it > th3 L1nux h4sh" comments or anything in the code that seems to attempt to > exploit the hash algorithms in (older) Linux. > > Look at the vc[] table and how it uses this in rndip(). The vc[] table is used to generate packets which don't fall victim to widely implemented source address checks (e.g. "ip verify unicast source reachable-via any" on recent Cisco routers). I've checked the generated packets and they appear to be distributed rather evenly among about 3,000 of the 8,192 hash buckets (with the old hash function, of course), so juno-z.101f.c does not specifically choose source addresses to trigger collisions. (BTW, that's the reason why I consider the hash collision DoS attack not too relevant in practice -- anybody who wants to DoS my machine can probably send lots of packets to it. juno-z.101f.c just works well enough, even if it doesn't saturate all available bandwidth.) From fw@deneb.enyo.de Mon May 26 02:35:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 02:35:42 -0700 (PDT) Received: from mail.enyo.de (gw.enyo.de [212.9.189.178] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4Q9ZT2x005683 for ; Mon, 26 May 2003 02:35:31 -0700 Received: from [212.9.189.171] (helo=deneb.enyo.de) by mail.enyo.de with esmtp (Exim 3.34 #2) id 19KENJ-0004AJ-00; Mon, 26 May 2003 11:34:37 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.14) id 19KENJ-0001IY-EO; Mon, 26 May 2003 11:34:37 +0200 To: "David S. Miller" Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress References: <20030519.181405.35017608.davem@redhat.com> <20030519212209.P39592@shell.cyberus.ca> <87adda6uro.fsf@deneb.enyo.de> <20030526.002934.132904126.davem@redhat.com> From: Florian Weimer Date: Mon, 26 May 2003 11:34:37 +0200 In-Reply-To: <20030526.002934.132904126.davem@redhat.com> (David S. Miller's message of "Mon, 26 May 2003 00:29:34 -0700 (PDT)") Message-ID: <87wuge59w2.fsf@deneb.enyo.de> User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-archive-position: 2719 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: fw@deneb.enyo.de Precedence: bulk X-list: netdev "David S. Miller" writes: > Let their loss be our gain :-) No, I am serious, their solution to > misbehaving flows seems to be just using slow path always and > continually optimize the slow path. Exactly, as a result you get stateless IP forwarding whose performance is mostly independent of the traffic characteristics. > Now, how about some real explanation about what they are actually > doing? Are they replicating the routing table all over the place? They do this for dCEF. In this case the CEF data structure are replicated on every linecard that supports autonomous routing decisions. (This is essential for GSRs because the internal bus is too narrow for almost any communications. You are lucky if the routing tables updates do not saturate it.) > That's one possibility, and would match up to their saying that more > router memory is required when using CEF. CEF is essentially yet another copy of the routing table and therefore requires memory (they do not aggregate prefixes, so some memory is required for a full Internet routing table.) > The other possibility is that it's a faster-trie thing generated > from the normal routing tables. Yeah, it's some kind of a trie according to a few Cisco documents (which are a bit self-contradictory, though). > Since CEF aparently works with QoS and other features, the key must > be many bits wide. Probably similar in size to our flowi's. I don't think IOS QoS is based on (d)CEF. It's true that on some Cisco routers, QoS requires (d)CEF-enabled linecards, but I believe this is just a software design issue and not inherently tied to the CEF data structures. So far I've only seen CEF tables with IPv4 addresses as indices. 8-) > So some bit branching trie based upon flow parameters. There are > hundreds of patented such schemes :-) Just ignore them. 8-) > Anyways, you keep saying that flow hashing is stupid, can you propose > an alternative? Only for pure IPv4 CIDR routing (based on prefixes and destination addresses). I'd try the following scheme: split the destination address into two parts, and use the more significant one as an index into a table of (function pointer, closure data pointer) pairs. These functions return a pointer to the adjacency information. They can be implemented in various ways, depending on the structure of the less significant part (e.g. if only one subnet is routed differently from the others, a few comparisons are sufficent to identify it). As a result, the routing decision could made with one or two indirect calls and a couple of memory accesses. For hosts, if the routing table contains less than (say) ten routes, order it by decreasing prefix length and scan it sequentially for a match. In all cases, L2 addresses should be stored indexed by the least significant bits of the corresponding IP addresses (no hashing required). Of course, this will result in vastly decreased functionality (no arbitary netmasks, no policy-based routing, code will be fine-tuned for typical Internet routing tables), so this proposal definitely comes at a price. (In the meantime, it might be beneficial to use more buckets in the routing cache and rely less on collision chaining.) From pb@bieringer.de Mon May 26 07:28:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 07:28:44 -0700 (PDT) Received: from smtp2.aerasec.de (gromit.aerasec.de [195.226.187.57]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4QES92x014423 for ; Mon, 26 May 2003 07:28:38 -0700 Received: by smtp2.aerasec.de (Postfix, from userid 995) id BD0721387A; Mon, 26 May 2003 16:28:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.aerasec.de (Postfix) with SMTP id 996581387C for ; Mon, 26 May 2003 16:28:01 +0200 (CEST) X-AV-Checked: Mon May 26 16:28:01 2003 smtp2.aerasec.de Received: from [10.3.62.6] (pD9E8AC71.dip.t-dialin.net [217.232.172.113]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client did not present a certificate) by smtp2.aerasec.de (Postfix) with ESMTP id E1B9A1387A for ; Mon, 26 May 2003 16:28:00 +0200 (CEST) Date: Mon, 26 May 2003 16:27:57 +0200 From: "Dr. Peter Bieringer" To: Maillist netdev Subject: sundance driver does not work with D-Link DFE-580TX Message-ID: <6530000.1053959277@klopffest.muc.aerasec.de> X-Mailer: Mulberry/3.0.3 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-archive-position: 2720 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: pb@bieringer.de Precedence: bulk X-list: netdev Hi, pls. take a look into: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=69000 Looks like current included "sundance.c" driver doesn't work proper together with current "mii.c" on a D-Link DFE-580TX. Can someone else doublecheck this? If confirmed, who can trigger the update of "sundance.c" driver from version 1.06 (shipped in 2.4.20 and 2.4.21-pre3) to 1.10? TIA, Peter -- Dr. Peter Bieringer http://www.bieringer.de/pb/ GPG/PGP Key 0x958F422D mailto: pb at bieringer dot de Deep Space 6 Co-Founder and Core Member http://www.deepspace6.net/ From mcr@sandelman.ottawa.on.ca Mon May 26 09:04:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 09:05:00 -0700 (PDT) Received: from noxmail.sandelman.ottawa.on.ca (cyphermail.sandelman.ottawa.on.ca [192.139.46.78]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4QG4r2x017478 for ; Mon, 26 May 2003 09:04:54 -0700 Received: from sandelman.ottawa.on.ca (marajade.sandelman.ottawa.on.ca [192.139.46.20]) by noxmail.sandelman.ottawa.on.ca (8.11.6p2/8.11.6) with ESMTP id h4QG4jl02634 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified OK); Mon, 26 May 2003 12:04:46 -0400 (EDT) Received: from marajade.sandelman.ottawa.on.ca (mcr@localhost) by sandelman.ottawa.on.ca (8.12.3/8.12.3/Debian -4) with ESMTP id h4QG4iQY020725; Mon, 26 May 2003 12:04:45 -0400 Message-Id: <200305261604.h4QG4iQY020725@sandelman.ottawa.on.ca> To: "Dr. Peter Bieringer" cc: Maillist netdev Subject: Re: sundance driver does not work with D-Link DFE-580TX In-reply-to: Your message of "Mon, 26 May 2003 16:27:57 +0200." <6530000.1053959277@klopffest.muc.aerasec.de> Mime-Version: 1.0 (generated by tm-edit 1.8) Content-Type: text/plain; charset=US-ASCII Date: Mon, 26 May 2003 12:04:43 -0400 From: Michael Richardson X-archive-position: 2721 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mcr@sandelman.ottawa.on.ca Precedence: bulk X-list: netdev >>>>> "Peter" == Peter Bieringer writes: Peter> pls. take a look into: Peter> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=69000 Peter> Looks like current included "sundance.c" driver doesn't work proper Peter> together with current "mii.c" on a D-Link DFE-580TX. This is a redhat bug. Stock kernels do not have this problem. Nor does pure-Becker code. ] ON HUMILITY: to err is human. To moo, bovine. | firewalls [ ] Michael Richardson, Sandelman Software Works, Ottawa, ON |net architect[ ] mcr@sandelman.ottawa.on.ca http://www.sandelman.ottawa.on.ca/ |device driver[ ] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [ From hch@lst.de Mon May 26 12:25:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 12:25:29 -0700 (PDT) Received: from mail.lst.de (verein.lst.de [212.34.189.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4QJPF2x023110 for ; Mon, 26 May 2003 12:25:17 -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 h4QJPEaH006007 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 26 May 2003 21:25:14 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.3) id h4QJPD2R006005 for netdev@oss.sgi.com; Mon, 26 May 2003 21:25:13 +0200 Date: Mon, 26 May 2003 21:25:13 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] switch lanmedia driver to initcalls Message-ID: <20030526192513.GA5995@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 2722 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 It's a PCI driver and has no business in setup.c :) --- 1.13/drivers/net/setup.c Fri May 23 09:50:54 2003 +++ edited/drivers/net/setup.c Sun May 25 13:33:06 2003 @@ -15,7 +15,6 @@ extern int fec_enet_init(void); extern int sdla_setup(void); extern int sdla_c_setup(void); -extern int lmc_setup(void); /* * Devices in this list must do new style probing. That is they must @@ -44,9 +43,6 @@ #endif #if defined(CONFIG_FEC_ENET) {fec_enet_init, 0}, -#endif -#if defined(CONFIG_LANMEDIA) - {lmc_setup, 0}, #endif {NULL, 0}, }; --- 1.14/drivers/net/wan/lmc/lmc_main.c Mon May 12 04:48:01 2003 +++ edited/drivers/net/wan/lmc/lmc_main.c Sun May 25 13:29:37 2003 @@ -1965,9 +1965,7 @@ return (struct net_device_stats *) &sc->stats; } -#ifdef MODULE - -int init_module (void) /*fold00*/ +static int __init init_lmc(void) { printk ("lmc: module loaded\n"); @@ -1978,7 +1976,7 @@ return 0; } -void cleanup_module (void) /*fold00*/ +static void __exit exit_lmc(void) { struct net_device *dev, *next; lmc_softc_t *sc; @@ -2020,7 +2018,9 @@ Lmc_root_dev = NULL; printk ("lmc module unloaded\n"); } -#endif + +module_init(init_lmc); +module_exit(exit_lmc); unsigned lmc_mii_readreg (lmc_softc_t * const sc, unsigned devaddr, unsigned regno) /*fold00*/ { From davem@redhat.com Mon May 26 16:33:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 16:33:51 -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.9) with SMTP id h4QNXe2x028307 for ; Mon, 26 May 2003 16:33:40 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA30018; Mon, 26 May 2003 16:33:00 -0700 Date: Mon, 26 May 2003 16:33:00 -0700 (PDT) Message-Id: <20030526.163300.28812759.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] switch lanmedia driver to initcalls From: "David S. Miller" In-Reply-To: <20030526192513.GA5995@lst.de> References: <20030526192513.GA5995@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2723 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 From: Christoph Hellwig Date: Mon, 26 May 2003 21:25:13 +0200 It's a PCI driver and has no business in setup.c :) Applied, thanks :-) From garzik@gtf.org Mon May 26 22:32:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 22:32:34 -0700 (PDT) Received: from havoc.gtf.org (host-64-213-145-173.atlantasolutions.com [64.213.145.173] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4R5WJ2x010429 for ; Mon, 26 May 2003 22:32:24 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id F2DCC6643; Tue, 27 May 2003 01:32:18 -0400 (EDT) Date: Tue, 27 May 2003 01:32:18 -0400 From: Jeff Garzik To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: [PATCH] 2.4.x net driver pending stuff Message-ID: <20030527053218.GA24582@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: 2724 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 Here are the pending bits for Marcelo, once 2.4.21 is released. BK users may pull from bk pull bk://kernel.bkbits.net/jgarzik/net-drivers-2.4 Others may obtain the patch from ftp://ftp.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.4/2.4.21-rc2-netdrvr1.patch.bz2 This will update the following files: drivers/net/bonding.c | 3434 ------------------------- Documentation/Configure.help | 9 Documentation/networking/bonding.txt | 148 - Documentation/networking/ifenslave.c | 334 +- drivers/net/8139cp.c | 7 drivers/net/Config.in | 3 drivers/net/Makefile | 6 drivers/net/arcnet/arcnet.c | 2 drivers/net/arcnet/rfc1201.c | 6 drivers/net/bonding.c | 266 + drivers/net/bonding/Makefile | 18 drivers/net/bonding/bond_3ad.c | 2667 +++++++++++++++++++ drivers/net/bonding/bond_3ad.h | 342 ++ drivers/net/bonding/bond_alb.c | 1585 +++++++++++ drivers/net/bonding/bond_alb.h | 129 drivers/net/bonding/bond_main.c | 4737 ++++++++++++++++++++++++++++++++--- drivers/net/bonding/bonding.h | 209 + drivers/net/e1000/e1000.h | 3 drivers/net/e1000/e1000_main.c | 167 + drivers/net/eepro.c | 2 drivers/net/r8169.c | 2 drivers/net/sundance.c | 144 - drivers/net/tulip/tulip_core.c | 7 drivers/net/typhoon.c | 4 drivers/net/via-rhine.c | 2 drivers/net/wireless/airo.c | 2 include/linux/if_arcnet.h | 4 include/linux/if_bonding.h | 101 include/linux/if_vlan.h | 1 include/linux/skbuff.h | 4 include/net/if_inet6.h | 5 include/net/irda/irlan_common.h | 2 net/core/dev.c | 4 net/core/skbuff.c | 3 net/ipv6/addrconf.c | 13 net/ipv6/ndisc.c | 3 net/irda/irlan/irlan_eth.c | 6 37 files changed, 10114 insertions(+), 4267 deletions(-) through these ChangeSets: (03/05/27 1.1229) [netdrvr eepro] update MODULE_AUTHOR per old-author request (03/05/27 1.1228) [netdrvr sundance] fix another flow control bug (03/05/27 1.1227) [netdrvr sundance] fix flow control bug (03/05/27 1.1226) [netdrvr bonding] fix ABI version control problem This fix makes bonding not commit to a specific ABI version if the ioctl command is not supported by bonding. (It also removes the '\n' in the continuous printk reporting the link down event in bond_mii_monitor - it got in there by mistake in our previous patch set and caused log messages to appear funny in some situations). (03/05/27 1.1225) [netdrvr bonding] fix long failover in 802.3ad mode This patch fixes the bug reported by Jay on April 3rd regarding long failover time when releasing the last slave in the active aggregator. The fix, as suggested by Jay, is to follow the spec recommendation and send a LACPDU to the partner saying this port is no longer aggregatable and therefore trigger an immediate re-selection of a new aggregator instead of waiting the entire expiration timeout. (03/05/25 1.1224) IPv6 over ARCnet (RFC2497) support, IPv6 part. (03/05/25 1.1223) IPv6 over ARCnet (RFC2497) support, driver part (03/05/25 1.1222) [irda] module refcounts for irlan (03/05/23 1.1215.1.7) [bonding] small cleanups (03/05/23 1.1215.1.6) [bonding] add rcv load balancing mode This patch adds a new mode that enables receive load balancing for IPv4 traffic on top of the transmit load balancing mode. This capability is achieved by intercepting and manipulating the ARP negotiation to teach clients several MAC addresses for the bond and thus distribute incoming traffic among all slaves with the highest link speed. In order to function properly, slaves are required to be able to have their MAC address set even while the interface is up since once the primary slave looses its link, the new primary slave (and only it) must be able to take over and receive the incoming traffic instead. If a non-primary slave looses its link, ARP packets will be sent to all clients communicating through it in order to teach them a replacement MAC address, and the primary slave will be put in promiscuous mode for 10 seconds for fault tolerance reasons. This patch is against bonding-20030415, but must come only after the locking scheme changing patch since it uses dev_set_promiscuity() that would otherwise cause a system hang. (03/05/23 1.1215.1.5) [bonding] support xmit load balancing mode (03/05/23 1.1215.1.4) [bonding] much improved locking This patch replaces the use of lock_irqsave/unlock_irqrestore in bonding with lock/unlock or lock_bh/unlock_bh as appropriate according to context. This change is based on a previous discussion regarding the fact that holding a lock_irqsave doesn't prevent softirqs from running which can cause deadlocks in certain situations. This new locking scheme has already undergone massive testing cycle by our QA group and we feel it is ready for release (some new modes and enhancements will not work properly without it). (03/05/23 1.1215.1.3) [bonding] better 802.3ad mode control, some cleanup This patch adds the lacp_rate module param to enable better control over the IEEE 802.3ad mode. This param controls the rate at which the partner system is asked to send LACPDUs to bonding. Two options exist: - slow (or 0) - LACPDUs are 30 seconds apart - fast (or 1) - LACPDUs are 1 second apart The default is slow (like most switches around). There are also some code beautifications (mainly converting comments to C style in code segments we added in the past). (03/05/23 1.1215.1.2) [bonding] ABI versioning This patch adds user-land to kernel ABI version control in bonding to restore backward compatibility between different versions of ifenslave and the bonding module. It uses ethtool's GDRVINFO ioctl to pass the ABI version number between ifenslave and the bonding module in both directions so both the driver and the application can tell which partner they're working against and take the appropriate measures when enslaving/releasing an interface. The bonding module remembers the ABI version received from the application, and from that moment on will deny enslave and release commands from an application using a different ABI version, which means that if you want to switch to an ifenslave with a different ABI version (or with non at all), you'll first have to re-load the bonding module. This patch also changes the driver/application versioning scheme to contain 3 fields X.Y.Z with the follows meaning: X - Major version - big behavior changes Y - Minor version - addition of features Z - Extra version - minor changes and bug fixes There are also three minor bug fixes: 1. Prevent enslaving an interface that is already a slave. 2. Prevent enslaving if the bond is down. 3. In bond_release_all, save old value of current_slave before assigning NULL to it to enable using it's original value later on. This patch is against bonding-20030415. (03/04/27 1.1137.1.6) [netdrvr e1000] add TSO support -- disabled * Copy TSO support for 2.5 e1000. Wrapped with NETIF_F_TSO, so not currently enabled in 2.4. Done to keep 2.4 and 2.5 drivers in-sync as much as possible. (03/04/27 1.1137.1.5) [netdrvr e1000] add support for NAPI * Copy NAPI support from 2.5 e1000 driver * Add CONFIG_E1000_NAPI option (03/04/27 1.1137.1.4) [netdrvr tulip] support DM910x chip from ALi (03/04/27 1.1137.1.3) Remove duplicate CONFIG_TULIP_MWI entry in Configure.help Noticed by Geert Uytterhoeven (03/04/27 1.1137.1.2) [netdrvr 8139cp] enable MWI via pci_set_mwi, rather than manually (03/04/26 1.1131.2.6) [netdrvr typhoon] s/#if/#ifdef/ for a CONFIG_ var (03/04/25 1.1131.2.5) [netdrvr sundance] small cleanups from 2.5 - s/long flag/unsigned long flag/ - C99 initializers (03/04/25 1.1131.2.4) [netdrvr sundance] bug fixes, VLAN support - Fix tx bugs in big-endian machines - Remove unused max_interrupt_work module parameter, the new NAPI-like rx scheme doesn't need it. - Remove redundancy get_stats() in intr_handler(), those I/O access could affect performance in ARM-based system - Add Linux software VLAN support - Fix bug of custom mac address (StationAddr register only accept word write) (03/04/25 1.1131.2.3) [netdrvr via-rhine] fix promisc mode I found a via-rhine bug, it can't receive BPDU (mac: 0180c2000000) in promiscuous mode. Fill all "1" in hash table to fix this problem in promiscuous mode. (RCR remain 0x1c, write it as 0x1f don't work) (03/04/25 1.1131.2.2) [wireless airo] fix end-of-array test FYI statsLabels[] is an array of char*, so the fix below is pretty obvious. (03/04/25 1.1131.2.1) [PATCH] fix .text.exit error in drivers/net/r8169.c In drivers/net/r8169.c the function rtl8169_remove_one is __devexit but the pointer to it didn't use __devexit_p resulting in a.text.exit compile error when !CONFIG_HOTPLUG. The fix is simple: (03/04/17 1.1101.8.7) [bonding] add support for IEEE 802.3ad Dynamic link aggregation Contributed by Shmulik Hen @ Intel, merge by Jay Vosburgh @ IBM (03/04/17 1.1101.8.6) [bonding] move private decls into new drv/net/bonding/bonding.h file (03/04/17 1.1101.8.5) [bonding] move driver into new drivers/net/bonding directory (03/04/17 1.1101.8.4) [bonding] Moved setting slave mac addr, and open, from app to the driver This patch enables support of modes that need to use the unique mac address of each slave. It moves setting the slave's mac address and opening it from the application to the driver. This breaks backward compatibility between the new driver and older applications ! It also blocks possibility of enslaving before the master is up (to prevent putting the system in an unstable state), and removes the code that unconditionally restores all base driver's flags (flags are automatically restored once all undo stages are done in proper order). Contributed by Shmulik Hen @ Intel (03/04/17 1.1101.8.3) [bonding] add support for getting slave's speed and duplex via ethtool Contributed by Shmulik Hen @ Intel (03/04/17 1.1101.8.2) [bonding] fix comment to prevent future merge difficulties Contributed by Jay Vosburgh @ IBM (03/04/17 1.1101.8.1) [net] store physical device a packet arrives in on (Needed for bonding) Contributed by Jay Vosburgh @ IBM, Shmulik Hen @ Intel, and others. From davem@redhat.com Mon May 26 23:32:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Mon, 26 May 2003 23:33:01 -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.9) with SMTP id h4R6Wt2x012631 for ; Mon, 26 May 2003 23:32:56 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA30975; Mon, 26 May 2003 23:32:11 -0700 Date: Mon, 26 May 2003 23:32:11 -0700 (PDT) Message-Id: <20030526.233211.54217447.davem@redhat.com> To: fw@deneb.enyo.de Cc: hadi@shell.cyberus.ca, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: Route cache performance under stress From: "David S. Miller" In-Reply-To: <87wuge59w2.fsf@deneb.enyo.de> References: <87adda6uro.fsf@deneb.enyo.de> <20030526.002934.132904126.davem@redhat.com> <87wuge59w2.fsf@deneb.enyo.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2725 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 From: Florian Weimer Date: Mon, 26 May 2003 11:34:37 +0200 Of course, this will result in vastly decreased functionality (no arbitary netmasks, no policy-based routing, code will be fine-tuned for typical Internet routing tables), so this proposal definitely comes at a price. As a general purpose operating system, where people DO in fact use these features quite regularly, we cannot make these kinds of choices without making it optional and definiteily non-default behavior. From shemminger@osdl.org Tue May 27 09:51:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Tue, 27 May 2003 09:51:54 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4RGpg2x006762 for ; Tue, 27 May 2003 09:51:45 -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 h4RGpTX27530; Tue, 27 May 2003 09:51:29 -0700 Date: Tue, 27 May 2003 09:51:29 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: muizelaar@rogers.com, netdev@oss.sgi.com Subject: Re: [PATCH] post-sysfs netdev cleanup Message-Id: <20030527095129.4bddbc51.shemminger@osdl.org> In-Reply-To: <20030525.192417.102551586.davem@redhat.com> References: <3ECD6E2D.5090000@rogers.com> <20030522.174415.28799441.davem@redhat.com> <3ECEB317.5020407@osdl.org> <20030525.192417.102551586.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2726 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 Sun, 25 May 2003 19:24:17 -0700 (PDT) "David S. Miller" wrote: > From: Stephen Hemminger > Date: Fri, 23 May 2003 16:47:35 -0700 > > Seems like a good idea too. > > Ok, great. > > Stephen, I think we need to find a way to put the device > registration call outside of the RTNL semaphore. I removed > in the unregister case, but to be complete we have to push it out in > the register path too. > > The reason for all of these issues is that link_watch grabs the RTNL > semaphore, and this runs via keventd. Thus, trying to invoke any > usermode helper (/sbin/hotplug etc.) while holding the RTNL semaphore > can deadlock. There needs to be some locking in the registration path doesn't there to prevent two calls to register the same name and other possible conflicts. So do you want to use dev_base lock or some other locking? From davem@redhat.com Wed May 28 01:34:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 01:35:01 -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.9) with SMTP id h4S8Yt2x009154 for ; Wed, 28 May 2003 01:34:55 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id BAA02615; Wed, 28 May 2003 01:33:59 -0700 Date: Wed, 28 May 2003 01:33:59 -0700 (PDT) Message-Id: <20030528.013359.132929461.davem@redhat.com> To: shemminger@osdl.org Cc: muizelaar@rogers.com, netdev@oss.sgi.com Subject: Re: [PATCH] post-sysfs netdev cleanup From: "David S. Miller" In-Reply-To: <20030527095129.4bddbc51.shemminger@osdl.org> References: <3ECEB317.5020407@osdl.org> <20030525.192417.102551586.davem@redhat.com> <20030527095129.4bddbc51.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2727 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 From: Stephen Hemminger Date: Tue, 27 May 2003 09:51:29 -0700 There needs to be some locking in the registration path doesn't there to prevent two calls to register the same name and other possible conflicts. So do you want to use dev_base lock or some other locking? Good point. We can't be as "fast and loose" with this as we can with the hotplug invocation... I can't come up with a usable solution at this moment. :( From hch@lst.de Wed May 28 04:07:02 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 04:07:18 -0700 (PDT) Received: from mail.lst.de (verein.lst.de [212.34.189.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4SB6x2x018984 for ; Wed, 28 May 2003 04:07:01 -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 h4SB6waH026429 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 28 May 2003 13:06:58 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.3) id h4SB6wvJ026427 for netdev@oss.sgi.com; Wed, 28 May 2003 13:06:58 +0200 Date: Wed, 28 May 2003 13:06:58 +0200 From: Christoph Hellwig To: netdev@oss.sgi.com Subject: [PATCH] remove sdla from setup.c Message-ID: <20030528110658.GA26411@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-archive-position: 2728 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 sdla had calls from both Space.c and setup.c. Leave the Space.c one alone as per previous discussion but move over the setup.c one to initcalls. (and remove the prototype for a third one from setup.c!) --- 1.14/drivers/net/setup.c Tue May 27 01:32:22 2003 +++ edited/drivers/net/setup.c Tue May 27 14:36:58 2003 @@ -13,8 +13,6 @@ extern int scc_enet_init(void); extern int fec_enet_init(void); -extern int sdla_setup(void); -extern int sdla_c_setup(void); /* * Devices in this list must do new style probing. That is they must @@ -35,9 +33,6 @@ #if defined(CONFIG_DMASCC) {dmascc_init, 0}, #endif -#if defined(CONFIG_SDLA) - {sdla_c_setup, 0}, -#endif #if defined(CONFIG_SCC_ENET) {scc_enet_init, 0}, #endif ===== drivers/net/wan/sdla.c 1.10 vs edited ===== --- 1.10/drivers/net/wan/sdla.c Sun May 18 17:18:07 2003 +++ edited/drivers/net/wan/sdla.c Tue May 27 15:07:49 2003 @@ -1667,20 +1667,20 @@ .name = "sdla0", .init = sdla_init }; +#endif /* MODULE */ -MODULE_LICENSE("GPL"); - -int init_module(void) +static int __init init_sdla(void) { - int result; + int result = 0; sdla_c_setup(); - if ((result = register_netdev(&sdla0)) != 0) - return result; - return 0; +#ifdef MODULE + result = register_netdev(&sdla0); +#endif + return result; } -void cleanup_module(void) +static void __exit exit_sdla(void) { unregister_netdev(&sdla0); if (sdla0.priv) @@ -1688,4 +1688,8 @@ if (sdla0.irq) free_irq(sdla0.irq, &sdla0); } -#endif /* MODULE */ + +MODULE_LICENSE("GPL"); + +module_init(init_sdla); +module_exit(exit_sdla); From manfred@colorfullife.com Wed May 28 18:16:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 18:16:21 -0700 (PDT) Received: from dbl.q-ag.de (dbl.q-ag.de [80.146.160.66]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4T1G52x004966 for ; Wed, 28 May 2003 18:16:09 -0700 Received: from colorfullife.com (localhost [127.0.0.1]) by dbl.q-ag.de (8.12.3/8.12.3/Debian-6.3) with ESMTP id h4T1FwDO025895; Thu, 29 May 2003 03:15:59 +0200 Message-ID: <3ED55F4D.1070306@colorfullife.com> Date: Thu, 29 May 2003 03:15:57 +0200 From: Manfred Spraul User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David S. Miller" CC: netdev@oss.sgi.com, Andrew Morton Subject: Re: oops in tcp_v4_rcv. References: <3ED54DBC.4020203@colorfullife.com> In-Reply-To: <3ED54DBC.4020203@colorfullife.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2729 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: manfred@colorfullife.com Precedence: bulk X-list: netdev [netdev added to cc list] I think I understand now what causes the crash: The tcp_ehash assumes that the entries are of the type 'struct inet_sock'. But the actual entry is of the type tcp_tw_bucket. And 'sk->inet.daddr' is not shared between both structures. << net/ipv4/tcp_ipv4, line 510: /* Must check for a TIME_WAIT'er before going to listener hash. */ for (sk = (head + tcp_ehash_size)->chain; sk; sk = sk->next) if (TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; << preprocessor output: << for (sk = (head + (tcp_hashinfo.__tcp_ehash_size))->chain; sk; sk = sk->next) if ((((&((struct inet_sock *)sk)->inet)->daddr == (saddr)) && ((&((struct inet_sock *)sk)->inet)->rcv_saddr == (daddr)) && ((*((__u32 *)&((&((struct inet_sock *)sk)->inet)->dport)))== (ports)) && (!((sk)->bound_dev_if) || ((sk)->bound_dev_if == (dif))))) goto hit; << Manfred Spraul wrote: > Hi, > > I'm looking at crashes that occur during network stress testing with > the CONFIG_DEBUG_PAGEALLOC from -mm: Pages that are not in use are > immediately unmapped from the linear mapping, and thus reading stale > pointer causes an immediate oops. > > I've now analyzed one crash: > the oops is in __tcp_v4_lookup_established, in the 2nd look [i.e. > looking at TIME_WAIT sockets. Easy to identify due to the access to > __tcp_ehash_size]. > > The entry in the hash table is an tcp_tw_bucket, and that structure is > only ~88 bytes long. The oops is caused by an access to objp+0x168, > which doesn't exist. From davem@redhat.com Wed May 28 18:42:03 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 18:42:09 -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.9) with SMTP id h4T1fv2x005948 for ; Wed, 28 May 2003 18:42:03 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA04886; Wed, 28 May 2003 18:40:54 -0700 Date: Wed, 28 May 2003 18:40:54 -0700 (PDT) Message-Id: <20030528.184054.78710412.davem@redhat.com> To: manfred@colorfullife.com Cc: netdev@oss.sgi.com, akpm@digeo.com, acme@conectiva.com.br Subject: Re: oops in tcp_v4_rcv. From: "David S. Miller" In-Reply-To: <3ED55F4D.1070306@colorfullife.com> References: <3ED54DBC.4020203@colorfullife.com> <3ED55F4D.1070306@colorfullife.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2730 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 From: Manfred Spraul Date: Thu, 29 May 2003 03:15:57 +0200 I think I understand now what causes the crash: The tcp_ehash assumes that the entries are of the type 'struct inet_sock'. But the actual entry is of the type tcp_tw_bucket. And 'sk->inet.daddr' is not shared between both structures. Thanks for figuring this out. Indeed, I had suspected the sock layout change Arnaldo did early in 2.5.x as the main possible suspect. I'll try to fix this. From acme@conectiva.com.br Wed May 28 18:50:13 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 18:50:21 -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.9) with SMTP id h4T1oB2x006365 for ; Wed, 28 May 2003 18:50:13 -0700 Received: from [200.181.169.138] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19LCh5-000814-00; Wed, 28 May 2003 22:59:03 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 3F5B11966C; Thu, 29 May 2003 01:50:21 +0000 (UTC) Date: Wed, 28 May 2003 22:50:20 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: manfred@colorfullife.com, netdev@oss.sgi.com, akpm@digeo.com Subject: Re: oops in tcp_v4_rcv. Message-ID: <20030529015020.GS12434@conectiva.com.br> References: <3ED54DBC.4020203@colorfullife.com> <3ED55F4D.1070306@colorfullife.com> <20030528.184054.78710412.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030528.184054.78710412.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2731 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 Wed, May 28, 2003 at 06:40:54PM -0700, David S. Miller escreveu: > From: Manfred Spraul > Date: Thu, 29 May 2003 03:15:57 +0200 > > I think I understand now what causes the crash: > The tcp_ehash assumes that the entries are of the type 'struct inet_sock'. > But the actual entry is of the type tcp_tw_bucket. And 'sk->inet.daddr' > is not shared between both structures. > > Thanks for figuring this out. Indeed, I had suspected the > sock layout change Arnaldo did early in 2.5.x as the main > possible suspect. > > I'll try to fix this. I'm as well looking at this, longstanding bug :-\ - Arnaldo From davem@redhat.com Wed May 28 18:52:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 18:53:06 -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.9) with SMTP id h4T1qp2x006695 for ; Wed, 28 May 2003 18:52:51 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id SAA04942; Wed, 28 May 2003 18:51:42 -0700 Date: Wed, 28 May 2003 18:51:42 -0700 (PDT) Message-Id: <20030528.185142.85410989.davem@redhat.com> To: acme@conectiva.com.br Cc: manfred@colorfullife.com, netdev@oss.sgi.com, akpm@digeo.com Subject: Re: oops in tcp_v4_rcv. From: "David S. Miller" In-Reply-To: <20030529015020.GS12434@conectiva.com.br> References: <3ED55F4D.1070306@colorfullife.com> <20030528.184054.78710412.davem@redhat.com> <20030529015020.GS12434@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2732 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 From: Arnaldo Carvalho de Melo Date: Wed, 28 May 2003 22:50:20 -0300 Em Wed, May 28, 2003 at 06:40:54PM -0700, David S. Miller escreveu: > I'll try to fix this. I'm as well looking at this, longstanding bug :-\ Here's a patch, should work: --- include/net/tcp.h.~1~ Wed May 28 18:42:52 2003 +++ include/net/tcp.h Wed May 28 18:49:47 2003 @@ -208,6 +208,8 @@ #endif }; +#define tcptw_sk(__sk) ((struct tcp_tw_bucket *)(__sk)) + extern kmem_cache_t *tcp_timewait_cachep; static inline void tcp_tw_put(struct tcp_tw_bucket *tw) @@ -246,7 +248,11 @@ #endif /* __BIG_ENDIAN */ #define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ (((*((__u64 *)&(inet_sk(__sk)->daddr)))== (__cookie)) && \ - ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \ + ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \ + (!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif)))) +#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ + (((*((__u64 *)&(tcptw_sk(__sk)->daddr)))== (__cookie)) && \ + ((*((__u32 *)&(tcptw_sk(__sk)->dport)))== (__ports)) && \ (!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif)))) #else /* 32-bit arch */ #define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr) @@ -254,6 +260,11 @@ ((inet_sk(__sk)->daddr == (__saddr)) && \ (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \ + (!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif)))) +#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ + ((tcptw_sk(__sk)->daddr == (__saddr)) && \ + (tcptw_sk(__sk)->rcv_saddr == (__daddr)) && \ + ((*((__u32 *)&(tcptw_sk(__sk)->dport)))== (__ports)) && \ (!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif)))) #endif /* 64-bit arch */ --- net/ipv4/tcp_ipv4.c.~1~ Wed May 28 18:44:59 2003 +++ net/ipv4/tcp_ipv4.c Wed May 28 18:45:18 2003 @@ -509,7 +509,7 @@ /* Must check for a TIME_WAIT'er before going to listener hash. */ for (sk = (head + tcp_ehash_size)->chain; sk; sk = sk->next) - if (TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) + if (TCP_IPV4_TW_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; out: read_unlock(&head->lock); @@ -570,7 +570,7 @@ skp = &sk2->next) { tw = (struct tcp_tw_bucket *)sk2; - if (TCP_IPV4_MATCH(sk2, acookie, saddr, daddr, ports, dif)) { + if (TCP_IPV4_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) { struct tcp_opt *tp = tcp_sk(sk); /* With PAWS, it is safe from the viewpoint From acme@conectiva.com.br Wed May 28 19:00:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 19:00:23 -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.9) with SMTP id h4T20I2x007543 for ; Wed, 28 May 2003 19:00:19 -0700 Received: from [200.181.169.138] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19LCqy-00082t-00; Wed, 28 May 2003 23:09:16 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id 8D73F1966C; Thu, 29 May 2003 02:00:35 +0000 (UTC) Date: Wed, 28 May 2003 23:00:35 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: manfred@colorfullife.com, netdev@oss.sgi.com, akpm@digeo.com Subject: Re: oops in tcp_v4_rcv. Message-ID: <20030529020034.GT12434@conectiva.com.br> References: <3ED55F4D.1070306@colorfullife.com> <20030528.184054.78710412.davem@redhat.com> <20030529015020.GS12434@conectiva.com.br> <20030528.185142.85410989.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030528.185142.85410989.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2733 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 Wed, May 28, 2003 at 06:51:42PM -0700, David S. Miller escreveu: > From: Arnaldo Carvalho de Melo > Date: Wed, 28 May 2003 22:50:20 -0300 > > Em Wed, May 28, 2003 at 06:40:54PM -0700, David S. Miller escreveu: > > I'll try to fix this. > > I'm as well looking at this, longstanding bug :-\ > > Here's a patch, should work: At first look, agreed. Thanks David for fixing this. - Arnaldo From davem@redhat.com Wed May 28 20:07:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 20:07: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.9) with SMTP id h4T37V2x008408 for ; Wed, 28 May 2003 20:07:32 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA05180; Wed, 28 May 2003 20:06:23 -0700 Date: Wed, 28 May 2003 20:06:23 -0700 (PDT) Message-Id: <20030528.200623.28791498.davem@redhat.com> To: acme@conectiva.com.br Cc: manfred@colorfullife.com, netdev@oss.sgi.com, akpm@digeo.com Subject: Re: oops in tcp_v4_rcv. From: "David S. Miller" In-Reply-To: <20030529020034.GT12434@conectiva.com.br> References: <20030529015020.GS12434@conectiva.com.br> <20030528.185142.85410989.davem@redhat.com> <20030529020034.GT12434@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2734 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 From: Arnaldo Carvalho de Melo Date: Wed, 28 May 2003 23:00:35 -0300 Em Wed, May 28, 2003 at 06:51:42PM -0700, David S. Miller escreveu: > Here's a patch, should work: At first look, agreed. Thanks David for fixing this. No problem. And a big double-thanks for Mandred for tracking this down. I wish him luck in tracking down the task struct use-after-free that he's also seeing. :-) From zhanght@netpower.com.cn Wed May 28 21:19:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 21:20:10 -0700 (PDT) Received: from mail.netpower.com.cn ([211.154.175.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4T4Jn2x009924 for ; Wed, 28 May 2003 21:19:54 -0700 Received: from netpower.com.cn [192.168.0.196] by mail.netpower.com.cn with ESMTP (SMTPD32-7.07) id A96033018E; Thu, 29 May 2003 12:15:28 +0800 Message-ID: <3ED58DBA.6000506@netpower.com.cn> Date: Thu, 29 May 2003 12:34:02 +0800 From: Zhang Haitao User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: zh-cn, en-us, en MIME-Version: 1.0 To: netdev@oss.sgi.com Subject: Hi, this is my patch for broadcom sb1250-mac.c Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-archive-position: 2735 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zhanght@netpower.com.cn Precedence: bulk X-list: netdev Hi, i've got sb1250-mac.c from broadcom directly, but find the original driver are not working stable when delivering 64bytes framesize packets under gigabits circumstance. This patch have been ported a part of NAPI (added an sbmac_poll function,dev->quota = 80 ) and modified some parameters to enhance the packets processing performance eg. tx&rx dma discriptor numbers and dual TX channel configuration. at the same, in order to let may driver working in Gigafiber circumstance, i also added some codes for fiber mode controll. After using my pacth, my board can process 140Mbps 64bytes packets under linux. but there are still some problem exsit in my driver : seems that bug will be trigger when running into fiber mode and i also use klogd to collect some oops message, hope someone can told me what's happend to make my kernel crashed.... :-( i'm very glad to let all of you to review this patch or give me some advice from the oops message! Thanks in advance ! yours Zhang Haitao here i post my most part of this patch and oops message get from klogd [minipanda@zhanght netpower]# cat /home/zhanght/patchcvs/sb1250.patchbroadcom --- ./sb1250-broadcom.c Thu May 29 12:24:17 2003 +++ ./sb1250-mac.debug.c Wed May 28 14:37:00 2003 @@ -44,8 +44,8 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1}; #endif -static int int_pktcnt = 0; -static int int_timeout = 0; +static int int_pktcnt = 32; +static int int_timeout = 1024; /* Operational parameters that usually are not changed. */ @@ -91,7 +91,8 @@ static char version1[] __devinitdata = "sb1250-mac.c:1.00 1/11/2001 Written by Mitch Lichtenberg (mpl@broadcom.com)\n"; #endif - +#define CONFIG_SB1250_NAPI +#define NAPI_LOP_MAX 10 MODULE_AUTHOR("Mitch Lichtenberg (mpl@broadcom.com)"); @@ -154,8 +155,8 @@ #define PKSEG1(x) ((sbmac_port_t) KSEG1ADDR(x)) -#define SBMAC_MAX_TXDESCR 32 -#define SBMAC_MAX_RXDESCR 32 +#define SBMAC_MAX_TXDESCR 128 +#define SBMAC_MAX_RXDESCR 128 #define ETHER_ALIGN 2 #define ETHER_ADDR_LEN 6 @@ -190,8 +191,8 @@ int sbdma_txdir; /* direction (1=transmit) */ int sbdma_maxdescr; /* total # of descriptors in ring */ #ifdef CONFIG_SBMAC_COALESCE - int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ - int sbdma_int_timeout; /* # usec rx/tx interrupt */ + int sbdma_int_pktcnt; /* # descriptors rx before interrupt*/ + int sbdma_int_timeout; /* # usec rx interrupt */ #endif sbmac_port_t sbdma_config0; /* DMA config register 0 */ @@ -255,18 +256,20 @@ sbmac_port_t sbm_isr; /* Interrupt status register */ sbmac_port_t sbm_imr; /* Interrupt mask register */ sbmac_port_t sbm_mdio; /* MDIO register */ - + sbmac_speed_t sbm_speed; /* current speed */ sbmac_duplex_t sbm_duplex; /* current duplex */ sbmac_fc_t sbm_fc; /* current flow control setting */ u_char sbm_hwaddr[ETHER_ADDR_LEN]; - sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ + sbmacdma_t sbm_txdma; /* for now, use channel 0 */ sbmacdma_t sbm_rxdma; int rx_hw_checksum; int sbe_idx; - + + int sbm_fibermode; + int sbm_phy_oldsignaldetect; }; @@ -288,7 +291,6 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); static void sbdma_emptyring(sbmacdma_t *d); static void sbdma_fillring(sbmacdma_t *d); -static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d); static int sbmac_initctx(struct sbmac_softc *s); static void sbmac_channel_start(struct sbmac_softc *s); @@ -299,6 +301,13 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr); static void sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs); static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); +#ifdef CONFIG_SB1250_NAPI +static int sbmac_poll(struct net_device *dev_instance, int *budget); +static inline void sbmac_irq_disable(struct sbmac_softc *s); +static inline void sbmac_irq_enable(struct sbmac_softc *s); +#else +static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); +#endif static void sbmac_setmulti(struct sbmac_softc *sc); static int sbmac_init(struct net_device *dev); static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); @@ -448,6 +457,15 @@ #define PHYSUP_LINKUP 0x04 #define PHYSUP_FDX 0x02 +/* Added for Fiber mode detection +just read Signal Detect alternation */ + +#define MII_AUXCTL 0x18 /* Auxiliary Control Register */ + +#define MII_SGMIISR 0x0C /* SGMII/100-X Status Register */ + +#define SGMIISR_FIBERSDS 0x2000 + #define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define MII_BMSR 0x01 /* Basic mode status register (ro) */ #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ @@ -459,6 +477,17 @@ #define ENABLE 1 #define DISABLE 0 +#ifdef CONFIG_SB1250_NAPI +static inline void sbmac_irq_disable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0)); +} +static inline void sbmac_irq_enable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); +} +#endif /********************************************************************** * SBMAC_MII_SYNC(s) * @@ -759,22 +788,22 @@ #ifdef CONFIG_SBMAC_COALESCE /* - * Setup Rx/Tx DMA coalescing defaults + * Setup RxTx DMA coalescing defaults */ - if ( int_pktcnt ) { - d->sbdma_int_pktcnt = int_pktcnt; - } - else { - d->sbdma_int_pktcnt = 1; - } + if ( int_pktcnt ) { + d->sbdma_int_pktcnt = int_pktcnt; + } + else { + d->sbdma_int_pktcnt = 1; + } - if ( int_timeout ) { - d->sbdma_int_timeout = int_timeout; - } - else { - d->sbdma_int_timeout = 0; - } + if ( int_timeout ) { + d->sbdma_int_timeout = int_timeout; + } + else { + d->sbdma_int_timeout = 0; + } #endif } @@ -944,7 +973,7 @@ sb_new = sb; /* * nothing special to reinit buffer, it's already aligned - * and sb->data already points to a good place. + * and sb->tail already points to a good place. */ } @@ -956,11 +985,11 @@ /* * Do not interrupt per DMA transfer. */ - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; #else - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | M_DMA_DSCRA_INTERRUPT; #endif @@ -1045,16 +1074,17 @@ phys = KVTOPHYS(sb->data); ncb = NUMCACHEBLKS(length+(phys & (CACHELINESIZE-1))); - +#ifdef CONFIG_SBMAC_COALESCE + /* do not interript per DMA transfer*/ dsc->dscr_a = phys | V_DMA_DSCRA_A_SIZE(ncb) | -#ifdef CONFIG_SBMAC_COALESCE - 0 | + M_DMA_ETHTX_SOP; #else + dsc->dscr_a = phys | + V_DMA_DSCRA_A_SIZE(ncb) | M_DMA_DSCRA_INTERRUPT | -#endif M_DMA_ETHTX_SOP; - +#endif /* transmitting: set outbound options and length */ dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | @@ -1133,7 +1163,7 @@ } } - +#ifndef CONFIG_SB1250_NAPI /********************************************************************** * SBDMA_RX_PROCESS(sc,d) * @@ -1181,6 +1211,14 @@ */ if (curidx == hwidx) break; + /*{ + int i; + for (i=0;;i++) { + if ((dsc->dscr_a & M_DMA_ETHRX_SOP) != 0) + break; + if (i >= NAPI_LOP_MAX) goto ret; + } + }*/ /* * Otherwise, get the packet's sk_buff ptr back @@ -1236,8 +1274,7 @@ sb->ip_summed = CHECKSUM_UNNECESSARY; } } /*rx_hw_checksum */ - - netif_rx(sb); + netif_rx(sb); } } else { @@ -1258,7 +1295,7 @@ } } - +#endif /********************************************************************** @@ -1352,6 +1389,7 @@ */ dev_kfree_skb_irq(sb); + //__kfree_skb(sb); //try free fast /* * .. and advance to the next buffer. @@ -1392,7 +1430,8 @@ static int sbmac_initctx(struct sbmac_softc *s) { - + + int auxctl; /* * figure out the addresses of some ports */ @@ -1413,6 +1452,8 @@ s->sbm_phy_oldanlpar = 0; s->sbm_phy_oldk1stsr = 0; s->sbm_phy_oldlinkstat = 0; + + s->sbm_phy_oldsignaldetect =0; /* * Initialize the DMA channels. Right now, only one per MAC is used @@ -1421,7 +1462,6 @@ sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); - /* * initial state is OFF */ @@ -1435,7 +1475,18 @@ s->sbm_speed = sbmac_speed_10; s->sbm_duplex = sbmac_duplex_half; s->sbm_fc = sbmac_fc_disabled; + + /* + * Fiber/Copper Mode AutoDetection + */ + sbmac_mii_write(s,1,MII_AUXCTL,0x2007); + auxctl = sbmac_mii_read(s,1,MII_AUXCTL); + if(auxctl) + { + s->sbm_fibermode=1; + } + else s->sbm_fibermode=0; return 0; } @@ -1533,7 +1584,7 @@ framecfg = V_MAC_MIN_FRAMESZ_DEFAULT | V_MAC_MAX_FRAMESZ_DEFAULT | V_MAC_BACKOFF_SEL(1); - + /* * Clear out the hash address map @@ -1604,14 +1655,14 @@ SBMAC_WRITECSR(s->sbm_framecfg,framecfg); SBMAC_WRITECSR(s->sbm_fifocfg,fifo); SBMAC_WRITECSR(s->sbm_maccfg,cfg); - + /* * Initialize DMA channels (rings should be ok now) */ sbdma_channel_start(&(s->sbm_rxdma), DMA_RX); sbdma_channel_start(&(s->sbm_txdma), DMA_TX); - + /* * Configure the speed, duplex, and flow control */ @@ -1632,6 +1683,8 @@ SBMAC_WRITECSR(s->sbm_macenable, M_MAC_RXDMA_EN0 | M_MAC_TXDMA_EN0 | + M_MAC_RXDMA_EN1 | + M_MAC_TXDMA_EN1 | M_MAC_RX_ENABLE | M_MAC_TX_ENABLE); @@ -1645,6 +1698,7 @@ SBMAC_WRITECSR(s->sbm_imr, ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); + #else /* * Accept any kind of interrupt on TX and RX DMA channel 0 @@ -1724,12 +1778,12 @@ sbdma_channel_stop(&(s->sbm_rxdma)); sbdma_channel_stop(&(s->sbm_txdma)); - + /* Empty the receive and transmit rings */ sbdma_emptyring(&(s->sbm_rxdma)); sbdma_emptyring(&(s->sbm_txdma)); - + } /********************************************************************** @@ -1967,7 +2021,7 @@ V_MAC_IFG_TX_1000 | V_MAC_IFG_THRSH_1000 | V_MAC_SLOT_SIZE_1000; - cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; +cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; break; case sbmac_speed_auto: /* XXX not implemented */ @@ -2102,6 +2156,7 @@ { struct net_device *dev = (struct net_device *) dev_instance; struct sbmac_softc *sc = (struct sbmac_softc *) (dev->priv); + uint64_t isr; for (;;) { @@ -2122,9 +2177,9 @@ if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) { sbdma_tx_process(sc,&(sc->sbm_txdma)); } - + /* - * Receives on channel 0 + * Receives on channel 0,1 */ /* @@ -2140,58 +2195,191 @@ * won't get another interrupt until a packet shows * up to start the timer again. Testing * EOP_SEEN here takes care of this case. - * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) - */ - - - if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { - sbdma_rx_process(sc,&(sc->sbm_rxdma)); + * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) + */ + + + if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { +#ifdef CONFIG_SB1250_NAPI + if (netif_rx_schedule_prep(dev)) { + sbmac_irq_disable(sc); + __netif_rx_schedule(dev); } +#else + sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#endif } - +} } /********************************************************************** - * SBMAC_START_TX(skb,dev) - * - * Start output on the specified interface. Basically, we - * queue as many buffers as we can until the ring fills up, or - * we run off the end of the queue, whichever comes first. - * - * Input parameters: - * - * - * Return value: - * nothing - ********************************************************************* */ +* SBMAC_START_TX(skb,dev) +* +* Start output on the specified interface. Basically, we +* queue as many buffers as we can until the ring fills up, or +* we run off the end of the queue, whichever comes first. +* +* Input parameters: +* +* +* Return value: +* nothing +********************************************************************* */ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) { - struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; - - /* lock eth irq */ - spin_lock_irq (&sc->sbm_lock); - - /* - * Put the buffer on the transmit ring. If we - * don't have room, stop the queue. - */ - - if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { - /* XXX save skb that we could not send */ - netif_stop_queue(dev); - spin_unlock_irq(&sc->sbm_lock); +struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; +spin_lock_irq (&sc->sbm_lock); +/* + * Put the buffer on the transmit ring. If we + * don't have room, stop the queue. + */ + +if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { + /* XXX save skb that we could not send, then test 1 channel */ + netif_stop_queue(dev); + spin_unlock_irq(&sc->sbm_lock); - return 1; + return 1; } dev->trans_start = jiffies; - spin_unlock_irq (&sc->sbm_lock); return 0; } +#ifdef CONFIG_SB1250_NAPI +//#define NAPI_POL_MAX 100 +static int sbmac_poll(struct net_device *dev_instance, int *budget) { + struct net_device *dev = (struct net_device *) dev_instance; + struct sbmac_softc *sc = (struct sbmac_softc *) (dev_instance->priv); + sbmacdma_t *d = &(sc->sbm_rxdma); + int rx_work_limit = *budget; + unsigned long flags; + long int receive=0; + int curidx; + int hwidx; + + sbdmadscr_t *dsc; + struct sk_buff *sb; + int len; + + if(rx_work_limit > dev->quota) + rx_work_limit = dev->quota; + + for (;;) { + /* + * figure out where we are (as an index) and where + * the hardware is (also as an index) + * + * This could be done faster if (for example) the + * descriptor table was page-aligned and contiguous in + * both virtual and physical memory -- you could then + * just compare the low-order bits of the virtual address + * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) + */ + if(--rx_work_limit < 0) goto not_done; + curidx = d->sbdma_remptr - d->sbdma_dscrtable; + hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - + d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); + + /* + * If they're the same, that means we've processed all + * of the descriptors up to (but not including) the one that + * the hardware is working on right now. + */ + + if (curidx == hwidx) break; + + /* + * Otherwise, get the packet's sk_buff ptr back + */ + + dsc = &(d->sbdma_dscrtable[curidx]); + sb = d->sbdma_ctxtable[curidx]; + d->sbdma_ctxtable[curidx] = NULL; + + len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; + + /* + * Check packet status. If good, process it. + * If not, silently drop it and put it back on the + * receive ring. + */ + + if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { + + /* + * Add a new buffer to replace the old one. If we fail + * to allocate a buffer, we're going to drop this + * packet and put it right back on the receive ring.[root@zhanght root]# cat /home/zhanght/patchcvs/sb1250.patchbroadcom --- ./sb1250-broadcom.c Thu May 29 12:24:17 2003 +++ ./sb1250-mac.debug.c Wed May 28 14:37:00 2003 @@ -44,8 +44,8 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1}; #endif -static int int_pktcnt = 0; -static int int_timeout = 0; +static int int_pktcnt = 32; +static int int_timeout = 1024; /* Operational parameters that usually are not changed. */ @@ -91,7 +91,8 @@ static char version1[] __devinitdata = "sb1250-mac.c:1.00 1/11/2001 Written by Mitch Lichtenberg (mpl@broadcom.com)\n"; #endif - +#define CONFIG_SB1250_NAPI +#define NAPI_LOP_MAX 10 MODULE_AUTHOR("Mitch Lichtenberg (mpl@broadcom.com)"); @@ -154,8 +155,8 @@ #define PKSEG1(x) ((sbmac_port_t) KSEG1ADDR(x)) -#define SBMAC_MAX_TXDESCR 32 -#define SBMAC_MAX_RXDESCR 32 +#define SBMAC_MAX_TXDESCR 128 +#define SBMAC_MAX_RXDESCR 128 #define ETHER_ALIGN 2 #define ETHER_ADDR_LEN 6 @@ -190,8 +191,8 @@ int sbdma_txdir; /* direction (1=transmit) */ int sbdma_maxdescr; /* total # of descriptors in ring */ #ifdef CONFIG_SBMAC_COALESCE - int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ - int sbdma_int_timeout; /* # usec rx/tx interrupt */ + int sbdma_int_pktcnt; /* # descriptors rx before interrupt*/ + int sbdma_int_timeout; /* # usec rx interrupt */ #endif sbmac_port_t sbdma_config0; /* DMA config register 0 */ @@ -255,18 +256,20 @@ sbmac_port_t sbm_isr; /* Interrupt status register */ sbmac_port_t sbm_imr; /* Interrupt mask register */ sbmac_port_t sbm_mdio; /* MDIO register */ - + sbmac_speed_t sbm_speed; /* current speed */ sbmac_duplex_t sbm_duplex; /* current duplex */ sbmac_fc_t sbm_fc; /* current flow control setting */ u_char sbm_hwaddr[ETHER_ADDR_LEN]; - sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ + sbmacdma_t sbm_txdma; /* for now, use channel 0 */ sbmacdma_t sbm_rxdma; int rx_hw_checksum; int sbe_idx; - + + int sbm_fibermode; + int sbm_phy_oldsignaldetect; }; @@ -288,7 +291,6 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); static void sbdma_emptyring(sbmacdma_t *d); static void sbdma_fillring(sbmacdma_t *d); -static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d); static int sbmac_initctx(struct sbmac_softc *s); static void sbmac_channel_start(struct sbmac_softc *s); @@ -299,6 +301,13 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr); static void sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs); static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); +#ifdef CONFIG_SB1250_NAPI +static int sbmac_poll(struct net_device *dev_instance, int *budget); +static inline void sbmac_irq_disable(struct sbmac_softc *s); +static inline void sbmac_irq_enable(struct sbmac_softc *s); +#else +static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); +#endif static void sbmac_setmulti(struct sbmac_softc *sc); static int sbmac_init(struct net_device *dev); static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); @@ -448,6 +457,15 @@ #define PHYSUP_LINKUP 0x04 #define PHYSUP_FDX 0x02 +/* Added for Fiber mode detection +just read Signal Detect alternation */ + +#define MII_AUXCTL 0x18 /* Auxiliary Control Register */ + +#define MII_SGMIISR 0x0C /* SGMII/100-X Status Register */ + +#define SGMIISR_FIBERSDS 0x2000 + #define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define MII_BMSR 0x01 /* Basic mode status register (ro) */ #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ @@ -459,6 +477,17 @@ #define ENABLE 1 #define DISABLE 0 +#ifdef CONFIG_SB1250_NAPI +static inline void sbmac_irq_disable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0)); +} +static inline void sbmac_irq_enable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); +} +#endif /********************************************************************** * SBMAC_MII_SYNC(s) * @@ -759,22 +788,22 @@ #ifdef CONFIG_SBMAC_COALESCE /* - * Setup Rx/Tx DMA coalescing defaults + * Setup RxTx DMA coalescing defaults */ - if ( int_pktcnt ) { - d->sbdma_int_pktcnt = int_pktcnt; - } - else { - d->sbdma_int_pktcnt = 1; - } + if ( int_pktcnt ) { + d->sbdma_int_pktcnt = int_pktcnt; + } + else { + d->sbdma_int_pktcnt = 1; + } - if ( int_timeout ) { - d->sbdma_int_timeout = int_timeout; - } - else { - d->sbdma_int_timeout = 0; - } + if ( int_timeout ) { + d->sbdma_int_timeout = int_timeout; + } + else { + d->sbdma_int_timeout = 0; + } #endif } @@ -944,7 +973,7 @@ sb_new = sb; /* * nothing special to reinit buffer, it's already aligned - * and sb->data already points to a good place. + * and sb->tail already points to a good place. */ } @@ -956,11 +985,11 @@ /* * Do not interrupt per DMA transfer. */ - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; #else - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | M_DMA_DSCRA_INTERRUPT; #endif @@ -1045,16 +1074,17 @@ phys = KVTOPHYS(sb->data); ncb = NUMCACHEBLKS(length+(phys & (CACHELINESIZE-1))); - +#ifdef CONFIG_SBMAC_COALESCE + /* do not interript per DMA transfer*/ dsc->dscr_a = phys | V_DMA_DSCRA_A_SIZE(ncb) | -#ifdef CONFIG_SBMAC_COALESCE - 0 | + M_DMA_ETHTX_SOP; #else + dsc->dscr_a = phys | + V_DMA_DSCRA_A_SIZE(ncb) | M_DMA_DSCRA_INTERRUPT | -#endif M_DMA_ETHTX_SOP; - +#endif /* transmitting: set outbound options and length */ dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | @@ -1133,7 +1163,7 @@ } } - +#ifndef CONFIG_SB1250_NAPI /********************************************************************** * SBDMA_RX_PROCESS(sc,d) * @@ -1181,6 +1211,14 @@ */ if (curidx == hwidx) break; + /*{ + int i; + for (i=0;;i++) { + if ((dsc->dscr_a & M_DMA_ETHRX_SOP) != 0) + break; + if (i >= NAPI_LOP_MAX) goto ret; + } + }*/ /* * Otherwise, get the packet's sk_buff ptr back @@ -1236,8 +1274,7 @@ sb->ip_summed = CHECKSUM_UNNECESSARY; } } /*rx_hw_checksum */ - - netif_rx(sb); + netif_rx(sb); } } else { @@ -1258,7 +1295,7 @@ } } - +#endif /********************************************************************** @@ -1352,6 +1389,7 @@ */ dev_kfree_skb_irq(sb); + //__kfree_skb(sb); //try free fast /* * .. and advance to the next buffer. @@ -1392,7 +1430,8 @@ static int sbmac_initctx(struct sbmac_softc *s) { - + + int auxctl; /* * figure out the addresses of some ports */ @@ -1413,6 +1452,8 @@ s->sbm_phy_oldanlpar = 0; s->sbm_phy_oldk1stsr = 0; s->sbm_phy_oldlinkstat = 0; + + s->sbm_phy_oldsignaldetect =0; /* * Initialize the DMA channels. Right now, only one per MAC is used @@ -1421,7 +1462,6 @@ sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); - /* * initial state is OFF */ @@ -1435,7 +1475,18 @@ s->sbm_speed = sbmac_speed_10; s->sbm_duplex = sbmac_duplex_half; s->sbm_fc = sbmac_fc_disabled; + + /* + * Fiber/Copper Mode AutoDetection + */ + sbmac_mii_write(s,1,MII_AUXCTL,0x2007); + auxctl = sbmac_mii_read(s,1,MII_AUXCTL); + if(auxctl) + { + s->sbm_fibermode=1; + } + else s->sbm_fibermode=0; return 0; } @@ -1533,7 +1584,7 @@ framecfg = V_MAC_MIN_FRAMESZ_DEFAULT | V_MAC_MAX_FRAMESZ_DEFAULT | V_MAC_BACKOFF_SEL(1); - + /* * Clear out the hash address map @@ -1604,14 +1655,14 @@ SBMAC_WRITECSR(s->sbm_framecfg,framecfg); SBMAC_WRITECSR(s->sbm_fifocfg,fifo); SBMAC_WRITECSR(s->sbm_maccfg,cfg); - + /* * Initialize DMA channels (rings should be ok now) */ sbdma_channel_start(&(s->sbm_rxdma), DMA_RX); sbdma_channel_start(&(s->sbm_txdma), DMA_TX); - + /* * Configure the speed, duplex, and flow control */ @@ -1632,6 +1683,8 @@ SBMAC_WRITECSR(s->sbm_macenable, M_MAC_RXDMA_EN0 | M_MAC_TXDMA_EN0 | + M_MAC_RXDMA_EN1 | + M_MAC_TXDMA_EN1 | M_MAC_RX_ENABLE | M_MAC_TX_ENABLE); @@ -1645,6 +1698,7 @@ SBMAC_WRITECSR(s->sbm_imr, ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); + #else /* * Accept any kind of interrupt on TX and RX DMA channel 0 @@ -1724,12 +1778,12 @@ sbdma_channel_stop(&(s->sbm_rxdma)); sbdma_channel_stop(&(s->sbm_txdma)); - + /* Empty the receive and transmit rings */ sbdma_emptyring(&(s->sbm_rxdma)); sbdma_emptyring(&(s->sbm_txdma)); - + } /********************************************************************** @@ -1967,7 +2021,7 @@ V_MAC_IFG_TX_1000 | V_MAC_IFG_THRSH_1000 | V_MAC_SLOT_SIZE_1000; - cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; +cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; break; case sbmac_speed_auto: /* XXX not implemented */ @@ -2102,6 +2156,7 @@ { struct net_device *dev = (struct net_device *) dev_instance; struct sbmac_softc *sc = (struct sbmac_softc *) (dev->priv); + uint64_t isr; for (;;) { @@ -2122,9 +2177,9 @@ if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) { sbdma_tx_process(sc,&(sc->sbm_txdma)); } - + /* - * Receives on channel 0 + * Receives on channel 0,1 */ /* @@ -2140,58 +2195,191 @@ * won't get another interrupt until a packet shows * up to start the timer again. Testing * EOP_SEEN here takes care of this case. - * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) - */ - - - if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { - sbdma_rx_process(sc,&(sc->sbm_rxdma)); + * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) + */ + + + if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { +#ifdef CONFIG_SB1250_NAPI + if (netif_rx_schedule_prep(dev)) { + sbmac_irq_disable(sc); + __netif_rx_schedule(dev); } +#else + sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#endif } - +} } /********************************************************************** - * SBMAC_START_TX(skb,dev) - * - * Start output on the specified interface. Basically, we - * queue as many buffers as we can until the ring fills up, or - * we run off the end of the queue, whichever comes first. - * - * Input parameters: - * - * - * Return value: - * nothing - ********************************************************************* */ +* SBMAC_START_TX(skb,dev) +* +* Start output on the specified interface. Basically, we +* queue as many buffers as we can until the ring fills up, or +* we run off the end of the queue, whichever comes first. +* +* Input parameters: +* +* +* Return value: +* nothing +********************************************************************* */ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) { - struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; - - /* lock eth irq */ - spin_lock_irq (&sc->sbm_lock); - - /* - * Put the buffer on the transmit ring. If we - * don't have room, stop the queue. - */ - - if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { - /* XXX save skb that we could not send */ - netif_stop_queue(dev); - spin_unlock_irq(&sc->sbm_lock); +struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; +spin_lock_irq (&sc->sbm_lock); +/* + * Put the buffer on the transmit ring. If we + * don't have room, stop the queue. + */ + +if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { + /* XXX save skb that we could not send, then test 1 channel */ + netif_stop_queue(dev); + spin_unlock_irq(&sc->sbm_lock); - return 1; + return 1; } dev->trans_start = jiffies; - spin_unlock_irq (&sc->sbm_lock); return 0; } +#ifdef CONFIG_SB1250_NAPI +//#define NAPI_POL_MAX 100 +static int sbmac_poll(struct net_device *dev_instance, int *budget) { + struct net_device *dev = (struct net_device *) dev_instance; + struct sbmac_softc *sc = (struct sbmac_softc *) (dev_instance->priv); + sbmacdma_t *d = &(sc->sbm_rxdma); + int rx_work_limit = *budget; + unsigned long flags; + long int receive=0; + int curidx; + int hwidx; + + sbdmadscr_t *dsc; + struct sk_buff *sb; + int len; + + if(rx_work_limit > dev->quota) + rx_work_limit = dev->quota; + + for (;;) { + /* + * figure out where we are (as an index) and where + * the hardware is (also as an index) + * + * This could be done faster if (for example) the + * descriptor table was page-aligned and contiguous in + * both virtual and physical memory -- you could then + * just compare the low-order bits of the virtual address + * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) + */ + if(--rx_work_limit < 0) goto not_done; + curidx = d->sbdma_remptr - d->sbdma_dscrtable; + hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - + d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); + + /* + * If they're the same, that means we've processed all + * of the descriptors up to (but not including) the one that + * the hardware is working on right now. + */ + + if (curidx == hwidx) break; + + /* + * Otherwise, get the packet's sk_buff ptr back + */ + + dsc = &(d->sbdma_dscrtable[curidx]); + sb = d->sbdma_ctxtable[curidx]; + d->sbdma_ctxtable[curidx] = NULL; + + len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; + + /* + * Check packet status. If good, process it. + * If not, silently drop it and put it back on the + * receive ring. + */ + + if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { + + /* + * Add a new buffer to replace the old one. If we fail + * to allocate a buffer, we're going to drop this + * packet and put it right back on the receive ring. + */ + + if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { + sc->sbm_stats.rx_dropped++; + sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ + } + else { + /* + * Set length into the packet + */ + skb_put(sb,len); + /* + * Buffer has been replaced on the receive ring. + * Pass the buffer to the kernel + */ + sc->sbm_stats.rx_bytes += len; + sc->sbm_stats.rx_packets++;receive++; + sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev); + if (sc->rx_hw_checksum == ENABLE) { + /* if the ip checksum is good indicate in skb. + else set CHECKSUM_NONE as device failed to + checksum the packet */ + + if (((dsc->dscr_b) |M_DMA_ETHRX_BADTCPCS) || + ((dsc->dscr_a)| M_DMA_ETHRX_BADIP4CS)){ + sb->ip_summed = CHECKSUM_NONE; + } else { + printk(KERN_DEBUG "hw checksum fail .\n"); + sb->ip_summed = CHECKSUM_UNNECESSARY; + } + } /*rx_hw_checksum */ + netif_receive_skb(sb); + } + } + else { + /* + * Packet was mangled somehow. Just drop it and + * put it back on the receive ring. + */ + sc->sbm_stats.rx_errors++; + sbdma_add_rcvbuffer(d,sb); + } + + + /* + * .. and advance to the next buffer. + */ + + d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); + + } + if (!receive) receive = 1; + dev->quota -= receive; + *budget -= receive; + + spin_lock_irqsave(&sc->sbm_lock,flags); + netif_rx_complete(dev); + sbmac_irq_enable(sc); + spin_unlock_irqrestore(&sc->sbm_lock,flags); + return 0; +not_done: + dev->quota -= receive; + *budget -= receive; + return 1; +} +#endif /********************************************************************** * SBMAC_SETMULTI(sc) * @@ -2448,6 +2636,10 @@ dev->do_ioctl = sbmac_mii_ioctl; dev->tx_timeout = sbmac_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; +#ifdef CONFIG_SB1250_NAPI + dev->poll = sbmac_poll; + dev->weight =dev->quota = 80; +#endif dev->change_mtu = sb1250_change_mtu; @@ -2525,6 +2717,10 @@ char buffer[100]; char *p = buffer; + int signaldetect; + + if(s->sbm_fibermode == 0) + { /* Read the mode status and mode control registers. */ bmsr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMSR); bmcr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMCR); @@ -2539,7 +2735,6 @@ else { k1stsr = 0; } - chg = 0; if ((bmsr & BMSR_LINKSTAT) == 0) { @@ -2618,8 +2813,43 @@ #endif if (noisy) { printk(KERN_INFO "%s: %s\n",s->sbm_dev->name,buffer); - } + } + } + else + { //fiber mode + + chg=0; + printk("sbm_phy_oldsignaldetect:%d\n",s->sbm_phy_oldsignaldetect); + + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(s,s->sbm_phys[0],MII_SGMIISR)); + + printk("current signaldetect:%d\n",signaldetect); + + if (signaldetect == 0) + { + printk("link state is DOWN!\n"); + s->sbm_phy_oldsignaldetect = 0; + return 0; + } + else + { + if(s->sbm_phy_oldsignaldetect != signaldetect) + { + s->sbm_phy_oldsignaldetect = signaldetect; + chg = 1; + printk("link state has been changed\n"); + } + } + if (chg==0) return 0; + printk("Link is up\n"); + s->sbm_speed = sbmac_speed_1000; + s->sbm_duplex = sbmac_duplex_full; + s->sbm_fc = sbmac_fc_frame; + s->sbm_state = sbmac_state_on; + noisy =0; + printk("fiber mode.\t"); + } return 1; } @@ -2632,9 +2862,12 @@ struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; int next_tick = HZ; int mii_status; + int signaldetect; spin_lock_irq (&sc->sbm_lock); - + + if(sc->sbm_fibermode == 0) + { /* make IFF_RUNNING follow the MII status bit "Link established" */ mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); @@ -2647,6 +2880,23 @@ netif_carrier_off(dev); } } + } + else + { + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(sc,sc->sbm_phys[0],MII_SGMIISR)); + if(sc->sbm_phy_oldsignaldetect != signaldetect) + { + sc->sbm_phy_oldsignaldetect = signaldetect; + if (signaldetect) { + printk("netif_carrier_on. \n"); + netif_carrier_on(dev); + } + else { + netif_carrier_off(dev); + } + printk("link state has been changed\n"); + } + } /* * Poll the PHY to see what speed we should be running at + */ + + if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { + sc->sbm_stats.rx_dropped++; + sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ + } + else { + /* + * Set length into the packet + */ + skb_put(sb,len); + /* + * Buffer has been replaced on the receive ring. + * Pass the buffer to the kernel + */ + sc->sbm_stats.rx_bytes += len; + sc->sbm_stats.rx_packets++;receive++; + sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev); + if (sc->rx_hw_checksum == ENABLE) { + /* if the ip checksum is good indicate in skb. + else set CHECKSUM_NONE as device failed to + checksum the packet */ + + if (((dsc->dscr_b) |M_DMA_ETHRX_BADTCPCS) || + ((dsc->dscr_a)| M_DMA_ETHRX_BADIP4CS)){ + sb->ip_summed = CHECKSUM_NONE; + } else { + printk(KERN_DEBUG "hw checksum fail .\n"); + sb->ip_summed = CHECKSUM_UNNECESSARY; + } + } /*rx_hw_checksum */ + netif_receive_skb(sb); + } + } + else { + /* + * Packet was mangled somehow. Just drop it and + * put it back on the receive ring. + */ + sc->sbm_stats.rx_errors++; + sbdma_add_rcvbuffer(d,sb); + } + + + /* + * .. and advance to the next buffer. + */ + + d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); + + } + if (!receive) receive = 1; + dev->quota -= receive; + *budget -= receive; + + spin_lock_irqsave(&sc->sbm_lock,flags); + netif_rx_complete(dev); + sbmac_irq_enable(sc); + spin_unlock_irqrestore(&sc->sbm_lock,flags); + return 0; +not_done: + dev->quota -= receive; + *budget -= receive; + return 1; +} +#endif /********************************************************************** * SBMAC_SETMULTI(sc) * @@ -2448,6 +2636,10 @@ dev->do_ioctl = sbmac_mii_ioctl; dev->tx_timeout = sbmac_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; +#ifdef CONFIG_SB1250_NAPI + dev->poll = sbmac_poll; + dev->weight =dev->quota = 80; +#endif dev->change_mtu = sb1250_change_mtu; @@ -2525,6 +2717,10 @@ char buffer[100]; char *p = buffer; + int signaldetect; + + if(s->sbm_fibermode == 0) + { /* Read the mode status and mode control registers. */ bmsr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMSR); bmcr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMCR); @@ -2539,7 +2735,6 @@ else { k1stsr = 0; } - chg = 0; if ((bmsr & BMSR_LINKSTAT) == 0) { @@ -2618,8 +2813,43 @@ #endif if (noisy) { printk(KERN_INFO "%s: %s\n",s->sbm_dev->name,buffer); - } + } + } + else + { //fiber mode + + chg=0; + printk("sbm_phy_oldsignaldetect:%d\n",s->sbm_phy_oldsignaldetect); + + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(s,s->sbm_phys[0],MII_SGMIISR)); + + printk("current signaldetect:%d\n",signaldetect); + + if (signaldetect == 0) + { + printk("link state is DOWN!\n"); + s->sbm_phy_oldsignaldetect = 0; + return 0; + } + else + { + if(s->sbm_phy_oldsignaldetect != signaldetect) + { + s->sbm_phy_oldsignaldetect = signaldetect; + chg = 1; + printk("link state has been changed\n"); + } + } + if (chg==0) return 0; + printk("Link is up\n"); + s->sbm_speed = sbmac_speed_1000; + s->sbm_duplex = sbmac_duplex_full; + s->sbm_fc = sbmac_fc_frame; + s->sbm_state = sbmac_state_on; + noisy =0; + printk("fiber mode.\t"); + } return 1; } @@ -2632,9 +2862,12 @@ struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; int next_tick = HZ; int mii_status; + int signaldetect; spin_lock_irq (&sc->sbm_lock); - + + if(sc->sbm_fibermode == 0) + { /* make IFF_RUNNING follow the MII status bit "Link established" */ mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); @@ -2647,6 +2880,23 @@ netif_carrier_off(dev); } } + } + else + { + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(sc,sc->sbm_phys[0],MII_SGMIISR)); + if(sc->sbm_phy_oldsignaldetect != signaldetect) + { + sc->sbm_phy_oldsignaldetect = signaldetect; + if (signaldetect) { + printk("netif_carrier_on. \n"); + netif_carrier_on(dev); + } + else { + netif_carrier_off(dev); + } + printk("link state has been changed\n"); + } + } /* * Poll the PHY to see what speed we should be running at ---------------------------------------------------- and blow is the oops messages ---------------------------------------------------- May 28 14:16:04 netpower kernel: napi mac_irq disable. May 28 14:16:04 netpower kernel: skput:over: 801dce38:2498 put:2498 dev:eth2kern el BUG at skbuff.c:92! May 28 14:16:04 netpower kernel: Unable to handle kernel paging request at virtu al address 00000000, epc == 801f1a5c, ra == 801dce4c May 28 14:16:04 netpower kernel: Oops in fault.c::do_page_fault, line 219: May 28 14:16:04 netpower kernel: $0 : 00000000 10001f00 0000001b 00000000 000000 01 80cbe000 00000001 00000000 May 28 14:16:04 netpower kernel: $8 : 007d351a 00000000 00008001 00000000 802f63 79 fffffffa 0000000a 802afc79 May 28 14:16:04 netpower kernel: $16: 8fe1b980 000009c2 8fe16a74 8fe16960 8fe140 00 0000004f 00000000 8fe16800 May 28 14:16:04 netpower kernel: $24: ffffffff 00000002 802ae0 00 802afdb8 8fe16800 801dce4c May 28 14:16:04 netpower kernel: Hi : 00000003 May 28 14:16:04 netpower kernel: Lo : 33333334 May 28 14:16:04 netpower kernel: epc : 801f1a5c Not tainted May 28 14:16:04 netpower kernel: Status: 10001f03 May 28 14:16:04 netpower kernel: Cause : 1080000c May 28 14:16:04 netpower kernel: Process swapper (pid: 0, stackpage=802ae000) May 28 14:16:04 netpower kernel: Stack: 802993c0 802993d8 0000005c 00000001 8 fe16800 8fe16960 801dce4c May 28 14:16:04 netpower kernel: 80115490 00000000 2ac58da0 80296972 8fe16968 8 fe168c0 8fe16800 00000001 May 28 14:16:04 netpower kernel: 802c11dc 802c11dc 802c11c0 00000000 00016424 8 ffae460 801f7874 00000000 May 28 14:16:04 netpower kernel: 802afe20 8029695c 00000001 0000012c ffffffff 00000000 802c0c90 fffffffb May 28 14:16:04 netpower kernel: 00000000 10001f00 802afea8 8ffd1208 8fed1cb0 8011ae44 801037d4 8010bb34 May 28 14:16:04 netpower kernel: 00000037 ... May 28 14:16:04 netpower kernel: Call Trace: [dm_head_vals.0+1568/4944] [dm_head_vals.0+1592/4944] [sbmac_poll+524/1240] [printk+608/688] [twist_table.0+3010/3712] May 28 14:16:04 netpower kernel: [net_rx_action+356/704] [twist_table.0+2988/3712] [do_softirq+228/440] [handle_IRQ_event+144/304] [local_timer_interrupt+152/164] [do_IRQ+316/372] May 28 14:16:04 netpower kernel: [sb1250_timer_interrupt+248/252] [sb1250_time_init+8/588] [cpu_idle+60/112] [cpu_idle+92/112] [init+0/468] [std_ide_release_region+204/2360] May 28 14:16:04 netpower kernel: [std_ide_release_region+268/2360] May 28 14:16:04 netpower kernel: May 28 14:16:04 netpower kernel: Code: 0c04548c 2406005c 8fbf0018 03e00008 27bd0020 3c02802a 244293e4 0807c68e May 28 14:16:04 netpower kernel: Kernel panic: Aiee, killing interrupt handler! From yoshfuji@wide.ad.jp Wed May 28 21:38:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Wed, 28 May 2003 21:38: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.9) with SMTP id h4T4cb2x010416 for ; Wed, 28 May 2003 21:38:38 -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 h4T4dIBo031948; Thu, 29 May 2003 13:39:18 +0900 Date: Thu, 29 May 2003 13:39:18 +0900 (JST) Message-Id: <20030529.133918.72483716.yoshfuji@wide.ad.jp> To: zhanght@netpower.com.cn Cc: netdev@oss.sgi.com Subject: Re: Hi, this is my patch for broadcom sb1250-mac.c From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <3ED58DBA.6000506@netpower.com.cn> References: <3ED58DBA.6000506@netpower.com.cn> 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-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: 2736 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@wide.ad.jp Precedence: bulk X-list: netdev In article <3ED58DBA.6000506@netpower.com.cn> (at Thu, 29 May 2003 12:34:02 +0800), Zhang Haitao says: > i'm very glad to let all of you to review this patch > or give me some advice from the oops message! Please don't try to make cosmetic changes including indentation, and/or new lines etc. Thank you. -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From davem@redhat.com Thu May 29 02:42:20 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 02:42: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.9) with SMTP id h4T9gK2x017261 for ; Thu, 29 May 2003 02:42:20 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA06026; Thu, 29 May 2003 02:41:14 -0700 Date: Thu, 29 May 2003 02:41:14 -0700 (PDT) Message-Id: <20030529.024114.78714066.davem@redhat.com> To: gandalf@wlug.westbo.se Cc: netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state From: "David S. Miller" In-Reply-To: <1052841090.13492.20.camel@tux.rsn.bth.se> References: <1052841090.13492.20.camel@tux.rsn.bth.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2737 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 From: Martin Josefsson Date: 13 May 2003 17:51:31 +0200 If more details are needed I can try to reproduce it again, shouldn't be too difficult. Can you reproduce this with the latest and greatest 2.5.x sources? I think we might have just nailed it... From davem@redhat.com Thu May 29 02:59:25 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 02:59: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.9) with SMTP id h4T9xP2x017671 for ; Thu, 29 May 2003 02:59:25 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA06078; Thu, 29 May 2003 02:57:49 -0700 Date: Thu, 29 May 2003 02:57:49 -0700 (PDT) Message-Id: <20030529.025749.59658664.davem@redhat.com> To: hch@lst.de Cc: netdev@oss.sgi.com Subject: Re: [PATCH] remove sdla from setup.c From: "David S. Miller" In-Reply-To: <20030528110658.GA26411@lst.de> References: <20030528110658.GA26411@lst.de> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2738 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 From: Christoph Hellwig Date: Wed, 28 May 2003 13:06:58 +0200 sdla had calls from both Space.c and setup.c. Leave the Space.c one alone as per previous discussion but move over the setup.c one to initcalls. (and remove the prototype for a third one from setup.c!) Looks ok, applied. Some of this wan driver stuff is so crappy :( From yoshfuji@wide.ad.jp Thu May 29 04:29:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 04:30:00 -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.9) with SMTP id h4TBTq2x019806 for ; Thu, 29 May 2003 04:29:53 -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 h4TBUWBo014043; Thu, 29 May 2003 20:30:32 +0900 Date: Thu, 29 May 2003 20:30:32 +0900 (JST) Message-Id: <20030529.203032.131225364.yoshfuji@wide.ad.jp> To: evil@g-house.de Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: Re: IPv6 module oopsing on 2.5.69 From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <3ED5E9E7.5070602@g-house.de> References: <3ED5E9E7.5070602@g-house.de> 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-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: 2739 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: yoshfuji@wide.ad.jp Precedence: bulk X-list: netdev CC: netdev Upgrade to 2.5.70 and retest, please. Thank you. In article <3ED5E9E7.5070602@g-house.de> (at Thu, 29 May 2003 13:07:19 +0200), Christian says: > while booting the ipv6 module gets installed, along with this message in > the log: ... -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From gandalf@wlug.westbo.se Thu May 29 05:46:52 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 05:47:03 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TCkd2x020864 for ; Thu, 29 May 2003 05:46:42 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 6AFFB36FDD; Thu, 29 May 2003 14:30:43 +0200 (CEST) Subject: Use after free in e100 From: Martin Josefsson To: linux.nics@intel.com Cc: netdev@oss.sgi.com Content-Type: multipart/mixed; boundary="=-vauby9rcL3iM4q8NTpnC" Organization: Message-Id: <1054211442.761.32.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 14:30:43 +0200 X-archive-position: 2740 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev --=-vauby9rcL3iM4q8NTpnC Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi When using 2.5.69-mm9 which includes Manfred's unmap-after-free patch I ran into a use-after-free bug in e100 that just might be real. I ran the two oopses through ksymoops to get some more detail but since ksyms doesn't exist in 2.5 anymore it failed to resolve the EIP (e100 as module). But fear not, the EIP is in the original report by kksymoops and I've included it below. (identical in both oopses) EIP is at e100_rx_srv+0x4ac/0x514 [e100] The two ksymoopsed oopses are attached. Driver output at init: (no module options) Intel(R) PRO/100 Network Driver - version 2.2.21-k1 Copyright (c) 2003 Intel Corporation e100: selftest OK. e100: eth0: Intel(R) PRO/100 Network Connection e100: selftest OK. e100: eth1: Intel(R) PRO/100 Network Connection lspci: 00:11.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 04) 00:12.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 05) -- /Martin --=-vauby9rcL3iM4q8NTpnC Content-Disposition: attachment; filename=e100-decoded Content-Type: text/plain; name=e100-decoded; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable ksymoops 2.4.8 on i686 2.5.69-mm9. Options used -v /usr/src/2.5/linux-2.5.69-mm9/vmlinux (specified) -K (specified) -L (specified) -O (specified) -m /boot/System.map-2.5.69-mm9 (specified) Unable to handle kernel paging request at virtual address c2f0a064 ec9056e4 *pde =3D 0000a067 Oops: 0000 [#1] CPU: 0 EIP: 0060:[] Not tainted VLI Using defaults from ksymoops -t elf32-i386 -a i386 EFLAGS: 00010286 eax: 03c495c9 ebx: e6df0004 ecx: e6df0260 edx: c2f0a004 esi: cd843004 edi: 0000003c ebp: c0375eb4 esp: c0375e84 ds: 007b es: 007b ss: 0068 Stack: 00004050 e6df0260 00004050 e6df0288 e6df0280 0000002e 0000002e 00000= 02d=20 e6df0004 c2f0a004 c037a022 e9106016 c0375ed4 ec9050bc e6df0260 e6ce3= a48=20 04000001 00000001 40000000 e6df0004 c0375ef4 c010ae1a 0000000b e6df0= 004=20 Call Trace: [] cpu_init+0xbe/0x28c [] e100intr+0x25c/0x2b8 [e100] [] handle_IRQ_event+0x2a/0x54 [] do_IRQ+0x187/0x2cc [] common_interrupt+0x18/0x20 [] do_softirq+0x47/0xb0 [] do_IRQ+0x2b6/0x2cc [] default_idle+0x0/0x34 [] default_idle+0x0/0x34 [] common_interrupt+0x18/0x20 [] default_idle+0x0/0x34 [] default_idle+0x0/0x34 [] default_idle+0x26/0x34 [] cpu_idle+0x35/0x44 [] _stext+0x0/0x20 [] _stext+0x1c/0x20 [] start_kernel+0x11c/0x120 Code: f3 a6 75 04 c6 40 6e 00 8b 55 f4 52 eb 04 8b 4d f4 51 e8 ac c5 92 d3 = 83 c4 04 a1 20 3b 33 c0 8b 5d f0 89 43 4c 8b 55 f4 8b 4d 08 <8b> 42 60 01 8= 1 84 00 00 00 8b 5d e4 89 5d ec 8b 45 08 8b 75 e8=20 >>EIP; ec9056e4 <_end+2c51eb24/3fc17440> <=3D=3D=3D=3D=3D >>ebx; e6df0004 <_end+26a09444/3fc17440> >>ecx; e6df0260 <_end+26a096a0/3fc17440> >>edx; c2f0a004 <_end+2b23444/3fc17440> >>esi; cd843004 <_end+d45c444/3fc17440> >>ebp; c0375eb4 >>esp; c0375e84 Trace; c037a022 Trace; ec9050bc <_end+2c51e4fc/3fc17440> Trace; c010ae1a Trace; c010b36b Trace; c0109980 Trace; c0120aa7 Trace; c010b49a Trace; c0106f24 Trace; c0106f24 Trace; c0109980 Trace; c0106f24 Trace; c0106f24 Trace; c0106f4a Trace; c0106fd9 Trace; c0105000 <_stext+0/0> Trace; c010501c Trace; c0376614 Code; ec9056b9 <_end+2c51eaf9/3fc17440> 00000000 <_EIP>: Code; ec9056b9 <_end+2c51eaf9/3fc17440> 0: f3 a6 repz cmpsb %es:(%edi),%ds:(%esi) Code; ec9056bb <_end+2c51eafb/3fc17440> 2: 75 04 jne 8 <_EIP+0x8> Code; ec9056bd <_end+2c51eafd/3fc17440> 4: c6 40 6e 00 movb $0x0,0x6e(%eax) Code; ec9056c1 <_end+2c51eb01/3fc17440> 8: 8b 55 f4 mov 0xfffffff4(%ebp),%edx Code; ec9056c4 <_end+2c51eb04/3fc17440> b: 52 push %edx Code; ec9056c5 <_end+2c51eb05/3fc17440> c: eb 04 jmp 12 <_EIP+0x12> Code; ec9056c7 <_end+2c51eb07/3fc17440> e: 8b 4d f4 mov 0xfffffff4(%ebp),%ecx Code; ec9056ca <_end+2c51eb0a/3fc17440> 11: 51 push %ecx Code; ec9056cb <_end+2c51eb0b/3fc17440> 12: e8 ac c5 92 d3 call d392c5c3 <_EIP+0xd392c5c3> Code; ec9056d0 <_end+2c51eb10/3fc17440> 17: 83 c4 04 add $0x4,%esp Code; ec9056d3 <_end+2c51eb13/3fc17440> 1a: a1 20 3b 33 c0 mov 0xc0333b20,%eax Code; ec9056d8 <_end+2c51eb18/3fc17440> 1f: 8b 5d f0 mov 0xfffffff0(%ebp),%ebx Code; ec9056db <_end+2c51eb1b/3fc17440> 22: 89 43 4c mov %eax,0x4c(%ebx) Code; ec9056de <_end+2c51eb1e/3fc17440> 25: 8b 55 f4 mov 0xfffffff4(%ebp),%edx Code; ec9056e1 <_end+2c51eb21/3fc17440> 28: 8b 4d 08 mov 0x8(%ebp),%ecx Code; ec9056e4 <_end+2c51eb24/3fc17440> <=3D=3D=3D=3D=3D 2b: 8b 42 60 mov 0x60(%edx),%eax <=3D=3D=3D=3D=3D Code; ec9056e7 <_end+2c51eb27/3fc17440> 2e: 01 81 84 00 00 00 add %eax,0x84(%ecx) Code; ec9056ed <_end+2c51eb2d/3fc17440> 34: 8b 5d e4 mov 0xffffffe4(%ebp),%ebx Code; ec9056f0 <_end+2c51eb30/3fc17440> 37: 89 5d ec mov %ebx,0xffffffec(%ebp) Code; ec9056f3 <_end+2c51eb33/3fc17440> 3a: 8b 45 08 mov 0x8(%ebp),%eax Code; ec9056f6 <_end+2c51eb36/3fc17440> 3d: 8b 75 e8 mov 0xffffffe8(%ebp),%esi <0>Kernel panic: Fatal exception in interrupt --=-vauby9rcL3iM4q8NTpnC Content-Disposition: attachment; filename=e100_2-decoded Content-Type: text/plain; name=e100_2-decoded; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable ksymoops 2.4.8 on i686 2.5.69-mm9. Options used -v /usr/src/2.5/linux-2.5.69-mm9/vmlinux (specified) -K (specified) -L (specified) -O (specified) -m /boot/System.map-2.5.69-mm9 (specified) Unable to handle kernel paging request at virtual address dd896064 ec9056e4 *pde =3D 00075067 Oops: 0000 [#1] CPU: 0 EIP: 0060:[] Not tainted VLI Using defaults from ksymoops -t elf32-i386 -a i386 EFLAGS: 00010282 eax: 089b89ea ebx: e8550004 ecx: e8550260 edx: dd896004 esi: cff0e004 edi: 0000003c ebp: c0375d84 esp: c0375d54 ds: 007b es: 007b ss: 0068 Stack: 00004050 e8550260 00004050 e8550288 e8550280 0000002e 0000002e 00000= 02d=20 e8550004 dd896004 c037a022 e9a13016 c0375da4 ec9050bc e8550260 e83a6= e68=20 04000001 00000001 40000000 e8550004 c0375dc4 c010ae1a 0000000b e8550= 004=20 Call Trace: [] cpu_init+0xbe/0x28c [] e100intr+0x25c/0x2b8 [e100] [] handle_IRQ_event+0x2a/0x54 [] do_IRQ+0x187/0x2cc [] common_interrupt+0x18/0x20 [] kfree+0x267/0x274 [] skb_release_data+0x92/0x9c [] skb_release_data+0x92/0x9c [] kfree_skbmem+0xd/0x20 [] __kfree_skb+0xec/0xf4 [] arp_process+0x42f/0x43c [] arp_rcv+0xaf/0x100 [] netif_receive_skb+0x1df/0x218 [] process_backlog+0x94/0x168 [] net_rx_action+0x6f/0x110 [] do_softirq+0x51/0xb0 [] do_IRQ+0x2b6/0x2cc [] default_idle+0x0/0x34 [] default_idle+0x0/0x34 [] common_interrupt+0x18/0x20 [] default_idle+0x0/0x34 [] default_idle+0x0/0x34 [] default_idle+0x26/0x34 [] cpu_idle+0x35/0x44 [] _stext+0x0/0x20 [] _stext+0x1c/0x20 [] start_kernel+0x11c/0x120 Code: f3 a6 75 04 c6 40 6e 00 8b 55 f4 52 eb 04 8b 4d f4 51 e8 ac c5 92 d3 = 83 c4 04 a1 20 3b 33 c0 8b 5d f0 89 43 4c 8b 55 f4 8b 4d 08 <8b> 42 60 01 8= 1 84 00 00 00 8b 5d e4 89 5d ec 8b 45 08 8b 75 e8=20 >>EIP; ec9056e4 <_end+2c51eb24/3fc17440> <=3D=3D=3D=3D=3D >>ebx; e8550004 <_end+28169444/3fc17440> >>ecx; e8550260 <_end+281696a0/3fc17440> >>edx; dd896004 <_end+1d4af444/3fc17440> >>esi; cff0e004 <_end+fb27444/3fc17440> >>ebp; c0375d84 >>esp; c0375d54 Trace; c037a022 Trace; ec9050bc <_end+2c51e4fc/3fc17440> Trace; c010ae1a Trace; c010b36b Trace; c0109980 Trace; c0140087 Trace; c022d8fa Trace; c022d8fa Trace; c022d911 Trace; c022da10 <__kfree_skb+ec/f4> Trace; c026d54f Trace; c026d60b Trace; c023223b Trace; c0232308 Trace; c023244b Trace; c0120ab1 Trace; c010b49a Trace; c0106f24 Trace; c0106f24 Trace; c0109980 Trace; c0106f24 Trace; c0106f24 Trace; c0106f4a Trace; c0106fd9 Trace; c0105000 <_stext+0/0> Trace; c010501c Trace; c0376614 Code; ec9056b9 <_end+2c51eaf9/3fc17440> 00000000 <_EIP>: Code; ec9056b9 <_end+2c51eaf9/3fc17440> 0: f3 a6 repz cmpsb %es:(%edi),%ds:(%esi) Code; ec9056bb <_end+2c51eafb/3fc17440> 2: 75 04 jne 8 <_EIP+0x8> Code; ec9056bd <_end+2c51eafd/3fc17440> 4: c6 40 6e 00 movb $0x0,0x6e(%eax) Code; ec9056c1 <_end+2c51eb01/3fc17440> 8: 8b 55 f4 mov 0xfffffff4(%ebp),%edx Code; ec9056c4 <_end+2c51eb04/3fc17440> b: 52 push %edx Code; ec9056c5 <_end+2c51eb05/3fc17440> c: eb 04 jmp 12 <_EIP+0x12> Code; ec9056c7 <_end+2c51eb07/3fc17440> e: 8b 4d f4 mov 0xfffffff4(%ebp),%ecx Code; ec9056ca <_end+2c51eb0a/3fc17440> 11: 51 push %ecx Code; ec9056cb <_end+2c51eb0b/3fc17440> 12: e8 ac c5 92 d3 call d392c5c3 <_EIP+0xd392c5c3> Code; ec9056d0 <_end+2c51eb10/3fc17440> 17: 83 c4 04 add $0x4,%esp Code; ec9056d3 <_end+2c51eb13/3fc17440> 1a: a1 20 3b 33 c0 mov 0xc0333b20,%eax Code; ec9056d8 <_end+2c51eb18/3fc17440> 1f: 8b 5d f0 mov 0xfffffff0(%ebp),%ebx Code; ec9056db <_end+2c51eb1b/3fc17440> 22: 89 43 4c mov %eax,0x4c(%ebx) Code; ec9056de <_end+2c51eb1e/3fc17440> 25: 8b 55 f4 mov 0xfffffff4(%ebp),%edx Code; ec9056e1 <_end+2c51eb21/3fc17440> 28: 8b 4d 08 mov 0x8(%ebp),%ecx Code; ec9056e4 <_end+2c51eb24/3fc17440> <=3D=3D=3D=3D=3D 2b: 8b 42 60 mov 0x60(%edx),%eax <=3D=3D=3D=3D=3D Code; ec9056e7 <_end+2c51eb27/3fc17440> 2e: 01 81 84 00 00 00 add %eax,0x84(%ecx) Code; ec9056ed <_end+2c51eb2d/3fc17440> 34: 8b 5d e4 mov 0xffffffe4(%ebp),%ebx Code; ec9056f0 <_end+2c51eb30/3fc17440> 37: 89 5d ec mov %ebx,0xffffffec(%ebp) Code; ec9056f3 <_end+2c51eb33/3fc17440> 3a: 8b 45 08 mov 0x8(%ebp),%eax Code; ec9056f6 <_end+2c51eb36/3fc17440> 3d: 8b 75 e8 mov 0xffffffe8(%ebp),%esi <0>Kernel panic: Fatal exception in interrupt --=-vauby9rcL3iM4q8NTpnC-- From gandalf@wlug.westbo.se Thu May 29 07:03:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 07:03:42 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TE3Y2x021734 for ; Thu, 29 May 2003 07:03:35 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 6136C36FDD; Thu, 29 May 2003 16:03:31 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: "David S. Miller" Cc: netdev@oss.sgi.com In-Reply-To: <20030529.024114.78714066.davem@redhat.com> References: <1052841090.13492.20.camel@tux.rsn.bth.se> <20030529.024114.78714066.davem@redhat.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1054217010.757.39.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 16:03:31 +0200 X-archive-position: 2741 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Thu, 2003-05-29 at 11:41, David S. Miller wrote: > From: Martin Josefsson > Date: 13 May 2003 17:51:31 +0200 > > If more details are needed I can try to reproduce it again, > shouldn't be too difficult. > > Can you reproduce this with the latest and greatest 2.5.x > sources? I think we might have just nailed it... I'll give it a spin later this evening if time permits. -- /Martin From acme@conectiva.com.br Thu May 29 08:36:07 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 08:36: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.9) with SMTP id h4TFa62x023994 for ; Thu, 29 May 2003 08:36:07 -0700 Received: from [200.181.171.58] (helo=brinquendo.conectiva.com.br) by orion.netbank.com.br with asmtp (Exim 3.33 #1) id 19LPaT-0000gK-00; Thu, 29 May 2003 12:45:05 -0300 Received: by brinquendo.conectiva.com.br (Postfix, from userid 500) id D6BA01966C; Thu, 29 May 2003 15:36:26 +0000 (UTC) Date: Thu, 29 May 2003 12:36:25 -0300 From: Arnaldo Carvalho de Melo To: "David S. Miller" Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] remove sdla from setup.c Message-ID: <20030529153625.GP24054@conectiva.com.br> References: <20030528110658.GA26411@lst.de> <20030529.025749.59658664.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030529.025749.59658664.davem@redhat.com> X-Url: http://advogato.org/person/acme Organization: Conectiva S.A. User-Agent: Mutt/1.5.4i X-archive-position: 2742 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 Thu, May 29, 2003 at 02:57:49AM -0700, David S. Miller escreveu: > From: Christoph Hellwig > Date: Wed, 28 May 2003 13:06:58 +0200 > > sdla had calls from both Space.c and setup.c. Leave the Space.c one > alone as per previous discussion but move over the setup.c one to > initcalls. (and remove the prototype for a third one from setup.c!) > > Looks ok, applied. > > Some of this wan driver stuff is so crappy :( Crappy? You are being nice... What about this: void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) { spin_lock_irqsave(lock, *smp_flags); } Why the hell do we need a bogus wrapper for something so standard? :-( - Arnaldo From shemminger@osdl.org Thu May 29 10:24:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 10:24:34 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4THOI2x026964 for ; Thu, 29 May 2003 10:24:26 -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 h4THO7X12680; Thu, 29 May 2003 10:24:07 -0700 Date: Thu, 29 May 2003 10:24:07 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH] change delete bridge to work with new unregister Message-Id: <20030529102407.3d3cfefd.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2743 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev The changes in 2.5.70 for unregister cause deleteing a bridge device to hang, because the last reference to the bridge was being dropped after calling unregister_netdev. Doing the unregister under lock, instead of by holding a reference fixes that. diff -Nru a/net/bridge/br_if.c b/net/bridge/br_if.c --- a/net/bridge/br_if.c Thu May 29 10:19:39 2003 +++ b/net/bridge/br_if.c Thu May 29 10:19:39 2003 @@ -170,11 +170,12 @@ struct net_device *dev; int ret = 0; - dev = dev_get_by_name(name); + rtnl_lock(); + dev = __dev_get_by_name(name); if (dev == NULL) - return -ENXIO; /* Could not find device */ + ret = -ENXIO; /* Could not find device */ - if (!(dev->priv_flags & IFF_EBRIDGE)) { + else if (!(dev->priv_flags & IFF_EBRIDGE)) { /* Attempt to delete non bridge device! */ ret = -EPERM; } @@ -186,11 +187,10 @@ else { del_ifs((struct net_bridge *) dev->priv); - - unregister_netdev(dev); + unregister_netdevice(dev); } - dev_put(dev); + rtnl_unlock(); return ret; } From shemminger@osdl.org Thu May 29 10:30:32 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 10:30:47 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4THUU2x027373 for ; Thu, 29 May 2003 10:30: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 h4THUCX14274; Thu, 29 May 2003 10:30:12 -0700 Date: Thu, 29 May 2003 10:30:11 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.70] sysfs cleanup and bugfix Message-Id: <20030529103011.3f038db7.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2744 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 A couple of bugs in netdev_unregister_sysfs; still working on the harder refcount issues. - if driver sets get_stats after register then unregister will attempt to delete kobject that has not be initialized. - unregister should call kobject_unregister not kobject_del. cleanup's: - use strlcpy instead of snprintf - don't need to memset the stats kobject diff -Nru a/net/core/net-sysfs.c b/net/core/net-sysfs.c --- a/net/core/net-sysfs.c Thu May 29 10:25:04 2003 +++ b/net/core/net-sysfs.c Thu May 29 10:25:04 2003 @@ -294,7 +294,7 @@ class_dev->class = &net_class; class_dev->class_data = net; - snprintf(class_dev->class_id, BUS_ID_SIZE, net->name); + strlcpy(class_dev->class_id, net->name, BUS_ID_SIZE); if ((ret = class_device_register(class_dev))) goto out; @@ -303,17 +303,18 @@ goto out_unreg; } + + net->stats_kobj.parent = NULL; if (net->get_stats) { struct kobject *k = &net->stats_kobj; - memset(k, 0, sizeof(*k)); k->parent = kobject_get(&class_dev->kobj); if (!k->parent) { ret = -EBUSY; goto out_unreg; } - snprintf(k->name, KOBJ_NAME_LEN, "%s", "statistics"); + strlcpy(k->name, "statistics", KOBJ_NAME_LEN); k->ktype = &netstat_ktype; if((ret = kobject_register(k))) @@ -331,8 +332,9 @@ void netdev_unregister_sysfs(struct net_device *net) { - if (net->get_stats) - kobject_del(&net->stats_kobj); + if (net->stats_kobj.parent) + kobject_unregister(&net->stats_kobj); + class_device_unregister(&net->class_dev); } From shemminger@osdl.org Thu May 29 10:37:06 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 10:37:12 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4THb32x027761 for ; Thu, 29 May 2003 10:37:06 -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 h4THapX17557; Thu, 29 May 2003 10:36:51 -0700 Date: Thu, 29 May 2003 10:36:50 -0700 From: Stephen Hemminger To: "David S. Miller" , Scott Feldman Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice Message-Id: <20030529103650.64d61340.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2745 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev The e100 driver sets many of the fields in the netdevice structure after calling the register function. This confuses the sysfs setup, because it uses the presence of the get_stats function pointer to decide whether to setup a statistics directory or not. The earlier patch to net-sysfs keeps this from causing a crash. This patch moves the initialization earlier before registration. It probably closes other races as well, where some program could access the e100 driver before the pointers were setup. --- linux-2.5/drivers/net/e100/e100_main.c 2003-05-27 11:04:34.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e100/e100_main.c 2003-05-29 08:56:47.000000000 -0700 @@ -614,6 +614,22 @@ goto err_dealloc; } + dev->vlan_rx_register = e100_vlan_rx_register; + dev->vlan_rx_add_vid = e100_vlan_rx_add_vid; + dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid; + dev->irq = pcid->irq; + dev->open = &e100_open; + dev->hard_start_xmit = &e100_xmit_frame; + dev->stop = &e100_close; + dev->change_mtu = &e100_change_mtu; + dev->get_stats = &e100_get_stats; + dev->set_multicast_list = &e100_set_multi; + dev->set_mac_address = &e100_set_mac; + dev->do_ioctl = &e100_ioctl; + if (bdp->flags & USE_IPCB) + dev->features = NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; + if ((rc = register_netdev(dev)) != 0) { goto err_pci; } @@ -660,23 +676,6 @@ goto err_unregister_netdev; } - dev->vlan_rx_register = e100_vlan_rx_register; - dev->vlan_rx_add_vid = e100_vlan_rx_add_vid; - dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid; - dev->irq = pcid->irq; - dev->open = &e100_open; - dev->hard_start_xmit = &e100_xmit_frame; - dev->stop = &e100_close; - dev->change_mtu = &e100_change_mtu; - dev->get_stats = &e100_get_stats; - dev->set_multicast_list = &e100_set_multi; - dev->set_mac_address = &e100_set_mac; - dev->do_ioctl = &e100_ioctl; - - if (bdp->flags & USE_IPCB) - dev->features = NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - e100nics++; e100_get_speed_duplex_caps(bdp); From shemminger@osdl.org Thu May 29 10:41:51 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 10:41:55 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4THfp2x028101 for ; Thu, 29 May 2003 10:41:51 -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 h4THfcX18579; Thu, 29 May 2003 10:41:38 -0700 Date: Thu, 29 May 2003 10:41:38 -0700 From: Stephen Hemminger To: "David S. Miller" , Scott Feldman Cc: netdev@oss.sgi.com Subject: [PATCH 2.5.70] e100 report link speed via if_port Message-Id: <20030529104138.751a1f54.shemminger@osdl.org> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2746 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev The e100 driver knows the link speed, but it is not visible through sysfs. Small patch to update the net_device if_port when speed is detected; this can then be read through /sys/class/net/eth0/if_port. --- linux-2.5-incr/drivers/net/e100/e100_main.c 2003-05-29 09:52:35.000000000 -0700 +++ linux-2.5-sysfs/drivers/net/e100/e100_main.c 2003-05-29 08:56:47.000000000 -0700 @@ -1720,12 +1720,22 @@ (bdp->cur_dplx_mode == HALF_DUPLEX) ? "Half" : "Full"); + if (bdp->cur_line_speed == 10) + dev->if_port = IF_PORT_10BASET; + else if(bdp->cur_line_speed == 100) { + if (bdp->cur_dplx_mode == HALF_DUPLEX) + dev->if_port = IF_PORT_100BASETX; + else + dev->if_port = IF_PORT_100BASEFX; + } + e100_config_fc(bdp); e100_config(bdp); } else { printk(KERN_ERR "e100: %s NIC Link is Down\n", bdp->device->name); + dev->if_port = IF_PORT_UNKNOWN; } } From zhanght@netpower.com.cn Thu May 29 10:51:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 10:51:32 -0700 (PDT) Received: from mail.netpower.com.cn ([211.154.175.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4THpK2x028561 for ; Thu, 29 May 2003 10:51:23 -0700 Received: from RavProxy [218.244.240.150] by mail.netpower.com.cn with ESMTP (SMTPD32-7.07) id A791C700B2; Fri, 30 May 2003 01:46:57 +0800 Date: Fri, 30 May 2003 1:44:0 +0800 From: "Zhang Haitao" Reply-To: zhanght@netpower.com.cn To: YOSHIFUJI.Hideaki/$B5HF#1QL@.sgi.com (B ) CC: "netdev@oss.sgi.com" Subject: Re: Re: Hi, this is my patch for broadcom sb1250-mac.c Organization: netpower X-mailer: Foxmail 4.1 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: 7bit Message-Id: <200305300146781.SM00840@RavProxy> X-archive-position: 2747 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zhanght@netpower.com.cn Precedence: bulk X-list: netdev Hi all! and Dear YOSHIFUJI Hideaki i've corrected some bugs in my last broken driver, now the driver work properly both under copper mode and fiber mode. so this time i resend it in a more clear style :-) and hope you all will glad to review it. (you can turn off/on the NAPI options to do some contrast test for both original mode and NAPI mode, even the parameters for original mode have been modified for better performance) Thanks Zhang Haitao ---------------------- --- ./sb1250-broadcom.c 2003-05-30 00:48:36.000000000 +0800 +++ ./sb1250-mac.debug.c 2003-05-30 00:48:36.000000000 +0800 @@ -44,8 +44,8 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1}; #endif -static int int_pktcnt = 0; -static int int_timeout = 0; +static int int_pktcnt = 32; +static int int_timeout = 1024; /* Operational parameters that usually are not changed. */ @@ -91,7 +91,8 @@ static char version1[] __devinitdata = "sb1250-mac.c:1.00 1/11/2001 Written by Mitch Lichtenberg (mpl@broadcom.com)\n"; #endif - +#define CONFIG_SB1250_NAPI +#define NAPI_LOP_MAX 10 MODULE_AUTHOR("Mitch Lichtenberg (mpl@broadcom.com)"); @@ -154,8 +155,8 @@ #define PKSEG1(x) ((sbmac_port_t) KSEG1ADDR(x)) -#define SBMAC_MAX_TXDESCR 32 -#define SBMAC_MAX_RXDESCR 32 +#define SBMAC_MAX_TXDESCR 128 +#define SBMAC_MAX_RXDESCR 128 #define ETHER_ALIGN 2 #define ETHER_ADDR_LEN 6 @@ -190,8 +191,8 @@ int sbdma_txdir; /* direction (1=transmit) */ int sbdma_maxdescr; /* total # of descriptors in ring */ #ifdef CONFIG_SBMAC_COALESCE - int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ - int sbdma_int_timeout; /* # usec rx/tx interrupt */ + int sbdma_int_pktcnt; /* # descriptors rx before interrupt*/ + int sbdma_int_timeout; /* # usec rx interrupt */ #endif sbmac_port_t sbdma_config0; /* DMA config register 0 */ @@ -262,11 +263,13 @@ u_char sbm_hwaddr[ETHER_ADDR_LEN]; - sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ + sbmacdma_t sbm_txdma; /* for now, use channel 0 */ sbmacdma_t sbm_rxdma; int rx_hw_checksum; int sbe_idx; + int sbm_fibermode; + int sbm_phy_oldsignaldetect; }; @@ -288,7 +291,6 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); static void sbdma_emptyring(sbmacdma_t *d); static void sbdma_fillring(sbmacdma_t *d); -static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d); static int sbmac_initctx(struct sbmac_softc *s); static void sbmac_channel_start(struct sbmac_softc *s); @@ -299,6 +301,13 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr); static void sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs); static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); +#ifdef CONFIG_SB1250_NAPI +static int sbmac_poll(struct net_device *dev_instance, int *budget); +static inline void sbmac_irq_disable(struct sbmac_softc *s); +static inline void sbmac_irq_enable(struct sbmac_softc *s); +#else +static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); +#endif static void sbmac_setmulti(struct sbmac_softc *sc); static int sbmac_init(struct net_device *dev); static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); @@ -448,6 +457,15 @@ #define PHYSUP_LINKUP 0x04 #define PHYSUP_FDX 0x02 +/* Added for Fiber mode detection +just read Signal Detect alternation */ + +#define MII_AUXCTL 0x18 /* Auxiliary Control Register */ + +#define MII_SGMIISR 0x0C /* SGMII/100-X Status Register */ + +#define SGMIISR_FIBERSDS 0x2000 + #define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define MII_BMSR 0x01 /* Basic mode status register (ro) */ #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ @@ -459,6 +477,17 @@ #define ENABLE 1 #define DISABLE 0 +#ifdef CONFIG_SB1250_NAPI +static inline void sbmac_irq_disable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0)); +} +static inline void sbmac_irq_enable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); +} +#endif /********************************************************************** * SBMAC_MII_SYNC(s) * @@ -759,7 +788,7 @@ #ifdef CONFIG_SBMAC_COALESCE /* - * Setup Rx/Tx DMA coalescing defaults + * Setup RxTx DMA coalescing defaults */ if ( int_pktcnt ) { @@ -944,7 +973,7 @@ sb_new = sb; /* * nothing special to reinit buffer, it's already aligned - * and sb->data already points to a good place. + * and sb->tail already points to a good place. */ } @@ -956,11 +985,11 @@ /* * Do not interrupt per DMA transfer. */ - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; #else - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | M_DMA_DSCRA_INTERRUPT; #endif @@ -1045,16 +1074,17 @@ phys = KVTOPHYS(sb->data); ncb = NUMCACHEBLKS(length+(phys & (CACHELINESIZE-1))); - +#ifdef CONFIG_SBMAC_COALESCE + /* do not interript per DMA transfer*/ dsc->dscr_a = phys | V_DMA_DSCRA_A_SIZE(ncb) | -#ifdef CONFIG_SBMAC_COALESCE - 0 | + M_DMA_ETHTX_SOP; #else + dsc->dscr_a = phys | + V_DMA_DSCRA_A_SIZE(ncb) | M_DMA_DSCRA_INTERRUPT | -#endif M_DMA_ETHTX_SOP; - +#endif /* transmitting: set outbound options and length */ dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | @@ -1133,7 +1163,7 @@ } } - +#ifndef CONFIG_SB1250_NAPI /********************************************************************** * SBDMA_RX_PROCESS(sc,d) * @@ -1181,6 +1211,14 @@ */ if (curidx == hwidx) break; + /*{ + int i; + for (i=0;;i++) { + if ((dsc->dscr_a & M_DMA_ETHRX_SOP) != 0) + break; + if (i >= NAPI_LOP_MAX) goto ret; + } + }*/ /* * Otherwise, get the packet's sk_buff ptr back @@ -1236,7 +1274,6 @@ sb->ip_summed = CHECKSUM_UNNECESSARY; } } /*rx_hw_checksum */ - netif_rx(sb); } } @@ -1258,7 +1295,7 @@ } } - +#endif /********************************************************************** @@ -1352,6 +1389,7 @@ */ dev_kfree_skb_irq(sb); + //__kfree_skb(sb); //try free fast /* * .. and advance to the next buffer. @@ -1393,6 +1431,7 @@ static int sbmac_initctx(struct sbmac_softc *s) { + int auxctl; /* * figure out the addresses of some ports */ @@ -1414,6 +1453,8 @@ s->sbm_phy_oldk1stsr = 0; s->sbm_phy_oldlinkstat = 0; + s->sbm_phy_oldsignaldetect =0; + /* * Initialize the DMA channels. Right now, only one per MAC is used * Note: Only do this _once_, as it allocates memory from the kernel! @@ -1421,7 +1462,6 @@ sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); - /* * initial state is OFF */ @@ -1436,6 +1476,17 @@ s->sbm_duplex = sbmac_duplex_half; s->sbm_fc = sbmac_fc_disabled; + /* + * Fiber/Copper Mode AutoDetection + */ + + sbmac_mii_write(s,1,MII_AUXCTL,0x2007); + auxctl = sbmac_mii_read(s,1,MII_AUXCTL); + if(auxctl) + { + s->sbm_fibermode=1; + } + else s->sbm_fibermode=0; return 0; } @@ -1632,6 +1683,8 @@ SBMAC_WRITECSR(s->sbm_macenable, M_MAC_RXDMA_EN0 | M_MAC_TXDMA_EN0 | + M_MAC_RXDMA_EN1 | + M_MAC_TXDMA_EN1 | M_MAC_RX_ENABLE | M_MAC_TX_ENABLE); @@ -1645,6 +1698,7 @@ SBMAC_WRITECSR(s->sbm_imr, ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); + #else /* * Accept any kind of interrupt on TX and RX DMA channel 0 @@ -1967,7 +2021,7 @@ V_MAC_IFG_TX_1000 | V_MAC_IFG_THRSH_1000 | V_MAC_SLOT_SIZE_1000; - cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; +cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; break; case sbmac_speed_auto: /* XXX not implemented */ @@ -2102,6 +2156,7 @@ { struct net_device *dev = (struct net_device *) dev_instance; struct sbmac_softc *sc = (struct sbmac_softc *) (dev->priv); + uint64_t isr; for (;;) { @@ -2124,7 +2179,7 @@ } /* - * Receives on channel 0 + * Receives on channel 0,1 */ /* @@ -2145,40 +2200,43 @@ if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { - sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#ifdef CONFIG_SB1250_NAPI + if (netif_rx_schedule_prep(dev)) { + sbmac_irq_disable(sc); + __netif_rx_schedule(dev); } +#else + sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#endif } - +} } static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) { - struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; - - /* lock eth irq */ - spin_lock_irq (&sc->sbm_lock); - - /* +struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; +spin_lock_irq (&sc->sbm_lock); +/* * Put the buffer on the transmit ring. If we * don't have room, stop the queue. */ - if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { - /* XXX save skb that we could not send */ +if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { + /* XXX save skb that we could not send, then test 1 channel */ netif_stop_queue(dev); spin_unlock_irq(&sc->sbm_lock); @@ -2186,12 +2244,142 @@ } dev->trans_start = jiffies; - spin_unlock_irq (&sc->sbm_lock); return 0; } +#ifdef CONFIG_SB1250_NAPI +//#define NAPI_POL_MAX 100 +static int sbmac_poll(struct net_device *dev_instance, int *budget) { + struct net_device *dev = (struct net_device *) dev_instance; + struct sbmac_softc *sc = (struct sbmac_softc *) (dev_instance->priv); + sbmacdma_t *d = &(sc->sbm_rxdma); + int rx_work_limit = *budget; + unsigned long flags; + long int receive=0; + int curidx; + int hwidx; + + sbdmadscr_t *dsc; + struct sk_buff *sb; + int len; + + if(rx_work_limit > dev->quota) + rx_work_limit = dev->quota; + + for (;;) { + /* + * figure out where we are (as an index) and where + * the hardware is (also as an index) + * + * This could be done faster if (for example) the + * descriptor table was page-aligned and contiguous in + * both virtual and physical memory -- you could then + * just compare the low-order bits of the virtual address + * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) + */ + if(--rx_work_limit < 0) goto not_done; + curidx = d->sbdma_remptr - d->sbdma_dscrtable; + hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - + d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); + + /* + * If they're the same, that means we've processed all + * of the descriptors up to (but not including) the one that + * the hardware is working on right now. + */ + + if (curidx == hwidx) break; + + /* + * Otherwise, get the packet's sk_buff ptr back + */ + + dsc = &(d->sbdma_dscrtable[curidx]); + sb = d->sbdma_ctxtable[curidx]; + d->sbdma_ctxtable[curidx] = NULL; + + len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; + /* + * Check packet status. If good, process it. + * If not, silently drop it and put it back on the + * receive ring. + */ + + if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { + + /* + * Add a new buffer to replace the old one. If we fail + * to allocate a buffer, we're going to drop this + * packet and put it right back on the receive ring. + */ + + if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { + sc->sbm_stats.rx_dropped++; + sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ + } + else { + /* + * Set length into the packet + */ + skb_put(sb,len); + + /* + * Buffer has been replaced on the receive ring. + * Pass the buffer to the kernel + */ + sc->sbm_stats.rx_bytes += len; + sc->sbm_stats.rx_packets++;receive++; + sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev); + if (sc->rx_hw_checksum == ENABLE) { + /* if the ip checksum is good indicate in skb. + else set CHECKSUM_NONE as device failed to + checksum the packet */ + + if (((dsc->dscr_b) |M_DMA_ETHRX_BADTCPCS) || + ((dsc->dscr_a)| M_DMA_ETHRX_BADIP4CS)){ + sb->ip_summed = CHECKSUM_NONE; + } else { + printk(KERN_DEBUG "hw checksum fail .\n"); + sb->ip_summed = CHECKSUM_UNNECESSARY; + } + } /*rx_hw_checksum */ + netif_receive_skb(sb); + } + } + else { + /* + * Packet was mangled somehow. Just drop it and + * put it back on the receive ring. + */ + sc->sbm_stats.rx_errors++; + sbdma_add_rcvbuffer(d,sb); + } + + + /* + * .. and advance to the next buffer. + */ + + d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); + + } + if (!receive) receive = 1; + dev->quota -= receive; + *budget -= receive; + + spin_lock_irqsave(&sc->sbm_lock,flags); + netif_rx_complete(dev); + sbmac_irq_enable(sc); + spin_unlock_irqrestore(&sc->sbm_lock,flags); + return 0; +not_done: + dev->quota -= receive; + *budget -= receive; + return 1; +} +#endif /********************************************************************** * SBMAC_SETMULTI(sc) * @@ -2448,6 +2636,10 @@ dev->do_ioctl = sbmac_mii_ioctl; dev->tx_timeout = sbmac_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; +#ifdef CONFIG_SB1250_NAPI + dev->poll = sbmac_poll; + dev->weight =dev->quota = 80; +#endif dev->change_mtu = sb1250_change_mtu; @@ -2525,6 +2717,10 @@ char buffer[100]; char *p = buffer; + int signaldetect; + + if(s->sbm_fibermode == 0) + { /* Read the mode status and mode control registers. */ bmsr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMSR); bmcr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMCR); @@ -2539,7 +2735,6 @@ else { k1stsr = 0; } - chg = 0; if ((bmsr & BMSR_LINKSTAT) == 0) { @@ -2620,6 +2815,41 @@ printk(KERN_INFO "%s: %s\n",s->sbm_dev->name,buffer); } + } + else + { //fiber mode + + chg=0; + printk("sbm_phy_oldsignaldetect:%d\n",s->sbm_phy_oldsignaldetect); + + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(s,s->sbm_phys[0],MII_SGMIISR)); + + printk("current signaldetect:%d\n",signaldetect); + + if (signaldetect == 0) + { + printk("link state is DOWN!\n"); + s->sbm_phy_oldsignaldetect = 0; + return 0; + } + else + { + if(s->sbm_phy_oldsignaldetect != signaldetect) + { + s->sbm_phy_oldsignaldetect = signaldetect; + chg = 1; + printk("link state has been changed\n"); + } + } + if (chg==0) return 0; + printk("Link is up\n"); + s->sbm_speed = sbmac_speed_1000; + s->sbm_duplex = sbmac_duplex_full; + s->sbm_fc = sbmac_fc_frame; + s->sbm_state = sbmac_state_on; + noisy =0; + printk("fiber mode.\t"); + } return 1; } @@ -2632,9 +2862,12 @@ struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; int next_tick = HZ; int mii_status; + int signaldetect; spin_lock_irq (&sc->sbm_lock); + if(sc->sbm_fibermode == 0) + { /* make IFF_RUNNING follow the MII status bit "Link established" */ mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); @@ -2647,6 +2880,23 @@ netif_carrier_off(dev); } } + } + else + { + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(sc,sc->sbm_phys[0],MII_SGMIISR)); + if(sc->sbm_phy_oldsignaldetect != signaldetect) + { + sc->sbm_phy_oldsignaldetect = signaldetect; + if (signaldetect) { + printk("netif_carrier_on. \n"); + netif_carrier_on(dev); + } + else { + netif_carrier_off(dev); + } + printk("link state has been changed\n"); + } + } /* * Poll the PHY to see what speed we should be running at ---------------------- >In article <3ED58DBA.6000506@netpower.com.cn> (at Thu, 29 May 2003 12:34:02 +0800), Zhang Haitao says: > >> i'm very glad to let all of you to review this patch >> or give me some advice from the oops message! > >Please don't try to make cosmetic changes >including indentation, and/or new lines etc. > >Thank you. > >-- >Hideaki YOSHIFUJI @ USAGI Project >GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA --------------------------- From aj@dungeon.inka.de Thu May 29 12:15:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 12:15:37 -0700 (PDT) Received: from mail.inka.de (mail@quechua.inka.de [193.197.184.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TJFR2x030416 for ; Thu, 29 May 2003 12:15:28 -0700 Received: from dungeon.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 19LSs2-0006vB-00; Thu, 29 May 2003 21:15:26 +0200 Received: from [192.168.1.12] (unknown [192.168.1.12]) by dungeon.inka.de (Postfix) with ESMTP id 180D420FE3 for ; Thu, 29 May 2003 21:15:24 +0200 (CEST) Subject: ipsec without interface From: Andreas Jellinghaus To: "netdev@oss.sgi.com" Content-Type: text/plain Organization: Message-Id: <1054235787.605.21.camel@simulacron> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 21:16:27 +0200 Content-Transfer-Encoding: 7bit X-archive-position: 2748 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: aj@dungeon.inka.de Precedence: bulk X-list: netdev sure, the simple configurations work fine with kernel 2.5.* ipsec. But I miss the interface and things I did with it. How are these setups supposed to work without an interface? a) in iptables allow everything coming from ipsec0, allow only ssh and ipsec on eth0. b) source address selection. put the default route on ipsec0, but the route to the tunnel endpoint on eth0 with the right gateway. also I wonder why I see incoming packets before and after encryption, but outgoing packets only before encryption. Andreas From aj@dungeon.inka.de Thu May 29 12:29:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 12:30:06 -0700 (PDT) Received: from mail.inka.de (mail@quechua.inka.de [193.197.184.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TJTu2x030894 for ; Thu, 29 May 2003 12:29:57 -0700 Received: from dungeon.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 19LT62-0000Md-00; Thu, 29 May 2003 21:29:54 +0200 Received: from [192.168.1.12] (unknown [192.168.1.12]) by dungeon.inka.de (Postfix) with ESMTP id 7B7BC20FE3 for ; Thu, 29 May 2003 21:29:52 +0200 (CEST) Subject: 2.5.70 kernel BUG at net/xfrm/xfrm_policy.c:185! From: Andreas Jellinghaus To: "netdev@oss.sgi.com" Content-Type: text/plain Organization: Message-Id: <1054236655.596.37.camel@simulacron> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 21:30:55 +0200 Content-Transfer-Encoding: 7bit X-archive-position: 2749 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: aj@dungeon.inka.de Precedence: bulk X-list: netdev kernel: ------------[ cut here ]------------ kernel: kernel BUG at net/xfrm/xfrm_policy.c:185! kernel: invalid operand: 0000 [#2] kernel: CPU: 0 kernel: EIP: 0060:[__xfrm_policy_destroy+20/96] Not tainted kernel: EFLAGS: 00010246 kernel: EIP is at __xfrm_policy_destroy+0x14/0x60 kernel: eax: 00000001 ebx: cfd48c00 ecx: 00000000 edx: 00000000 kernel: esi: c873ed80 edi: c86fde54 ebp: 00000001 esp: c86fddb4 kernel: ds: 007b es: 007b ss: 0068 kernel: Process ping (pid: 500, threadinfo=c86fc000 task=c874d240) kernel: Stack: cfd48c00 cfd48c00 c03207ad cfd48c00 c86fde14 00000001 c86fde58 c8 6fddf0 kernel: 00000002 c86f2e60 cfc66000 00000400 00000002 00000003 00000000 c8 6f2e60 kernel: c02e20cf 0100a8c0 0a00a8c0 00000000 c86fde58 c86fde54 00000000 c0 2e221f kernel: Call Trace: kernel: [xfrm_lookup+493/1184] xfrm_lookup+0x1ed/0x4a0 kernel: [__ip_route_output_key+47/240] __ip_route_output_key+0x2f/0xf0 kernel: [ip_route_output_flow+47/128] ip_route_output_flow+0x2f/0x80 kernel: [udp_connect+391/816] udp_connect+0x187/0x330 kernel: [inet_autobind+134/336] inet_autobind+0x86/0x150 kernel: [inet_dgram_connect+79/128] inet_dgram_connect+0x4f/0x80 kernel: [sys_connect+155/208] sys_connect+0x9b/0xd0 kernel: [sock_map_fd+250/304] sock_map_fd+0xfa/0x130 kernel: [sock_create+406/704] sock_create+0x196/0x2c0 kernel: [sys_socket+61/96] sys_socket+0x3d/0x60 kernel: [sys_socketcall+201/672] sys_socketcall+0xc9/0x2a0 kernel: [capable+35/80] capable+0x23/0x50 kernel: [syscall_call+7/11] syscall_call+0x7/0xb kernel: kernel: Code: 0f 0b b9 00 33 88 37 c0 8b 8b c0 00 00 00 85 c9 74 08 0f 0b setkey -f mysettings and I can go on as usual. seems to happen when racoon does some update and some packet is still in the queue. racoon is 2003-05-29 21:29:31: INFO: main.c:174:main(): @(#)racoon 20001216 20001216 sakane@kame.net 2003-05-29 21:29:31: INFO: main.c:175:main(): @(#)This product linked OpenSSL 0.9.7b 10 Apr 2003 (http://www.openssl.org/) I think it is 0.2.2 from ipsec-tools.sf.net ... Andreas From gandalf@wlug.westbo.se Thu May 29 12:57:17 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 12:57:21 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TJvE2x031603 for ; Thu, 29 May 2003 12:57:17 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 67A0636FDD; Thu, 29 May 2003 21:57:11 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: "David S. Miller" Cc: netdev@oss.sgi.com In-Reply-To: <1054217010.757.39.camel@tux.rsn.bth.se> References: <1052841090.13492.20.camel@tux.rsn.bth.se> <20030529.024114.78714066.davem@redhat.com> <1054217010.757.39.camel@tux.rsn.bth.se> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1054238230.709.1.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 21:57:11 +0200 X-archive-position: 2750 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev On Thu, 2003-05-29 at 16:03, Martin Josefsson wrote: > > Can you reproduce this with the latest and greatest 2.5.x > > sources? I think we might have just nailed it... > > I'll give it a spin later this evening if time permits. I've just tested 2.5-bk and I can still reproduce it. The wording of my mail might have been a bit wrong, I don't see complete hangs, just ~2 minute stalls in ESTABLISHED state and then it continues like nothing happened. -- /Martin From aj@dungeon.inka.de Thu May 29 13:07:22 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 13:07:29 -0700 (PDT) Received: from mail.inka.de (mail@quechua.inka.de [193.197.184.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TK7L2x032106 for ; Thu, 29 May 2003 13:07:22 -0700 Received: from dungeon.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 19LSmq-0004Wt-00; Thu, 29 May 2003 21:10:04 +0200 Received: from [192.168.1.12] (unknown [192.168.1.12]) by dungeon.inka.de (Postfix) with ESMTP id 97AAE20F99 for ; Thu, 29 May 2003 21:04:52 +0200 (CEST) Subject: ipsec 2.5.70 trouble From: Andreas Jellinghaus To: "netdev@oss.sgi.com" Content-Type: text/plain Organization: Message-Id: <1054235155.596.9.camel@simulacron> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 May 2003 21:05:55 +0200 Content-Transfer-Encoding: 7bit X-archive-position: 2751 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: aj@dungeon.inka.de Precedence: bulk X-list: netdev I create a single ping, I can see the packet plain in OUTPUT iptable, I can see the packet encrypted with tcpdump on the source machine. but on the target machine (same lan), I see the packets encrypted, but where is that second packet in tcpdump comming from? ping 192.168.1.1 source machine has real ip eth0 192.168.0.10 and for ipsec an additional 192.168.3.2, and a default route with src 192.168.3.2 and an ipsec policy put everything from/to 192.168.3.2 in a tunnel 192.168.0.10-192.168.0.1. source machine iptables May 29 20:36:26 simulacron kernel: iptlog.output IN= OUT=eth0 SRC=192.168.3.2 DST=192.168.1.1 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=32002 SEQ=1 source machine tcpdump 20:36:26.296466 192.168.0.10 > 192.168.0.1: ESP(spi=0x0dfc33a3,seq=0x7) (DF) destination machine tcpdump tcpdump: listening on eth0 20:35:23.773924 192.168.0.10 > 192.168.0.1: ESP(spi=0x0dfc33a3,seq=0x7) (DF) 20:35:23.773924 truncated-ip - 24 bytes missing!192.168.0.10 > 192.168.0.1: truncated-ip - 13087 bytes missing!64.4.224.214 > 192.168.0.10: (frag 17664:13167@672) [tos 0xfc] (ipip) destination machine iptables May 29 20:35:23 localhost kernel: iptlog.input IN=eth0 OUT= MAC=00:e0:7d:01:bb:0d:00:04:76:45:01:6e:08:00 SRC=192.168.0.10 DST=192.168.0.1 LEN=152 TOS=0x00 PREC=0x00 TTL=64 ID=55297 DF PROTO=ESP SPI=0xdfc33a3 Regards, Andreas From jgarzik@pobox.com Thu May 29 13:49:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 13:49:50 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TKnd2x000727 for ; Thu, 29 May 2003 13:49:43 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19LULC-0003gU-4U; Thu, 29 May 2003 21:49:38 +0100 Message-ID: <3ED67256.9040200@pobox.com> Date: Thu, 29 May 2003 16:49: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: Stephen Hemminger CC: "David S. Miller" , Scott Feldman , netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] e100 report link speed via if_port References: <20030529104138.751a1f54.shemminger@osdl.org> In-Reply-To: <20030529104138.751a1f54.shemminger@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2752 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 dev->if_port is deprecated. that's what ethtool is for... :) Jeff From sim@netnation.com Thu May 29 13:51:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 13:51:34 -0700 (PDT) Received: from peace.netnation.com (newpeace.netnation.com [204.174.223.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TKpQ2x001013 for ; Thu, 29 May 2003 13:51:26 -0700 Received: from sim by peace.netnation.com with local (Exim 4.20) id 19LUMv-0007vk-3P; Thu, 29 May 2003 13:51:25 -0700 Date: Thu, 29 May 2003 13:51:25 -0700 From: Simon Kirby To: "David S. Miller" Cc: netdev@oss.sgi.com, linux-net@vger.kernel.org, kuznet@ms2.inr.ac.ru Subject: Re: Route cache performance under stress Message-ID: <20030529205125.GA30058@netnation.com> References: <20030522.015815.91322249.davem@redhat.com> <20030522.034058.71558626.davem@redhat.com> <20030522114438.GD2961@netnation.com> <20030522.153330.74735095.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030522.153330.74735095.davem@redhat.com> User-Agent: Mutt/1.5.4i X-archive-position: 2753 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: sim@netnation.com Precedence: bulk X-list: netdev On Thu, May 22, 2003 at 03:33:30PM -0700, David S. Miller wrote: > If you'd like I can try to regenerate a profile, but you probably > already know what it will look like. > > I obviously know some things that will change, but I am still > very much interested in new profiles. Sorry for the delay -- I was away for a few days. Here are profile results from the same machine (still with XT-PIC), the same 300000 route entries, and your original patch that fixes the hashing. I should also mention that in all of these tests I have one filter rule in the INPUT chain (after routing) to avoid sending back zillions of ICMP packets out to the spoofed source IPs. ... 27 check_pgt_cache 0.8438 1430 ip_rcv_finish 2.4870 135 ipv4_dst_destroy 2.8125 357 cpu_idle 3.1875 7714 ip_route_input_slow 3.3481 434 fib_rules_policy 3.8750 2952 ip_rcv 5.2714 85 kmem_cache_alloc 5.3125 2188 netif_receive_skb 5.4700 2734 alloc_skb 5.6958 822 skb_release_data 5.7083 2161 __kfree_skb 5.8723 572 ip_local_deliver 5.9583 1023 __constant_c_and_count_memset 6.3937 3801 fib_validate_source 6.7875 6778 rt_garbage_collect 7.1801 497 __fib_res_prefsrc 7.7656 3035 inet_select_addr 8.2473 2717 tcp_match 8.4906 552 ipt_hook 8.6250 706 kmalloc 8.8250 1561 kfree 8.8693 1287 jhash_3words 8.9375 5937 nf_hook_slow 10.9136 2532 fib_semantic_match 12.1731 2356 eth_type_trans 12.2708 2166 nf_iterate 12.3068 4446 net_rx_action 12.6307 1622 kfree_skbmem 12.6719 842 rt_hash_code 13.1562 16030 ipt_do_table 14.5199 2104 tg3_recycle_rx 14.6111 13795 tg3_rx 14.6133 5667 __kmem_cache_alloc 17.7094 1193 ipt_route_hook 18.6406 2851 do_gettimeofday 19.7986 7423 fib_lookup 23.1969 1497 fib_rule_put 23.3906 8803 ip_packet_match 26.1994 4970 dst_destroy 28.2386 22479 rt_intern_hash 29.2695 8804 kmem_cache_free 55.0250 8380 dst_alloc 58.1944 18252 fn_hash_lookup 63.3750 25473 tg3_interrupt 75.8125 24036 do_softirq 100.1500 51355 ip_route_input 118.8773 57304 tg3_poll 188.5000 111691 handle_IRQ_event 698.0688 168828 default_idle 2637.9375 Full profile output available here: http://blue.netnation.com/sim/ref/ readprofile.full_route_table_hash_fixed.* Note that if I increase the packet rate and NAPI kicks in, all of the handle_IRQ and similar overhead basically disappears because it no longer uses IRQs. Pretty spiffy. Here is a profile of that: ... 25 tasklet_hi_action 0.1562 46 timer_bh 0.2054 97 net_rx_action 0.2756 93 tg3_vlan_rx 0.3875 158 tg3_poll 0.5197 1630 ip_rcv_finish 2.8348 142 ipv4_dst_destroy 2.9583 429 fib_rules_policy 3.8304 8959 ip_route_input_slow 3.8885 2438 ip_rcv 4.3536 2504 alloc_skb 5.2167 1991 __kfree_skb 5.4103 2279 netif_receive_skb 5.6975 929 skb_release_data 6.4514 669 ip_local_deliver 6.9688 1175 __constant_c_and_count_memset 7.3438 2367 tcp_match 7.3969 124 kmem_cache_alloc 7.7500 4535 fib_validate_source 8.0982 598 __fib_res_prefsrc 9.3438 8896 rt_garbage_collect 9.4237 3582 inet_select_addr 9.7337 1747 kfree 9.9261 717 ipt_hook 11.2031 938 kmalloc 11.7250 1747 jhash_3words 12.1319 6879 nf_hook_slow 12.6452 2439 eth_type_trans 12.7031 1695 kfree_skbmem 13.2422 2358 nf_iterate 13.3977 872 rt_hash_code 13.6250 2933 fib_semantic_match 14.1010 16553 ipt_do_table 14.9937 15339 tg3_rx 16.2489 2482 tg3_recycle_rx 17.2361 5967 __kmem_cache_alloc 18.6469 1237 ipt_route_hook 19.3281 3120 do_gettimeofday 21.6667 8299 ip_packet_match 24.6994 8031 fib_lookup 25.0969 1877 fib_rule_put 29.3281 6088 dst_destroy 34.5909 26833 rt_intern_hash 34.9388 10666 kmem_cache_free 66.6625 20193 fn_hash_lookup 70.1146 10516 dst_alloc 73.0278 64803 ip_route_input 150.0069 Full profile output available as: readprofile.full_route_table_hash_fixed_napi.* Hmm.. I see there is some redundant hashing going on in ip_route_input_slow() (called only from ip_route_input() which already calculates the hash), but my patch to fix that adds yet another argument to ip_route_slow() which isn't that pretty. It looks like that function isn't using much CPU anyway. Why is ip_route_input() so heavy still? This kernel is compiled CONFIG_SMP which makes the read_lock() calls actually do something, but it looks like they should be fairly light. Should I add an iteration counter to the for loop, perhaps? Simon- From davem@redhat.com Thu May 29 14:06:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:06: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.9) with SMTP id h4TL672x001732 for ; Thu, 29 May 2003 14:06:08 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07723; Thu, 29 May 2003 14:03:55 -0700 Date: Thu, 29 May 2003 14:03:54 -0700 (PDT) Message-Id: <20030529.140354.104040997.davem@redhat.com> To: acme@conectiva.com.br Cc: hch@lst.de, netdev@oss.sgi.com Subject: Re: [PATCH] remove sdla from setup.c From: "David S. Miller" In-Reply-To: <20030529153625.GP24054@conectiva.com.br> References: <20030528110658.GA26411@lst.de> <20030529.025749.59658664.davem@redhat.com> <20030529153625.GP24054@conectiva.com.br> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2754 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 From: Arnaldo Carvalho de Melo Date: Thu, 29 May 2003 12:36:25 -0300 Em Thu, May 29, 2003 at 02:57:49AM -0700, David S. Miller escreveu: > Some of this wan driver stuff is so crappy :( Crappy? You are being nice... It's possible :-) You'd think at least the frame relay code, which is pretty important especially in countries like Poland, would get cleaned up by somebody. From davem@redhat.com Thu May 29 14:09:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:09: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.9) with SMTP id h4TL9c2x002070 for ; Thu, 29 May 2003 14:09:39 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07747; Thu, 29 May 2003 14:08:29 -0700 Date: Thu, 29 May 2003 14:08:28 -0700 (PDT) Message-Id: <20030529.140828.78714529.davem@redhat.com> To: shemminger@osdl.org Cc: scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] e100 report link speed via if_port From: "David S. Miller" In-Reply-To: <20030529104138.751a1f54.shemminger@osdl.org> References: <20030529104138.751a1f54.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2755 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 From: Stephen Hemminger Date: Thu, 29 May 2003 10:41:38 -0700 The e100 driver knows the link speed, but it is not visible through sysfs. Small patch to update the net_device if_port when speed is detected; this can then be read through /sys/class/net/eth0/if_port. if_port is deprecated, use ethtool ioctls to determine the link speed... From garzik@gtf.org Thu May 29 14:10:57 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:11:02 -0700 (PDT) Received: from havoc.gtf.org (host-64-213-145-173.atlantasolutions.com [64.213.145.173] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TLAs2x002393 for ; Thu, 29 May 2003 14:10:56 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id 8D1346672; Thu, 29 May 2003 17:10:53 -0400 (EDT) Date: Thu, 29 May 2003 17:10:53 -0400 From: Jeff Garzik To: torvalds@transmeta.com Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: [BK PATCHES] net driver merges Message-ID: <20030529211053.GA9069@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: 2756 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 Linus, please do a bk pull bk://kernel.bkbits.net/jgarzik/net-drivers-2.5 Others may download the patch from ftp://ftp.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.5/2.5.70-bk3-netdrvr1.patch.bz2 This will update the following files: drivers/net/8139too.c | 6 drivers/net/amd8111e.c | 1047 +++++++++++++++++++++++++++---------------- drivers/net/amd8111e.h | 968 ++++++++++++++++++++------------------- drivers/net/e100/e100_main.c | 33 - drivers/net/pci-skeleton.c | 4 drivers/net/pcnet32.c | 7 drivers/net/r8169.c | 44 + drivers/net/tlan.c | 116 +++- 8 files changed, 1306 insertions(+), 919 deletions(-) through these ChangeSets: (03/05/29 1.1438) [netdrvr e100] initialize callbacks before registering netdev Ouch. (03/05/29 1.1437) [netdrvr amd8111e] interrupt coalescing, libmii, bug fixes * Dynamic interrupt coalescing * mii lib support * dynamic IPG support (disabled by default) * jumbo frame fix * vlan fix * rx irq coalescing fix (03/05/29 1.1436) [netdrvr tlan] fix 64-bit issues (03/05/29 1.1435) [netdrvr r8169] use alloc_etherdev, pci_disable_device (03/05/29 1.1433) [netdrvr 8139too] respond to "isn't this racy?" comment (03/05/28 1.1432) [netdrvr] s/init_etherdev/alloc_etherdev/ in code comments, in 8139too and pci-skeleton drivers. (03/05/28 1.1431) [netdrvr tlan] cleanup * use pci_{request,release}_regions for PCI devices * use alloc_etherdev (fixes race) * propagate error returns from pci_xxx function errors (03/05/27 1.1392.7.7) [netdrvr pcnet32] bug fixes I would like to see a couple of the pcnet32 changes that I think we can agree on be put into the trees so a couple of the potential defects can be avoided. The following patch contains just these pieces. The only controversial one is an arbitrary change in the number of iterations in a while loop spinning on hardware state. No matter how this is done, I am not especially fond of this bit of code as it has no reasonable error recovery path -- however, as a half-way, incremental solution, increasing the polling time should help as the 100 value was certainly found to be insufficient. 1000 may not be sufficient either, but it is certainly no worse. Both of the other changes were hit in testing (and I belive the wmb() at a customer even), so it would help reduce some debug if these go in. Any feedback is appreciated - thanks. From garzik@gtf.org Thu May 29 14:12:29 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:12:36 -0700 (PDT) Received: from havoc.gtf.org (host-64-213-145-173.atlantasolutions.com [64.213.145.173] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TLCQ2x002769 for ; Thu, 29 May 2003 14:12:28 -0700 Received: by havoc.gtf.org (Postfix, from userid 500) id CA4356673; Thu, 29 May 2003 17:12:25 -0400 (EDT) Date: Thu, 29 May 2003 17:12:25 -0400 From: Jeff Garzik To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com Subject: 2.4.x net driver updates Message-ID: <20030529211225.GA9241@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: 2757 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 BK users may obtain the updates by issuing bk pull bk://kernel.bkbits.net/jgarzik/net-drivers-2.4 Others may download the changes in patch form from ftp://ftp.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.4/2.4.21-rc6-netdrvr1.patch.bz2 This will update the following files: drivers/net/bonding.c | 3434 ------------------------- Documentation/Configure.help | 9 Documentation/networking/bonding.txt | 148 - Documentation/networking/ifenslave.c | 334 +- drivers/net/8139cp.c | 7 drivers/net/8139too.c | 6 drivers/net/Config.in | 3 drivers/net/Makefile | 6 drivers/net/amd8111e.c | 1063 +++++-- drivers/net/amd8111e.h | 968 +++---- drivers/net/arcnet/arcnet.c | 2 drivers/net/arcnet/rfc1201.c | 6 drivers/net/bonding.c | 266 + drivers/net/bonding/Makefile | 18 drivers/net/bonding/bond_3ad.c | 2667 +++++++++++++++++++ drivers/net/bonding/bond_3ad.h | 342 ++ drivers/net/bonding/bond_alb.c | 1585 +++++++++++ drivers/net/bonding/bond_alb.h | 129 drivers/net/bonding/bond_main.c | 4737 ++++++++++++++++++++++++++++++++--- drivers/net/bonding/bonding.h | 209 + drivers/net/e1000/e1000.h | 3 drivers/net/e1000/e1000_main.c | 167 + drivers/net/eepro.c | 2 drivers/net/pci-skeleton.c | 4 drivers/net/pcnet32.c | 7 drivers/net/r8169.c | 52 drivers/net/sundance.c | 144 - drivers/net/tlan.c | 258 + drivers/net/tlan.h | 7 drivers/net/tokenring/olympic.c | 3 drivers/net/tulip/tulip_core.c | 7 drivers/net/typhoon.c | 4 drivers/net/via-rhine.c | 2 drivers/net/wireless/airo.c | 2 include/linux/if_arcnet.h | 4 include/linux/if_bonding.h | 101 include/linux/if_vlan.h | 1 include/linux/skbuff.h | 4 include/net/if_inet6.h | 5 include/net/irda/irlan_common.h | 2 net/core/dev.c | 4 net/core/skbuff.c | 3 net/ipv6/addrconf.c | 13 net/ipv6/ndisc.c | 3 net/irda/irlan/irlan_eth.c | 6 45 files changed, 11508 insertions(+), 5239 deletions(-) through these ChangeSets: (03/05/29 1.1237) [netdrvr amd8111e] remove out-of-tree feature that snuck in (03/05/29 1.1236) [netdrvr amd8111e] interrupt coalescing, libmii, bug fixes * Dynamic interrupt coalescing * mii lib support * dynamic IPG support (disabled by default) * jumbo frame fix * vlan fix * rx irq coalescing fix (03/05/29 1.1235) [netdrvr tlan] fix 64-bit issues (03/05/29 1.1234) [netdrvr r8169] sync with 2.5 (backport whitespace cleanups) (03/05/29 1.1233) [netdrvr r8169] use alloc_etherdev (fix race), pci_disable_device (03/05/29 1.1232) [netdrvr olympic] fix build with gcc 3.3 (03/05/29 1.1220.1.25) [netdrvr 8139too] add comment, whitespace cleanup (03/05/28 1.1220.1.24) [netdrvr] s/init_etherdev/alloc_etherdev/ in code comments, in 8139too and pci-skeleton drivers. (03/05/28 1.1220.1.23) [netdrvr tlan] backport fixes and cleanups from 2.5 * alloc_etherdev (fixes race) * PCI DMA API * C99 initializers * speling fixes * use pci_{request,release}_regions for PCI devices * propagate error returns back from pci_xxx functions * call pci_set_dma_mask * use keventd for adapter error reset (2.5 uses workqueue) (03/05/27 1.1230) [netdrvr pcnet32] bug fixes I would like to see a couple of the pcnet32 changes that I think we can agree on be put into the trees so a couple of the potential defects can be avoided. The following patch contains just these pieces. The only controversial one is an arbitrary change in the number of iterations in a while loop spinning on hardware state. No matter how this is done, I am not especially fond of this bit of code as it has no reasonable error recovery path -- however, as a half-way, incremental solution, increasing the polling time should help as the 100 value was certainly found to be insufficient. 1000 may not be sufficient either, but it is certainly no worse. Both of the other changes were hit in testing (and I belive the wmb() at a customer even), so it would help reduce some debug if these go in. Any feedback is appreciated - thanks. (03/05/27 1.1229) [netdrvr eepro] update MODULE_AUTHOR per old-author request (03/05/27 1.1228) [netdrvr sundance] fix another flow control bug (03/05/27 1.1227) [netdrvr sundance] fix flow control bug (03/05/27 1.1226) [netdrvr bonding] fix ABI version control problem This fix makes bonding not commit to a specific ABI version if the ioctl command is not supported by bonding. (It also removes the '\n' in the continuous printk reporting the link down event in bond_mii_monitor - it got in there by mistake in our previous patch set and caused log messages to appear funny in some situations). (03/05/27 1.1225) [netdrvr bonding] fix long failover in 802.3ad mode This patch fixes the bug reported by Jay on April 3rd regarding long failover time when releasing the last slave in the active aggregator. The fix, as suggested by Jay, is to follow the spec recommendation and send a LACPDU to the partner saying this port is no longer aggregatable and therefore trigger an immediate re-selection of a new aggregator instead of waiting the entire expiration timeout. (03/05/25 1.1224) IPv6 over ARCnet (RFC2497) support, IPv6 part. (03/05/25 1.1223) IPv6 over ARCnet (RFC2497) support, driver part (03/05/25 1.1222) [irda] module refcounts for irlan (03/05/23 1.1215.1.7) [bonding] small cleanups (03/05/23 1.1215.1.6) [bonding] add rcv load balancing mode This patch adds a new mode that enables receive load balancing for IPv4 traffic on top of the transmit load balancing mode. This capability is achieved by intercepting and manipulating the ARP negotiation to teach clients several MAC addresses for the bond and thus distribute incoming traffic among all slaves with the highest link speed. In order to function properly, slaves are required to be able to have their MAC address set even while the interface is up since once the primary slave looses its link, the new primary slave (and only it) must be able to take over and receive the incoming traffic instead. If a non-primary slave looses its link, ARP packets will be sent to all clients communicating through it in order to teach them a replacement MAC address, and the primary slave will be put in promiscuous mode for 10 seconds for fault tolerance reasons. This patch is against bonding-20030415, but must come only after the locking scheme changing patch since it uses dev_set_promiscuity() that would otherwise cause a system hang. (03/05/23 1.1215.1.5) [bonding] support xmit load balancing mode (03/05/23 1.1215.1.4) [bonding] much improved locking This patch replaces the use of lock_irqsave/unlock_irqrestore in bonding with lock/unlock or lock_bh/unlock_bh as appropriate according to context. This change is based on a previous discussion regarding the fact that holding a lock_irqsave doesn't prevent softirqs from running which can cause deadlocks in certain situations. This new locking scheme has already undergone massive testing cycle by our QA group and we feel it is ready for release (some new modes and enhancements will not work properly without it). (03/05/23 1.1215.1.3) [bonding] better 802.3ad mode control, some cleanup This patch adds the lacp_rate module param to enable better control over the IEEE 802.3ad mode. This param controls the rate at which the partner system is asked to send LACPDUs to bonding. Two options exist: - slow (or 0) - LACPDUs are 30 seconds apart - fast (or 1) - LACPDUs are 1 second apart The default is slow (like most switches around). There are also some code beautifications (mainly converting comments to C style in code segments we added in the past). (03/05/23 1.1215.1.2) [bonding] ABI versioning This patch adds user-land to kernel ABI version control in bonding to restore backward compatibility between different versions of ifenslave and the bonding module. It uses ethtool's GDRVINFO ioctl to pass the ABI version number between ifenslave and the bonding module in both directions so both the driver and the application can tell which partner they're working against and take the appropriate measures when enslaving/releasing an interface. The bonding module remembers the ABI version received from the application, and from that moment on will deny enslave and release commands from an application using a different ABI version, which means that if you want to switch to an ifenslave with a different ABI version (or with non at all), you'll first have to re-load the bonding module. This patch also changes the driver/application versioning scheme to contain 3 fields X.Y.Z with the follows meaning: X - Major version - big behavior changes Y - Minor version - addition of features Z - Extra version - minor changes and bug fixes There are also three minor bug fixes: 1. Prevent enslaving an interface that is already a slave. 2. Prevent enslaving if the bond is down. 3. In bond_release_all, save old value of current_slave before assigning NULL to it to enable using it's original value later on. This patch is against bonding-20030415. (03/04/27 1.1137.1.6) [netdrvr e1000] add TSO support -- disabled * Copy TSO support for 2.5 e1000. Wrapped with NETIF_F_TSO, so not currently enabled in 2.4. Done to keep 2.4 and 2.5 drivers in-sync as much as possible. (03/04/27 1.1137.1.5) [netdrvr e1000] add support for NAPI * Copy NAPI support from 2.5 e1000 driver * Add CONFIG_E1000_NAPI option (03/04/27 1.1137.1.4) [netdrvr tulip] support DM910x chip from ALi (03/04/27 1.1137.1.3) Remove duplicate CONFIG_TULIP_MWI entry in Configure.help Noticed by Geert Uytterhoeven (03/04/27 1.1137.1.2) [netdrvr 8139cp] enable MWI via pci_set_mwi, rather than manually (03/04/26 1.1131.2.6) [netdrvr typhoon] s/#if/#ifdef/ for a CONFIG_ var (03/04/25 1.1131.2.5) [netdrvr sundance] small cleanups from 2.5 - s/long flag/unsigned long flag/ - C99 initializers (03/04/25 1.1131.2.4) [netdrvr sundance] bug fixes, VLAN support - Fix tx bugs in big-endian machines - Remove unused max_interrupt_work module parameter, the new NAPI-like rx scheme doesn't need it. - Remove redundancy get_stats() in intr_handler(), those I/O access could affect performance in ARM-based system - Add Linux software VLAN support - Fix bug of custom mac address (StationAddr register only accept word write) (03/04/25 1.1131.2.3) [netdrvr via-rhine] fix promisc mode I found a via-rhine bug, it can't receive BPDU (mac: 0180c2000000) in promiscuous mode. Fill all "1" in hash table to fix this problem in promiscuous mode. (RCR remain 0x1c, write it as 0x1f don't work) (03/04/25 1.1131.2.2) [wireless airo] fix end-of-array test FYI statsLabels[] is an array of char*, so the fix below is pretty obvious. (03/04/25 1.1131.2.1) [PATCH] fix .text.exit error in drivers/net/r8169.c In drivers/net/r8169.c the function rtl8169_remove_one is __devexit but the pointer to it didn't use __devexit_p resulting in a.text.exit compile error when !CONFIG_HOTPLUG. The fix is simple: (03/04/17 1.1101.8.7) [bonding] add support for IEEE 802.3ad Dynamic link aggregation Contributed by Shmulik Hen @ Intel, merge by Jay Vosburgh @ IBM (03/04/17 1.1101.8.6) [bonding] move private decls into new drv/net/bonding/bonding.h file (03/04/17 1.1101.8.5) [bonding] move driver into new drivers/net/bonding directory (03/04/17 1.1101.8.4) [bonding] Moved setting slave mac addr, and open, from app to the driver This patch enables support of modes that need to use the unique mac address of each slave. It moves setting the slave's mac address and opening it from the application to the driver. This breaks backward compatibility between the new driver and older applications ! It also blocks possibility of enslaving before the master is up (to prevent putting the system in an unstable state), and removes the code that unconditionally restores all base driver's flags (flags are automatically restored once all undo stages are done in proper order). Contributed by Shmulik Hen @ Intel (03/04/17 1.1101.8.3) [bonding] add support for getting slave's speed and duplex via ethtool Contributed by Shmulik Hen @ Intel (03/04/17 1.1101.8.2) [bonding] fix comment to prevent future merge difficulties Contributed by Jay Vosburgh @ IBM (03/04/17 1.1101.8.1) [net] store physical device a packet arrives in on (Needed for bonding) Contributed by Jay Vosburgh @ IBM, Shmulik Hen @ Intel, and others. From davem@redhat.com Thu May 29 14:15:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:15:26 -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.9) with SMTP id h4TLFK2x003106 for ; Thu, 29 May 2003 14:15:21 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07797; Thu, 29 May 2003 14:14:11 -0700 Date: Thu, 29 May 2003 14:14:10 -0700 (PDT) Message-Id: <20030529.141410.85405194.davem@redhat.com> To: aj@dungeon.inka.de Cc: netdev@oss.sgi.com Subject: Re: ipsec 2.5.70 trouble From: "David S. Miller" In-Reply-To: <1054235155.596.9.camel@simulacron> References: <1054235155.596.9.camel@simulacron> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2758 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 From: Andreas Jellinghaus Date: 29 May 2003 21:05:55 +0200 but on the target machine (same lan), I see the packets encrypted, but where is that second packet in tcpdump comming from? After we do the transformation, we stick it back into the nework stack input to prevent stack exhaustion. And yes it is on purpose and not changing. From shemminger@osdl.org Thu May 29 14:28:35 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:28:39 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TLSY2x003539 for ; Thu, 29 May 2003 14:28:35 -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 h4TLSKX24396; Thu, 29 May 2003 14:28:20 -0700 Date: Thu, 29 May 2003 14:28:20 -0700 From: Stephen Hemminger To: "David S. Miller" , Jeff Garzik Cc: scott.feldman@intel.com, netdev@oss.sgi.com Subject: [PATCH 2.5.70] remove if_port_text Message-Id: <20030529142820.5f657d77.shemminger@osdl.org> In-Reply-To: <20030529.140828.78714529.davem@redhat.com> References: <20030529104138.751a1f54.shemminger@osdl.org> <20030529.140828.78714529.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (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: 2759 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 Eliminate necrophilic code, net-sysfs shouldn't support deprecated if_port. Since nowhere else is using if_port_text, eliminate it. diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h --- a/include/linux/netdevice.h Thu May 29 14:24:18 2003 +++ b/include/linux/netdevice.h Thu May 29 14:24:18 2003 @@ -147,8 +147,6 @@ #ifdef __KERNEL__ -extern const char *if_port_text[]; - #include #include diff -Nru a/net/core/net-sysfs.c b/net/core/net-sysfs.c --- a/net/core/net-sysfs.c Thu May 29 14:24:18 2003 +++ b/net/core/net-sysfs.c Thu May 29 14:24:18 2003 @@ -16,16 +16,6 @@ #include #include -const char *if_port_text[] = { - [IF_PORT_UNKNOWN] = "unknown", - [IF_PORT_10BASE2] = "BNC", - [IF_PORT_10BASET] = "10baseT", - [IF_PORT_AUI] = "AUI", - [IF_PORT_100BASET] = "100baseT", - [IF_PORT_100BASETX] = "100baseTX", - [IF_PORT_100BASEFX] = "100baseFX" -}; - #define to_net_dev(class) container_of((class), struct net_device, class_dev) /* generate a show function for simple field */ @@ -66,20 +56,6 @@ NETDEVICE_ATTR(features, "%#x\n"); NETDEVICE_ATTR(type, "%d\n"); -/* TODO: only a few devices set this now should fix others. */ -static ssize_t show_port(struct class_device *dev, char *buf) -{ - unsigned char port = to_net_dev(dev)->if_port; - char *cp = buf; - - cp += sprintf(cp, "%d", port); - if (port < ARRAY_SIZE(if_port_text)) - cp += sprintf(cp, " (%s)", if_port_text[port]); - *cp++ ='\n'; - return cp - buf; -} -static CLASS_DEVICE_ATTR(if_port, S_IRUGO, show_port, NULL); - static ssize_t format_addr(char *buf, const unsigned char *addr, int len) { int i; @@ -175,7 +151,6 @@ &class_device_attr_features, &class_device_attr_mtu, &class_device_attr_flags, - &class_device_attr_if_port, &class_device_attr_type, &class_device_attr_address, &class_device_attr_broadcast, diff -Nru a/net/netsyms.c b/net/netsyms.c --- a/net/netsyms.c Thu May 29 14:24:18 2003 +++ b/net/netsyms.c Thu May 29 14:24:18 2003 @@ -609,8 +609,6 @@ EXPORT_SYMBOL(dev_mc_upload); EXPORT_SYMBOL(__kill_fasync); -EXPORT_SYMBOL(if_port_text); - #ifdef CONFIG_HIPPI EXPORT_SYMBOL(hippi_type_trans); #endif From jgarzik@pobox.com Thu May 29 14:39:30 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:39:37 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TLdS2x004131 for ; Thu, 29 May 2003 14:39:29 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19LV7Q-0004GZ-13; Thu, 29 May 2003 22:39:28 +0100 Message-ID: <3ED67E01.6060906@pobox.com> Date: Thu, 29 May 2003 17:39:13 -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" , scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] remove if_port_text References: <20030529104138.751a1f54.shemminger@osdl.org> <20030529.140828.78714529.davem@redhat.com> <20030529142820.5f657d77.shemminger@osdl.org> In-Reply-To: <20030529142820.5f657d77.shemminger@osdl.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2760 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: > Eliminate necrophilic code, net-sysfs shouldn't support deprecated if_port. > Since nowhere else is using if_port_text, eliminate it. Looks good to me... David? Jeff From davem@redhat.com Thu May 29 14:50:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:50:12 -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.9) with SMTP id h4TLo72x004640 for ; Thu, 29 May 2003 14:50:08 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07944; Thu, 29 May 2003 14:48:54 -0700 Date: Thu, 29 May 2003 14:48:53 -0700 (PDT) Message-Id: <20030529.144853.88480047.davem@redhat.com> To: jgarzik@pobox.com Cc: shemminger@osdl.org, scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] remove if_port_text From: "David S. Miller" In-Reply-To: <3ED67E01.6060906@pobox.com> References: <20030529.140828.78714529.davem@redhat.com> <20030529142820.5f657d77.shemminger@osdl.org> <3ED67E01.6060906@pobox.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2761 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 From: Jeff Garzik Date: Thu, 29 May 2003 17:39:13 -0400 Stephen Hemminger wrote: > Eliminate necrophilic code, net-sysfs shouldn't support > deprecated if_port. Since nowhere else is using if_port_text, > eliminate it. Looks good to me... David? I'm fine with it. I'll apply to 2.5.x Jeff what do you think about 2.4.x? From niv@us.ibm.com Thu May 29 14:50:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:50:22 -0700 (PDT) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.130]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TLoB2x004639 for ; Thu, 29 May 2003 14:50:18 -0700 Received: from westrelay05.boulder.ibm.com (westrelay05.boulder.ibm.com [9.17.193.33]) by e32.co.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4TLo5kc285072; Thu, 29 May 2003 17:50:05 -0400 Received: from us.ibm.com (d03av03.boulder.ibm.com [9.17.193.83]) by westrelay05.boulder.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4TLnfqS073308; Thu, 29 May 2003 15:49:44 -0600 Message-ID: <3ED68090.5040903@us.ibm.com> Date: Thu, 29 May 2003 14:50:08 -0700 From: Nivedita Singhvi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Josefsson CC: "David S. Miller" , netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state References: <1052841090.13492.20.camel@tux.rsn.bth.se> <20030529.024114.78714066.davem@redhat.com> <1054217010.757.39.camel@tux.rsn.bth.se> <1054238230.709.1.camel@tux.rsn.bth.se> In-Reply-To: <1054238230.709.1.camel@tux.rsn.bth.se> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2762 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: niv@us.ibm.com Precedence: bulk X-list: netdev Martin Josefsson wrote: > I've just tested 2.5-bk and I can still reproduce it. > The wording of my mail might have been a bit wrong, I don't see complete > hangs, just ~2 minute stalls in ESTABLISHED state and then it continues > like nothing happened. > This actually addresses a situation of memory corruption and illegal reference panics, correct? And should potentially fix such issues or other seeming weirdnesses that might be happening in both sendmsg() and sendfile() code paths? Any other symptoms or particulars? I'm wondering if this addresses might explain some other bugs we have run into (not identified as TCP yet)? thanks, Nivedita From davem@redhat.com Thu May 29 14:54:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:54: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.9) with SMTP id h4TLrw2x005333 for ; Thu, 29 May 2003 14:54:00 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07970; Thu, 29 May 2003 14:52:47 -0700 Date: Thu, 29 May 2003 14:52:46 -0700 (PDT) Message-Id: <20030529.145246.23019115.davem@redhat.com> To: niv@us.ibm.com Cc: gandalf@wlug.westbo.se, netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state From: "David S. Miller" In-Reply-To: <3ED68090.5040903@us.ibm.com> References: <1054217010.757.39.camel@tux.rsn.bth.se> <1054238230.709.1.camel@tux.rsn.bth.se> <3ED68090.5040903@us.ibm.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2763 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 From: Nivedita Singhvi Date: Thu, 29 May 2003 14:50:08 -0700 Martin Josefsson wrote: > I've just tested 2.5-bk and I can still reproduce it. > The wording of my mail might have been a bit wrong, I don't see complete > hangs, just ~2 minute stalls in ESTABLISHED state and then it continues > like nothing happened. > This actually addresses a situation of memory corruption and illegal reference panics, correct? It prevents TCP input from "reading" bogus memory when comparing time_wait buckets to the saddr/sport/daddr/dport of an incoming packet. By bogus memory I mean it's some large offset from the base of the struct tcp_tw_bucket structure, past it's end. From davem@redhat.com Thu May 29 14:55:46 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:55:49 -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.9) with SMTP id h4TLth2x005673 for ; Thu, 29 May 2003 14:55:46 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA07990; Thu, 29 May 2003 14:54:33 -0700 Date: Thu, 29 May 2003 14:54:33 -0700 (PDT) Message-Id: <20030529.145433.35666641.davem@redhat.com> To: gandalf@wlug.westbo.se Cc: netdev@oss.sgi.com Subject: Re: Dump of TCP hang in established state From: "David S. Miller" In-Reply-To: <1054238230.709.1.camel@tux.rsn.bth.se> References: <20030529.024114.78714066.davem@redhat.com> <1054217010.757.39.camel@tux.rsn.bth.se> <1054238230.709.1.camel@tux.rsn.bth.se> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2764 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 From: Martin Josefsson Date: 29 May 2003 21:57:11 +0200 I've just tested 2.5-bk and I can still reproduce it. Can you get a tcpdump trace at the sender side for the complete life of the connection for which the hang occurs? There isn't much we can do about this without a trace. From davem@redhat.com Thu May 29 14:59:31 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 14:59:35 -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.9) with SMTP id h4TLxV2x006033 for ; Thu, 29 May 2003 14:59:31 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id OAA08026; Thu, 29 May 2003 14:58:21 -0700 Date: Thu, 29 May 2003 14:58:21 -0700 (PDT) Message-Id: <20030529.145821.38706415.davem@redhat.com> To: aj@dungeon.inka.de Cc: netdev@oss.sgi.com Subject: Re: 2.5.70 kernel BUG at net/xfrm/xfrm_policy.c:185! From: "David S. Miller" In-Reply-To: <1054236655.596.37.camel@simulacron> References: <1054236655.596.37.camel@simulacron> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2765 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 From: Andreas Jellinghaus Date: 29 May 2003 21:30:55 +0200 kernel: ------------[ cut here ]------------ kernel: kernel BUG at net/xfrm/xfrm_policy.c:185! kernel: invalid operand: 0000 [#2] You need to make sure you have Herbert's flow cache refcount fix applied. In general, try to run with the current -bk 2.5.x sources as we fix bugs on almost a daily basis. I personally consider 2.5.70 as released to be an ancient dinosaur already :-) # 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.1229.1.176 -> 1.1229.1.177 # net/core/flow.c 1.2 -> 1.3 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/05/27 herbert@gondor.apana.org.au 1.1229.1.177 # [NET]: Missing refcount bump in flow cache. # -------------------------------------------- # diff -Nru a/net/core/flow.c b/net/core/flow.c --- a/net/core/flow.c Thu May 29 14:57:31 2003 +++ b/net/core/flow.c Thu May 29 14:57:31 2003 @@ -199,6 +199,8 @@ fle->genid = atomic_read(&flow_cache_genid); fle->object = obj; fle->object_ref = obj_ref; + if (obj) + atomic_inc(fle->object_ref); flow_count(cpu)++; } From gandalf@wlug.westbo.se Thu May 29 15:00:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 15:00:47 -0700 (PDT) Received: from tux.rsn.bth.se (postfix@tux.rsn.bth.se [194.47.143.135]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TM0c2x006253 for ; Thu, 29 May 2003 15:00:39 -0700 Received: by tux.rsn.bth.se (Postfix, from userid 501) id 159D436FDD; Fri, 30 May 2003 00:00:35 +0200 (CEST) Subject: Re: Dump of TCP hang in established state From: Martin Josefsson To: "David S. Miller" Cc: netdev@oss.sgi.com In-Reply-To: <20030529.145433.35666641.davem@redhat.com> References: <20030529.024114.78714066.davem@redhat.com> <1054217010.757.39.camel@tux.rsn.bth.se> <1054238230.709.1.camel@tux.rsn.bth.se> <20030529.145433.35666641.davem@redhat.com> Content-Type: multipart/mixed; boundary="=-qYql9ciHiNamFIMcnWJ9" Organization: Message-Id: <1054245634.711.57.camel@tux.rsn.bth.se> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 30 May 2003 00:00:34 +0200 X-archive-position: 2766 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: gandalf@wlug.westbo.se Precedence: bulk X-list: netdev --=-qYql9ciHiNamFIMcnWJ9 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2003-05-29 at 23:54, David S. Miller wrote: > From: Martin Josefsson > Date: 29 May 2003 21:57:11 +0200 > > I've just tested 2.5-bk and I can still reproduce it. > > Can you get a tcpdump trace at the sender side for the complete life > of the connection for which the hang occurs? > > There isn't much we can do about this without a trace. I've already sent the trace twice to netdev, I've attached it again. I can reproduce it quite easily, both with TCP_CORK and without. -- /Martin --=-qYql9ciHiNamFIMcnWJ9 Content-Disposition: attachment; filename=stall-57798-anon Content-Type: text/plain; name=stall-57798-anon; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable 16:02:08.643827 x.x.x.x.57798 > y.y.y.y.3632: S 1626991454:1626991454(0) wi= n 5840 (DF) 16:02:08.647286 y.y.y.y.3632 > x.x.x.x.57798: S 77827266:77827266(0) ack 16= 26991455 win 5696 (DF) 16:02:08.647330 x.x.x.x.57798 > y.y.y.y.3632: . ack 1 win 730 (DF) 16:02:08.906471 x.x.x.x.57798 > y.y.y.y.3632: . 1:1425(1424) ack 1 win 730 = (DF) 16:02:08.906495 x.x.x.x.57798 > y.y.y.y.3632: . 1425:2849(1424) ack 1 win 7= 30 (DF) 16:02:08.906517 x.x.x.x.57798 > y.y.y.y.3632: P 2849:4273(1424) ack 1 win 7= 30 (DF) 16:02:08.910667 y.y.y.y.3632 > x.x.x.x.57798: . ack 1425 win 8544 (DF) 16:02:08.910672 y.y.y.y.3632 > x.x.x.x.57798: . ack 2849 win 11392 (DF) 16:02:08.911239 y.y.y.y.3632 > x.x.x.x.57798: . ack 4273 win 14240 (DF) 16:02:09.060689 x.x.x.x.57798 > y.y.y.y.3632: . 4273:5697(1424) ack 1 win 7= 30 (DF) 16:02:09.060714 x.x.x.x.57798 > y.y.y.y.3632: . 5697:7121(1424) ack 1 win 7= 30 (DF) 16:02:09.060738 x.x.x.x.57798 > y.y.y.y.3632: P 7121:8545(1424) ack 1 win 7= 30 (DF) 16:02:09.060754 x.x.x.x.57798 > y.y.y.y.3632: . 8545:9969(1424) ack 1 win 7= 30 (DF) 16:02:09.060772 x.x.x.x.57798 > y.y.y.y.3632: . 9969:11393(1424) ack 1 win = 730 (DF) 16:02:09.060785 x.x.x.x.57798 > y.y.y.y.3632: . 11393:12817(1424) ack 1 win= 730 (DF) 16:02:09.064187 y.y.y.y.3632 > x.x.x.x.57798: . ack 7121 win 19936 (DF) 16:02:09.064192 y.y.y.y.3632 > x.x.x.x.57798: . ack 5697 win 17088 (DF) 16:02:09.064194 y.y.y.y.3632 > x.x.x.x.57798: . ack 8545 win 22784 (DF) 16:02:09.064451 y.y.y.y.3632 > x.x.x.x.57798: . ack 9969 win 25632 (DF) 16:02:09.064454 y.y.y.y.3632 > x.x.x.x.57798: . ack 11393 win 28480 (DF) 16:02:09.064456 y.y.y.y.3632 > x.x.x.x.57798: . ack 12817 win 31328 (DF) 16:02:09.170403 x.x.x.x.57798 > y.y.y.y.3632: . 12817:14241(1424) ack 1 win= 730 (DF) 16:02:09.170418 x.x.x.x.57798 > y.y.y.y.3632: P 14241:15665(1424) ack 1 win= 730 (DF) 16:02:09.170430 x.x.x.x.57798 > y.y.y.y.3632: . 15665:17089(1424) ack 1 win= 730 (DF) 16:02:09.170451 x.x.x.x.57798 > y.y.y.y.3632: . 17089:18513(1424) ack 1 win= 730 (DF) 16:02:09.170464 x.x.x.x.57798 > y.y.y.y.3632: P 18513:19937(1424) ack 1 win= 730 (DF) 16:02:09.170482 x.x.x.x.57798 > y.y.y.y.3632: . 19937:21361(1424) ack 1 win= 730 (DF) 16:02:09.170496 x.x.x.x.57798 > y.y.y.y.3632: . 21361:22785(1424) ack 1 win= 730 (DF) 16:02:09.170513 x.x.x.x.57798 > y.y.y.y.3632: P 22785:24209(1424) ack 1 win= 730 (DF) 16:02:09.170528 x.x.x.x.57798 > y.y.y.y.3632: . 24209:25633(1424) ack 1 win= 730 (DF) 16:02:09.170546 x.x.x.x.57798 > y.y.y.y.3632: . 25633:27057(1424) ack 1 win= 730 (DF) 16:02:09.170560 x.x.x.x.57798 > y.y.y.y.3632: P 27057:28481(1424) ack 1 win= 730 (DF) 16:02:09.174188 y.y.y.y.3632 > x.x.x.x.57798: . ack 14241 win 34176 (DF) 16:02:09.174529 y.y.y.y.3632 > x.x.x.x.57798: . ack 15665 win 37024 (DF) 16:02:09.174533 y.y.y.y.3632 > x.x.x.x.57798: . ack 17089 win 39872 (DF) 16:02:09.174535 y.y.y.y.3632 > x.x.x.x.57798: . ack 18513 win 42720 (DF) 16:02:09.175157 y.y.y.y.3632 > x.x.x.x.57798: . ack 19937 win 45568 (DF) 16:02:09.175160 y.y.y.y.3632 > x.x.x.x.57798: . ack 21361 win 48416 (DF) 16:02:09.175178 y.y.y.y.3632 > x.x.x.x.57798: . ack 22785 win 51264 (DF) 16:02:09.175383 y.y.y.y.3632 > x.x.x.x.57798: . ack 24209 win 54112 (DF) 16:02:09.175422 y.y.y.y.3632 > x.x.x.x.57798: . ack 25633 win 56960 (DF) 16:02:09.175696 y.y.y.y.3632 > x.x.x.x.57798: . ack 27057 win 59808 (DF) 16:02:09.175731 y.y.y.y.3632 > x.x.x.x.57798: . ack 28481 win 62656 (DF) 16:02:09.178274 x.x.x.x.57798 > y.y.y.y.3632: . 28481:29905(1424) ack 1 win= 730 (DF) 16:02:09.178302 x.x.x.x.57798 > y.y.y.y.3632: . 29905:31329(1424) ack 1 win= 730 (DF) 16:02:09.178326 x.x.x.x.57798 > y.y.y.y.3632: P 31329:32753(1424) ack 1 win= 730 (DF) 16:02:09.178374 x.x.x.x.57798 > y.y.y.y.3632: . 32753:34177(1424) ack 1 win= 730 (DF) 16:02:09.178395 x.x.x.x.57798 > y.y.y.y.3632: . 34177:35601(1424) ack 1 win= 730 (DF) 16:02:09.178415 x.x.x.x.57798 > y.y.y.y.3632: P 35601:37025(1424) ack 1 win= 730 (DF) 16:02:09.178435 x.x.x.x.57798 > y.y.y.y.3632: . 37025:38449(1424) ack 1 win= 730 (DF) 16:02:09.178453 x.x.x.x.57798 > y.y.y.y.3632: . 38449:39873(1424) ack 1 win= 730 (DF) 16:02:09.178472 x.x.x.x.57798 > y.y.y.y.3632: P 39873:41297(1424) ack 1 win= 730 (DF) 16:02:09.178490 x.x.x.x.57798 > y.y.y.y.3632: . 41297:42721(1424) ack 1 win= 730 (DF) 16:02:09.178509 x.x.x.x.57798 > y.y.y.y.3632: . 42721:44145(1424) ack 1 win= 730 (DF) 16:02:09.178528 x.x.x.x.57798 > y.y.y.y.3632: . 44145:45569(1424) ack 1 win= 730 (DF) 16:02:09.181333 y.y.y.y.3632 > x.x.x.x.57798: . ack 29905 win 64080 (DF) 16:02:09.182086 y.y.y.y.3632 > x.x.x.x.57798: . ack 31329 win 64080 (DF) 16:02:09.182139 y.y.y.y.3632 > x.x.x.x.57798: . ack 32753 win 64080 (DF) 16:02:09.182151 y.y.y.y.3632 > x.x.x.x.57798: . ack 35601 win 64080 (DF) 16:02:09.182583 y.y.y.y.3632 > x.x.x.x.57798: . ack 38449 win 64080 (DF) 16:02:09.182587 y.y.y.y.3632 > x.x.x.x.57798: . ack 41297 win 64080 (DF) 16:02:09.183271 y.y.y.y.3632 > x.x.x.x.57798: . ack 44145 win 64080 (DF) 16:02:09.215723 y.y.y.y.3632 > x.x.x.x.57798: . ack 45569 win 64080 (DF) 16:02:09.330622 x.x.x.x.57798 > y.y.y.y.3632: . 45569:46993(1424) ack 1 win= 730 (DF) 16:02:09.330645 x.x.x.x.57798 > y.y.y.y.3632: P 46993:48417(1424) ack 1 win= 730 (DF) 16:02:09.330664 x.x.x.x.57798 > y.y.y.y.3632: . 48417:49841(1424) ack 1 win= 730 (DF) 16:02:09.330678 x.x.x.x.57798 > y.y.y.y.3632: . 49841:51265(1424) ack 1 win= 730 (DF) 16:02:09.330696 x.x.x.x.57798 > y.y.y.y.3632: P 51265:52689(1424) ack 1 win= 730 (DF) 16:02:09.330709 x.x.x.x.57798 > y.y.y.y.3632: . 52689:54113(1424) ack 1 win= 730 (DF) 16:02:09.330727 x.x.x.x.57798 > y.y.y.y.3632: . 54113:55537(1424) ack 1 win= 730 (DF) 16:02:09.330740 x.x.x.x.57798 > y.y.y.y.3632: P 55537:56961(1424) ack 1 win= 730 (DF) 16:02:09.330760 x.x.x.x.57798 > y.y.y.y.3632: . 56961:58385(1424) ack 1 win= 730 (DF) 16:02:09.330775 x.x.x.x.57798 > y.y.y.y.3632: . 58385:59809(1424) ack 1 win= 730 (DF) 16:02:09.330794 x.x.x.x.57798 > y.y.y.y.3632: P 59809:61233(1424) ack 1 win= 730 (DF) 16:02:09.330806 x.x.x.x.57798 > y.y.y.y.3632: . 61233:62657(1424) ack 1 win= 730 (DF) 16:02:09.330823 x.x.x.x.57798 > y.y.y.y.3632: . 62657:64081(1424) ack 1 win= 730 (DF) 16:02:09.333999 y.y.y.y.3632 > x.x.x.x.57798: . ack 48417 win 64080 (DF) 16:02:09.334363 y.y.y.y.3632 > x.x.x.x.57798: . ack 51265 win 64080 (DF) 16:02:09.334622 y.y.y.y.3632 > x.x.x.x.57798: . ack 54113 win 64080 (DF) 16:02:09.335094 y.y.y.y.3632 > x.x.x.x.57798: . ack 56961 win 64080 (DF) 16:02:09.335356 y.y.y.y.3632 > x.x.x.x.57798: . ack 59809 win 64080 (DF) 16:02:09.335839 y.y.y.y.3632 > x.x.x.x.57798: . ack 62657 win 64080 (DF) 16:02:09.375666 y.y.y.y.3632 > x.x.x.x.57798: . ack 64081 win 64080 (DF) 16:02:09.438879 x.x.x.x.57798 > y.y.y.y.3632: P 64081:65505(1424) ack 1 win= 730 (DF) 16:02:09.438892 x.x.x.x.57798 > y.y.y.y.3632: . 65505:66929(1424) ack 1 win= 730 (DF) 16:02:09.438911 x.x.x.x.57798 > y.y.y.y.3632: . 66929:68353(1424) ack 1 win= 730 (DF) 16:02:09.438924 x.x.x.x.57798 > y.y.y.y.3632: P 68353:69777(1424) ack 1 win= 730 (DF) 16:02:09.438943 x.x.x.x.57798 > y.y.y.y.3632: . 69777:71201(1424) ack 1 win= 730 (DF) 16:02:09.438958 x.x.x.x.57798 > y.y.y.y.3632: . 71201:72625(1424) ack 1 win= 730 (DF) 16:02:09.438976 x.x.x.x.57798 > y.y.y.y.3632: P 72625:74049(1424) ack 1 win= 730 (DF) 16:02:09.438989 x.x.x.x.57798 > y.y.y.y.3632: . 74049:75473(1424) ack 1 win= 730 (DF) 16:02:09.439008 x.x.x.x.57798 > y.y.y.y.3632: . 75473:76897(1424) ack 1 win= 730 (DF) 16:02:09.439022 x.x.x.x.57798 > y.y.y.y.3632: . 76897:78321(1424) ack 1 win= 730 (DF) 16:02:09.439041 x.x.x.x.57798 > y.y.y.y.3632: . 78321:79745(1424) ack 1 win= 730 (DF) 16:02:09.439054 x.x.x.x.57798 > y.y.y.y.3632: P 79745:81169(1424) ack 1 win= 730 (DF) 16:02:09.439071 x.x.x.x.57798 > y.y.y.y.3632: . 81169:82593(1424) ack 1 win= 730 (DF) 16:02:09.443513 y.y.y.y.3632 > x.x.x.x.57798: . ack 66929 win 64080 (DF) 16:02:09.443823 y.y.y.y.3632 > x.x.x.x.57798: . ack 69777 win 64080 (DF) 16:02:09.444319 y.y.y.y.3632 > x.x.x.x.57798: . ack 72625 win 64080 (DF) 16:02:09.444680 y.y.y.y.3632 > x.x.x.x.57798: . ack 75473 win 64080 (DF) 16:02:09.444770 y.y.y.y.3632 > x.x.x.x.57798: . ack 78321 win 64080 (DF) 16:02:09.444899 y.y.y.y.3632 > x.x.x.x.57798: . ack 81169 win 64080 (DF) 16:02:09.445460 x.x.x.x.57798 > y.y.y.y.3632: . 82593:84017(1424) ack 1 win= 730 (DF) 16:02:09.445481 x.x.x.x.57798 > y.y.y.y.3632: P 84017:85441(1424) ack 1 win= 730 (DF) 16:02:09.445501 x.x.x.x.57798 > y.y.y.y.3632: . 85441:86865(1424) ack 1 win= 730 (DF) 16:02:09.445514 x.x.x.x.57798 > y.y.y.y.3632: . 86865:88289(1424) ack 1 win= 730 (DF) 16:02:09.445531 x.x.x.x.57798 > y.y.y.y.3632: P 88289:89713(1424) ack 1 win= 730 (DF) 16:02:09.445583 x.x.x.x.57798 > y.y.y.y.3632: . 89713:91137(1424) ack 1 win= 730 (DF) 16:02:09.445597 x.x.x.x.57798 > y.y.y.y.3632: . 91137:92561(1424) ack 1 win= 730 (DF) 16:02:09.445616 x.x.x.x.57798 > y.y.y.y.3632: P 92561:93985(1424) ack 1 win= 730 (DF) 16:02:09.445629 x.x.x.x.57798 > y.y.y.y.3632: . 93985:95409(1424) ack 1 win= 730 (DF) 16:02:09.445650 x.x.x.x.57798 > y.y.y.y.3632: . 95409:96833(1424) ack 1 win= 730 (DF) 16:02:09.445665 x.x.x.x.57798 > y.y.y.y.3632: P 96833:98257(1424) ack 1 win= 730 (DF) 16:02:09.445683 x.x.x.x.57798 > y.y.y.y.3632: . 98257:99681(1424) ack 1 win= 730 (DF) 16:02:09.445695 x.x.x.x.57798 > y.y.y.y.3632: . 99681:101105(1424) ack 1 wi= n 730 (DF) 16:02:09.451822 y.y.y.y.3632 > x.x.x.x.57798: . ack 84017 win 64080 (DF) 16:02:09.452573 y.y.y.y.3632 > x.x.x.x.57798: . ack 86865 win 64080 (DF) 16:02:09.452740 y.y.y.y.3632 > x.x.x.x.57798: . ack 89713 win 64080 (DF) 16:02:09.452989 y.y.y.y.3632 > x.x.x.x.57798: . ack 92561 win 64080 (DF) 16:02:09.453352 y.y.y.y.3632 > x.x.x.x.57798: . ack 95409 win 64080 (DF) 16:02:09.454195 y.y.y.y.3632 > x.x.x.x.57798: . ack 98257 win 64080 (DF) 16:02:09.454400 y.y.y.y.3632 > x.x.x.x.57798: . ack 101105 win 64080 (DF) 16:02:09.597688 x.x.x.x.57798 > y.y.y.y.3632: P 101105:102529(1424) ack 1 w= in 730 (DF) 16:02:09.597702 x.x.x.x.57798 > y.y.y.y.3632: . 102529:103953(1424) ack 1 w= in 730 (DF) 16:02:09.597721 x.x.x.x.57798 > y.y.y.y.3632: . 103953:105377(1424) ack 1 w= in 730 (DF) 16:02:09.597734 x.x.x.x.57798 > y.y.y.y.3632: P 105377:106801(1424) ack 1 w= in 730 (DF) 16:02:09.597755 x.x.x.x.57798 > y.y.y.y.3632: . 106801:108225(1424) ack 1 w= in 730 (DF) 16:02:09.597768 x.x.x.x.57798 > y.y.y.y.3632: . 108225:109649(1424) ack 1 w= in 730 (DF) 16:02:09.597787 x.x.x.x.57798 > y.y.y.y.3632: . 109649:111073(1424) ack 1 w= in 730 (DF) 16:02:09.597800 x.x.x.x.57798 > y.y.y.y.3632: . 111073:112497(1424) ack 1 w= in 730 (DF) 16:02:09.597818 x.x.x.x.57798 > y.y.y.y.3632: P 112497:113921(1424) ack 1 w= in 730 (DF) 16:02:09.597832 x.x.x.x.57798 > y.y.y.y.3632: . 113921:115345(1424) ack 1 w= in 730 (DF) 16:02:09.597849 x.x.x.x.57798 > y.y.y.y.3632: . 115345:116769(1424) ack 1 w= in 730 (DF) 16:02:09.597862 x.x.x.x.57798 > y.y.y.y.3632: P 116769:118193(1424) ack 1 w= in 730 (DF) 16:02:09.597903 x.x.x.x.57798 > y.y.y.y.3632: . 118193:119617(1424) ack 1 w= in 730 (DF) 16:02:09.597915 x.x.x.x.57798 > y.y.y.y.3632: . 119617:121041(1424) ack 1 w= in 730 (DF) 16:02:09.610011 y.y.y.y.3632 > x.x.x.x.57798: . ack 103953 win 64080 (DF) 16:02:09.610486 y.y.y.y.3632 > x.x.x.x.57798: . ack 106801 win 64080 (DF) 16:02:09.610899 y.y.y.y.3632 > x.x.x.x.57798: . ack 109649 win 64080 (DF) 16:02:09.611921 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF= ) 16:02:09.611944 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF= ) 16:02:09.611963 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF= ) 16:02:09.611996 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF= ) 16:02:09.703860 x.x.x.x.57798 > y.y.y.y.3632: P 121041:122465(1424) ack 1 w= in 730 (DF) 16:02:09.703873 x.x.x.x.57798 > y.y.y.y.3632: . 122465:123889(1424) ack 1 w= in 730 (DF) 16:02:09.703892 x.x.x.x.57798 > y.y.y.y.3632: . 123889:125313(1424) ack 1 w= in 730 (DF) 16:02:09.703908 x.x.x.x.57798 > y.y.y.y.3632: P 125313:126737(1424) ack 1 w= in 730 (DF) 16:02:09.703926 x.x.x.x.57798 > y.y.y.y.3632: . 126737:128161(1424) ack 1 w= in 730 (DF) 16:02:09.703939 x.x.x.x.57798 > y.y.y.y.3632: . 128161:129585(1424) ack 1 w= in 730 (DF) 16:02:09.705559 x.x.x.x.57798 > y.y.y.y.3632: P 129585:131009(1424) ack 1 w= in 730 (DF) 16:02:09.705565 x.x.x.x.57798 > y.y.y.y.3632: . 131009:132433(1424) ack 1 w= in 730 (DF) 16:02:09.705570 x.x.x.x.57798 > y.y.y.y.3632: . 132433:133857(1424) ack 1 w= in 730 (DF) 16:02:09.705574 x.x.x.x.57798 > y.y.y.y.3632: P 133857:135281(1424) ack 1 w= in 730 (DF) 16:02:09.705578 x.x.x.x.57798 > y.y.y.y.3632: . 135281:136705(1424) ack 1 w= in 730 (DF) 16:02:09.714200 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.714499 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.714698 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.714772 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715358 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715361 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715550 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715552 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715672 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715675 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.715677 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.808712 x.x.x.x.57798 > y.y.y.y.3632: . 136705:138129(1424) ack 1 w= in 730 (DF) 16:02:09.808735 x.x.x.x.57798 > y.y.y.y.3632: P 138129:139548(1419) ack 1 w= in 730 (DF) 16:02:09.808784 x.x.x.x.57798 > y.y.y.y.3632: . 111073:112497(1424) ack 1 w= in 730 (DF) 16:02:09.808813 x.x.x.x.57798 > y.y.y.y.3632: P 112497:113921(1424) ack 1 w= in 730 (DF) 16:02:09.808838 x.x.x.x.57798 > y.y.y.y.3632: . 119617:121041(1424) ack 1 w= in 730 (DF) 16:02:09.822496 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:02:09.822498 y.y.y.y.3632 > x.x.x.x.57798: . ack 111073 win 64080 (DF) 16:04:24.936079 x.x.x.x.57798 > y.y.y.y.3632: . 111073:112497(1424) ack 1 w= in 730 (DF) 16:04:24.938582 y.y.y.y.3632 > x.x.x.x.57798: . ack 112497 win 62656 (DF) 16:04:24.939909 x.x.x.x.57798 > y.y.y.y.3632: P 112497:113921(1424) ack 1 w= in 730 (DF) 16:04:24.939937 x.x.x.x.57798 > y.y.y.y.3632: . 119617:121041(1424) ack 1 w= in 730 (DF) 16:04:24.942568 y.y.y.y.3632 > x.x.x.x.57798: . ack 119617 win 55536 (DF= ) 16:04:24.942573 y.y.y.y.3632 > x.x.x.x.57798: . ack 139548 win 46992 (DF) 16:04:25.038755 y.y.y.y.3632 > x.x.x.x.57798: P 1:1166(1165) ack 139548 win= 64080 (DF) 16:04:25.038765 y.y.y.y.3632 > x.x.x.x.57798: F 1166:1166(0) ack 139548 win= 64080 (DF) 16:04:25.038893 x.x.x.x.57798 > y.y.y.y.3632: . ack 1166 win 1019 (DF) 16:04:25.039286 x.x.x.x.57798 > y.y.y.y.3632: F 139548:139548(0) ack 1167 w= in 1019 (DF) 16:04:25.041470 y.y.y.y.3632 > x.x.x.x.57798: . ack 139549 win 64080 (DF) --=-qYql9ciHiNamFIMcnWJ9-- From scott.feldman@intel.com Thu May 29 15:45:58 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 15:46:02 -0700 (PDT) Received: from caduceus.jf.intel.com (fmr06.intel.com [134.134.136.7]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TMjw2x007117 for ; Thu, 29 May 2003 15:45:58 -0700 Received: from petasus.jf.intel.com (petasus.jf.intel.com [10.7.209.6]) by caduceus.jf.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.66 2003/05/22 21:17:36 rfjohns1 Exp $) with ESMTP id h4TMefA03990 for ; Thu, 29 May 2003 22:40:41 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) by petasus.jf.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 h4TMfSD12316 for ; Thu, 29 May 2003 22:41:28 GMT Received: from orsmsx331.amr.corp.intel.com ([192.168.65.56]) by orsmsxvs040.jf.intel.com (NAVGW 2.5.2.11) with SMTP id M2003052915560217998 ; Thu, 29 May 2003 15:56:02 -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); Thu, 29 May 2003 15:45:51 -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: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice Date: Thu, 29 May 2003 15:45:51 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice Thread-Index: AcMmI28YpSkd6QKvQVKEmt27NV0iYgAECFBQ From: "Feldman, Scott" To: "Jeff Garzik" , "Stephen Hemminger" Cc: "David S. Miller" , X-OriginalArrivalTime: 29 May 2003 22:45:51.0787 (UTC) FILETIME=[0E608FB0:01C32634] Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h4TMjw2x007117 X-archive-position: 2767 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 > Agreed. I consider this a rather serious bug, that could > cause crashes in multiple corner cases; sysfs being only > one of those cases. > > I'm going to go ahead and apply this to 2.5. > > Stephen, could I get you to send me a similar patch for 2.4? > (it doesn't apply cleanly) It's very much a bug in 2.4 also. 2.4 e100 should be fine, as this breakage was just introduced in last patchset for 2.5 (only). Thanks Stephen. -scott From jgarzik@pobox.com Thu May 29 15:53:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 15:53:51 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TMri2x007522 for ; Thu, 29 May 2003 15:53:45 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19LVZ8-0004Xy-1I; Thu, 29 May 2003 23:08:06 +0100 Message-ID: <3ED684BA.4070001@pobox.com> Date: Thu, 29 May 2003 18:07:54 -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: shemminger@osdl.org, scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] remove if_port_text References: <20030529.140828.78714529.davem@redhat.com> <20030529142820.5f657d77.shemminger@osdl.org> <3ED67E01.6060906@pobox.com> <20030529.144853.88480047.davem@redhat.com> In-Reply-To: <20030529.144853.88480047.davem@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2768 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 David S. Miller wrote: > From: Jeff Garzik > Date: Thu, 29 May 2003 17:39:13 -0400 > > Stephen Hemminger wrote: > > Eliminate necrophilic code, net-sysfs shouldn't support > > deprecated if_port. Since nowhere else is using if_port_text, > > eliminate it. > > Looks good to me... David? > > I'm fine with it. I'll apply to 2.5.x > > Jeff what do you think about 2.4.x? I'd rather not... that's an ABI-visible thing. Jeff From scott.feldman@intel.com Thu May 29 16:38:33 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 16:38:39 -0700 (PDT) Received: from hermes.fm.intel.com (fmr01.intel.com [192.55.52.18]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TNcW2x008954 for ; Thu, 29 May 2003 16:38:33 -0700 Received: from talaria.fm.intel.com (talaria.fm.intel.com [10.1.192.39]) by hermes.fm.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.66 2003/05/22 21:17:36 rfjohns1 Exp $) with ESMTP id h4TNY7J23896 for ; Thu, 29 May 2003 23:34:07 GMT Received: from fmsmsxv040-1.fm.intel.com (fmsmsxvs040.fm.intel.com [132.233.42.124]) by talaria.fm.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 h4TNdFi27977 for ; Thu, 29 May 2003 23:39:15 GMT Received: from [134.134.3.229] ([134.134.3.229]) by fmsmsxv040-1.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003052916381728885 ; Thu, 29 May 2003 16:38:17 -0700 Date: Thu, 29 May 2003 16:48:51 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: Stephen Hemminger , "David S. Miller" , Subject: Re: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice In-Reply-To: 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 h4TNcW2x008954 X-archive-position: 2769 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: scott.feldman@intel.com Precedence: bulk X-list: netdev On Thu, 29 May 2003, Jeff Garzik wrote: > > Stephen Hemminger wrote: [cut] > > This patch moves the initialization earlier before registration.  It > > probably closes other races as well, where some program could access > > the e100 driver before the pointers were setup. > > > Agreed.  I consider this a rather serious bug, that could cause crashes > in multiple corner cases; sysfs being only one of those cases. > > I'm going to go ahead and apply this to 2.5. > > Stephen, could I get you to send me a similar patch for 2.4? > (it doesn't apply cleanly)  It's very much a bug in 2.4 also. > >         Jeff Wait! More work is required, otherwise VLANs, checksum offloading and SG support are broken. Here's a patch that applies on top of Stephen's to address this. USE_IPCB needs to be defined before filling out netdev->features. Again, not an issue for 2.4 e100 driver. -scott --- linux-2.5.70/drivers/net/e100/e100_main.c.orig 2003-05-29 16:40:00.000000000 -0700 +++ linux-2.5.70/drivers/net/e100/e100_main.c 2003-05-29 16:40:27.000000000 -0700 @@ -614,26 +614,6 @@ goto err_dealloc; } - dev->vlan_rx_register = e100_vlan_rx_register; - dev->vlan_rx_add_vid = e100_vlan_rx_add_vid; - dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid; - dev->irq = pcid->irq; - dev->open = &e100_open; - dev->hard_start_xmit = &e100_xmit_frame; - dev->stop = &e100_close; - dev->change_mtu = &e100_change_mtu; - dev->get_stats = &e100_get_stats; - dev->set_multicast_list = &e100_set_multi; - dev->set_mac_address = &e100_set_mac; - dev->do_ioctl = &e100_ioctl; - if (bdp->flags & USE_IPCB) - dev->features = NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - - if ((rc = register_netdev(dev)) != 0) { - goto err_pci; - } - if (((bdp->pdev->device > 0x1030) && (bdp->pdev->device < 0x103F)) || ((bdp->pdev->device >= 0x1050) @@ -657,6 +637,27 @@ } else { bdp->rfd_size = 16; } + + dev->vlan_rx_register = e100_vlan_rx_register; + dev->vlan_rx_add_vid = e100_vlan_rx_add_vid; + dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid; + dev->irq = pcid->irq; + dev->open = &e100_open; + dev->hard_start_xmit = &e100_xmit_frame; + dev->stop = &e100_close; + dev->change_mtu = &e100_change_mtu; + dev->get_stats = &e100_get_stats; + dev->set_multicast_list = &e100_set_multi; + dev->set_mac_address = &e100_set_mac; + dev->do_ioctl = &e100_ioctl; + if (bdp->flags & USE_IPCB) + dev->features = NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; + + if ((rc = register_netdev(dev)) != 0) { + goto err_pci; + } + e100_check_options(e100nics, bdp); if (!e100_init(bdp)) { From aj@dungeon.inka.de Thu May 29 16:38:38 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 16:38:42 -0700 (PDT) Received: from mail.inka.de (mail@quechua.inka.de [193.197.184.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4TNcY2x008959 for ; Thu, 29 May 2003 16:38:38 -0700 Received: from dungeon.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 19LWyf-0007B1-00; Fri, 30 May 2003 01:38:33 +0200 Received: from [192.168.1.12] (unknown [192.168.1.12]) by dungeon.inka.de (Postfix) with ESMTP id 72A6720FBC; Fri, 30 May 2003 01:38:30 +0200 (CEST) Subject: Re: ipsec 2.5.70 trouble From: Andreas Jellinghaus To: "David S. Miller" Cc: netdev@oss.sgi.com In-Reply-To: <20030529.141410.85405194.davem@redhat.com> References: <1054235155.596.9.camel@simulacron> <20030529.141410.85405194.davem@redhat.com> Content-Type: text/plain Organization: Message-Id: <1054251582.2598.57.camel@simulacron> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 30 May 2003 01:39:43 +0200 Content-Transfer-Encoding: 7bit X-archive-position: 2770 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: aj@dungeon.inka.de Precedence: bulk X-list: netdev On Thu, 2003-05-29 at 23:14, David S. Miller wrote: > After we do the transformation, we stick it back into > the nework stack input to prevent stack exhaustion. > > And yes it is on purpose and not changing. ok. I can't "GET http://www.microsoft.com/" (and lots of other websites). The setup is laptop -> wlan+ipsec (esp, tunnel mode) -> firewall+nat -> pppoe -> internet. 01:34:25.500786 212.202.202.151.33369 > 207.46.249.190.80: S 750265125:750265125 (0) win 5840 (DF) 01:34:25.661897 207.46.249.190.80 > 212.202.202.151.33369: S 2015313287:2015313287(0) ack 750265126 win 16384 01:34:25.665581 212.202.202.151.33369 > 207.46.249.190.80: . ack 1 win 5840 (DF) 01:34:25.676682 212.202.202.151.33369 > 207.46.249.190.80: P 1:93(92) ack 1 win 5840 (DF) 01:34:26.513105 212.202.202.151.33369 > 207.46.249.190.80: P 1:93(92) ack 1 win 5840 (DF) 01:34:26.673758 207.46.249.190.80 > 212.202.202.151.33369: . ack 93 win 65443 (DF) 01:34:28.437372 212.202.202.151.33369 > 207.46.249.190.80: F 93:93(0) ack 1 win 5840 (DF) 01:34:28.597316 207.46.249.190.80 > 212.202.202.151.33369: . ack 94 win 65443 (DF) Can I do anything about this? Thanks, Andreas From davem@redhat.com Thu May 29 16:48:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 16:48: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.9) with SMTP id h4TNmX2x010042 for ; Thu, 29 May 2003 16:48:34 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id QAA08309; Thu, 29 May 2003 16:47:23 -0700 Date: Thu, 29 May 2003 16:47:22 -0700 (PDT) Message-Id: <20030529.164722.116357594.davem@redhat.com> To: aj@dungeon.inka.de Cc: netdev@oss.sgi.com Subject: Re: ipsec 2.5.70 trouble From: "David S. Miller" In-Reply-To: <1054251582.2598.57.camel@simulacron> References: <1054235155.596.9.camel@simulacron> <20030529.141410.85405194.davem@redhat.com> <1054251582.2598.57.camel@simulacron> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2771 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 From: Andreas Jellinghaus Date: 30 May 2003 01:39:43 +0200 Can I do anything about this? The connection looks fine, 212.202.202.151 simply isn't sending any data back. Maybe dropped PMTU messages, can you get a trace from the other end of the IPSEC tunnel? From jgarzik@pobox.com Thu May 29 17:09:24 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 17:09:28 -0700 (PDT) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4U09L2x010816 for ; Thu, 29 May 2003 17:09:24 -0700 Received: from rdu26-227-011.nc.rr.com ([66.26.227.11] helo=pobox.com) by www.linux.org.uk with esmtp (Exim 4.14) id 19LXSS-0005Y7-71; Fri, 30 May 2003 01:09:20 +0100 Message-ID: <3ED6A124.1060704@pobox.com> Date: Thu, 29 May 2003 20:09:08 -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: "Feldman, Scott" CC: Stephen Hemminger , "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2772 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 Your patch doesn't apply at all, even with 'patch -l'. I backed out Stephen's patch, and will be looking for a fix from you ;-) Jeff From davem@redhat.com Thu May 29 20:03:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 20:04: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.9) with SMTP id h4U33t2x014198 for ; Thu, 29 May 2003 20:03:55 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA08944; Thu, 29 May 2003 20:02:41 -0700 Date: Thu, 29 May 2003 20:02:41 -0700 (PDT) Message-Id: <20030529.200241.108806909.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH] change delete bridge to work with new unregister From: "David S. Miller" In-Reply-To: <20030529102407.3d3cfefd.shemminger@osdl.org> References: <20030529102407.3d3cfefd.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2773 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 From: Stephen Hemminger Date: Thu, 29 May 2003 10:24:07 -0700 The changes in 2.5.70 for unregister cause deleteing a bridge device to hang, because the last reference to the bridge was being dropped after calling unregister_netdev. Doing the unregister under lock, instead of by holding a reference fixes that. Applied, thanks. From davem@redhat.com Thu May 29 20:06:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 20:06: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.9) with SMTP id h4U36P2x014516 for ; Thu, 29 May 2003 20:06:26 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA08957; Thu, 29 May 2003 20:05:14 -0700 Date: Thu, 29 May 2003 20:05:14 -0700 (PDT) Message-Id: <20030529.200514.55840993.davem@redhat.com> To: shemminger@osdl.org Cc: netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] sysfs cleanup and bugfix From: "David S. Miller" In-Reply-To: <20030529103011.3f038db7.shemminger@osdl.org> References: <20030529103011.3f038db7.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2774 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 From: Stephen Hemminger Date: Thu, 29 May 2003 10:30:11 -0700 A couple of bugs in netdev_unregister_sysfs; still working on the harder refcount issues. Applied. Stephen, I'll hack on the unregister issues with Al Viro. I think his scheme is the way to go. From davem@redhat.com Thu May 29 20:16:39 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 20:16: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.9) with SMTP id h4U3Gc2x015025 for ; Thu, 29 May 2003 20:16:39 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id UAA08982; Thu, 29 May 2003 20:15:23 -0700 Date: Thu, 29 May 2003 20:15:23 -0700 (PDT) Message-Id: <20030529.201523.83619362.davem@redhat.com> To: shemminger@osdl.org Cc: jgarzik@pobox.com, scott.feldman@intel.com, netdev@oss.sgi.com Subject: Re: [PATCH 2.5.70] remove if_port_text From: "David S. Miller" In-Reply-To: <20030529142820.5f657d77.shemminger@osdl.org> References: <20030529104138.751a1f54.shemminger@osdl.org> <20030529.140828.78714529.davem@redhat.com> <20030529142820.5f657d77.shemminger@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2775 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 From: Stephen Hemminger Date: Thu, 29 May 2003 14:28:20 -0700 Eliminate necrophilic code, net-sysfs shouldn't support deprecated if_port. Since nowhere else is using if_port_text, eliminate it. Applied, thanks Stephen. From davem@redhat.com Thu May 29 21:59:08 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 21:59:15 -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.9) with SMTP id h4U4x72x017133 for ; Thu, 29 May 2003 21:59:08 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id TAA27521; Sun, 25 May 2003 19:24:17 -0700 Date: Sun, 25 May 2003 19:24:17 -0700 (PDT) Message-Id: <20030525.192417.102551586.davem@redhat.com> To: shemminger@osdl.org Cc: muizelaar@rogers.com, netdev@oss.sgi.com Subject: Re: [PATCH] post-sysfs netdev cleanup From: "David S. Miller" In-Reply-To: <3ECEB317.5020407@osdl.org> References: <3ECD6E2D.5090000@rogers.com> <20030522.174415.28799441.davem@redhat.com> <3ECEB317.5020407@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2776 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 From: Stephen Hemminger Date: Fri, 23 May 2003 16:47:35 -0700 Seems like a good idea too. Ok, great. Stephen, I think we need to find a way to put the device registration call outside of the RTNL semaphore. I removed in the unregister case, but to be complete we have to push it out in the register path too. The reason for all of these issues is that link_watch grabs the RTNL semaphore, and this runs via keventd. Thus, trying to invoke any usermode helper (/sbin/hotplug etc.) while holding the RTNL semaphore can deadlock. From scott.feldman@intel.com Thu May 29 22:01:43 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 22:01:57 -0700 (PDT) Received: from caduceus.fm.intel.com (fmr02.intel.com [192.55.52.25]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4U51g2x017721 for ; Thu, 29 May 2003 22:01:43 -0700 Received: from petasus.fm.intel.com (petasus.fm.intel.com [10.1.192.37]) by caduceus.fm.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.66 2003/05/22 21:17:36 rfjohns1 Exp $) with ESMTP id h4U4rsI03388 for ; Fri, 30 May 2003 04:53:55 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.fm.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 h4U4t5p10448 for ; Fri, 30 May 2003 04:55:05 GMT Received: from [134.134.3.229] ([134.134.3.229]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003052921583127120 ; Thu, 29 May 2003 21:58:31 -0700 Date: Thu, 29 May 2003 22:12:02 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: "Feldman, Scott" , Subject: [PATCH 2.5 2/2] 10GbE ethtool support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2778 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 Add 10GbE support for ethtool. --- linux-2.5/include/linux/ethtool.h.orig 2003-05-29 21:55:28.000000000 -0700 +++ linux-2.5/include/linux/ethtool.h 2003-05-29 21:56:30.000000000 -0700 @@ -299,6 +299,7 @@ #define SUPPORTED_MII (1 << 9) #define SUPPORTED_FIBRE (1 << 10) #define SUPPORTED_BNC (1 << 11) +#define SUPPORTED_10000baseT_Full (1 << 12) /* Indicates what features are advertised by the interface. */ #define ADVERTISED_10baseT_Half (1 << 0) @@ -313,6 +314,7 @@ #define ADVERTISED_MII (1 << 9) #define ADVERTISED_FIBRE (1 << 10) #define ADVERTISED_BNC (1 << 11) +#define ADVERTISED_10000baseT_Full (1 << 12) /* The following are all involved in forcing a particular link * mode for the device for setting things. When getting the @@ -320,10 +322,11 @@ * it was foced up into this mode or autonegotiated. */ -/* The forced speed, 10Mb, 100Mb, gigabit. */ +/* The forced speed, 10Mb, 100Mb, gigabit, 10GbE. */ #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 +#define SPEED_10000 10000 /* Duplex, half or full. */ #define DUPLEX_HALF 0x00 From scott.feldman@intel.com Thu May 29 22:01:36 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 22:01:51 -0700 (PDT) Received: from caduceus.fm.intel.com (fmr02.intel.com [192.55.52.25]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4U51Z2x017662 for ; Thu, 29 May 2003 22:01:35 -0700 Received: from petasus.fm.intel.com (petasus.fm.intel.com [10.1.192.37]) by caduceus.fm.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.66 2003/05/22 21:17:36 rfjohns1 Exp $) with ESMTP id h4U4rkI03296 for ; Fri, 30 May 2003 04:53:47 GMT Received: from fmsmsxvs041.fm.intel.com (fmsmsxvs041.fm.intel.com [132.233.42.126]) by petasus.fm.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 h4U4swp10373 for ; Fri, 30 May 2003 04:54:58 GMT Received: from [134.134.3.229] ([134.134.3.229]) by fmsmsxvs041.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2003052921582327538 ; Thu, 29 May 2003 21:58:23 -0700 Date: Thu, 29 May 2003 22:11:54 -0700 (PDT) From: "Feldman, Scott" X-X-Sender: scott.feldman@localhost.localdomain Reply-To: "Feldman, Scott" To: Jeff Garzik cc: "Feldman, Scott" , Subject: [PATCH 2.5 1/2] remove ethtool privileged references Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 2777 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 dev_ioctl already checks capable(CAP_NET_ADMIN) for SOICETHTOOL, so privileged reference are not necessary. --- linux-2.5/include/linux/ethtool.h.orig 2003-05-29 21:49:36.000000000 -0700 +++ linux-2.5/include/linux/ethtool.h 2003-05-29 21:52:34.000000000 -0700 @@ -252,23 +252,23 @@ /* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001 /* Get settings. */ -#define ETHTOOL_SSET 0x00000002 /* Set settings, privileged. */ +#define ETHTOOL_SSET 0x00000002 /* Set settings. */ #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ -#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers, privileged. */ +#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ -#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options, priv. */ +#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ -#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */ -#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv. */ +#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ +#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ #define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ -#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data, priv. */ +#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ -#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config, priv. */ +#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ -#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */ +#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ -#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters, priv. */ +#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ @@ -276,8 +276,8 @@ #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable * (ethtool_value) */ #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable - * (ethtool_value), priv. */ -#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */ + * (ethtool_value). */ +#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ From scott.feldman@intel.com Thu May 29 22:14:00 2003 Received: with ECARTIS (v1.0.0; list netdev); Thu, 29 May 2003 22:14:03 -0700 (PDT) Received: from caduceus.fm.intel.com (fmr02.intel.com [192.55.52.25]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4U5Dx2x018745 for ; Thu, 29 May 2003 22:13:59 -0700 Received: from talaria.fm.intel.com (talaria.fm.intel.com [10.1.192.39]) by caduceus.fm.intel.com (8.11.6p2/8.11.6/d: outer.mc,v 1.66 2003/05/22 21:17:36 rfjohns1 Exp $) with ESMTP id h4U564I08956 for ; Fri, 30 May 2003 05:06:10 GMT Received: from orsmsxvs041.jf.intel.com (orsmsxvs041.jf.intel.com [192.168.65.54]) by talaria.fm.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 h4U5EDR22872 for ; Fri, 30 May 2003 05:14:13 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 M2003052922132900941 ; Thu, 29 May 2003 22:13:29 -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); Thu, 29 May 2003 22:10:04 -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: [PATCH 2.5 2/2] 10GbE ethtool support Date: Thu, 29 May 2003 22:10:03 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 2.5 2/2] 10GbE ethtool support Thread-Index: AcMmaI2U0GJnCInVSJy/Chiu/YYEDgAAO+Zg From: "Feldman, Scott" To: "Jeff Garzik" Cc: , "Feldman, Scott" X-OriginalArrivalTime: 30 May 2003 05:10:04.0194 (UTC) FILETIME=[BAAEB820:01C32669] Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h4U5Dx2x018745 X-archive-position: 2779 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 Patches also applies to 2.4. From zhanght@netpower.com.cn Fri May 30 00:40:54 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 00:41:08 -0700 (PDT) Received: from mail.netpower.com.cn ([211.154.175.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4U7ei2x022465 for ; Fri, 30 May 2003 00:40:51 -0700 Received: from netpower.com.cn [192.168.0.196] by mail.netpower.com.cn with ESMTP (SMTPD32-7.07) id A9F418700B0; Fri, 30 May 2003 15:36:20 +0800 Message-ID: <3ED70E55.3020202@netpower.com.cn> Date: Fri, 30 May 2003 15:55:01 +0800 From: Zhang Haitao Reply-To: zhanght@netpower.com.cn User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: zh-cn, en-us, en MIME-Version: 1.0 To: netdev Subject: Re: Re: Hi, this is my patch for broadcom sb1250-mac.c Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-archive-position: 2780 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zhanght@netpower.com.cn Precedence: bulk X-list: netdev Hi all! and Dear YOSHIFUJI Hideaki i've corrected some bugs in my last broken driver, now the driver work properly both under copper mode and fiber mode. so this time i resend it in a more clear style :-) and hope you all will glad to review it. (you can turn off/on the NAPI options to do some contrast test for both original mode and NAPI mode, even the parameters for original mode have been modified for better performance) Thanks Zhang Haitao ---------------------- --- ./sb1250-broadcom.c 2003-05-30 00:48:36.000000000 +0800 +++ ./sb1250-mac.debug.c 2003-05-30 00:48:36.000000000 +0800 @@ -44,8 +44,8 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1}; #endif -static int int_pktcnt = 0; -static int int_timeout = 0; +static int int_pktcnt = 32; +static int int_timeout = 1024; /* Operational parameters that usually are not changed. */ @@ -91,7 +91,8 @@ static char version1[] __devinitdata = "sb1250-mac.c:1.00 1/11/2001 Written by Mitch Lichtenberg (mpl@broadcom.com)\n"; #endif - +#define CONFIG_SB1250_NAPI +#define NAPI_LOP_MAX 10 MODULE_AUTHOR("Mitch Lichtenberg (mpl@broadcom.com)"); @@ -154,8 +155,8 @@ #define PKSEG1(x) ((sbmac_port_t) KSEG1ADDR(x)) -#define SBMAC_MAX_TXDESCR 32 -#define SBMAC_MAX_RXDESCR 32 +#define SBMAC_MAX_TXDESCR 128 +#define SBMAC_MAX_RXDESCR 128 #define ETHER_ALIGN 2 #define ETHER_ADDR_LEN 6 @@ -190,8 +191,8 @@ int sbdma_txdir; /* direction (1=transmit) */ int sbdma_maxdescr; /* total # of descriptors in ring */ #ifdef CONFIG_SBMAC_COALESCE - int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ - int sbdma_int_timeout; /* # usec rx/tx interrupt */ + int sbdma_int_pktcnt; /* # descriptors rx before interrupt*/ + int sbdma_int_timeout; /* # usec rx interrupt */ #endif sbmac_port_t sbdma_config0; /* DMA config register 0 */ @@ -262,11 +263,13 @@ u_char sbm_hwaddr[ETHER_ADDR_LEN]; - sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ + sbmacdma_t sbm_txdma; /* for now, use channel 0 */ sbmacdma_t sbm_rxdma; int rx_hw_checksum; int sbe_idx; + int sbm_fibermode; + int sbm_phy_oldsignaldetect; }; @@ -288,7 +291,6 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); static void sbdma_emptyring(sbmacdma_t *d); static void sbdma_fillring(sbmacdma_t *d); -static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d); static int sbmac_initctx(struct sbmac_softc *s); static void sbmac_channel_start(struct sbmac_softc *s); @@ -299,6 +301,13 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr); static void sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs); static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); +#ifdef CONFIG_SB1250_NAPI +static int sbmac_poll(struct net_device *dev_instance, int *budget); +static inline void sbmac_irq_disable(struct sbmac_softc *s); +static inline void sbmac_irq_enable(struct sbmac_softc *s); +#else +static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d); +#endif static void sbmac_setmulti(struct sbmac_softc *sc); static int sbmac_init(struct net_device *dev); static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); @@ -448,6 +457,15 @@ #define PHYSUP_LINKUP 0x04 #define PHYSUP_FDX 0x02 +/* Added for Fiber mode detection +just read Signal Detect alternation */ + +#define MII_AUXCTL 0x18 /* Auxiliary Control Register */ + +#define MII_SGMIISR 0x0C /* SGMII/100-X Status Register */ + +#define SGMIISR_FIBERSDS 0x2000 + #define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define MII_BMSR 0x01 /* Basic mode status register (ro) */ #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ @@ -459,6 +477,17 @@ #define ENABLE 1 #define DISABLE 0 +#ifdef CONFIG_SB1250_NAPI +static inline void sbmac_irq_disable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0)); +} +static inline void sbmac_irq_enable(struct sbmac_softc *s){ + SBMAC_WRITECSR(s->sbm_imr, + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | + ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); +} +#endif /********************************************************************** * SBMAC_MII_SYNC(s) * @@ -759,7 +788,7 @@ #ifdef CONFIG_SBMAC_COALESCE /* - * Setup Rx/Tx DMA coalescing defaults + * Setup RxTx DMA coalescing defaults */ if ( int_pktcnt ) { @@ -944,7 +973,7 @@ sb_new = sb; /* * nothing special to reinit buffer, it's already aligned - * and sb->data already points to a good place. + * and sb->tail already points to a good place. */ } @@ -956,11 +985,11 @@ /* * Do not interrupt per DMA transfer. */ - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; #else - dsc->dscr_a = KVTOPHYS(sb_new->data) | + dsc->dscr_a = KVTOPHYS(sb_new->tail) | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | M_DMA_DSCRA_INTERRUPT; #endif @@ -1045,16 +1074,17 @@ phys = KVTOPHYS(sb->data); ncb = NUMCACHEBLKS(length+(phys & (CACHELINESIZE-1))); - +#ifdef CONFIG_SBMAC_COALESCE + /* do not interript per DMA transfer*/ dsc->dscr_a = phys | V_DMA_DSCRA_A_SIZE(ncb) | -#ifdef CONFIG_SBMAC_COALESCE - 0 | + M_DMA_ETHTX_SOP; #else + dsc->dscr_a = phys | + V_DMA_DSCRA_A_SIZE(ncb) | M_DMA_DSCRA_INTERRUPT | -#endif M_DMA_ETHTX_SOP; - +#endif /* transmitting: set outbound options and length */ dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | @@ -1133,7 +1163,7 @@ } } - +#ifndef CONFIG_SB1250_NAPI /********************************************************************** * SBDMA_RX_PROCESS(sc,d) * @@ -1181,6 +1211,14 @@ */ if (curidx == hwidx) break; + /*{ + int i; + for (i=0;;i++) { + if ((dsc->dscr_a & M_DMA_ETHRX_SOP) != 0) + break; + if (i >= NAPI_LOP_MAX) goto ret; + } + }*/ /* * Otherwise, get the packet's sk_buff ptr back @@ -1236,7 +1274,6 @@ sb->ip_summed = CHECKSUM_UNNECESSARY; } } /*rx_hw_checksum */ - netif_rx(sb); } } @@ -1258,7 +1295,7 @@ } } - +#endif /********************************************************************** @@ -1352,6 +1389,7 @@ */ dev_kfree_skb_irq(sb); + //__kfree_skb(sb); //try free fast /* * .. and advance to the next buffer. @@ -1393,6 +1431,7 @@ static int sbmac_initctx(struct sbmac_softc *s) { + int auxctl; /* * figure out the addresses of some ports */ @@ -1414,6 +1453,8 @@ s->sbm_phy_oldk1stsr = 0; s->sbm_phy_oldlinkstat = 0; + s->sbm_phy_oldsignaldetect =0; + /* * Initialize the DMA channels. Right now, only one per MAC is used * Note: Only do this _once_, as it allocates memory from the kernel! @@ -1421,7 +1462,6 @@ sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); - /* * initial state is OFF */ @@ -1436,6 +1476,17 @@ s->sbm_duplex = sbmac_duplex_half; s->sbm_fc = sbmac_fc_disabled; + /* + * Fiber/Copper Mode AutoDetection + */ + + sbmac_mii_write(s,1,MII_AUXCTL,0x2007); + auxctl = sbmac_mii_read(s,1,MII_AUXCTL); + if(auxctl) + { + s->sbm_fibermode=1; + } + else s->sbm_fibermode=0; return 0; } @@ -1632,6 +1683,8 @@ SBMAC_WRITECSR(s->sbm_macenable, M_MAC_RXDMA_EN0 | M_MAC_TXDMA_EN0 | + M_MAC_RXDMA_EN1 | + M_MAC_TXDMA_EN1 | M_MAC_RX_ENABLE | M_MAC_TX_ENABLE); @@ -1645,6 +1698,7 @@ SBMAC_WRITECSR(s->sbm_imr, ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); + #else /* * Accept any kind of interrupt on TX and RX DMA channel 0 @@ -1967,7 +2021,7 @@ V_MAC_IFG_TX_1000 | V_MAC_IFG_THRSH_1000 | V_MAC_SLOT_SIZE_1000; - cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; +cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; break; case sbmac_speed_auto: /* XXX not implemented */ @@ -2102,6 +2156,7 @@ { struct net_device *dev = (struct net_device *) dev_instance; struct sbmac_softc *sc = (struct sbmac_softc *) (dev->priv); + uint64_t isr; for (;;) { @@ -2124,7 +2179,7 @@ } /* - * Receives on channel 0 + * Receives on channel 0,1 */ /* @@ -2145,40 +2200,43 @@ if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { - sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#ifdef CONFIG_SB1250_NAPI + if (netif_rx_schedule_prep(dev)) { + sbmac_irq_disable(sc); + __netif_rx_schedule(dev); } +#else + sbdma_rx_process(sc,&(sc->sbm_rxdma)); +#endif } - +} } static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) { - struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; - - /* lock eth irq */ - spin_lock_irq (&sc->sbm_lock); - - /* +struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; +spin_lock_irq (&sc->sbm_lock); +/* * Put the buffer on the transmit ring. If we * don't have room, stop the queue. */ - if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { - /* XXX save skb that we could not send */ +if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { + /* XXX save skb that we could not send, then test 1 channel */ netif_stop_queue(dev); spin_unlock_irq(&sc->sbm_lock); @@ -2186,12 +2244,142 @@ } dev->trans_start = jiffies; - spin_unlock_irq (&sc->sbm_lock); return 0; } +#ifdef CONFIG_SB1250_NAPI +//#define NAPI_POL_MAX 100 +static int sbmac_poll(struct net_device *dev_instance, int *budget) { + struct net_device *dev = (struct net_device *) dev_instance; + struct sbmac_softc *sc = (struct sbmac_softc *) (dev_instance->priv); + sbmacdma_t *d = &(sc->sbm_rxdma); + int rx_work_limit = *budget; + unsigned long flags; + long int receive=0; + int curidx; + int hwidx; + + sbdmadscr_t *dsc; + struct sk_buff *sb; + int len; + + if(rx_work_limit > dev->quota) + rx_work_limit = dev->quota; + + for (;;) { + /* + * figure out where we are (as an index) and where + * the hardware is (also as an index) + * + * This could be done faster if (for example) the + * descriptor table was page-aligned and contiguous in + * both virtual and physical memory -- you could then + * just compare the low-order bits of the virtual address + * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) + */ + if(--rx_work_limit < 0) goto not_done; + curidx = d->sbdma_remptr - d->sbdma_dscrtable; + hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - + d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); + + /* + * If they're the same, that means we've processed all + * of the descriptors up to (but not including) the one that + * the hardware is working on right now. + */ + + if (curidx == hwidx) break; + + /* + * Otherwise, get the packet's sk_buff ptr back + */ + + dsc = &(d->sbdma_dscrtable[curidx]); + sb = d->sbdma_ctxtable[curidx]; + d->sbdma_ctxtable[curidx] = NULL; + + len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; + /* + * Check packet status. If good, process it. + * If not, silently drop it and put it back on the + * receive ring. + */ + + if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { + + /* + * Add a new buffer to replace the old one. If we fail + * to allocate a buffer, we're going to drop this + * packet and put it right back on the receive ring. + */ + + if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { + sc->sbm_stats.rx_dropped++; + sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ + } + else { + /* + * Set length into the packet + */ + skb_put(sb,len); + + /* + * Buffer has been replaced on the receive ring. + * Pass the buffer to the kernel + */ + sc->sbm_stats.rx_bytes += len; + sc->sbm_stats.rx_packets++;receive++; + sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev); + if (sc->rx_hw_checksum == ENABLE) { + /* if the ip checksum is good indicate in skb. + else set CHECKSUM_NONE as device failed to + checksum the packet */ + + if (((dsc->dscr_b) |M_DMA_ETHRX_BADTCPCS) || + ((dsc->dscr_a)| M_DMA_ETHRX_BADIP4CS)){ + sb->ip_summed = CHECKSUM_NONE; + } else { + printk(KERN_DEBUG "hw checksum fail .\n"); + sb->ip_summed = CHECKSUM_UNNECESSARY; + } + } /*rx_hw_checksum */ + netif_receive_skb(sb); + } + } + else { + /* + * Packet was mangled somehow. Just drop it and + * put it back on the receive ring. + */ + sc->sbm_stats.rx_errors++; + sbdma_add_rcvbuffer(d,sb); + } + + + /* + * .. and advance to the next buffer. + */ + + d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); + + } + if (!receive) receive = 1; + dev->quota -= receive; + *budget -= receive; + + spin_lock_irqsave(&sc->sbm_lock,flags); + netif_rx_complete(dev); + sbmac_irq_enable(sc); + spin_unlock_irqrestore(&sc->sbm_lock,flags); + return 0; +not_done: + dev->quota -= receive; + *budget -= receive; + return 1; +} +#endif /********************************************************************** * SBMAC_SETMULTI(sc) * @@ -2448,6 +2636,10 @@ dev->do_ioctl = sbmac_mii_ioctl; dev->tx_timeout = sbmac_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; +#ifdef CONFIG_SB1250_NAPI + dev->poll = sbmac_poll; + dev->weight =dev->quota = 80; +#endif dev->change_mtu = sb1250_change_mtu; @@ -2525,6 +2717,10 @@ char buffer[100]; char *p = buffer; + int signaldetect; + + if(s->sbm_fibermode == 0) + { /* Read the mode status and mode control registers. */ bmsr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMSR); bmcr = sbmac_mii_read(s,s->sbm_phys[0],MII_BMCR); @@ -2539,7 +2735,6 @@ else { k1stsr = 0; } - chg = 0; if ((bmsr & BMSR_LINKSTAT) == 0) { @@ -2620,6 +2815,41 @@ printk(KERN_INFO "s: s\n",s->sbm_dev->name,buffer); } + } + else + { //fiber mode + + chg=0; + printk("sbm_phy_oldsignaldetect:d\n",s->sbm_phy_oldsignaldetect); + + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(s,s->sbm_phys[0],MII_SGMIISR)); + + printk("current signaldetect:d\n",signaldetect); + + if (signaldetect == 0) + { + printk("link state is DOWN!\n"); + s->sbm_phy_oldsignaldetect = 0; + return 0; + } + else + { + if(s->sbm_phy_oldsignaldetect != signaldetect) + { + s->sbm_phy_oldsignaldetect = signaldetect; + chg = 1; + printk("link state has been changed\n"); + } + } + if (chg==0) return 0; + printk("Link is up\n"); + s->sbm_speed = sbmac_speed_1000; + s->sbm_duplex = sbmac_duplex_full; + s->sbm_fc = sbmac_fc_frame; + s->sbm_state = sbmac_state_on; + noisy =0; + printk("fiber mode.\t"); + } return 1; } @@ -2632,9 +2862,12 @@ struct sbmac_softc *sc = (struct sbmac_softc *)dev->priv; int next_tick = HZ; int mii_status; + int signaldetect; spin_lock_irq (&sc->sbm_lock); + if(sc->sbm_fibermode == 0) + { /* make IFF_RUNNING follow the MII status bit "Link established" */ mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); @@ -2647,6 +2880,23 @@ netif_carrier_off(dev); } } + } + else + { + signaldetect = (SGMIISR_FIBERSDS & sbmac_mii_read(sc,sc->sbm_phys[0],MII_SGMIISR)); + if(sc->sbm_phy_oldsignaldetect != signaldetect) + { + sc->sbm_phy_oldsignaldetect = signaldetect; + if (signaldetect) { + printk("netif_carrier_on. \n"); + netif_carrier_on(dev); + } + else { + netif_carrier_off(dev); + } + printk("link state has been changed\n"); + } + } /* * Poll the PHY to see what speed we should be running at ---------------------- >In article <3ED58DBA.6000506@netpower.com.cn> (at Thu, 29 May 2003 12:34:02 +0800), Zhang Haitao says: > >> i'm very glad to let all of you to review this patch >> or give me some advice from the oops message! > >Please don't try to make cosmetic changes >including indentation, and/or new lines etc. > >Thank you. > >-- >Hideaki YOSHIFUJI @ USAGI Project >GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA --------------------------- From vnuorval@tcs.hut.fi Fri May 30 07:44:11 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 07:44:23 -0700 (PDT) Received: from saturn.tcs.hut.fi (root@saturn.tcs.hut.fi [130.233.215.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4UEi92x000957 for ; Fri, 30 May 2003 07:44:10 -0700 Received: from rhea.tcs.hut.fi (really [130.233.215.147]) by tcs.hut.fi via smail with esmtp id (Debian Smail3.2.0.102) for ; Fri, 30 May 2003 17:34:46 +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-5) with ESMTP id h4UEYjjH003711; Fri, 30 May 2003 17:34:45 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-5) with ESMTP id h4UEYejM003707; Fri, 30 May 2003 17:34:41 +0300 Date: Fri, 30 May 2003 17:34:40 +0300 (EEST) From: Ville Nuorvala To: "David S. Miller" , , , cc: Antti Tuominen , Lars Henrik Petander , , Subject: [patch]: CONFIG_IPV6_SUBTREES fix for MIPv6 In-Reply-To: <20030424132559.GA15894@morphine.tml.hut.fi> Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-377318441-732465963-1054304123=:3584" Content-ID: X-archive-position: 2781 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 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-732465963-1054304123=:3584 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: Hi guys, here is a patch that fixes CONFIG_IPV6_SUBTREES and allows overriding normal routes with source address specific ones. This is for example needed in MIPv6 for handling the traffic to and from a mobile node's home address correctly. The patch is sent as an attachment to this mail but is also available at: http://www.mipl.mediapoli.com/patches/source-routing.patch Regards, Ville Nuorvala -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 ---377318441-732465963-1054304123=:3584 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="source-routing.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: ATTACHMENT; FILENAME="source-routing.patch" ZGlmZiAtTnVyIC0tZXhjbHVkZT1TQ0NTIC0tZXhjbHVkZT1CaXRLZWVwZXIg LS1leGNsdWRlPUNoYW5nZVNldCBsaW51eC0yLjUvaW5jbHVkZS9saW51eC9p cHY2LmggbWVyZ2UtMi41L2luY2x1ZGUvbGludXgvaXB2Ni5oDQotLS0gbGlu dXgtMi41L2luY2x1ZGUvbGludXgvaXB2Ni5oCVdlZCBNYXkgMjggMjA6MDc6 MjIgMjAwMw0KKysrIG1lcmdlLTIuNS9pbmNsdWRlL2xpbnV4L2lwdjYuaAlX ZWQ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FkZHJfY21wKCZmbC5mbDZfZHN0LCAmbnAtPmRhZGRyKSA/DQotCQkg ICAgICAmbnAtPmRhZGRyIDogTlVMTCk7DQorCQkgICAgICAmbnAtPmRhZGRy IDogTlVMTCwNCisJCSAgICAgICFpcHY2X2FkZHJfY21wKCZmbC5mbDZfc3Jj LCAmbnAtPnNhZGRyKSA/DQorCQkgICAgICAmbnAtPnNhZGRyIDogTlVMTCk7 DQogCWlmIChlcnIgPiAwKQ0KIAkJZXJyID0gbnAtPnJlY3ZlcnIgPyBuZXRf eG1pdF9lcnJubyhlcnIpIDogMDsNCiAJcmVsZWFzZV9zb2NrKHNrKTsNCg== ---377318441-732465963-1054304123=:3584-- From yoshfuji@linux-ipv6.org Fri May 30 08:02:45 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 08:02: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.9) with SMTP id h4UF2i2x001846 for ; Fri, 30 May 2003 08:02:45 -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 h4UF3JBo021877; Sat, 31 May 2003 00:03:19 +0900 Date: Sat, 31 May 2003 00:03:19 +0900 (JST) Message-Id: <20030531.000319.114704530.yoshfuji@linux-ipv6.org> To: vnuorval@tcs.hut.fi Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, ajtuomin@morphine.tml.hut.fi, lpetande@morphine.tml.hut.fi, jagana@us.ibm.com, kumarkr@us.ibm.com, yoshfuji@linux-ipv6.org Subject: Re: [patch]: CONFIG_IPV6_SUBTREES fix for MIPv6 From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: References: <20030424132559.GA15894@morphine.tml.hut.fi> 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: 2782 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 Fri, 30 May 2003 17:34:40 +0300 (EEST)), Ville Nuorvala says: > here is a patch that fixes CONFIG_IPV6_SUBTREES and allows overriding > normal routes with source address specific ones. This is for example > needed in MIPv6 for handling the traffic to and from a mobile node's home > address correctly. Let us test the patch. It seemed buggy when USAGI tested before. -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From vnuorval@tcs.hut.fi Fri May 30 08:04:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 08:05:05 -0700 (PDT) Received: from saturn.tcs.hut.fi (root@saturn.tcs.hut.fi [130.233.215.2]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4UF4o2x002155 for ; Fri, 30 May 2003 08:04:51 -0700 Received: from rhea.tcs.hut.fi (really [130.233.215.147]) by tcs.hut.fi via smail with esmtp id (Debian Smail3.2.0.102) for ; Fri, 30 May 2003 18:00: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-5) with ESMTP id h4UF0vjH003795; Fri, 30 May 2003 18:00:57 +0300 Received: from localhost (vnuorval@localhost) by rhea.tcs.hut.fi (8.12.3/8.12.3/Debian-5) with ESMTP id h4UF0tgl003791; Fri, 30 May 2003 18:00:56 +0300 Date: Fri, 30 May 2003 18:00:55 +0300 (EEST) From: Ville Nuorvala To: "David S. Miller" , , , cc: Antti Tuominen , Lars Henrik Petander , , Subject: [patch]: ipv6 tunnel for MIPv6 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-377318441-2090258196-1054306855=:3584" X-archive-position: 2783 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 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-2090258196-1054306855=:3584 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi again guys, there was a while ago some talk about an xfrm6_tunnel driver IIRC. I don't know how far along the project is and what capabilities the xfrm6_tunnels will have, but in the mean time I have an ipv6-in-ipv6 tunnel driver specified in RFC 2473 to offer you. If the xfrm6_tunnels are going to support ipv6-in-ipv6 you also might find the code useful. The tunnels are needed by MIPv6 for encapsulation and decapsulation of tunneled packets between the home agent and mobile node. Some proctocols like DHCP are also run over the virtual link between the MN and the home network according to the MIPv6 specification. The patch is sent as an attachment to this mail, but is also available at: http://www.mipl.mediapoli.com/patches/ip6-tunnel.patch Regards, Ville Nuorvala -- Ville Nuorvala Research Assistant, Institute of Digital Communications, Helsinki University of Technology email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257 ---377318441-2090258196-1054306855=:3584 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ip6-tunnel.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="ip6-tunnel.patch" ZGlmZiAtTnVyIC0tZXhjbHVkZT1TQ0NTIC0tZXhjb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41L25ldC9uZXRzeW1zLmMJV2Vk IE1heSAyOCAyMToxMjowMiAyMDAzDQpAQCAtNDc3LDggKzQ3NywxMCBAQA0K IEVYUE9SVF9TWU1CT0woc3lzY3RsX21heF9zeW5fYmFja2xvZyk7DQogI2Vu ZGlmDQogDQotRVhQT1JUX1NZTUJPTChpcF9nZW5lcmljX2dldGZyYWcpOw0K KyNlbmRpZg0KIA0KKyNpZiBkZWZpbmVkIChDT05GSUdfSVBWNl9NT0RVTEUp IHx8IGRlZmluZWQgKENPTkZJR19JUF9TQ1RQX01PRFVMRSkgfHwgZGVmaW5l ZCAoQ09ORklHX0lQVjZfVFVOTkVMX01PRFVMRSkNCitFWFBPUlRfU1lNQk9M KGlwX2dlbmVyaWNfZ2V0ZnJhZyk7DQogI2VuZGlmDQogDQogRVhQT1JUX1NZ TUJPTCh0Y3BfcmVhZF9zb2NrKTsNCg== ---377318441-2090258196-1054306855=:3584-- From yoshfuji@linux-ipv6.org Fri May 30 08:38:21 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 08:38: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.9) with SMTP id h4UFcK2x003172 for ; Fri, 30 May 2003 08:38: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 h4UFcxBo022053; Sat, 31 May 2003 00:38:59 +0900 Date: Sat, 31 May 2003 00:38:58 +0900 (JST) Message-Id: <20030531.003858.108351451.yoshfuji@linux-ipv6.org> To: vnuorval@tcs.hut.fi Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, ajtuomin@morphine.tml.hut.fi, lpetande@morphine.tml.hut.fi, jagana@us.ibm.com, kumarkr@us.ibm.com, yoshfuji@linux-ipv6.org Subject: Re: [patch]: ipv6 tunnel for MIPv6 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: 2784 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 Fri, 30 May 2003 18:00:55 +0300 (EEST)), Ville Nuorvala says: > there was a while ago some talk about an xfrm6_tunnel driver IIRC. I don't > know how far along the project is and what capabilities the xfrm6_tunnels > will have, but in the mean time I have an ipv6-in-ipv6 tunnel driver > specified in RFC 2473 to offer you. If the xfrm6_tunnels are going to > support ipv6-in-ipv6 you also might find the code useful. The code exists in our repository. Kanda-san is preparing patch for xfrm6_tunnel; patch will soon be available. > The tunnels are needed by MIPv6 for encapsulation and decapsulation of > tunneled packets between the home agent and mobile node. Some proctocols > like DHCP are also run over the virtual link between the MN and the home > network according to the MIPv6 specification. I'm not sure if MIP6 will use this tunnel driver. -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From rddunlap@osdl.org Fri May 30 09:00:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 09:00:33 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4UG0N2x003590 for ; Fri, 30 May 2003 09:00:26 -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 h4UG0EX08614; Fri, 30 May 2003 09:00:14 -0700 Date: Fri, 30 May 2003 09:00:15 -0700 From: "Randy.Dunlap" To: linux-net@vger.kernel.org Cc: netdev@oss.sgi.com Subject: netlink tester program Message-Id: <20030530090015.7c435c9a.rddunlap@osdl.org> Organization: OSDL X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i586-pc-linux-gnu) X-Face: +5V?h'hZQPB9kW Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 2785 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 Hi-- I tried to write a simple test program for (rt)netlink, but I didn't succeed I'm sorry to say. Does anyone have one or know of one? [alternative plan is to use kgdb to determine why my test program is failing...] I think it should be possible in around 100 lines of code. I don't want to use iproute2 and libnetlink -- they are much larger and more complex than a syscall interface test program should be. I've asked Alexey but I'm getting no replies from him. Thanks, -- ~Randy From jaganav@us.ibm.com Fri May 30 13:42:18 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 13:42:28 -0700 (PDT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.105]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4UKgA2x012946 for ; Fri, 30 May 2003 13:42:18 -0700 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e5.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4UKdYtd118386; Fri, 30 May 2003 16:39:34 -0400 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4UKdJt9032606; Fri, 30 May 2003 16:39:29 -0400 Message-ID: <3ED7C129.2000800@us.ibm.com> Date: Fri, 30 May 2003 13:38:01 -0700 From: Venkata Jagana Organization: IBM Corp User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: yoshfuji@linux-ipv6.org CC: vnuorval@tcs.hut.fi, davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, ajtuomin@morphine.tml.hut.fi, lpetande@morphine.tml.hut.fi, jagana@us.ibm.com, kumarkr@us.ibm.com Subject: Re: [patch]: CONFIG_IPV6_SUBTREES fix for MIPv6 References: <20030424132559.GA15894@morphine.tml.hut.fi> <20030531.000319.114704530.yoshfuji@linux-ipv6.org> In-Reply-To: <20030531.000319.114704530.yoshfuji@linux-ipv6.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 2786 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jaganav@us.ibm.com Precedence: bulk X-list: netdev When we have tested this recently (just two months ago), we found only two bugs but MIPL has already fixed those in their development version. How long before have you tested this and what problems have you encountered in your test? Thanks, Venkat YOSHIFUJI Hideaki / wrote: >In article (at Fri, 30 May 2003 17:34:40 +0300 (EEST)), Ville Nuorvala says: > > > >>here is a patch that fixes CONFIG_IPV6_SUBTREES and allows overriding >>normal routes with source address specific ones. This is for example >>needed in MIPv6 for handling the traffic to and from a mobile node's home >>address correctly. >> >> > >Let us test the patch. It seemed buggy when USAGI tested before. > > > From davem@redhat.com Fri May 30 17:12:34 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 17:12: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.9) with SMTP id h4V0CX2x017023 for ; Fri, 30 May 2003 17:12:34 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id RAA11869; Fri, 30 May 2003 17:11:11 -0700 Date: Fri, 30 May 2003 17:11:11 -0700 (PDT) Message-Id: <20030530.171111.71099698.davem@redhat.com> To: rddunlap@osdl.org Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: netlink tester program From: "David S. Miller" In-Reply-To: <20030530090015.7c435c9a.rddunlap@osdl.org> References: <20030530090015.7c435c9a.rddunlap@osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2787 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 From: "Randy.Dunlap" Date: Fri, 30 May 2003 09:00:15 -0700 I tried to write a simple test program for (rt)netlink, but I didn't succeed I'm sorry to say. Does anyone have one or know of one? [alternative plan is to use kgdb to determine why my test program is failing...] I bet if you actually posted your test program, you'll get more feedback... From krkumar@us.ibm.com Fri May 30 18:15:15 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 18:15:28 -0700 (PDT) Received: from e3.ny.us.ibm.com (e3.ny.us.ibm.com [32.97.182.103]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4V1F12x018053 for ; Fri, 30 May 2003 18:15:14 -0700 Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150]) by e3.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h4V1EtE2164736; Fri, 30 May 2003 21:14:55 -0400 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay02.pok.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h4V1Eoh3178712; Fri, 30 May 2003 21:14:52 -0400 Message-ID: <3ED80230.2030508@us.ibm.com> Date: Fri, 30 May 2003 18:15:28 -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: davem@redhat.com, kuznet@ms2.inr.ac.ru CC: netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: [PATCH] Prefix List patch against 2.5.70 Content-Type: text/plain; charset=UTF-8; format=flowed X-MIME-Autoconverted: from 8bit to quoted-printable by e3.ny.us.ibm.com id h4V1EtE2164736 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by oss.sgi.com id h4V1F12x018053 X-archive-position: 2788 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 all, Following is a modified patch to implement Prefix List in IPv6. This has the following changes from the patch submitted previously : - Added user interface to retrieve the prefix list and other RA parameters for DHVPv6 (http://sourceforge.net/projects/dhcpv6). Also incorporated Yoshifuji’s suggestion to change the user interface to use rtnetlink instead of /proc (I have kept an OPTIONAL extra user interface which is provided as a file in /proc/net, but that code can be removed - it is clearly marked as OPTIONAL). I am not an expert in netlink code, so please excuse me if I have committed any blunders. - Changed to support different parameters of a RA (flags, lifetime, address of the router, etc. Alexey had originally asked why I am not using fib to store the prefix list, and the reasons for the way this is designed as part of the dev are : - To be a prefix list entry, it should come via an RA. So a manual ifconfig
should not cause a prefix entry to be created. This can however be avoided by adding more code to determine if this is an RA added routing entry or a manual one. However, a routing table is per destination, while the Prefix List is conceptualized as being per interface. - Routing table will have lots of address prefixes that are not configured to the local interface. Eg, none of the interfaces might have the address 2002::2, but a route entry can exist for this; or I can add a route myself and should not expect to see the prefix of this route in the Prefix List. More code (flags) needs to be present to parse each entry in this case. Eg, for each routing entry, you need to make sure it is the same device, that it is not a Link Local destination, and there is no 'next hop' field. - Also, when the user requests the Prefix List, the search over a longer routing table across all radix tree nodes is more time consuming since there is no key to use for the lookup (you have to always walk the entire tree). I think it would be faster in the case where the routing table is very large, and there aren't too many interfaces. The difference is that in case of routing table lookup, you go through the entire tree and parse each entry, while in the proposed approach, the linear search is only done to locate the 'dev' and then the work is more straightforward – return all entries. The implementation is done by adding the prefix on receipt of a RA (or update the prefix) to the list of prefixes off the inet6_dev structure (along with addr_list, mc_list, ac_list, etc). This also has a new spinlock in the structure so that the idev->lock need not be held in writer mode on every RA, rather the spinlock is held. Following is the patch against 2.5.70 (I have created against 2.4.20 also, but am holding off on that). Thanks, - KK diff -ruN linux-2.5.70.org/include/linux/icmpv6.h linux-2.5.70/include/linux/icmpv6.h --- linux-2.5.70.org/include/linux/icmpv6.h 2003-05-26 18:00:26.000000000 -0700 +++ linux-2.5.70/include/linux/icmpv6.h 2003-05-30 15:14:46.000000000 -0700 @@ -122,6 +122,12 @@ #define ICMPV6_UNK_OPTION 2 /* + * Bit flags of the RA + */ +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 + +/* * constants for (set|get)sockopt */ diff -ruN linux-2.5.70.org/include/linux/rtnetlink.h linux-2.5.70/include/linux/rtnetlink.h --- linux-2.5.70.org/include/linux/rtnetlink.h 2003-05-26 18:00:46.000000000 -0700 +++ linux-2.5.70/include/linux/rtnetlink.h 2003-05-30 15:14:46.000000000 -0700 @@ -47,7 +47,9 @@ #define RTM_DELTFILTER (RTM_BASE+29) #define RTM_GETTFILTER (RTM_BASE+30) -#define RTM_MAX (RTM_BASE+31) +#define RTM_GETPLIST (RTM_BASE+34) + +#define RTM_MAX (RTM_BASE+35) /* Generic structure for encapsulation optional route information. diff -ruN linux-2.5.70.org/include/net/addrconf.h linux-2.5.70/include/net/addrconf.h --- linux-2.5.70.org/include/net/addrconf.h 2003-05-26 18:00:46.000000000 -0700 +++ linux-2.5.70/include/net/addrconf.h 2003-05-30 15:16:29.000000000 -0700 @@ -45,6 +45,29 @@ #define IN6_ADDR_HSIZE 16 +/* An element of the prefix list, which is added to idev->prefix_list */ +struct prefix_element { + struct list_head list; /* linkage member for this entry */ + struct prefix_info pinfo; /* actual prefix information */ + unsigned long timestamp; /* jiffies when RA was received */ + unsigned int ra_flags; /* bit-flags contained in the RA */ + struct in6_addr ra_addr; /* router's address */ +}; + +/* prefix list returned to user space in this structure */ +struct plist_user_info { + char name[IFNAMSIZ]; /* interface name */ + int ifindex; /* interface index */ + int nprefixes; /* number of elements in 'prefix' */ + struct var_plist_user_info { /* multiple elements */ + char flags[3]; /* router advertised flags */ + int plen; /* prefix length */ + __u32 valid; /* valid lifetime */ + struct in6_addr ra_addr;/* advertising router */ + struct in6_addr prefix; /* prefix */ + } plist_vars[0]; +}; + extern void addrconf_init(void); extern void addrconf_cleanup(void); @@ -95,7 +118,8 @@ extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group, struct in6_addr *src_addr); -extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); +extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, + struct in6_addr *ra_addr, struct ra_msg *ra); /* * anycast prototypes (anycast.c) diff -ruN linux-2.5.70.org/include/net/if_inet6.h linux-2.5.70/include/net/if_inet6.h --- linux-2.5.70.org/include/net/if_inet6.h 2003-05-26 18:00:59.000000000 -0700 +++ linux-2.5.70/include/net/if_inet6.h 2003-05-30 15:17:59.000000000 -0700 @@ -176,6 +176,12 @@ struct timer_list mc_gq_timer; /* general query timer */ struct timer_list mc_ifc_timer; /* interface change timer */ +#ifdef CONFIG_IPV6_PREFIXLIST + struct list_head prefix_list; + spinlock_t prefix_lock; + int prefix_count; /* number of prefixes */ +#endif + struct ifacaddr6 *ac_list; rwlock_t lock; atomic_t refcnt; diff -ruN linux-2.5.70.org/net/ipv6/Kconfig linux-2.5.70/net/ipv6/Kconfig --- linux-2.5.70.org/net/ipv6/Kconfig 2003-05-26 18:00:40.000000000 -0700 +++ linux-2.5.70/net/ipv6/Kconfig 2003-05-30 17:58:10.000000000 -0700 @@ -42,4 +42,13 @@ If unsure, say Y. +config IPV6_PREFIXLIST + bool "IPv6: Prefix List" + depends on IPV6 + ---help--- + For applications needing to retrieve the list of prefixes supported + on the system. Defined in RFC2461. + + If unsure, say Y. + source "net/ipv6/netfilter/Kconfig" diff -ruN linux-2.5.70.org/net/ipv6/addrconf.c linux-2.5.70/net/ipv6/addrconf.c --- linux-2.5.70.org/net/ipv6/addrconf.c 2003-05-26 18:00:58.000000000 -0700 +++ linux-2.5.70/net/ipv6/addrconf.c 2003-05-30 17:55:31.000000000 -0700 @@ -67,6 +67,7 @@ #include #include #include +#include #ifdef CONFIG_IPV6_PRIVACY #include @@ -87,6 +88,8 @@ #define ADBG(x) #endif +#define INFINITE 0xffffffff + #ifdef CONFIG_SYSCTL static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf *p); static void addrconf_sysctl_unregister(struct ipv6_devconf *p); @@ -292,6 +295,9 @@ struct net_device *dev = idev->dev; BUG_TRAP(idev->addr_list==NULL); BUG_TRAP(idev->mc_list==NULL); +#ifdef CONFIG_IPV6_PREFIXLIST + BUG_TRAP(list_empty(&idev->prefix_list) == 1); +#endif #ifdef NET_REFCNT_DEBUG printk(KERN_DEBUG "in6_dev_finish_destroy: %s\n", dev ? dev->name : "NIL"); #endif @@ -319,6 +325,10 @@ if (ndev) { memset(ndev, 0, sizeof(struct inet6_dev)); +#ifdef CONFIG_IPV6_PREFIXLIST + INIT_LIST_HEAD(&ndev->prefix_list); + ndev->prefix_lock = SPIN_LOCK_UNLOCKED; +#endif ndev->lock = RW_LOCK_UNLOCKED; ndev->dev = dev; memcpy(&ndev->cnf, &ipv6_devconf_dflt, sizeof(ndev->cnf)); @@ -746,6 +756,321 @@ } #endif +#ifdef CONFIG_IPV6_PREFIXLIST + +/* Adds a prefix to the list of prefixes on this interface */ +static int ipv6_add_prefix(struct inet6_dev *idev, struct prefix_info *pinfo, + __u32 lifetime, struct in6_addr *ra_addr, struct ra_msg *ra) +{ + int ifindex; + struct in6_addr prefix; + struct list_head *head; + struct prefix_element *p; + + ipv6_addr_prefix(&prefix, &pinfo->prefix, pinfo->prefix_len); + + /* Check if the prefix exists in our list */ + + read_lock_bh(&idev->lock); + spin_lock_bh(&idev->prefix_lock); + ifindex = idev->dev->ifindex; + list_for_each(head, &idev->prefix_list) { + p = list_entry(head, struct prefix_element, list); + if (p->pinfo.prefix_len == pinfo->prefix_len + && ipv6_addr_cmp(&p->pinfo.prefix, &prefix) == 0) { + /* Existing Prefix, modify it with new values */ + p->pinfo.valid = lifetime; + p->timestamp = jiffies; + ipv6_addr_copy(&p->ra_addr, ra_addr); + p->ra_flags = 0; /* overwrite prev value */ + if (ra->icmph.icmp6_addrconf_managed) + p->ra_flags |= ND_RA_FLAG_MANAGED; + if (ra->icmph.icmp6_addrconf_other) + p->ra_flags |= ND_RA_FLAG_OTHER; + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + return 0; + } + } + + /* New Prefix, allocate one and fill in */ + if ((p = kmalloc(sizeof(struct prefix_element), GFP_ATOMIC)) == NULL) { + ADBG(("ipv6_add_prefix: malloc failed\n")); + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + return -1; + } + memset(p, 0, sizeof(*p)); + INIT_LIST_HEAD(&p->list); + p->pinfo.valid = lifetime; + p->timestamp = jiffies; + p->pinfo.prefix_len = pinfo->prefix_len; + ipv6_addr_copy(&p->pinfo.prefix, &prefix); + ipv6_addr_copy(&p->ra_addr, ra_addr); + if (ra->icmph.icmp6_addrconf_managed) + p->ra_flags = ND_RA_FLAG_MANAGED; + if (ra->icmph.icmp6_addrconf_other) + p->ra_flags |= ND_RA_FLAG_OTHER; + + list_add(&p->list, idev->prefix_list.prev); /* add to end of list */ + idev->prefix_count++; + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + return 0; +} + +/* Kernel level interface to the prefix list */ +int ipv6_get_prefix_entries(struct prefix_info **plist, int ifindex, int plen) +{ + int count; + struct net_device *dev; + struct inet6_dev *idev; + struct list_head *head; + struct prefix_element *p; + + if (plist == NULL) { + BUG_TRAP(plist != NULL); + return -EINVAL; + } + if ((dev = dev_get_by_index(ifindex)) == NULL) { + printk(KERN_WARNING "Bad I/F (%d) in ipv6_get_prefix_entries\n", + ifindex); + return -EINVAL; + } + + if ((idev = __in6_dev_get(dev)) == NULL) { + dev_put(dev); + return -EINVAL; + } + + read_lock_bh(&idev->lock); + if (!(count = idev->prefix_count)) { + /* No elements on list */ + goto out; + } + if ((*plist = kmalloc(count * sizeof(struct prefix_info), + GFP_ATOMIC)) == NULL) { + count = -ENOMEM; + goto out; + } + count = 0; + spin_lock_bh(&idev->prefix_lock); + list_for_each(head, &idev->prefix_list) { + p = list_entry(head, struct prefix_element, list); + if (plen == 0 || p->pinfo.prefix_len == plen) { + memcpy(*plist + count, &p->pinfo, + sizeof(struct prefix_info)); + count++; + } + } + spin_unlock_bh(&idev->prefix_lock); + out: + read_unlock_bh(&idev->lock); + dev_put(dev); + return count; +} + +/* User level interface to the prefix list */ +int prefix_list_dump(struct sk_buff *skb, struct netlink_callback *cb) +{ + /* variables for manipulating prefix_list */ + int i, nprefixes, count; + struct net_device *dev; + struct inet6_dev *idev; + struct list_head *head; + struct prefix_element *p_el; + + /* variables for manipulating netlink */ + int type = cb->nlh->nlmsg_type; + struct nlmsghdr *nlh; + struct plist_user_info *pinfo; + unsigned char *b = skb->tail, *org_tail = skb->tail; + + read_lock(&dev_base_lock); + for (dev = dev_base; dev; dev = dev->next) { + if (!(idev = __in6_dev_get(dev))) + continue; + read_lock_bh(&idev->lock); + if (!(nprefixes = idev->prefix_count)) { + read_unlock_bh(&idev->lock); + continue; + } + nlh = NLMSG_PUT(skb, NETLINK_CB(cb->skb).pid, + cb->nlh->nlmsg_seq, type, sizeof(*pinfo) + + nprefixes * sizeof(struct var_plist_user_info)); + pinfo = NLMSG_DATA(nlh); + count = 0; + spin_lock_bh(&idev->prefix_lock); + list_for_each(head, &idev->prefix_list) { + p_el = list_entry(head, struct prefix_element, list); + if (!count) { /* store stuff first time */ + strcpy(pinfo->name, dev->name); + pinfo->ifindex = dev->ifindex; + } + pinfo->plist_vars[count].plen = p_el->pinfo.prefix_len; + pinfo->plist_vars[count].valid = p_el->pinfo.valid - + (jiffies - p_el->timestamp)/HZ; + if ((p_el->ra_flags & (ND_RA_FLAG_MANAGED | + ND_RA_FLAG_OTHER)) + == (ND_RA_FLAG_MANAGED|ND_RA_FLAG_OTHER)) + strcpy(pinfo->plist_vars[count].flags, "MO"); + else if (p_el->ra_flags & ND_RA_FLAG_MANAGED) + strcpy(pinfo->plist_vars[count].flags, "M"); + else if (p_el->ra_flags & ND_RA_FLAG_OTHER) + strcpy(pinfo->plist_vars[count].flags, "O"); + else + strcpy(pinfo->plist_vars[count].flags, "-"); + ipv6_addr_copy(&pinfo->plist_vars[count].ra_addr, + &p_el->ra_addr); + for (i = 0; i < 8; i++) + pinfo->plist_vars[count].ra_addr.s6_addr16[i] = + __constant_ntohs(pinfo->plist_vars[count].ra_addr.s6_addr16[i]); + ipv6_addr_copy(&pinfo->plist_vars[count].prefix, + &p_el->pinfo.prefix); + for (i = 0; i < p_el->pinfo.prefix_len/16; i++) + pinfo->plist_vars[count].prefix.s6_addr16[i] = + __constant_ntohs(pinfo->plist_vars[count].prefix.s6_addr16[i]); + count++; + } + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + BUG_TRAP(nprefixes == count); + pinfo->nprefixes = count; + nlh->nlmsg_len = skb->tail - org_tail; + org_tail = skb->tail; + } + read_unlock(&dev_base_lock); + return skb->len; + +nlmsg_failure : + read_unlock_bh(&idev->lock); + read_unlock(&dev_base_lock); + skb_trim(skb, b - skb->data); + return -1; +} + +/* Expire prefixes from the idev list periodically */ +static void ipv6_expire_prefixes(void) +{ + unsigned long now = jiffies; + struct net_device *dev; + struct inet6_dev *idev; + struct list_head *head, *next; + struct prefix_element *p; + unsigned long age; + + read_lock(&dev_base_lock); + for (dev = dev_base; dev; dev = dev->next) { + if (!(idev = __in6_dev_get(dev))) { + continue; + } + read_lock_bh(&idev->lock); + if (!idev->prefix_count) { + read_unlock_bh(&idev->lock); + continue; + } + spin_lock_bh(&idev->prefix_lock); + list_for_each_safe(head, next, &idev->prefix_list) { + p = list_entry(head, struct prefix_element, list); + if (p->pinfo.valid != INFINITE) { + age = (now - p->timestamp) / HZ; + if (age > p->pinfo.valid) { + idev->prefix_count--; + list_del(&p->list); + kfree(p); + } + } + } + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + } + read_unlock(&dev_base_lock); +} + +#ifdef CONFIG_PROC_FS + +/* OPTIONAL alternate interface to prefix list via /proc filesystem */ +static int prefix_list_proc_dump(char *buffer, char **start, off_t offset, + int length) +{ + int i; + int len = 0; + off_t pos=0; + off_t begin=0; + + struct net_device *dev; + struct inet6_dev *idev; + struct list_head *head; + struct prefix_element *p; + + read_lock(&dev_base_lock); + for (dev = dev_base; dev; dev = dev->next) { + if (!(idev = __in6_dev_get(dev))) { + continue; + } + read_lock_bh(&idev->lock); + spin_lock_bh(&idev->prefix_lock); + if (list_empty(&idev->prefix_list)) { + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + continue; + } + list_for_each(head, &idev->prefix_list) { + p = list_entry(head, struct prefix_element, list); + len += sprintf(buffer + len, "%-6s %-4d %-4d", + dev->name, dev->ifindex, p->pinfo.prefix_len); + if ((p->ra_flags & (ND_RA_FLAG_MANAGED | + ND_RA_FLAG_OTHER)) + == (ND_RA_FLAG_MANAGED|ND_RA_FLAG_OTHER)) + len += sprintf(buffer + len, "%-4s", "MO"); + else if (p->ra_flags & ND_RA_FLAG_MANAGED) + len += sprintf(buffer + len, "%-4s", "M"); + else if (p->ra_flags & ND_RA_FLAG_OTHER) + len += sprintf(buffer + len, "%-4s", "O"); + else + len += sprintf(buffer + len, "%-4s", "-"); + for (i = 0; i < p->pinfo.prefix_len / 8; i++) { + sprintf(buffer + len, "%02x", + p->pinfo.prefix.s6_addr[i]); + len += 2; + } + len += sprintf(buffer + len, "%-4s", " "); + for (i = 0; i < 16; i++) { + sprintf(buffer + len, "%02x", + p->ra_addr.s6_addr[i]); + len += 2; + } + len += sprintf(buffer + len, "\n"); + pos=begin+len; + if(posoffset+length) { + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + goto done; + } + } + spin_unlock_bh(&idev->prefix_lock); + read_unlock_bh(&idev->lock); + } +done: + read_unlock(&dev_base_lock); + + *start=buffer+(offset-begin); + len-=(offset-begin); + if(len>length) + len=length; + if(len<0) + len=0; + return len; +} + +#endif /* CONFIG_PROC_FS */ + +#endif /* CONFIG_IPV6_PREFIXLIST */ + /* * Choose an appropriate source address * should do: @@ -1281,7 +1606,8 @@ return idev; } -void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) +void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, + struct in6_addr *ra_addr, struct ra_msg *ra) { struct prefix_info *pinfo; struct rt6_info *rt; @@ -1355,6 +1681,12 @@ addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES); } +#ifdef CONFIG_IPV6_PREFIXLIST + if (pinfo->onlink && valid_lft) + /* Add this prefix to the list of prefixes on this interface */ + ipv6_add_prefix(in6_dev, pinfo, valid_lft, ra_addr, ra); +#endif + if (rt) dst_release(&rt->u.dst); @@ -1851,6 +2183,10 @@ struct inet6_dev *idev; struct inet6_ifaddr *ifa, **bifa; int i; +#ifdef CONFIG_IPV6_PREFIXLIST + struct list_head *head, *next; + struct prefix_element *p; +#endif ASSERT_RTNL(); @@ -1913,6 +2249,17 @@ else ipv6_mc_down(idev); +#ifdef CONFIG_IPV6_PREFIXLIST + /* Step 5: Free up Prefix List */ + spin_lock_bh(&idev->prefix_lock); + list_for_each_safe(head, next, &idev->prefix_list) { + p = list_entry(head, struct prefix_element, list); + kfree(p); + } + INIT_LIST_HEAD(&idev->prefix_list); + spin_unlock_bh(&idev->prefix_lock); +#endif + /* Shot the device (if unregistered) */ if (how == 1) { @@ -2141,6 +2488,7 @@ return len; } + #endif /* CONFIG_PROC_FS */ /* @@ -2241,6 +2589,15 @@ write_unlock(&addrconf_hash_lock); } +#ifdef CONFIG_IPV6_PREFIXLIST + /* + * We need to expire prefixes even if no addresses are deleted in the + * loop above, since autoconfiguration may not be set in all router + * advertisements. + */ + ipv6_expire_prefixes(); +#endif + addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next; add_timer(&addr_chk_timer); spin_unlock_bh(&addrconf_verify_lock); @@ -2692,6 +3049,10 @@ void __init addrconf_init(void) { +#ifdef CONFIG_IPV6_PREFIXLIST + struct rtnetlink_link *link_p; +#endif + #ifdef MODULE struct net_device *dev; #endif @@ -2730,7 +3091,16 @@ #ifdef CONFIG_PROC_FS proc_net_create("if_inet6", 0, iface_proc_info); #endif - + +#ifdef CONFIG_IPV6_PREFIXLIST + if ((link_p = rtnetlink_links[PF_UNSPEC]) != NULL) /* PF_INET6 ? */ + link_p[RTM_GETPLIST - RTM_BASE].dumpit = prefix_list_dump; +#ifdef CONFIG_PROC_FS + /* OPTIONAL alternate interface to prefix list via /proc filesystem */ + proc_net_create("ra6", 0, prefix_list_proc_dump); +#endif +#endif + addrconf_verify(0); rtnetlink_links[PF_INET6] = inet6_rtnetlink_table; #ifdef CONFIG_SYSCTL @@ -2798,6 +3168,9 @@ #ifdef CONFIG_PROC_FS proc_net_remove("if_inet6"); +#ifdef CONFIG_IPV6_PREFIXLIST + proc_net_remove("ra6"); +#endif #endif } #endif /* MODULE */ diff -ruN linux-2.5.70.org/net/ipv6/ndisc.c linux-2.5.70/net/ipv6/ndisc.c --- linux-2.5.70.org/net/ipv6/ndisc.c 2003-05-26 18:00:41.000000000 -0700 +++ linux-2.5.70/net/ipv6/ndisc.c 2003-05-30 15:14:46.000000000 -0700 @@ -1146,7 +1146,8 @@ for (p = ndopts.nd_opts_pi; p; p = ndisc_next_option(p, ndopts.nd_opts_pi_end)) { - addrconf_prefix_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3); + addrconf_prefix_rcv(skb->dev, (u8*)p, + (p->nd_opt_len) << 3, &skb->nh.ipv6h->saddr, ra_msg); } } From yoshfuji@linux-ipv6.org Fri May 30 19:02:10 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 19:02:20 -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.9) with SMTP id h4V2292x018783 for ; Fri, 30 May 2003 19:02:10 -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 h4V22nBo025154; Sat, 31 May 2003 11:02:50 +0900 Date: Sat, 31 May 2003 11:02:49 +0900 (JST) Message-Id: <20030531.110249.12960077.yoshfuji@linux-ipv6.org> To: krkumar@us.ibm.com Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: [PATCH] Prefix List patch against 2.5.70 From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= In-Reply-To: <3ED80230.2030508@us.ibm.com> References: <3ED80230.2030508@us.ibm.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: 2789 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 <3ED80230.2030508@us.ibm.com> (at Fri, 30 May 2003 18:15:28 -0700), Krishna Kumar says: > +/* prefix list returned to user space in this structure */ > +struct plist_user_info { ^ip6 or ipv6 or so. > + char name[IFNAMSIZ]; /* interface name */ ~~~~~~~~~~~~~~~~~~~duplicate information. > + int ifindex; /* interface index */ > + int nprefixes; /* number of elements in 'prefix' */ > + struct var_plist_user_info { /* multiple elements */ > + char flags[3]; /* router advertised flags */ ~~~~~~~~this is not good interface. > + int plen; /* prefix length */ > + __u32 valid; /* valid lifetime */ > + struct in6_addr ra_addr;/* advertising router */ > + struct in6_addr prefix; /* prefix */ > + } plist_vars[0]; > +}; > + > extern void addrconf_init(void); > extern void addrconf_cleanup(void); > : I think we should use 1 fixed-length message per prefix, instead of variable length message. > + pinfo->plist_vars[count].plen = p_el->pinfo.prefix_len; > + pinfo->plist_vars[count].valid = p_el->pinfo.valid - > + (jiffies - p_el->timestamp)/HZ; > + if ((p_el->ra_flags & (ND_RA_FLAG_MANAGED | > + ND_RA_FLAG_OTHER)) > + == (ND_RA_FLAG_MANAGED|ND_RA_FLAG_OTHER)) > + strcpy(pinfo->plist_vars[count].flags, "MO"); > + else if (p_el->ra_flags & ND_RA_FLAG_MANAGED) > + strcpy(pinfo->plist_vars[count].flags, "M"); > + else if (p_el->ra_flags & ND_RA_FLAG_OTHER) > + strcpy(pinfo->plist_vars[count].flags, "O"); > + else > + strcpy(pinfo->plist_vars[count].flags, "-"); > + ipv6_addr_copy(&pinfo->plist_vars[count].ra_addr, > + &p_el->ra_addr); > + for (i = 0; i < 8; i++) > + pinfo->plist_vars[count].ra_addr.s6_addr16[i] = > + __constant_ntohs(pinfo->plist_vars[count].ra_addr.s6_addr16[i]); > + ipv6_addr_copy(&pinfo->plist_vars[count].prefix, > + &p_el->pinfo.prefix); > + for (i = 0; i < p_el->pinfo.prefix_len/16; i++) > + pinfo->plist_vars[count].prefix.s6_addr16[i] = > + __constant_ntohs(pinfo->plist_vars[count].prefix.s6_addr16[i]); Absoletely nasty. - don't use charaters to represent flags; use real flags. - use network-byte order. > +static int prefix_list_proc_dump(char *buffer, char **start, off_t offset, > + int length) > +{ : Please use seq_file. Again, what I proposed was to store prefix information on fib with some flags to represent advertised by routers and give user-space the RA information using new rtattr (RTA_RA6INFO or something like that). struct rta_ra6info { u32 rta_ra6flags; }; -- Hideaki YOSHIFUJI @ USAGI Project GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA From rddunlap@osdl.org Fri May 30 20:22:19 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 20:22:26 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4V3MI2x019841 for ; Fri, 30 May 2003 20:22:18 -0700 Received: from fire-1.osdl.org (air1.pdx.osdl.net [172.20.0.5]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h4V3MCX24629; Fri, 30 May 2003 20:22:12 -0700 Received: from osdl.org (fire.osdl.org [65.172.181.4]) by fire-1.osdl.org (8.12.8/8.11.6) with SMTP id h4V3MC5C006484; Fri, 30 May 2003 20:22:12 -0700 Received: from 4.64.196.31 (SquirrelMail authenticated user rddunlap) by www.osdl.org with HTTP; Fri, 30 May 2003 20:22:12 -0700 (PDT) Message-ID: <32804.4.64.196.31.1054351332.squirrel@www.osdl.org> Date: Fri, 30 May 2003 20:22:12 -0700 (PDT) Subject: Re: netlink tester program From: "Randy.Dunlap" To: In-Reply-To: <20030530.171111.71099698.davem@redhat.com> References: <20030530090015.7c435c9a.rddunlap@osdl.org> <20030530.171111.71099698.davem@redhat.com> X-Priority: 3 Importance: Normal Cc: , , X-Mailer: SquirrelMail (version 1.2.11) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 2790 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 > From: "Randy.Dunlap" > Date: Fri, 30 May 2003 09:00:15 -0700 > > I tried to write a simple test program for (rt)netlink, but I didn't > succeed I'm sorry to say. Does anyone have one or know of one? > [alternative plan is to use kgdb to determine why my test program is > failing...] > > I bet if you actually posted your test program, you'll get more > feedback... I did think of that. Oh well, it's at this URL, bugs and all. http://www.xenotime.net/linux/ipv6/rtnl_test.c It's a heavily modified version of a posting like so: /* original name = testIPv6.c */ /* author: amit.limaye@patni.com */ And I'll be looking at Herbert's traceroute function also. Thanks, ~Randy From davem@redhat.com Fri May 30 23:34:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 23:34:59 -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.9) with SMTP id h4V6Yt2x022114 for ; Fri, 30 May 2003 23:34:55 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA12393; Fri, 30 May 2003 23:32:57 -0700 Date: Fri, 30 May 2003 23:32:57 -0700 (PDT) Message-Id: <20030530.233257.21920899.davem@redhat.com> To: yoshfuji@linux-ipv6.org Cc: krkumar@us.ibm.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: [PATCH] Prefix List patch against 2.5.70 From: "David S. Miller" In-Reply-To: <20030531.110249.12960077.yoshfuji@linux-ipv6.org> References: <3ED80230.2030508@us.ibm.com> <20030531.110249.12960077.yoshfuji@linux-ipv6.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-archive-position: 2792 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 From: YOSHIFUJI Hideaki / $B5HF#1QL@(B Date: Sat, 31 May 2003 11:02:49 +0900 (JST) Again, what I proposed was to store prefix information on fib with some flags to represent advertised by routers and give user-space the RA information using new rtattr (RTA_RA6INFO or something like that). This sounds very reasonable. From davem@redhat.com Fri May 30 23:34:26 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 23:34: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.9) with SMTP id h4V6YP2x022080 for ; Fri, 30 May 2003 23:34:26 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA12387; Fri, 30 May 2003 23:32:29 -0700 Date: Fri, 30 May 2003 23:32:29 -0700 (PDT) Message-Id: <20030530.233229.08331783.davem@redhat.com> To: krkumar@us.ibm.com Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, linux-net@vger.kernel.org Subject: Re: [PATCH] Prefix List patch against 2.5.70 From: "David S. Miller" In-Reply-To: <3ED80230.2030508@us.ibm.com> References: <3ED80230.2030508@us.ibm.com> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2791 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 From: Krishna Kumar Date: Fri, 30 May 2003 18:15:28 -0700 This code is so gross.. +/* prefix list returned to user space in this structure */ +struct plist_user_info { + char name[IFNAMSIZ]; /* interface name */ + int ifindex; /* interface index */ Just as Yoshfuji said, name is determinable with ifindex alone. Don't duplicate information. + struct var_plist_user_info { /* multiple elements */ + char flags[3]; /* router advertised flags */ BARF +#ifdef CONFIG_IPV6_PREFIXLIST + BUG_TRAP(list_empty(&idev->prefix_list) == 1); +#endif list_empty() returns a boolean, which for true is not necessarily the integer value "1". This will therefore never trigger when it should on cpus which use "-1" as the boolean value true. You have all of this complexity which duplicates work made by the routing code to keep track of these kinds of entities. Your "takes a long time to walk the routes" argument is NULL and void, what if I have 6,000 VLAN interfaces configured up speaking ipv6? This is not a hypothetical situation, I know people who do this. If you're worried about search complexity, you can keep the "interesting" routes on a special linked list to avoid having to walk all of the routes. These prefix things really do seem like route attributes. That is 1,000 times cleaner than this thing you are showing us. From davem@redhat.com Fri May 30 23:43:40 2003 Received: with ECARTIS (v1.0.0; list netdev); Fri, 30 May 2003 23:43: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.9) with SMTP id h4V6ha2x022805 for ; Fri, 30 May 2003 23:43:40 -0700 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id XAA12430; Fri, 30 May 2003 23:42:12 -0700 Date: Fri, 30 May 2003 23:42:11 -0700 (PDT) Message-Id: <20030530.234211.102567405.davem@redhat.com> To: rddunlap@osdl.org Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: netlink tester program From: "David S. Miller" In-Reply-To: <32804.4.64.196.31.1054351332.squirrel@www.osdl.org> References: <20030530090015.7c435c9a.rddunlap@osdl.org> <20030530.171111.71099698.davem@redhat.com> <32804.4.64.196.31.1054351332.squirrel@www.osdl.org> X-FalunGong: Information control. X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 2793 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 From: "Randy.Dunlap" Date: Fri, 30 May 2003 20:22:12 -0700 (PDT) Oh well, it's at this URL, bugs and all. http://www.xenotime.net/linux/ipv6/rtnl_test.c I know you don't want to use libnetlink from iproute2, but I want to stress that it takes care of all of the minutae of netlink socket usage that you have to duplicate in your little test program and this duplication leads to bugs. Firstly, you needs to be fixed to call recvmsg() multiple times, you'll get one entry for each recvmsg call in the table you are querying. You really need something like rtnl_talk() or rtnl_dump_filter() from libnetlink to do this properly. From ak@suse.de Sat May 31 05:09:53 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 31 May 2003 05:10:01 -0700 (PDT) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4VC9k2x030384 for ; Sat, 31 May 2003 05:09:53 -0700 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 9844C148D4; Sat, 31 May 2003 14:09:40 +0200 (MEST) Date: Sat, 31 May 2003 14:09:40 +0200 From: Andi Kleen To: "David S. Miller" Cc: rddunlap@osdl.org, linux-net@vger.kernel.org, netdev@oss.sgi.com Subject: Re: netlink tester program Message-ID: <20030531120940.GB11898@wotan.suse.de> References: <20030530090015.7c435c9a.rddunlap@osdl.org> <20030530.171111.71099698.davem@redhat.com> <32804.4.64.196.31.1054351332.squirrel@www.osdl.org> <20030530.234211.102567405.davem@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030530.234211.102567405.davem@redhat.com> X-archive-position: 2794 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 > You really need something like rtnl_talk() or rtnl_dump_filter() > from libnetlink to do this properly. In case it's helpful I wrote manpages for libnetlink some time ago. I also have some simple example programs using it. Other examples can be found in the zebra or bird source code. -Andi -Andi libnetlink(3) libnetlink(3) NAME libnetlink - A library for accessing the netlink service SYNOPSIS #include #include #include #include int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) int rtnl_send(struct rtnl_handle *rth, char *buf, int len) int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) int rtnl_dump_filter(struct rtnl_handle *rth, int (*filter)(struct sockaddr_nl *, struct nlmsghdr *n, void *), void *arg1, int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *arg2) int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, unsigned groups, struct nlmsghdr *answer, int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int rtnl_listen(struct rtnl_handle *rtnl, int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int rtnl_from_file(FILE *rtnl, int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data) int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data) int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) DESCRIPTION libnetlink provides a higher level interface to rtnetlink(7). The read functions return 0 on success and a negative errno on failure. The send functions return the amount of data sent, or -1 on error. rtnl_open Open a rtnetlink socket and save the state into the rth handle. This handle is passed to all subsequent calls. subscriptions is a bitmap of the rtnetlink multicast groups the socket will be a member of. rtnl_wilddump_request Request a full dump of the type database for family addresses. type is a rtnetlink message type. rtnl_dump_request Request a full dump of the type data buffer into buf with maximum length of len. type is a rtnetlink message type. rtnl_dump_filter Receive netlink data after a request and filter it. The filter callback checks if the received message is wanted. It gets the source address of the mes- sage, the message itself and arg1 as arguments. 0 as return means that the filter passed, a negative value is returned by rtnl_dump_filter in case of error. NULL for filter means to not use a filter. junk is used to filter messages not destined to the local socket. Only one message bundle is received. Unless there is no message pending, this function does not block. rtnl_listen Receive netlink data after a request and pass it to handler. handler is a callback that gets the mes- sage source address, the message itself, and the jarg cookie as arguments. It will get called for all received messages. Only one message bundle is received. Unless there is no message pending this function does not block. rtnl_from_file Works like rtnl_listen, but reads a netlink message bundle from the file file and passes the messages to handler for parsing. The file contains raw data as received from a rtnetlink socket. The following functions are useful to construct custom rtnetlink messages. For simple database dumping with fil- tering it is better to use the higher level functions above. See rtnetlink(3) and netlink(3) on how to generate a rtnetlink message. The following utility functions require a continuous buffer that already contains a netlink message header and a rtnetlink request. rtnl_send Send the rtnetlink message in buf of length len to handle rth. addattr32 Add a __u32 attribute of type type and with value data to netlink message n, which is part of a buffer of length maxlen. addattr_l Add a variable length attribute of type type and with value data and alen length to netlink message n, which is part of a buffer of length maxlen. data is copied. rta_addattr32 Initialize the rtnetlink attribute rta with a __u32 data value. rta_addattr32 Initialize the rtnetlink attribute rta with a vari- able length data value. BUGS The functions sometimes use fprintf and exit when a fatal error occurs. This library should be named librtnetlink. AUTHORS netlink/rtnetlink was designed and written by Alexey Kuznetsov. Andi Kleen wrote the man page. SEE ALSO netlink(7), rtnetlink(7) /usr/include/linux/rtnetlink.h libnetlink(3) > From mk@karaba.org Sat May 31 08:20:47 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 31 May 2003 08:20:59 -0700 (PDT) Received: from zanzibar.karaba.org (karaba.org [218.219.152.88] (may be forged)) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4VFKj2x002368 for ; Sat, 31 May 2003 08:20:46 -0700 Received: from [3ffe:501:1057:710::53] (helo=hyakusiki.karaba.org) by zanzibar.karaba.org with esmtp (Exim 3.35 #1 (Debian)) id 19M89R-0000cc-00; Sun, 01 Jun 2003 00:20:10 +0900 Date: Sun, 01 Jun 2003 00:20:07 +0900 Message-ID: <87fzmv5ejc.wl@karaba.org> From: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= To: davem@redhat.com, jmorris@intercode.com.au, kuznet@ms2.inr.ac.ru Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org Subject: [PATCH] xfrm ip6ip6 MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII X-archive-position: 2795 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: mk@karaba.org Precedence: bulk X-list: netdev Hello, Here is the xfrm style ip6ip6 patch, which is against linux-2.5.70+CS1.1254.2.15. I honestly have to say it is not tested well. But I promise I'll test/fix after xfrm tunnel tool will be visible :-) (Does anyone work on this?) Anyway, I have one discussion point. When we use 'setkey -D', xfrm ipip tunnels are displayed as unspec SAs. Do we need to filter out these xfrm_states other than AH/ESP/IPcomp in case of PF_KEY based queries? Regards, -mk Index: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/include/net/xfrm.h =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/include/net/xfrm.h,v retrieving revision 1.1.1.23 retrieving revision 1.1.1.23.10.1 diff -u -r1.1.1.23 -r1.1.1.23.10.1 --- linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/include/net/xfrm.h 26 May 2003 08:04:25 -0000 1.1.1.23 +++ linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/include/net/xfrm.h 31 May 2003 08:52:20 -0000 1.1.1.23.10.1 @@ -493,8 +493,16 @@ } /* placeholder until xfrm6_tunnel.c is written */ -static inline int xfrm6_tunnel_check_size(struct sk_buff *skb) -{ return 0; } +extern int xfrm6_tunnel_check_size(struct sk_buff *skb); +#define XFRM_ADDR_HSIZE 1024 +static __inline__ /* same as __xfrm6_dst_hash */ +unsigned xfrm6_tunnel_addr_hash(xfrm_address_t *addr) +{ + unsigned h; + h = ntohl(addr->a6[2]^addr->a6[3]); + h = (h ^ (h>>16)) % XFRM_DST_HSIZE; + return h; +} /* A struct encoding bundle of transformations to apply to some set of flow. * Index: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/Makefile =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/Makefile,v retrieving revision 1.1.1.12 retrieving revision 1.1.1.12.10.1 diff -u -r1.1.1.12 -r1.1.1.12.10.1 --- linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/Makefile 26 May 2003 08:04:11 -0000 1.1.1.12 +++ linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/Makefile 31 May 2003 08:56:24 -0000 1.1.1.12.10.1 @@ -9,7 +9,7 @@ protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \ exthdrs.o sysctl_net_ipv6.o datagram.o proc.o \ ip6_flowlabel.o ipv6_syms.o \ - xfrm6_policy.o xfrm6_state.o xfrm6_input.o + xfrm6_policy.o xfrm6_state.o xfrm6_input.o xfrm6_tunnel.o obj-$(CONFIG_INET6_AH) += ah6.o obj-$(CONFIG_INET6_ESP) += esp6.o Index: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/ipcomp6.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ipcomp6.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.2.8.2 diff -u -r1.1.1.2 -r1.1.1.2.8.2 --- linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/ipcomp6.c 21 May 2003 13:15:20 -0000 1.1.1.2 +++ linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/ipcomp6.c 31 May 2003 14:19:54 -0000 1.1.1.2.8.2 @@ -254,6 +254,66 @@ xfrm_state_put(x); } +static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x) +{ + struct xfrm_state *t = NULL; + + t = xfrm_state_alloc(); + if (!t) + goto out; + + t->id.proto = IPPROTO_IPV6; + t->id.spi = xfrm6_tunnel_addr_hash((xfrm_address_t *)&x->props.saddr); + memcpy(t->id.daddr.a6, x->id.daddr.a6, sizeof(struct in6_addr)); + memcpy(&t->sel, &x->sel, sizeof(t->sel)); + t->props.family = AF_INET6; + t->props.mode = 1; + memcpy(t->props.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr)); + + t->type = xfrm_get_type(IPPROTO_IPV6, t->props.family); + if (t->type == NULL) + goto error; + + if (t->type->init_state(t, NULL)) + goto error; + + t->km.state = XFRM_STATE_VALID; + atomic_set(&t->tunnel_users, 1); + +out: + return t; + +error: + xfrm_state_put(t); + goto out; +} + +static int ipcomp6_tunnel_attach(struct xfrm_state *x) +{ + int err = 0; + struct xfrm_state *t; + u32 spi; + + spi = xfrm6_tunnel_addr_hash((xfrm_address_t *)&x->props.saddr); + + t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr, + spi, IPPROTO_IPV6, AF_INET6); + if (!t) { + t = ipcomp6_tunnel_create(x); + if (!t) { + err = -EINVAL; + goto out; + } + xfrm_state_insert(t); + xfrm_state_hold(t); + } + x->tunnel = t; + atomic_inc(&t->tunnel_users); + +out: + return err; +} + static void ipcomp6_free_data(struct ipcomp_data *ipcd) { if (ipcd->tfm) @@ -292,6 +352,12 @@ ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0); if (!ipcd->tfm) goto error; + + if (x->props.mode) { + err = ipcomp6_tunnel_attach(x); + if (err) + goto error; + } calg_desc = xfrm_calg_get_byname(x->calg->alg_name); BUG_ON(!calg_desc); Index: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/xfrm6_tunnel.c =================================================================== RCS file: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/xfrm6_tunnel.c diff -N linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/xfrm6_tunnel.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/ipv6/xfrm6_tunnel.c 31 May 2003 14:03:12 -0000 1.1.4.2 @@ -0,0 +1,259 @@ +/* + * Copyright (C)2003 USAGI/WIDE Project + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author Mitsuru KANDA + * + * Based on xfrm4_tunnel + * + */ +#include +#include +#include +#include +#include +#include +#include +#include + +int xfrm6_tunnel_check_size(struct sk_buff *skb) +{ + int mtu, ret = 0; + struct dst_entry *dst = skb->dst; + + mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr); + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + + if (skb->len > mtu) { + icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); + ret = -EMSGSIZE; + } + + return ret; +} + +static int ip6ip6_output(struct sk_buff *skb) +{ + struct dst_entry *dst = skb->dst; + struct xfrm_state *x = dst->xfrm; + struct ipv6hdr *iph, *top_iph; + int err; + + if ((err = xfrm6_tunnel_check_size(skb)) != 0) + goto error_nolock; + + iph = skb->nh.ipv6h; + + top_iph = (struct ipv6hdr *)skb_push(skb, x->props.header_len); + top_iph->version = 6; + top_iph->priority = iph->priority; + top_iph->flow_lbl[0] = iph->flow_lbl[0]; + top_iph->flow_lbl[1] = iph->flow_lbl[1]; + top_iph->flow_lbl[2] = iph->flow_lbl[2]; + top_iph->nexthdr = IPPROTO_IPV6; + top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); + top_iph->hop_limit = iph->hop_limit; + memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr)); + memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr)); + skb->nh.raw = skb->data; + skb->h.raw = skb->nh.raw + sizeof(struct ipv6hdr); + + x->curlft.bytes += skb->len; + x->curlft.packets++; + + spin_unlock_bh(&x->lock); + + if ((skb->dst = dst_pop(dst)) == NULL) { + kfree_skb(skb); + err = -EHOSTUNREACH; + goto error_nolock; + } + + return NET_XMIT_BYPASS; + +error_nolock: + kfree_skb(skb); + return err; +} + +static int ip6ip6_xfrm_rcv(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) +{ + if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) + return -EINVAL; + + skb->mac.raw = skb->nh.raw; + skb->nh.raw = skb->data; + dst_release(skb->dst); + skb->dst = NULL; + skb->protocol = htons(ETH_P_IPV6); + skb->pkt_type = PACKET_HOST; + netif_rx(skb); + + return 0; +} + +static int ip6ip6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) +{ + struct sk_buff *skb = *pskb; + struct xfrm_state *x = NULL; + struct ipv6hdr *iph = skb->nh.ipv6h; + int err = 0; + u32 spi; + + /* After device-like ip6ip6 tunnel will be implemented, + * we do take precedence here. + * (currently not yet exist in kernel source tree.) + * For more information, see xfrm4_tunnel.c + */ + /* device-like_ip6ip6_handler() */ + + spi = xfrm6_tunnel_addr_hash((xfrm_address_t *)&iph->saddr); + x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, + spi, + IPPROTO_IPV6, AF_INET6); + + if (!x) + goto drop; + + spin_lock(&x->lock); + + if (unlikely(x->km.state != XFRM_STATE_VALID)) + goto drop_unlock; + + err = ip6ip6_xfrm_rcv(x, NULL, skb); + if (err) + goto drop_unlock; + + x->curlft.bytes += skb->len; + x->curlft.packets++; + spin_unlock(&x->lock); + xfrm_state_put(x); + + *nhoffp = sizeof(struct ipv6hdr); + + return 1; + +drop_unlock: + spin_unlock(&x->lock); + xfrm_state_put(x); +drop: + kfree_skb(skb); + + return -1; +} + +static void ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + int type, int code, int offset, __u32 info) +{ + /* call here first for device-like ip6ip6 err handling */ + /* foo->err_handler(), see xfrm4_tunnel.c */ + + /* xfrm ip6ip6 native err handling */ + switch (type) { + case ICMPV6_DEST_UNREACH: + switch (code) { + case ICMPV6_NOROUTE: + case ICMPV6_ADM_PROHIBITED: + case ICMPV6_NOT_NEIGHBOUR: + case ICMPV6_ADDR_UNREACH: + case ICMPV6_PORT_UNREACH: + default: + printk(KERN_ERR "xfrm ip6ip6: Destination Unreach.\n"); + break; + } + break; + case ICMPV6_PKT_TOOBIG: + printk(KERN_ERR "xfrm ip6ip6: Packet Too Big.\n"); + break; + case ICMPV6_TIME_EXCEED: + switch (code) { + case ICMPV6_EXC_HOPLIMIT: + printk(KERN_ERR "xfrm ip6ip6: Too small Hoplimit.\n"); + break; + case ICMPV6_EXC_FRAGTIME: + default: + break; + } + break; + case ICMPV6_PARAMPROB: + switch (code) { + case ICMPV6_HDR_FIELD: break; + case ICMPV6_UNK_NEXTHDR: break; + case ICMPV6_UNK_OPTION: break; + } + break; + default: + break; + } + return; +} + +static int ip6ip6_init_state(struct xfrm_state *x, void *args) +{ + if (!x->props.mode) + return -EINVAL; + + x->props.header_len = sizeof(struct ipv6hdr); + + return 0; +} + +static void ip6ip6_destroy(struct xfrm_state *x) +{ +} + +static struct xfrm_type ip6ip6_type = { + .description = "IP6IP6", + .owner = THIS_MODULE, + .proto = IPPROTO_IPV6, + .init_state = ip6ip6_init_state, + .destructor = ip6ip6_destroy, + .input = ip6ip6_xfrm_rcv, + .output = ip6ip6_output, +}; + +static struct inet6_protocol ip6ip6_protocol = { + .handler = ip6ip6_rcv, + .err_handler = ip6ip6_err, + .flags = INET6_PROTO_NOPOLICY, +}; + +static int __init ip6ip6_init(void) +{ + if (xfrm_register_type(&ip6ip6_type, AF_INET6) < 0) { + printk(KERN_INFO "ip6ip6 init: can't add xfrm type\n"); + return -EAGAIN; + } + if (inet6_add_protocol(&ip6ip6_protocol, IPPROTO_IPV6) < 0) { + printk(KERN_INFO "ip6ip6 init: can't add protocol\n"); + xfrm_unregister_type(&ip6ip6_type, AF_INET6); + return -EAGAIN; + } + return 0; +} + +static void __exit ip6ip6_fini(void) +{ + if (inet6_del_protocol(&ip6ip6_protocol, IPPROTO_IPV6) < 0) + printk(KERN_INFO "ip6ip6 close: can't remove protocol\n"); + if (xfrm_unregister_type(&ip6ip6_type, AF_INET6) < 0) + printk(KERN_INFO "ip6ip6 close: can't remove xfrm type\n"); +} + +module_init(ip6ip6_init); +module_exit(ip6ip6_fini); +MODULE_LICENSE("GPL"); Index: linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/xfrm/xfrm_output.c =================================================================== RCS file: /cvsroot/usagi/usagi-backport/linux25/net/xfrm/xfrm_output.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.16.1 diff -u -r1.1.1.1 -r1.1.1.1.16.1 --- linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/xfrm/xfrm_output.c 6 May 2003 12:43:55 -0000 1.1.1.1 +++ linux25-b2_5_70+CS1_1254_2_15_XFRM6_TUNNEL_20030531/net/xfrm/xfrm_output.c 31 May 2003 08:54:21 -0000 1.1.1.1.16.1 @@ -28,9 +28,11 @@ err = xfrm4_tunnel_check_size(skb); break; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) case AF_INET6: err = xfrm6_tunnel_check_size(skb); break; +#endif default: err = -EINVAL; From jmorris@intercode.com.au Sat May 31 09:02:56 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 31 May 2003 09:03:06 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:jDs1zsANr/p3x0kXlkx8YAhSEj+T4UPn@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4VG2r2x003055 for ; Sat, 31 May 2003 09:02:55 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4VG1gr01887; Sun, 1 Jun 2003 02:01:42 +1000 Date: Sun, 1 Jun 2003 02:01:42 +1000 (EST) From: James Morris To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , Subject: Re: [PATCH] xfrm ip6ip6 In-Reply-To: <87fzmv5ejc.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2796 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Sun, 1 Jun 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > Anyway, I have one discussion point. > When we use 'setkey -D', xfrm ipip tunnels are displayed as unspec SAs. > Do we need to filter out these xfrm_states other than AH/ESP/IPcomp > in case of PF_KEY based queries? Good question. We need to either filter them out or make sure they are displayed as ipip. Part of the answer will depend on whether we want to expose xfrm-based ipip tunnels for general use, or only use them internally for ipcomp. - James -- James Morris From jmorris@intercode.com.au Sat May 31 09:07:01 2003 Received: with ECARTIS (v1.0.0; list netdev); Sat, 31 May 2003 09:07:09 -0700 (PDT) Received: from blackbird.intercode.com.au (IDENT:glPgLPIDodZ7cio6dkbpNWhQz3zB9Dnn@blackbird.intercode.com.au [203.32.101.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h4VG6u2x003398 for ; Sat, 31 May 2003 09:07:00 -0700 Received: from excalibur.intercode.com.au (excalibur.intercode.com.au [203.32.101.12]) by blackbird.intercode.com.au (8.11.6p2/8.9.3) with ESMTP id h4VG68r01911; Sun, 1 Jun 2003 02:06:08 +1000 Date: Sun, 1 Jun 2003 02:06:07 +1000 (EST) From: James Morris To: Mitsuru KANDA / =?ISO-2022-JP?B?GyRCP0BFRBsoQiAbJEI9PBsoQg==?= cc: davem@redhat.com, , , Subject: Re: [PATCH] xfrm ip6ip6 In-Reply-To: <87fzmv5ejc.wl@karaba.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 X-archive-position: 2797 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jmorris@intercode.com.au Precedence: bulk X-list: netdev On Sun, 1 Jun 2003, Mitsuru KANDA / [ISO-2022-JP] $B?@ED(B $B=<(B wrote: > I honestly have to say it is not tested well. Btw, one simple way to test the xfrm tunneling is to set up a plain ipcomp tunnel and run ssh or https over it, which should cause non-compressed packets to be sent (they will fail the compressability test). - James -- James Morris