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 MDAuMDAwMDAwMDAwIC0wODAwCisrKyBsaW51eC0yLjUtZGV2L2luY2x1ZGUvYXNtLWkzODYvYXNt X29mZnNldHMuaAkyMDAzLTA1LTA1IDEwOjExOjUwLjAwMDAwMDAwMCAtMDcwMApAQCAtMCwwICsx LDIyIEBACisjaWZuZGVmIF9fQVNNX09GRlNFVFNfSF9fCisjZGVmaW5lIF9fQVNNX09GRlNFVFNf SF9fCisvKgorICogRE8gTk9UIE1PRElGWS4KKyAqCisgKiBUaGlzIGZpbGUgd2FzIGdlbmVyYXRl ZCBieSBhcmNoL2kzODYvTWFrZWZpbGUKKyAqCisgKi8KKworI2RlZmluZSBTSUdDT05URVhUX2Vh eCA0NCAvKiBvZmZzZXRvZiAoc3RydWN0IHNpZ2NvbnRleHQsIGVheCkgKi8KKyNkZWZpbmUgU0lH Q09OVEVYVF9lYnggMzIgLyogb2Zmc2V0b2YgKHN0cnVjdCBzaWdjb250ZXh0LCBlYngpICovCisj ZGVmaW5lIFNJR0NPTlRFWFRfZWN4IDQwIC8qIG9mZnNldG9mIChzdHJ1Y3Qgc2lnY29udGV4dCwg ZWN4KSAqLworI2RlZmluZSBTSUdDT05URVhUX2VkeCAzNiAvKiBvZmZzZXRvZiAoc3RydWN0IHNp Z2NvbnRleHQsIGVkeCkgKi8KKyNkZWZpbmUgU0lHQ09OVEVYVF9lc2kgMjAgLyogb2Zmc2V0b2Yg KHN0cnVjdCBzaWdjb250ZXh0LCBlc2kpICovCisjZGVmaW5lIFNJR0NPTlRFWFRfZWRpIDE2IC8q IG9mZnNldG9mIChzdHJ1Y3Qgc2lnY29udGV4dCwgZWRpKSAqLworI2RlZmluZSBTSUdDT05URVhU X2VicCAyNCAvKiBvZmZzZXRvZiAoc3RydWN0IHNpZ2NvbnRleHQsIGVicCkgKi8KKyNkZWZpbmUg U0lHQ09OVEVYVF9lc3AgMjggLyogb2Zmc2V0b2YgKHN0cnVjdCBzaWdjb250ZXh0LCBlc3ApICov CisjZGVmaW5lIFNJR0NPTlRFWFRfZWlwIDU2IC8qIG9mZnNldG9mIChzdHJ1Y3Qgc2lnY29udGV4 dCwgZWlwKSAqLworCisjZGVmaW5lIFJUX1NJR0ZSQU1FX3NpZ2NvbnRleHQgMTY0IC8qIG9mZnNl dG9mIChzdHJ1Y3QgcnRfc2lnZnJhbWUsIHVjLnVjX21jb250ZXh0KSAqLworCisjZW5kaWYKZGlm ZiAtdXJOcCAtWCBkb250ZGlmZiBsaW51eC0yLjUvaW5jbHVkZS9saW51eC9uZXRkZXZpY2UuaCBs aW51eC0yLjUtZGV2L2luY2x1ZGUvbGludXgvbmV0ZGV2aWNlLmgKLS0tIGxpbnV4LTIuNS9pbmNs dWRlL2xpbnV4L25ldGRldmljZS5oCTIwMDMtMDQtMTQgMTM6MzI6MjEuMDAwMDAwMDAwIC0wNzAw CisrKyBsaW51eC0yLjUtZGV2L2luY2x1ZGUvbGludXgvbmV0ZGV2aWNlLmgJMjAwMy0wNS0wNSAx MDowNjoxOS4wMDAwMDAwMDAgLTA3MDAKQEAgLTI5LDYgKzI5LDcgQEAKICNpbmNsdWRlIDxsaW51 eC9pZl9ldGhlci5oPgogI2luY2x1ZGUgPGxpbnV4L2lmX3BhY2tldC5oPgogI2luY2x1ZGUgPGxp bnV4L2tvYmplY3QuaD4KKyNpbmNsdWRlIDxsaW51eC9tb2R1bGUuaD4KIAogI2luY2x1ZGUgPGFz bS9hdG9taWMuaD4KICNpbmNsdWRlIDxhc20vY2FjaGUuaD4KQEAgLTYyOSwxMiArNjMwLDMyIEBA IGV4dGVybiBpbnQgbmV0ZGV2X2ZpbmlzaF91bnJlZ2lzdGVyKHN0cnUKIAogc3RhdGljIGlubGlu ZSB2b2lkIGRldl9wdXQoc3RydWN0IG5ldF9kZXZpY2UgKmRldikKIHsKKwltb2R1bGVfcHV0KGRl di0+b3duZXIpOwogCWlmIChhdG9taWNfZGVjX2FuZF90ZXN0KCZkZXYtPnJlZmNudCkpCiAJCW5l dGRldl9maW5pc2hfdW5yZWdpc3RlcihkZXYpOwogfQogCi0jZGVmaW5lIF9fZGV2X3B1dChkZXYp IGF0b21pY19kZWMoJihkZXYpLT5yZWZjbnQpCi0jZGVmaW5lIGRldl9ob2xkKGRldikgYXRvbWlj X2luYygmKGRldiktPnJlZmNudCkKK3N0YXRpYyBpbmxpbmUgdm9pZCBfX2Rldl9wdXQoc3RydWN0 IG5ldF9kZXZpY2UgKmRldikKK3sKKwltb2R1bGVfcHV0KGRldi0+b3duZXIpOworCWF0b21pY19k ZWMoJmRldi0+cmVmY250KTsKK30KKworc3RhdGljIGlubGluZSB2b2lkIGRldl9ob2xkKHN0cnVj dCBuZXRfZGV2aWNlICpkZXYpCit7CisJX19tb2R1bGVfZ2V0KGRldi0+b3duZXIpOworCWF0b21p Y19pbmMoJmRldi0+cmVmY250KTsKK30KKworc3RhdGljIGlubGluZSBpbnQgZGV2X3RyeV9ob2xk KHN0cnVjdCBuZXRfZGV2aWNlICpkZXYpCit7CisJaW50IHJldCA9IDA7CisJaWYgKHRyeV9tb2R1 bGVfZ2V0KGRldi0+b3duZXIpKXsKKwkJYXRvbWljX2luYygmZGV2LT5yZWZjbnQpOworCQlyZXQg PSAxOworCX0KKwlyZXR1cm4gcmV0OworfQogCiAvKiBDYXJyaWVyIGxvc3MgZGV0ZWN0aW9uLCBk aWFsIG9uIGRlbWFuZC4gVGhlIGZ1bmN0aW9ucyBuZXRpZl9jYXJyaWVyX29uCiAgKiBhbmQgX29m ZiBtYXkgYmUgY2FsbGVkIGZyb20gSVJRIGNvbnRleHQsIGJ1dCBpdCBpcyBjYWxsZXIKZGlmZiAt dXJOcCAtWCBkb250ZGlmZiBsaW51eC0yLjUvbmV0L2NvcmUvZGV2LmMgbGludXgtMi41LWRldi9u ZXQvY29yZS9kZXYuYwotLS0gbGludXgtMi41L25ldC9jb3JlL2Rldi5jCTIwMDMtMDUtMDUgMDk6 NDE6MDMuMDAwMDAwMDAwIC0wNzAwCisrKyBsaW51eC0yLjUtZGV2L25ldC9jb3JlL2Rldi5jCTIw MDMtMDUtMDUgMTA6MDY6MjAuMDAwMDAwMDAwIC0wNzAwCkBAIC0xLDMgKzEsNCBAQAorI2RlZmlu ZSBORVRfUkVGQ05UX0RFQlVHCTEKIC8qCiAgKiAJTkVUMwlQcm90b2NvbCBpbmRlcGVuZGVudCBk ZXZpY2Ugc3VwcG9ydCByb3V0aW5lcy4KICAqCkBAIC00NDAsOCArNDQxLDggQEAgc3RydWN0IG5l dF9kZXZpY2UgKmRldl9nZXRfYnlfbmFtZShjb25zdAogCiAJcmVhZF9sb2NrKCZkZXZfYmFzZV9s b2NrKTsKIAlkZXYgPSBfX2Rldl9nZXRfYnlfbmFtZShuYW1lKTsKLQlpZiAoZGV2KQotCQlkZXZf aG9sZChkZXYpOworCWlmIChkZXYgJiYgIWRldl90cnlfaG9sZChkZXYpKQorCQlkZXYgPSBOVUxM OwogCXJlYWRfdW5sb2NrKCZkZXZfYmFzZV9sb2NrKTsKIAlyZXR1cm4gZGV2OwogfQpAQCAtNTEz LDggKzUxNCw4IEBAIHN0cnVjdCBuZXRfZGV2aWNlICpkZXZfZ2V0X2J5X2luZGV4KGludCAKIAog CXJlYWRfbG9jaygmZGV2X2Jhc2VfbG9jayk7CiAJZGV2ID0gX19kZXZfZ2V0X2J5X2luZGV4KGlm aW5kZXgpOwotCWlmIChkZXYpCi0JCWRldl9ob2xkKGRldik7CisJaWYgKGRldiAmJiAhZGV2X3Ry eV9ob2xkKGRldikpCisJCWRldiA9IE5VTEw7CiAJcmVhZF91bmxvY2soJmRldl9iYXNlX2xvY2sp OwogCXJldHVybiBkZXY7CiB9CkBAIC01NjMsOCArNTY0LDggQEAgc3RydWN0IG5ldF9kZXZpY2Ug KiBkZXZfZ2V0X2J5X2ZsYWdzKHVucwogCiAJcmVhZF9sb2NrKCZkZXZfYmFzZV9sb2NrKTsKIAlk ZXYgPSBfX2Rldl9nZXRfYnlfZmxhZ3MoaWZfZmxhZ3MsIG1hc2spOwotCWlmIChkZXYpCi0JCWRl dl9ob2xkKGRldik7CisJaWYgKGRldiAmJiAhZGV2X3RyeV9ob2xkKGRldikpCisJICAgIGRldiA9 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 H4sICK0PwT4AA3N0YWxsLTU3NjgyLWFub24A1Z3LjibHcYX3fopeUgBB5P0GQytDGy88sJ9AELQQ bMkCKEA2hHl3x2WG3aO/JuNEdrV/CAQJguyeL8/JzMrIqKzIWFedK6efcp+x5Zf/+Un/qr2N9PLr l//9Sf/KLaf18h8vsdTWS5ohrNd//SH86uWvf/jTSx0lvPzzH3/+mX6shR9//u3v/vPf/vXHv/zh j7//+S+//eOf+b+22EuO4yX8+Kf//vOPf/35d7/9r9+/5F+//PAvv/nVP8VfGjNyT+kbOLXlm7Zx Y0oKqYZE/1yv/8qNIfBrS6O2rc32tW25XbUt5zTbKG9a+baN4aqNrRmG/aRNkRb0TObwn8h/P5qS 8msb/p7V0hi9m6xIfZLqD/SP8isYXNvYgmexRTJ2pVHm3exeDfanF8ZS9/d8KzuTomgMwC+dSz8p uFFLueYxpIf5hnzByzOaPrPMRSO5e7X2/NqMC3aJ1sz/iSdQXz2m6GaXLTvVAfnM/Sy4GPNM7zC6 FHtQsc5FHeqeTIbY0u3JxNg1Z3NPJsvohg1oHmRqNOG/A4SMrsEe0axzcY+6p6+htkarl3+SkZRX TCP6J9SW3mu2Vi/1mieVet3DGBuvY3gzl6+APdlyWSgvEcU/h/trQ67ow1qcPsloogWqtuafVAY9 V8hsntRq9py5gWZfLA29RcBsFrq4W/3zeC+30TJj0pm74qjRP68ssxtkNj/FBJdSH7t10TS7W08R GlssdHG3+ieyYfYAoh/mrhRzu31e5QmZzU9RNbvyT52bzT9gyRWhi7v17onckzWyP8lwoliT4v27 51UtYMDHq4a6PcrYLZCm23XabrPSxf1690zu3Q76hLtSD/X2iZUL5jYvWsLLMSd0ibx0e9qLlCjl ncy4eyqPaAdDwl1pznDvzKK9bMeCbFm11O0eEvrY7hfENIetl5Uu7lf3XKY/b6c3R+ux/UnGE/88 PWVvpseR0a1jUV4usaMRyZXbcWCrsiyUQqQoP6HPritirnZ8Ld4u1uZ+ehgOl2SPLuGuXFtwz+WR t/QUQLc5MFC3K6cbzt0upts0nlnp4nnrfnpYetFUCEedOp7n6Ggccqk3BCwpwNGA5vdiau95XpUB jCj2duVR/Ikuw+Ea7B2FcBc7639e7eklYM8riUXU7RLje/q3JuD5zEpXicmf7jL1YhtGiX5+yR6/ 52lZK5DcY6WcyfSn2Cy9Zi79i16O7PV5NUp8z3pEzceIHAEIsZUAx9KXDg97PRJvVynRn9czHG7B 3jcJd/FKcPfTowHpW+Gu0qY/02bR0QQux9Y6m+YI71kNWwNXB46ndXSlVt8xnhvv+BCixJTYeI5v Yp0LIgUv5hNSenPxXPU/IdtrQy71Yk9IifDu0VvsFVCUrjKHP4G51yt7HUgvx1h36O2h2Ht/Ubo4 svE/rwy95qveTxJR0a+k5s9g7uljgtlxeWa53X5MjxOx2mk8Ubo4svE/Icdeb7dXB+GuWqs/hWnR zZWR+pq5/GbRn8K06EAeQLiLes6fUdzTZwAy9cJdvCb5x7lBB6Jc4a4Wkz+/Z9Gz7bxwF6+ON4+6 2Tq2R5Zn3B1zfNJiaOtlpYtJ/nE+t3q7GYN9EoVxtVr9+T2LngDtzF2tzYNs245eA7+6RPpanrDu vm4XxAi8pxClq418kN/b66VJY/c1c1eb/SD3ZdCzfRJIuHxa4yD3taWnUrDYW1YUd18/HiOoqQJ9 LUpXT82f+5ppq7cmOw4X7uol+PNCBn028BwBr2G3uE2PY9ttVrp6Lf5MlKUXiBaEu+h/+vNCe3rO Gctzyqp5h9s5V8BtVrr6yP68kKUXyJkId/XZ/TkTg97APaasmre43aM1umgus9I1YvRnaWbe6u3Z jkWFu0aq/iyNQZ9gzkRWTbfbj2egiDjsrJQoXaMEfwbD0jvt2Fu4fMzPn0/Y00uKWD5B1uk73C4p QycLS1yjDX8+wdILZDOEu8ZI/nzCnl5bwo7JyDp9h9u1mfkEGl2sdA3eGbj11r1eIJ8g3DVj9OcT 9nReNzC3eZ32uj0fc2VEBM7JiNI1U/VnMOYuW0V04BC6cNekZ55/Zhl09HAjr9OY22nvNvIuQ5Su WYs/Z/JG7yXdzHsTnblr0hbLP7P29F47drqR1+lb3O7me2caXax0TVos/XN5r3cA752FywfS/TmT Pb0HMA8s67Tb7cccERGBeFuUrsg5hvdM5kvBzXqQfXpRMPFp63nz5OoVPFYhS/UthtcEHJUWqaQ4 T3+qZva94gx8BiBg4lOM7p9gW/4oGXRcEog3OD5KtZNTKpUU0wPAP6nHXjHwUZyCiT/SQcJmz6f9 G3Zmmpdst+P1imhuNVgxSyXFsx0kibaKZwASZApekZ4tB0kbg2++5uBPbRhMfNop+OfYnl8m9qpB wgZ3j1+kn2dNluM0x0SqfNt0kLiZW8UcgtuOM5j4NR+kbvb8AR4Yk9DhFseH+WkAK2appLj1g+SN obggPc5g4o94kL7Z8RtNXyxU0ujhBstbtN9ysOWslSTP5s7g8D5jJxl5z6HgFVMM7hyOxa/gqTkN H26x3D4mSKNMtJLkVNxpHD68spXc7fS7gomfhzuRY/OxaEnjB7fljye7WmwBCBBFK0mu2Z3LsSS3 CGwJBEz81t3ZHIOfGjzKOYBwW/6YhudX8EC8Ilrl21x3QqeFtJfcgLVEwMSf1Z3SMfg5RPDzAYkg 7rA8B/NZyqOMta6YY3BndUzJwPlnBRM/FXdex+Kj+XgNIdyWP6aIiQEk5FUrSc7DndoxJZspeepy ARO/Jndyx+CXFNHPKTmEuMPykjIwsUUrSW7dnd5pIe8lFyBiETDxR3Sndyx+Lth7EA0hnJZTuHSF nFZ+h0cZayXJs7rzOy2UreQSkFnG4BVp9+fO7xj8mgdqOYcQbssf3wi0WpDqA6JVaj24EzwcEe0k F2S7L2Di5+FO8Fj8hj7LJYS4xfIGHKVUrVwVK7kzPKbkCswyAS/+E90ZHoNPzx3sJZSGEG7LL5EV eJaKVpI8gjupZEpGCqoImPizulM8Fj8nMEiUEAKzPO8tz+byxaOMta5Yw3Rnld5KfsxcE78B+wIB E5/Cq/fMsgt+5yAZs5xDiDss76EDEYtoJcm5u9NKLbS9ZODto4KJTx3vn2V7fgTePypYKgcd5HgM /eiXzRLCuLv8UjLwoZNqJckjHOR4DMuBT8kVTPxZDnI8e36N4CyTEMZt+WPlD0KaFd/Ycta6Ygvz IMfT95KB8ysKJn7KBzmeLX8UtF6BhDBuyx/fiRHSjJholIlWkswVtdySx16y+RaULWcw8Ws8yPHs +TOBBVckhLnF8glJZq0kmQIc/8Q2JDcgfBAw8Uc4yPFs+TMltGAnhzB3WD6hDb9oJckUt/gntiG5 AWk1AUsluoMcz55fOrgvkBDmFsuL+YXAJy2mSBO7p3yQ45lbyRWo46Rg4ud+kOPZ80cFEw4SNbkt v3grNclLQDJrJck1HuR4DMkTWL4FTPxWD3I8Oz5tCwb4YJGo6QbLe7C//mfJrJUkj+DP8cSwlczH luxZxmDiT3/RaYs/GpjjkajpFsvHBHafonXFEfy1ri3JMwBbQQETP/nrXRv8FBJYtEyWcLflj2+l CGk+WGiUiVaSnP1lr1uMe8lmRUC2nMFSStWf4zH4EVlLBEz85q9GbfITsBUUMPG7vyK16X8Ct4IS qLuH3OPrfkKC5zE1arpllNOyAPRyl0LYY/orYZu9bBbQZf6UUtgz+GthW/wEfnmmUdMtlifz0zMa 2KKVJCd/PWxTMnIiVMDEz/6K2Bafr7HALOeoyW3547vXnnoAnqWilSRXf1XsFtNWcjcPmnOXVymL PZu/LrbBzwk91CFR0x2W54S8lRKtJLn7a2Obks23UsxnsJTm9ud4DH4Di3JpCKGWW3XAXi2/qHXW MzbKphTIDsFfIbvFvJXcgUMlCiZ+8tfINvnA0S0FEz/7a1Zb/InWMZZA3TvLYvjx64/x/UAvP2uz //ZN2P355bFdBa2KodGku12P76QJCZTw0j6grqj+At78mn3TFaUAFxIpmPjNX1Db4tNmG7S8Rn+6 79LyBmzRVCtJ7v4q3pbkCd7gojH7LZKRciCqlSTP7E937SVXfluGSe7Tn2G8klzta9BYMmtdKQZ/ 9XBLcolgUlVi9lskl2yfFVStJDn5y3m3uHvzzpLBx7rE7PdIBg4Bq1a52eMgw7aX3AbYy7JNuEVy D0BJftFKkqu/jLgtGdzuyzbhHslmzRUe2KyVJDd/XW9L8mio5BrQ44FvJD8eKSHkAC4VEa0kufuL iRuS+aw1KLlVf+r2SnLLwFkx1UqSZzrII+4lo/XEdTOESS57yfYFCDywWeuiaNxfUrzF11Mcj0cq eoM/jpLN0C2SK3DvlWolyclf49uQ3COYINf9l1vyxcCi/w8MbNFKkrO/sLgluYLHo3TLd4vkat5K xHdAsVaSXPzVzOnvneQRwPerurW5Q/KwX4NwL7NWktz8xb5NycD7VQXLrV8H2dI9PzYsdab7DLfl l0jzZZ/eNFb4WTL99bctyQn46lDBK+Xgr8Bt8UdEb4QIcIF3w/IBZCtVK0lO/iLcLY69ZOAMvYKJ n/1luE0++NmCRuBuyx/PyhASuG1WtZLk4q/9bUoGrjRWMPGbv/q3xZ/mx0Hc5QwmfvfX/7a7HHyw STh+S5dP8+AGW85aSfL0Fx03LS9A8kTAK5XgLzu+548QwIMjGhvfYDkhkQ2XaJVrKw8SoXMrOQbA cgETP/trj1t8Cv0wyyVQdVv+eFaHkOYoo4ktWkly8Rc8NyUjG04BE7/5C5Bb/Al+j6VR4y2Wz2G/ 7FOtJLn7q563FPaSkds7BUz86a97bvDldjnM8g5faPDG8sezKvzBCfAsF60r1eAvfW5JzsjrDgET P/mLn1v8MsEHi0SNt1hul6ujUSZaSXL21z9vKW4lV6DmjYKJX/wV0E0+eJODRo1uyx/P6nCVDWAr JFrlFmR/JsuQ3MyrMz7ptdo8y7q/DLrBT+hlsRqo3mE5LcTAVky0kuTpr4RuSbaXb+YzeKUW/LXQ LT5XgcYsn3Chf8PyBlTjUK0kOfnLoXMZn63kBizfAiZ+9hdEN/iZoiHMcglU77A8pwaMctFKkou/ JropGTiEqODF3ePP8ez5JYD3K2ig6rb88UQaxT1AyTjVSpK7vzB6S3krGSkZp2DiT39pdItPUTJo eYfr/luWd+TBwloXX8Dpz/EYkhOy+xQw8aO/PrrFbwW9yzfAxf9fLU+PhwC5wC3wYBGtJDn7S6S3 VPaSza0YdbmAiV/8RdINfq0BfCskgeodltcKlP9UrSS5+euk89DYSkaS1wImfvdXSjf4/P0DaPmE C9PXN+HSBbIgp0VEK0me/lrpLb2+e7xIq3EBMYDP4JVG8NdKN/nAF+wKJn70Vy43+UDJPAUTP/sr l1v83MEXobI3umPI9djBt1ISqN6DRN59ir2Lb5M+SCttXeZv4IBRxmDiN3+1dItf0K2QBKpuyx/P cRAS+GxAtZLk7i+X3lLfSwYK1CuY+NNfLt3iczExzPIO3wlgWM7H6exRxlpXmsFfod2UPIBMpoCJ H/310k3+BMIHARM/++ulW/xRweVbAmV3lz8eKiEkUNlJtZLk4i+YbkmeAVi+BEz85i+YbvBHDtjJ Sw2U77B8ZOSAmmglyb0d5HgMyeaHptzlDCb+PCiYvudPPq2GWd7gawHeWH4RF88I3ISmWlcO4aBg ehp7ycAdhwomfjwomG7wa0YfLBO+FuCN5ZdIs5jVpxfVSpLzQcH0NPeSgcKMCiZ+OSiYvuXTYw3d ikls7rb88d0rIYFbcVUrSW4HBdMNycmsU8BdzmDi94OC6QYfvQNPA+VbLK/AG37VSpLnQcH0HPaS gY/2FbxyDMWf4zH4E7xTRwPlOyyPAbidV7WS5HhQMH0vOUawZJsGqm7Jj6+bKeBEz1dLoHYHMhWw rqwGKjchUWMnXJZ8j8x8zx+C1IXKjXx83TTlMm0MWeCy1G+Qj7l//rACe3WsD6pbkAMsMa8T1YvM D7nfnmi7jIWV+lDAkHOHLKEgT3/B0aMoH9ydMF4fRQ8uE78CV7AqmPjl4CIDi4/EWAImfju4yMDi A/t1BRO/H9wqYPD5uxibz2Dij4NbBSw+UCNYwfQL4aDEv8UHPoFWMP1CPCjxb/GRbZWA6RfyQb19 g498Katg+oVyUG/f4ptnkpjPYPqFdlD83uIDpWQVTL/QD4rfW3zgwwUF0y+Mg0r0Fh/ZcAl4Zdpr +pNnBn8A5R8VTPx4UBbe4gMFsxVM/HxQFt7iA2/YFUz8clAW3uIDR/oVTPx2UKPd4E/gTKSCid8P arTv+bmBt9poDACFXHLW9yv8AjnMcywsmbWS5HFQo33k16Zc8SfCZ/DKJRzUaN/zSwXz1Rp23GF5 sT+1JcmilSTHgxrto+wlm68omM9g4ueDGu0Gv4PFpDTSucVy/gjQlsxaSXI5qNFuSB7AyV8FE78d 1Gjf82sCv6HX4OoOy2sCXveqVpLcD2q0W5KBD2cUTPxxUKPd4NM6BVrO8dwtlmfgda9qXbmGgxrt o+4lI9tHARM/HtRoN/gdzLFpCHmL5R04361aSXI+qNFuSUYidgETvxzUaDf4E82+SdR6h+UNufZe tZLkdlCjfS+5ca7U5jOY+P2gRrvBLwV8lkugjFke95aXgVjOWknyOKjRPtprUy74FTjUoOBF0flB jXaDP8A37Boo32I5co5DtZLkeFCj3ZA8kVScgImfD2q07/l9gFecaKDstvzhHAkhJ1gNTwNFN/Lh HAUjgWp4ai+5XA4q0Y++dXkiEYOAiV8PKtHv+SMA99ApmPj9oEa7xUcSPgIm/jio0W7wY8Y+tdVA +Y4hNyJwKZpqXbmHgxrtluQO5FgETPx4UKPd4g+gywVM/HxQMN3gN7Asvwbqt3Q5cgxTtZLkclCj fYytZCitL2Di14OC6Xv+5KsXIcslUHdb/nCogZFA/V7VSpL7QY12SzKSSRcw8cdBwXSDX8CqSxqo 32J5Ab5uVq2LNsoHNdrH3EtGXl4LmPjxoEb7lk8hMnjbpAbqN1hOSPN8O0tmrSQ5H9RCtyQjOR4B E78c1EI3+Am8uVgDdbflD6e1GNmA5Vu0kuR6UAvdkoy8IhYw8Xs+yPFs+VKcBbM8o+XnDctjBiru q1aSPA4Kk8+wlZyBW20UvDKfk3XPshm3/BrBt1ISqLstfzhHxkjgvgvVSpLjQZVwSzKyLxMw8fNB yW6D3wI6ygdamN2ynL8ysCWzVpJcDkp2W5KBrzgUTPx6UD/b4HOdSshy2RvcYjn0ulu0kmSKTO+e 2BOohqpg4o+DYtZ7fkoNjMtlb3CH5Skhr5tF6yohHBSzNiTTomTyFUz8eFBZ2uBXNOEgewO35Q8H dBkJvCJRrSQ5HVSWnmkvGVi+FUz8clDmec/PMYP5etkb3GF5RnafqpUk14PK0pZkYJYpePGhO3+O Z88vqYHPctkbuC1/PLrDSHArILHxLcg8kYnF9i452uV/luStyyXaQZqCF/3oQWXpWfb8bL8iUTDx 40FlaYsPnNZTMPHTQZlng9/Akvm6N7hlyPGH8bZk1kqSy0FlaUNyB87RKJj49aCy9J5fA7r7lL2B 1/J5hYwZGWWslST3g8rShuQIbMUUTPxxUFna4NeCfaulexO/5T9+/bFvrh78Jux+vHqQ2wXsytWQ VVI4KD8969aXBlxirWDix4Py0wZ/oodtPqZfOES/7JcJfvX2Ie3S0P26XegZgo9pF8fX1+0CNqE6 gGgcpYOa3vtx1EJA+Awmfjmo6W3xC/B8EzDx60GBbYMPf2bnGBdpPy7Sy9++2fB8todJK8CnMeoP 2dQP6oDP1/MgD6V0+HaiD1gGDJsy2/Rmk/LZ7Vov0EOa7SLXxkEp8dm3rnFy8BmuvQn6P+9NvHJt DCDkEbtW4Sof/kfS1jXehz/TNd4x+F0bAfh4TO0i1+JBDXXDtdTBV74f4xpvOg5cy8jyI3aRa+mg 8rvhWgOvbbzZtbcbhs97E69ca8C7brWLXCsHxePn2LlGsdRTxtrbcPrz3sQL16jV94emjlZzDHXS 6nF/oO9oNUdeB62mfSMwQnlo0gitB9cLzLkdoRU4mK9g4veDWv8W37y3hfkMXpwuOci67/n8KfsT Rw0HogejpiGberFrFd7r+VeDnWst5PKcufYmAv28N/HRNf4gAnBN7CLXov+Sgx7C1jV+df081ySk OnCtAWcM1C5yLfnvSbBco8X5ma5xSHXgGn8v/MRWc0hz0OoJHG7QTqa+Lv47Kay+nsBBPQUv/j7Z /arG4MeRntJrb9f3z/tOvOi1OIFyQGoXudb911r0ELeuzQm+xvwY1zg48LuWkO/z1C5ybfhvxjBc 45vIn+kaBwcHrkXgLI7aRa5N/30elmt8z+ATXHsbFXzem3jl2nzO3uRrq/mB7W91DkCZJ+3kVWr0 X2TSQ9r1dQ5AAQgFL/6O3v1K0eKn/JTV4Guv8TJ30GsJOUckdpFrxX8XiuFayWBp0Ltde7O+fd6b eOEa/fZTMjVfW80PzINWt/qUTM3XVvPU97e6xgSsITI0aYRW/205PZTdCK0RyQoKeLFS9ytpi5+Q 8o3vOMJs8eFSpB8yauSBfTBq4BIOH9NqfmAetfo5a8iXVvMk8re6hQx8yvGOQ+5cFWwzQkdGa0c4 XMu2a2/n/Oe9iReujQG/I2HntNWp1Qa1mib1R7R6xgBnQPFW132rk9Hq62aiE+m5zez/725mPj7z ZrX4fNBq8F7nJ5sb4cfCk5uJRsDPbWZFjw88t5ntH2Ns9vsf/h/RTDgT8dRmpg9YSj+kmeiu8bnN zP8YboLXXdy7dv7Srq/NdMXK1Grw60A9fietrpUvZsJaXT+g1aPUgLzVe8fXbv1N2cmHIlZyDw+W x9UjUepa4moe33ctxzfwG11rixNu8aeYYgjIN3qHH6xRCKdFBb+oeeSXDF4grkeiBFjmKN/dF9FU /LLDUPiHuEaDDcjjnn4AJg3Pr2qu+MiZ4NOvgWx+Q2vEaRu01/hNA9hr+UN6rSFFxo+/YZKGt61r tKX5uA96bH4P4KKpHmivyQR+Zq916J3N6ec+iGsdmOun5+9NPtcGQ+eaHA5loJSh2fVaeQP/iF7j VoPPdXFOW82Vz5/b6glW/9BZqq3mD6Ke3GpkhpyeCeaGf7lHTtRc8ZEZcnp2D+EjZwdPz9jY/Big tz/cudTHo/o+5EL4yIdUAib+nL4PuQA++tG/jkFdVzgweOqsiUhBErVrlcalqG52LSNfdAt48QV8 /nVlz6enLdprbKH2WuODUVCv5avIOxm9dtFNuUxgcok/ZFNJvg+5pKVpa1NF6sYImPi1+V5tInww Q6wWYhsko5vi33fTVb80M5j+9KKGkC+0zW0/xJT7fb408BCtStDtdokRHr6PSNrBgJGYPDXsd3gA kmMjCCkz4A4kH5ICkRW6CPfvkOkCCRsrA+n9yNHHAD5Wjyt+e4mAgz/nnj+r/ViTqfK1YmgM7Tsh PVMyf+H0C/qRNwNQ/JhZK317icB9kieX8EAkcwtUMrXiWPKIHTiOyizetuV3SubGXDRhJHuN113Q lyKlsX+Pp5QRd5JTDPYrZWat+u29BfdJThE4cM9IboEAU/xe5hiSnIK1Pv7mk8BW65yHCzPdrpmC 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 o7ejGo2JxUaUXKZEHjDSUY0GxBKLcSyU/LURS6lHNRoS2W9Ng6HkrI3YKd7hOTx123xV89SmrsRU 7/CckrvNczQ3bUTiCfYOIiXjuC356EVBusdzRIAyESUHbcTRwz2e07KtZdZ8p8Saajn0nHFI7Knh cVNpM40R3LWVrXy59B26KBCQLtwpfbO7tiJ6QtXtUfv1MXNij19NN6y8cqfUFXdtRXSDSKjcmbkM u2sroFNEdF554U6pcKu9jrLh2oU7cye3RArpBU9wyp1Sa1d7HUGJ51FrfJ4Uk1vUg/SBJzjlij7s lvUQXQRkSBfuJIpuYQ/SDZ28cqf0H/d43Y2UG3vMxk5Ps+1WWSgcaiNXlaXHW2IK8FnQRtQMu4QY jfq4ZtU1RKPEpblsCbEY+y7NIIuItv5Z43YFkW+PbVU1Wu4n8l1sybaqGpkmYs4HRFH3Eu58lDap DrfWPjJ9PRsInXD9Ve6UycRbBSAdallnnYi4Cozu1jAhvRnysHCnzEjeKgDpUMt61NmszJKqW8NE 9GaogMqdMq2t9roGtyqcdUrMs5Ti1jAhnbCapFx5munWMCEdaln6OLOy1/Xs1jAhveGOV7lTJtjl Xjewdq3cWWNya5iI3gPWMJU7ZZZe7XU94W5fuVMqyh1el2+me/7VGMYdA5JtTXWN6Ip9SySm2B5r So5bQqxGXUgzywoijxG254waz0uI2ficUaNoCbEbe2n1XRuxHBFbqdV2jRonNuI4IFLuvaFq+LjR Zi3Fq33FQOmy2Hv0gTtA5c5ah1f7gvQR8dNM5c7as1f7wvSEK4JyZx3Nq31hOhlysnBlb5FX+8L0 gvtP5c6Wqlf7wvSG+0/lTu6XvNoXphs2lCl3tkJe7QvRRwiGlRfubNwCL/a6EQwTn3KnKNOLvW4E wvGu3NlG82pfr+hljw43tbHXCXf2GL3aF6YbduIqd/ZUvLP2K/pNB0iU5Tmmqa5JtjXVtVKu2DvE blQzNMetIFKOtm5BM8sSYu22Z6waz0uIrRmJEkVLiN3YvavvriAWMkypGiOzU/DqQszsF0P26B3F 6eNJubLv1qsLQXoJhiwh3Nlr9+pCmG7Y7qzc2Xvy6kKYng0rL9zJ9cmrC2F6x/2Ycid3rV5dCNMH VqWUO0cqXl2I6eOQXiPux5Q7Rx5eXQjTE+7HlDtHIa8uhOkFZxvlzsHDgN/rAL1iDVy5c3DK83sd oBt8Xrmyz9+rC2G64em/cmcMMX7D6HuEL7EbJRtN9rbCVo8KW+F1tLVEmmLdxJvHvXJEiWztgia2 JUQZrixETScriDkX233UIHYTb5vpQnHYtg9q6CwhUrDdxy1Q7kdyOardsMtecRyeqbi1oRTixZQd fjPsytrAzM/DrQ5BfjLstFcw80t260OQnw177RXMfB5EvNkZ8ovhJJSCmc+51JueIb9inWQDM39U t0oE+R13ZBt4Ro4Ct06E+D0YzpkomPmJ3EoR5FtO2ShYD+K5tSLIz4b4VzDzRXNZzSfclW5g5tfm 1osgv+I9chuY+T26FSPEH5YzXgpm/qjuORzy4e5M4Qt4xsQ1bKn/1Ri4tBlLrtQAU8lt6Qq+gyTj ZrUt7S5BWtWdLdOtQEaOWOMBSUlufuTD88fkZQ2np80f/vcqVfx52rOLrAc338QuieR9u4wPs9/I LonwfbuMBxPeyC6J/Fu7WsjdcGBryxicOBK5RbQc2sXePX6zHI4VMPPlCexqvuGR7gZmfsluIQ3x B3zAJesvYObX5pbSIB8eqJDrF7Ce4XeLaZCfDY2Dgpk/iltOA/xSCt5QsIFn5OHPLahBPpS0+PoV zPxEbkkN8puhcVYw83N3i2qYbxjcFMz8ktyyGuYbBicFM782t652zOfvsmoV9rrQQV1IXBeuM/qf sExEImvn8zZmSv61mFmH8QDw25gpadpiZjO+huiNzJRsbjCTW/3vupqS9E1m1uUtssdMqQ0WM0v5 npGuJcRm5vf0Ta00FjOtb/LymJntZkpBsplpPDv/NmZK3bKZaTxw/zZmSl2FZvbQWzQ06/pt/KU9 ulV2iunis3t8eApVmhUBM38U6syPYyG/4x0H96iciN8N71W5R+WEfPiSt/tUrmv+zd78zs3S+iF+ OMJEHAuHiZi5vG57zBTHPzKTZqLzyDXAvdx3eDP/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 MELQ@,2.I LT-B"\Q=@?QEB2*ZH4&/@"(@T:E-DE6\1S02XY.V_,8PS9!_-F>P89 M>-@'J6'B NEA%[>B"::,D$8;N)/#\B=8[?:G6D-8P@79-AF]+K8&^)YO7!8O MV*FQFM%W>#V>?!G/HA8,PJV82V#(3D6UZ#U>P M]CPQ:_=1:1E2WNU3-HT)G.\XWLR7FM.Z58V.!&=&8QAB-3,- ML9L9>&:F(58S00_IF4CLC"E'7[2D3PE(S=Q#4ZTI_\KXA-LIC")*.@2@M6:W MFE:R-[SVV2[GTW25O7IX>+@R";CN>/LX[Z7S,PSTE"S ['$L\7 YP.UVS]L$ M8U:OPP17MV>0$?8#8[("^C^/LEUJK 42N[C8=3%B=8.3XN+VL#C ]2'Y0W^6 M^+E>X=I%MML:R$#0]2_*#$ER'51H=LDM*5B R2T(;BP1%YQ]H(OUISZ(TWLS M!&X"G%VA/23?TN?M!;>=G:J(>;L[]-+. SKD^]PX(@$Z(O;Y+2] 'R:07Q'' MC$*@H4TGTE,37(R5[) ^B2+8YKR_;LUAL"JH370KQ;E$76"=Z#Y_78#EE3ZZ M8'"&FT,$ LJ "]L ^(R5@93&6T=B%P(J:J9J8AD"]GY \!PP-X?DM*<%9C[F MNGW;0*I1$0Q,@-G62 "VBD#W63%^WJH "\)]5,'@7)@0 M)AN*ZP>\=^ET,VR;"1+XP)1F+G/Z- MVG-HH="V$::K3GC8 ;,K$S*7EV5"YOW_U0FQOZ>'GAQ>)F2^IUTFG;7H4RC< M2=!#M3Y6I^.:2V+UNK:A"E8CL\V%0NX;6".I*12VP4L9/P;)J1L!@1BN!(G= MKFB5RE"E'B1R3MXB@_2&GL)NF)_4X-C6?=3%F%/0T[K+47H8'UF'1PR[)0"]/+B^@7YU^N?2/DMV/Z0K)>A]KRO:V3GX;&+ MVU9V'NQ:ROMXUZW]Y<:UEIP&!V%=<5-8X'B MNMY18;1]I+%^7T'7%EOY-,^$L"3I2#F-E#"1$Y*25;3=@C(/>9RX#&9KT=+J('S\\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& M#UCX&'$_"+PIFR@F$E?$U;-=AQ-7E$GN^H]"NDH @6O->]74S9;Q?#=);N:S MY>[KS6PZ F3KV3JYOC\0&# F)*P04[!"/O,#%GC"$]/0DQ,+@?5H\S1Z2BK5 MC\81?+F UA6D\E ]!NZ4JW$:#".!C+,6M%JG5*E0],U$C@))UI^71#O'2SF)Q,0$S*)%1][,K)R9BW68]Y4JL#/1'D>GW8BX:/L*'?V8<^4NC&!,N:)Z@_V@Q)ES4/OVBZNGZ#:JG<\5>DN:)$ONO MSE7ZQ?P%3?)CS3+VT$MO?>&PX4_FWT&)!.=B,X\^)Z\KV:>T.SIR4<^]:S%6 M.NQ=T$ZD>I0L"!D:,;(K'PGE7 GUDC@))54#)Y7FK ]#PSB>Z[_3K: MSA8)<&D9@7.1(?"806# $0*85%3\-*+TJQG1F1%C>FVC=%(QL@-:.!,U?P4, MP$#SAOYS/#T@M^S3JS359QL-J/=9#U: MW"VVH_7#MHEV?*SC /&!9^;$@/R[>@G!J(H="RB5 MUZHN0$L M)Q?@MY (CAZX%^+ $3Z)A!C>@NYO=@O!)Y*:@)8 M\R# O@9VZRM &]!]$?:6>$8!M;L*&S3/4UV7;>R7)C^FL5\D$\&CJZ0KC.)9 ME-:)+MN"UFF?J5[JIBL=L 9A]3V&T@A?ZP&],2>;UXS?A7'DOB=_0X=Z2W_83UH?M. ?M M\Y:;(X!7GWQ[X_E6&'5%:&UEH$^(LXOI;AF?G[4[H@SO7CI#/**R/JOX07Q*P/[* A]QP)ZA4'=E3NB_-#$=G7(%![9/5 M2R"B1X=973IV20CF26!4J2 \*-;FL,ZVS&X)N^AAA(Z#LS(O5O6IZ%%B[C*F M6Q9R0TLHCI7\^#Z)'W1O.S*C$SD76A\Q-)6:9:1-9Z"#3&'%$-]Q/Z# Z#TL M;RO,] 0DAI [0!AM5XM93'AKS#7@.E3K>$$+2I-Y$FV2-AA0UK@%FR<;RF0U M&L]RU@#-I%6>D,I+"NMV%:_FYZCLD:Y7_9@T_MQ); TSQ;JTQ" 647P*J_S4 MG I&LY)F\A#8#0?/,RHN KN6^F5]]18[^&B1^ T&"8@$W0R!O5GHFF8(GFH? M %INB$30G7, @6=6%,' /B_P[TBS]/A7,*(GR=>SSC([[:.MI^&QL;7R2$HU/6;.(!Y\%DP*-580G['WC1Y/D2),..T&2&50> MH;(9V]O%>I39T2J@QGHO#Z:KU#FCKZN,M4-7W+&'IA=G501>G%.+J[?:,#X_ M=W[3#_5IL#X.MH_H-6AHH'Z#5T$&@IP%8C](VP!S@ZL?6'%0GD1N0-C,/1X1 MA;#&U>%S9'^$=L159)Y/HFVDD02^BSY%OY4_CKMH*A$\=0MSHEC?H$M8+<&@*E'(3FM+K34R-:!J^J4R,P;J68"SJO49C+ M]IS7H#"'SI7T7Y+"C(D@;2*@-%V]5.;0156S< @]0\@*GB5-L F42N_?,=AT MGT23G&K?PJF\U_%VR\WL;@D6Q>9^E6Y-!NNET56@6329I-D/&_-#J=<\6:*B MRT@\/8&#VN C<5?VV/<(K-UFCE26\Y]W"HMQH4\JD)>R8&-MT]G=79*2CW>] MFL_M6/+]VK370E)'S;AR#U'97.\OJ_2A\6FHLV3-@:V2:+E;M^HVOA\ERW_M MDIU-4;JL\M<;PA4NGQ)%Y0D:QM%F.UJ8?S5/M?:RTR%C@-/PIU,PS),=3PDR^@RM"H3MQ=>^OT*"$/829QI+YEGS"[*HIW33 MNKN+ZXFPQLX)!8X H=VDX"Y&BPDV1D_A'//H/&LPZ*NB>Y*<4@@[]B7!CK!C M7PP1\X80<1T*SS/N18#B&T6-=1C6"S&\B_")@L:"H^>+X*#;(@H>4N^PEWC*#!M5T'PDLQ"O!/2*C$V[6<3"DZ[HJ"#V%0IX]FJ5J7( M,ZEW&FVT8Y2V3*@FE%H]%B;-\B52CG5HVLNJU%!3N0)%V4";V4 M'(- FGBI5*7TK@H=IS;^4#1>^BLU0B(_R.:\*>?"KM( (X6 M"PC:K4?350I8Y]&OR62$PL1J,ICCU'X*X[-,IA=(4?.L$MV+U6?C3AYM5Z-E M\G7;M+:5+*)]\L"F^G>[35L,MQ),,Q](8RZ _,),T]'XOM76,BV_C57]WY5G M+1#0WNO0V/CF)M\N' MQ@I!\#3^!>:2L>@64Y1/2!!FC (KC'=U6S 68K '82?'!9<4S93EIS8Y+KAG M#CV -0;><>"#<1HI@=PCSK9K+:& WV:>4AF=(([1OF2)DQBX^JRP#T"3<41@ES0V7F M!;@ES^Z_>M_?7CE_&:WJE\;/&;E#'RN^=61: %2 MR1"LY9J%X)\_-I++4.0:^+SDHBPE:&%];IP0+I*$L(+X"\>VG =5E*/+6: L MW8^*VX;%<^D O'Y8/,?F@J2F*$G-%LI[)BK!<$.G!<(NNCP=S@==7ELG* L) MVJ36A5.AVF?^I6/5WE@\'ID\]6Z5NB51J"L1;)1I(L3[-01/4:ZT3H[^=H)/ MI@AF2R@9"F""W;4WC<(/$(5??[>B+@-$"LP (?@4CFDII4"M4HK"T*P&338K M$@4SP:X&#B!0I!.K.J6XWB4HE2()%O,I:&KILH6(UYSGH\I"T'[D2!^U M*@.?*T]+!K3?@U)\K8/]J/$H-/ 0UHPJP+B2@<\Q*C,H6F(-.QAX@ FV\F@% M V\*8!Q9>?#$4.#P$38FE,D0DRL-[#8+;]JQ:FA,7( T%:'?]4'MF4BY&)(S M\)D>8HTT[,LH/&^EEBZQALK:"2H(A(O!ALZU$Z1RKJ1\2<$&K$O3)MC0OV@" MY4'[MCS0["H1%V1AM?3 M A+<$%F9"'2<4I8@H/:('6 UFM94N'9PQ(M4D': MW62H3 71(Z8DU*(]VSHO3&% 6N7NNYP08#@Y;G)+N2'EU!!S@BHW:'L!!S A MTP;%4A(U4>]ZW(B)QV$IK?Z$S#!CP&NG0B$Y3U]4;N\4_)8;I4$!0M2I(E M3B=AHKW\E/J&\&GYG#&4! 2?P&6KZ!8+PDXI,PWV(JKX^#02A;)1#2[!;AI5+>2AN492>E,S@^N2P;G [55'$B"*$'7/-!+EY14D5:#@J MM<@0Q+AD^>*F?J;/2VX#B5!NUAPA9*@E"[&)151['[M MGKDZ7RQ\228<5D!M8\*9V>I5$0*]( B<"^3K-EGJWV:4E^F]Y7C^\+KCY_5 7^*_>NN8.W1Z8^LO;O0^P2B(**@M)P3I M=989QBK:J7-MJNX)B0E0,BC<2($5B-:SMEDS^];?Z#Z*ON8H3=BA1+6)N/NM.*#=0K8@3D\# -YQ>A#ZQQ"WS,C\OWC]#KH#""E875*#^OL MMS<9#)7I-;GTGT#?!I2@IOO6YUR8Z^;Z,>-?1_-X6;/?Z)&'BR?QLIC?!IU MI&N9WHJE3(?);!,WMNX7NRP_+,]QI5V)UVPT%^8#EM$V&LV39=E'8US;M.;G M&"HS00\1'G9OQ:/:)$ >3:T9NRY4H-='<\.D<*G=KEO6(.R2-',H?Y 5W# H M+F"J+DMW+"76]I3%#-OLQNV&LG]X*1*!S\1@J2QD!B5? MDQB.^_T0XT6[C9F[?N$LQJNONJ/NL]ND^B,EKXTC@]$0H# ZI-R";\=$F'./ M'X%>L9NWM WV@_[[/[CZ"]!Q8:C!!W**8Q:$F'G@:C4>+39W3DLVR="#T-FC M-V6E9+$*)D8IS:72WODF6)H;^$T!>DF1=LRP/!^K1V5&<.445 M31">JN!I+YE/N9M^369896X1[6'F4_*KAM_D$,NN;.(%2X(UQ5U"JF.+L+/V M6.-,#0-)F+MF?4 78W4![)_UP4(22V%1+'77KDUA,ZJ-9F#CY<7=]==K[>.A M+_'.*Y5XP'H['2^Q,D'.1U%?!XPSK*1EH$F;;)(P(YW3GEECNG+=&0NYJ@??U@?!3 M3H@(B 0#.Z7>YD="T48#[0'L$VU9\QQ!SZF^-[Z?,8G)602?:,9,6BP-M*A9 MM;&MM0,)BWD0[&)JFWQ:W&**%U-.^V0->UAIPT#>TA OZ@T]#'&=FHM'&,$3 M3'"=0TNYA0B?RA0W^;V4G*N*;PNH\5'N\V"YH*M=14=L:Y>E1H(U)P@^26JO MP#@AP9KL1BDID5>Z;4WV>O.PF\EN3$E!MJ3X%C9[IX163(XG:+/N^QGWA:S/ MCKGW&L756YB3:Q+-,J",[*"8D=W7S->YF![E8A:-1)O[H1&EHKH_!.USK^C0 M-+!N8*XRWC5$85(57T?4C SM8,90U2%8K;XO63V$R@47^F M\^C.EH*2.XE,,ZS41&08>#BI5LL[HU+-UB8#(-G8D6H*5B8@B9X:++&*L'Q) MNY7U5GYWPM$[.9[QQ;>6W=+XXEM*8 ;M']_!T7FG,.Y5OXQO^:U]*\)) MK^"0V@VE[0@3& 69+"TV^.9S3 K9:!&M__F7'_XQ@H-O]/['#[^\MG19=^\" M6F9F>E=\JW6%S$"@ZVV>U6EP[&<09'FH?'Z5)74MCT7[M.F1/B:?^+P;!GV= M+C\-8ETMNK+7._<07MW>-]U6?)7?-XT"C'/?X_U>@AHX5R^J MUA.^6KM)?&43U4N F9->YS\+T"J9+I%*[VG!B-!YV4O1G .=Z9?Y,L# E%@& MF-!C;*@'>JW6*[3CE,6,0S^(21*:SW"NX4M=ZE!OHR2=1G&R,0E#REPF_TE? MT97#0J1E/[,F2(?AA,K8)7;*,HS68;#E?1=MK&(/*>%#EFW#@ M4UOUW=+Q:#NK$+9SP,+'B,.1ZDW9!&8_<:W5VVIP'F_F(% ]7T7+75!'7E0N MGI"N*NUGRTSUJMSF8>J/T=^?F^FT*RM$3U:8U\L[[IZ::P^8.(^@[N4G6"&X M[B4EN7=RHM+@D=*P7J\S?RBT>5C FJ[BL\WL?Y+5M'P6GU\Z?_S#Q]&?WWWZ M\.Z]%D0>ED_W0GPCZR)9;)+M60[II>/""&WHM#@<)&F:<\Q2(#[O"#:RM#(I M%Q]TZ?QG5F+=P_ 4@L&@YZA\3!1&L!]5F]'<^EA? \' H@OK"WV'%?%-.7!S M2863X]OFC38]]]$XTS1#UJ:+(1"O_"'8SVZ;WO@B!YU#@=IS8'GM9Y[A+D&1 M3O/L%Z BC:!R=O;3LW>]O\8[*5S?24&O3U4W_9Q1UE?_D'7N\A2S> A:=QM^ ; Thu, 15 May 2003 16:28: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 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.