From michael.vittrup.larsen@ericsson.com Mon Nov 1 01:58:52 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 01:59:00 -0800 (PST) Received: from albatross.ericsson.se (albatross.ericsson.se [193.180.251.49]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA19wpFT004323 for ; Mon, 1 Nov 2004 01:58:52 -0800 Received: from esealmw143.al.sw.ericsson.se ([153.88.254.118]) by albatross.ericsson.se (8.12.10/8.12.10/WIREfire-1.8b) with ESMTP id iA19wYWR004513 for ; Mon, 1 Nov 2004 10:58:34 +0100 (MET) Received: from esealnt613.al.sw.ericsson.se ([153.88.254.125]) by esealmw143.al.sw.ericsson.se with Microsoft SMTPSVC(6.0.3790.211); Mon, 1 Nov 2004 10:58:33 +0100 Received: from unixmail.ted.dk.eu.ericsson.se (knud.ted.dk.eu.ericsson.se [213.159.188.246]) by esealnt613.al.sw.ericsson.se with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id WB1YZ71Q; Mon, 1 Nov 2004 10:58:33 +0100 Received: from diadem.ted.dk.eu.ericsson.se (diadem.ted.dk.eu.ericsson.se [213.159.189.76]) by unixmail.ted.dk.eu.ericsson.se (8.10.1/8.10.1/TEDmain-1.0) with ESMTP id iA19wR321026; Mon, 1 Nov 2004 10:58:31 +0100 (MET) X-Sybari-Trust: ac4731ec 8cefd49f cf62e456 00000138 From: Michael Vittrup Larsen Organization: Ericsson To: Stephen Hemminger Subject: Re: [PATCH] tcp: efficient port randomisation Date: Mon, 1 Nov 2004 11:58:23 +0200 User-Agent: KMail/1.7 Cc: "David S. Miller" , netdev@oss.sgi.com References: <20041027092531.78fe438c@guest-251-240.pdx.osdl.net> <200410291048.01955.michael.vittrup.larsen@ericsson.com> <20041029102828.123502e7@zqx3.pdx.osdl.net> In-Reply-To: <20041029102828.123502e7@zqx3.pdx.osdl.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200411011058.23141.michael.vittrup.larsen@ericsson.com> X-OriginalArrivalTime: 01 Nov 2004 09:58:33.0685 (UTC) FILETIME=[59293050:01C4BFF9] X-archive-position: 11274 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: michael.vittrup.larsen@ericsson.com Precedence: bulk X-list: netdev Content-Length: 850 Lines: 21 On Friday 29 October 2004 19:28, Stephen Hemminger wrote: > Provide port randomization for incoming connections using variation of > existing sequence number hash. Replace tcp_portalloc_lock and > tcp_port_rover with atomic operation to allow better parallelism. > > This is based on > http://www.ietf.org/internet-drafts/draft-larsen-tsvwg-port-randomisation-0 >0.txt (with confirmation of of no IPR issues). I have looked through this, and have a few comments: * It is probably a good strategy to set 'tcp_rover_next' such that the next search is resumed from the previous port found to be free. (similar to the old algorithm). I don't see this in your patch, but of course I could have missed it. * connect_port_offset() does not (at least from an algorithm point of view) need to return an u32, an u16 is sufficient. Michael Larsen From kas@fi.muni.cz Mon Nov 1 03:23:43 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 03:23:55 -0800 (PST) Received: from anor.ics.muni.cz (root@anor.ics.muni.cz [147.251.4.35]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1BNfQ2009259 for ; Mon, 1 Nov 2004 03:23:42 -0800 Received: from anxur.fi.muni.cz (IDENT:0@anxur.fi.muni.cz [147.251.48.3]) by anor.ics.muni.cz (8.12.1/8.12.1) with ESMTP id iA1BNK4k013917; Mon, 1 Nov 2004 12:23:20 +0100 Received: from anxur.fi.muni.cz (IDENT:11561@localhost [127.0.0.1]) by anxur.fi.muni.cz (8.12.10/8.12.8) with ESMTP id iA1BNJc4007145; Mon, 1 Nov 2004 12:23:19 +0100 (MET) Received: (from kas@localhost) by anxur.fi.muni.cz (8.12.10/8.12.8/Submit) id iA1BNEHT007136; Mon, 1 Nov 2004 12:23:14 +0100 (MET) Date: Mon, 1 Nov 2004 12:23:14 +0100 From: Jan Kasprzak To: Jeff Garzik Cc: janitor@sternwelten.at, netdev@oss.sgi.com, nacc@us.ibm.com Subject: Re: [patch 06/18] net/cosa: replace schedule_timeout() with msleep_interruptible() Message-ID: <20041101112313.GD12416@fi.muni.cz> References: <4184C79F.3090602@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4184C79F.3090602@pobox.com> User-Agent: Mutt/1.4.2i X-Muni-Spam-TestIP: 147.251.48.3 X-Muni-Virus-Test: Clean X-archive-position: 11275 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kas@fi.muni.cz Precedence: bulk X-list: netdev Content-Length: 686 Lines: 16 Jeff Garzik wrote: : why add all the memory barriers and such associated with : set_current_state() ? : This is not time-critical - COSA is an ISA-only device, and the driver is not tested on SMP (I have tried to make it SMP-aware, but at the time I had no SMP machine with ISA slot). -Yenya -- | Jan "Yenya" Kasprzak | | GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E | | http://www.fi.muni.cz/~kas/ Czech Linux Homepage: http://www.linux.cz/ | > Whatever the Java applications and desktop dances may lead to, Unix will < > still be pushing the packets around for a quite a while. --Rob Pike < From hch@lst.de Mon Nov 1 03:46:24 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 03:46:32 -0800 (PST) Received: from mail.lst.de (verein.lst.de [213.95.11.210]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1BkNkX010666 for ; Mon, 1 Nov 2004 03:46:24 -0800 Received: from verein.lst.de (localhost [127.0.0.1]) by mail.lst.de (8.12.3/8.12.3/Debian-6.6) with ESMTP id iA1Bk5la007538 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Nov 2004 12:46:05 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id iA1Bk5WH007536; Mon, 1 Nov 2004 12:46:05 +0100 Date: Mon, 1 Nov 2004 12:46:05 +0100 From: Christoph Hellwig To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] remove dead exports from net/core/dev.c Message-ID: <20041101114605.GA7507@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Scanned-By: MIMEDefang 2.39 X-archive-position: 11276 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 Content-Length: 5873 Lines: 196 this also allows to kill some competely dead code, e.g. many of the non-locked __foo routines. Signed-off-by: Christoph Hellwig --- 1.91/include/linux/netdevice.h 2004-10-26 18:09:33 +02:00 +++ edited/include/linux/netdevice.h 2004-10-30 21:04:33 +02:00 @@ -526,20 +526,13 @@ extern int netdev_boot_setup_check(struct net_device *dev); extern unsigned long netdev_boot_base(const char *prefix, int unit); extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); -extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 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); -static inline int __deprecated dev_get(const char *name) -{ - return __dev_get(name); -} + extern struct net_device *dev_get_by_flags(unsigned short flags, unsigned short mask); -extern struct net_device *__dev_get_by_flags(unsigned short flags, - unsigned short mask); extern struct net_device *dev_get_by_name(const char *name); extern struct net_device *__dev_get_by_name(const char *name); extern int dev_alloc_name(struct net_device *dev, const char *name); @@ -553,7 +546,6 @@ extern int register_netdevice_notifier(struct notifier_block *nb); extern int unregister_netdevice_notifier(struct notifier_block *nb); extern int call_netdevice_notifiers(unsigned long val, void *v); -extern int dev_new_index(void); extern struct net_device *dev_get_by_index(int ifindex); extern struct net_device *__dev_get_by_index(int ifindex); extern int dev_restart(struct net_device *dev); @@ -910,7 +902,6 @@ /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct net_device *dev); -extern void fddi_setup(struct net_device *dev); extern void tr_setup(struct net_device *dev); extern void fc_setup(struct net_device *dev); extern void fc_freedev(struct net_device *dev); --- 1.169/net/core/dev.c 2004-10-26 18:09:33 +02:00 +++ edited/net/core/dev.c 2004-10-30 23:17:56 +02:00 @@ -520,35 +520,6 @@ return dev; } -/* - Return value is changed to int to prevent illegal usage in future. - It is still legal to use to check for device existence. - - User should understand, that the result returned by this function - is meaningless, if it was not issued under rtnl semaphore. - */ - -/** - * dev_get - test if a device exists - * @name: name to test for - * - * Test if a name exists. Returns true if the name is found. In order - * to be sure the name is not allocated or removed during the test the - * caller must hold the rtnl semaphore. - * - * This function exists only for back compatibility with older - * drivers. - */ -int __dev_get(const char *name) -{ - struct net_device *dev; - - read_lock(&dev_base_lock); - dev = __dev_get_by_name(name); - read_unlock(&dev_base_lock); - return dev != NULL; -} - /** * __dev_get_by_index - find a device by its ifindex * @ifindex: index of device @@ -623,26 +594,17 @@ return dev; } -struct net_device *__dev_getfirstbyhwtype(unsigned short type) -{ - struct net_device *dev; - - for (dev = dev_base; dev; dev = dev->next) - if (dev->type == type) - break; - return dev; -} - -EXPORT_SYMBOL(__dev_getfirstbyhwtype); - struct net_device *dev_getfirstbyhwtype(unsigned short type) { struct net_device *dev; rtnl_lock(); - dev = __dev_getfirstbyhwtype(type); - if (dev) - dev_hold(dev); + for (dev = dev_base; dev; dev = dev->next) { + if (dev->type == type) { + dev_hold(dev); + break; + } + } rtnl_unlock(); return dev; } @@ -665,32 +627,14 @@ struct net_device *dev; read_lock(&dev_base_lock); - dev = __dev_get_by_flags(if_flags, mask); - if (dev) - dev_hold(dev); - read_unlock(&dev_base_lock); - return dev; -} - -/** - * __dev_get_by_flags - find any device with given flags - * @if_flags: IFF_* values - * @mask: bitmask of bits in if_flags to check - * - * Search for any interface with the given flags. Returns NULL if a device - * is not found or a pointer to the device. The caller must hold either - * the RTNL semaphore or @dev_base_lock. - */ - -struct net_device *__dev_get_by_flags(unsigned short if_flags, unsigned short mask) -{ - struct net_device *dev; - for (dev = dev_base; dev != NULL; dev = dev->next) { - if (((dev->flags ^ if_flags) & mask) == 0) - return dev; + if (((dev->flags ^ if_flags) & mask) == 0) { + dev_hold(dev); + break; + } } - return NULL; + read_unlock(&dev_base_lock); + return dev; } /** @@ -2696,7 +2640,7 @@ * number. The caller must hold the rtnl semaphore or the * dev_base_lock to be sure it remains unique. */ -int dev_new_index(void) +static int dev_new_index(void) { static int ifindex; for (;;) { @@ -3236,30 +3180,23 @@ subsys_initcall(net_dev_init); -EXPORT_SYMBOL(__dev_get); -EXPORT_SYMBOL(__dev_get_by_flags); EXPORT_SYMBOL(__dev_get_by_index); EXPORT_SYMBOL(__dev_get_by_name); EXPORT_SYMBOL(__dev_remove_pack); EXPORT_SYMBOL(__skb_linearize); -EXPORT_SYMBOL(call_netdevice_notifiers); EXPORT_SYMBOL(dev_add_pack); EXPORT_SYMBOL(dev_alloc_name); EXPORT_SYMBOL(dev_close); EXPORT_SYMBOL(dev_get_by_flags); EXPORT_SYMBOL(dev_get_by_index); EXPORT_SYMBOL(dev_get_by_name); -EXPORT_SYMBOL(dev_getbyhwaddr); EXPORT_SYMBOL(dev_ioctl); -EXPORT_SYMBOL(dev_new_index); EXPORT_SYMBOL(dev_open); EXPORT_SYMBOL(dev_queue_xmit); -EXPORT_SYMBOL(dev_queue_xmit_nit); EXPORT_SYMBOL(dev_remove_pack); EXPORT_SYMBOL(dev_set_allmulti); EXPORT_SYMBOL(dev_set_promiscuity); EXPORT_SYMBOL(dev_change_flags); -EXPORT_SYMBOL(dev_change_name); EXPORT_SYMBOL(dev_set_mtu); EXPORT_SYMBOL(free_netdev); EXPORT_SYMBOL(netdev_boot_setup_check); From hch@lst.de Mon Nov 1 03:57:12 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 03:57:17 -0800 (PST) Received: from mail.lst.de (verein.lst.de [213.95.11.210]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1BvBam011317 for ; Mon, 1 Nov 2004 03:57:11 -0800 Received: from verein.lst.de (localhost [127.0.0.1]) by mail.lst.de (8.12.3/8.12.3/Debian-6.6) with ESMTP id iA1Burla007725 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Nov 2004 12:56:53 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id iA1BurxK007723; Mon, 1 Nov 2004 12:56:53 +0100 Date: Mon, 1 Nov 2004 12:56:53 +0100 From: Christoph Hellwig To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] remove dead skb_iter* functions Message-ID: <20041101115653.GA7714@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Scanned-By: MIMEDefang 2.39 X-archive-position: 11277 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 Content-Length: 4363 Lines: 160 Signed-off-by: Christoph Hellwig --- 1.56/include/linux/skbuff.h 2004-10-05 23:51:01 +02:00 +++ edited/include/linux/skbuff.h 2004-10-30 21:04:33 +02:00 @@ -592,7 +592,6 @@ /* * Insert a packet on a list. */ -extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk); static inline void __skb_insert(struct sk_buff *newsk, struct sk_buff *prev, struct sk_buff *next, struct sk_buff_head *list) @@ -1120,22 +1119,6 @@ extern void skb_init(void); extern void skb_add_mtu(int mtu); - -struct skb_iter { - /* Iteration functions set these */ - unsigned char *data; - unsigned int len; - - /* Private to iteration */ - unsigned int nextfrag; - struct sk_buff *fraglist; -}; - -/* Keep iterating until skb_iter_next returns false. */ -extern void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i); -extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i); -/* Call this if aborting loop before !skb_iter_next */ -extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); #ifdef CONFIG_NETFILTER static inline void nf_conntrack_put(struct nf_conntrack *nfct) --- 1.39/net/core/skbuff.c 2004-10-20 06:56:24 +02:00 +++ edited/net/core/skbuff.c 2004-10-30 21:04:33 +02:00 @@ -929,72 +929,7 @@ return -EFAULT; } -/* Keep iterating until skb_iter_next returns false. */ -void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i) -{ - i->len = skb_headlen(skb); - i->data = (unsigned char *)skb->data; - i->nextfrag = 0; - i->fraglist = NULL; -} - -int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i) -{ - /* Unmap previous, if not head fragment. */ - if (i->nextfrag) - kunmap_skb_frag(i->data); - - if (i->fraglist) { - fraglist: - /* We're iterating through fraglist. */ - if (i->nextfrag < skb_shinfo(i->fraglist)->nr_frags) { - i->data = kmap_skb_frag(&skb_shinfo(i->fraglist) - ->frags[i->nextfrag]); - i->len = skb_shinfo(i->fraglist)->frags[i->nextfrag] - .size; - i->nextfrag++; - return 1; - } - /* Fragments with fragments? Too hard! */ - BUG_ON(skb_shinfo(i->fraglist)->frag_list); - i->fraglist = i->fraglist->next; - if (!i->fraglist) - goto end; - - i->len = skb_headlen(i->fraglist); - i->data = i->fraglist->data; - i->nextfrag = 0; - return 1; - } - - if (i->nextfrag < skb_shinfo(skb)->nr_frags) { - i->data = kmap_skb_frag(&skb_shinfo(skb)->frags[i->nextfrag]); - i->len = skb_shinfo(skb)->frags[i->nextfrag].size; - i->nextfrag++; - return 1; - } - - i->fraglist = skb_shinfo(skb)->frag_list; - if (i->fraglist) - goto fraglist; - -end: - /* Bug trap for callers */ - i->data = NULL; - return 0; -} - -void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i) -{ - /* Unmap previous, if not head fragment. */ - if (i->data && i->nextfrag) - kunmap_skb_frag(i->data); - /* Bug trap for callers */ - i->data = NULL; -} - /* Checksum skb data. */ - unsigned int skb_checksum(const struct sk_buff *skb, int offset, int len, unsigned int csum) { @@ -1318,25 +1253,6 @@ } -/** - * skb_insert - insert a buffer - * @old: buffer to insert before - * @newsk: buffer to insert - * - * Place a packet before a given packet in a list. The list locks are taken - * and this function is atomic with respect to other list locked calls - * A buffer cannot be placed on two lists at the same time. - */ - -void skb_insert(struct sk_buff *old, struct sk_buff *newsk) -{ - unsigned long flags; - - spin_lock_irqsave(&old->list->lock, flags); - __skb_insert(newsk, old->prev, old, old->list); - spin_unlock_irqrestore(&old->list->lock, flags); -} - #if 0 /* * Tune the memory allocator for a new MTU size. @@ -1444,7 +1360,6 @@ EXPORT_SYMBOL(pskb_expand_head); EXPORT_SYMBOL(skb_checksum); EXPORT_SYMBOL(skb_clone); -EXPORT_SYMBOL(skb_clone_fraglist); EXPORT_SYMBOL(skb_copy); EXPORT_SYMBOL(skb_copy_and_csum_bits); EXPORT_SYMBOL(skb_copy_and_csum_dev); @@ -1456,13 +1371,8 @@ EXPORT_SYMBOL(skb_under_panic); EXPORT_SYMBOL(skb_dequeue); EXPORT_SYMBOL(skb_dequeue_tail); -EXPORT_SYMBOL(skb_insert); EXPORT_SYMBOL(skb_queue_purge); EXPORT_SYMBOL(skb_queue_head); EXPORT_SYMBOL(skb_queue_tail); EXPORT_SYMBOL(skb_unlink); EXPORT_SYMBOL(skb_append); -EXPORT_SYMBOL(skb_split); -EXPORT_SYMBOL(skb_iter_first); -EXPORT_SYMBOL(skb_iter_next); -EXPORT_SYMBOL(skb_iter_abort); From hch@lst.de Mon Nov 1 05:02:04 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 05:02:13 -0800 (PST) Received: from mail.lst.de (verein.lst.de [213.95.11.210]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1D22nV016986 for ; Mon, 1 Nov 2004 05:02:03 -0800 Received: from verein.lst.de (localhost [127.0.0.1]) by mail.lst.de (8.12.3/8.12.3/Debian-6.6) with ESMTP id iA1D1ila008754 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Nov 2004 14:01:45 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id iA1D1isb008752; Mon, 1 Nov 2004 14:01:44 +0100 Date: Mon, 1 Nov 2004 14:01:44 +0100 From: Christoph Hellwig To: davem@redhat.com Cc: netdev@oss.sgi.com Subject: [PATCH] remove net_init.c ifdef clutter Message-ID: <20041101130144.GA8727@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Scanned-By: MIMEDefang 2.39 X-archive-position: 11278 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 Content-Length: 20351 Lines: 727 Move the devicetype-specific functions from net_init.c to the devicetype-specific files under net/. --- 1.24/drivers/net/net_init.c 2004-04-06 00:46:26 +02:00 +++ edited/drivers/net/net_init.c 2004-11-01 13:20:45 +01:00 @@ -105,260 +105,6 @@ } EXPORT_SYMBOL(alloc_netdev); -/** - * alloc_etherdev - Allocates and sets up an ethernet device - * @sizeof_priv: Size of additional driver-private structure to be allocated - * for this ethernet device - * - * Fill in the fields of the device structure with ethernet-generic - * values. Basically does everything except registering the device. - * - * Constructs a new net device, complete with a private data area of - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for - * this private data area. - */ - -struct net_device *alloc_etherdev(int sizeof_priv) -{ - return alloc_netdev(sizeof_priv, "eth%d", ether_setup); -} - -EXPORT_SYMBOL(alloc_etherdev); - -static int eth_mac_addr(struct net_device *dev, void *p) -{ - struct sockaddr *addr=p; - if (netif_running(dev)) - return -EBUSY; - memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); - return 0; -} - -static int eth_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > 1500)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - -#ifdef CONFIG_FDDI - -/** - * alloc_fddidev - Register FDDI device - * @sizeof_priv: Size of additional driver-private structure to be allocated - * for this FDDI device - * - * Fill in the fields of the device structure with FDDI-generic values. - * - * Constructs a new net device, complete with a private data area of - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for - * this private data area. - */ - -struct net_device *alloc_fddidev(int sizeof_priv) -{ - return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup); -} - -EXPORT_SYMBOL(alloc_fddidev); - -static int fddi_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < FDDI_K_SNAP_HLEN) || (new_mtu > FDDI_K_SNAP_DLEN)) - return(-EINVAL); - dev->mtu = new_mtu; - return(0); -} - -#endif /* CONFIG_FDDI */ - -#ifdef CONFIG_HIPPI - -static int hippi_change_mtu(struct net_device *dev, int new_mtu) -{ - /* - * HIPPI's got these nice large MTUs. - */ - if ((new_mtu < 68) || (new_mtu > 65280)) - return -EINVAL; - dev->mtu = new_mtu; - return(0); -} - - -/* - * For HIPPI we will actually use the lower 4 bytes of the hardware - * address as the I-FIELD rather than the actual hardware address. - */ -static int hippi_mac_addr(struct net_device *dev, void *p) -{ - struct sockaddr *addr = p; - if (netif_running(dev)) - return -EBUSY; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - return 0; -} - -static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) -{ - /* Never send broadcast/multicast ARP messages */ - p->mcast_probes = 0; - - /* In IPv6 unicast probes are valid even on NBMA, - * because they are encapsulated in normal IPv6 protocol. - * Should be a generic flag. - */ - if (p->tbl->family != AF_INET6) - p->ucast_probes = 0; - return 0; -} - -static void hippi_setup(struct net_device *dev) -{ - dev->set_multicast_list = NULL; - dev->change_mtu = hippi_change_mtu; - dev->hard_header = hippi_header; - dev->rebuild_header = hippi_rebuild_header; - dev->set_mac_address = hippi_mac_addr; - dev->hard_header_parse = NULL; - dev->hard_header_cache = NULL; - dev->header_cache_update = NULL; - dev->neigh_setup = hippi_neigh_setup_dev; - - /* - * We don't support HIPPI `ARP' for the time being, and probably - * never will unless someone else implements it. However we - * still need a fake ARPHRD to make ifconfig and friends play ball. - */ - dev->type = ARPHRD_HIPPI; - dev->hard_header_len = HIPPI_HLEN; - dev->mtu = 65280; - dev->addr_len = HIPPI_ALEN; - dev->tx_queue_len = 25 /* 5 */; - memset(dev->broadcast, 0xFF, HIPPI_ALEN); - - - /* - * HIPPI doesn't support broadcast+multicast and we only use - * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. - */ - dev->flags = 0; -} - -/** - * alloc_hippi_dev - Register HIPPI device - * @sizeof_priv: Size of additional driver-private structure to be allocated - * for this HIPPI device - * - * Fill in the fields of the device structure with HIPPI-generic values. - * - * Constructs a new net device, complete with a private data area of - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for - * this private data area. - */ - -struct net_device *alloc_hippi_dev(int sizeof_priv) -{ - return alloc_netdev(sizeof_priv, "hip%d", hippi_setup); -} - -EXPORT_SYMBOL(alloc_hippi_dev); - -#endif /* CONFIG_HIPPI */ - -void ether_setup(struct net_device *dev) -{ - /* Fill in the fields of the device structure with ethernet-generic values. - This should be in a common file instead of per-driver. */ - - dev->change_mtu = eth_change_mtu; - dev->hard_header = eth_header; - dev->rebuild_header = eth_rebuild_header; - dev->set_mac_address = eth_mac_addr; - dev->hard_header_cache = eth_header_cache; - dev->header_cache_update= eth_header_cache_update; - dev->hard_header_parse = eth_header_parse; - - dev->type = ARPHRD_ETHER; - dev->hard_header_len = ETH_HLEN; - dev->mtu = 1500; /* eth_mtu */ - dev->addr_len = ETH_ALEN; - dev->tx_queue_len = 1000; /* Ethernet wants good queues */ - - memset(dev->broadcast,0xFF, ETH_ALEN); - - /* New-style flags. */ - dev->flags = IFF_BROADCAST|IFF_MULTICAST; -} -EXPORT_SYMBOL(ether_setup); - -#ifdef CONFIG_FDDI - -void fddi_setup(struct net_device *dev) -{ - /* - * Fill in the fields of the device structure with FDDI-generic values. - * This should be in a common file instead of per-driver. - */ - - dev->change_mtu = fddi_change_mtu; - dev->hard_header = fddi_header; - dev->rebuild_header = fddi_rebuild_header; - - dev->type = ARPHRD_FDDI; - dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ - dev->mtu = FDDI_K_SNAP_DLEN; /* Assume max payload of 802.2 SNAP frame */ - dev->addr_len = FDDI_K_ALEN; - dev->tx_queue_len = 100; /* Long queues on FDDI */ - - memset(dev->broadcast, 0xFF, FDDI_K_ALEN); - - /* New-style flags */ - dev->flags = IFF_BROADCAST | IFF_MULTICAST; -} -EXPORT_SYMBOL(fddi_setup); - -#endif /* CONFIG_FDDI */ - -#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) - -static int ltalk_change_mtu(struct net_device *dev, int mtu) -{ - return -EINVAL; -} - -static int ltalk_mac_addr(struct net_device *dev, void *addr) -{ - return -EINVAL; -} - - -void ltalk_setup(struct net_device *dev) -{ - /* Fill in the fields of the device structure with localtalk-generic values. */ - - dev->change_mtu = ltalk_change_mtu; - dev->hard_header = NULL; - dev->rebuild_header = NULL; - dev->set_mac_address = ltalk_mac_addr; - dev->hard_header_cache = NULL; - dev->header_cache_update= NULL; - - dev->type = ARPHRD_LOCALTLK; - dev->hard_header_len = LTALK_HLEN; - dev->mtu = LTALK_MTU; - dev->addr_len = LTALK_ALEN; - dev->tx_queue_len = 10; - - dev->broadcast[0] = 0xFF; - - dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; -} -EXPORT_SYMBOL(ltalk_setup); - -#endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */ - int register_netdev(struct net_device *dev) { int err; @@ -404,90 +150,3 @@ EXPORT_SYMBOL(register_netdev); EXPORT_SYMBOL(unregister_netdev); - -#ifdef CONFIG_TR - -void tr_setup(struct net_device *dev) -{ - /* - * Configure and register - */ - - dev->hard_header = tr_header; - dev->rebuild_header = tr_rebuild_header; - - dev->type = ARPHRD_IEEE802_TR; - dev->hard_header_len = TR_HLEN; - dev->mtu = 2000; - dev->addr_len = TR_ALEN; - dev->tx_queue_len = 100; /* Long queues on tr */ - - memset(dev->broadcast,0xFF, TR_ALEN); - - /* New-style flags. */ - dev->flags = IFF_BROADCAST | IFF_MULTICAST ; -} - -/** - * alloc_trdev - Register token ring device - * @sizeof_priv: Size of additional driver-private structure to be allocated - * for this token ring device - * - * Fill in the fields of the device structure with token ring-generic values. - * - * Constructs a new net device, complete with a private data area of - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for - * this private data area. - */ - -struct net_device *alloc_trdev(int sizeof_priv) -{ - return alloc_netdev(sizeof_priv, "tr%d", tr_setup); -} - -EXPORT_SYMBOL(tr_setup); -EXPORT_SYMBOL(alloc_trdev); - -#endif /* CONFIG_TR */ - -#ifdef CONFIG_NET_FC - -void fc_setup(struct net_device *dev) -{ - dev->hard_header = fc_header; - dev->rebuild_header = fc_rebuild_header; - - dev->type = ARPHRD_IEEE802; - dev->hard_header_len = FC_HLEN; - dev->mtu = 2024; - dev->addr_len = FC_ALEN; - dev->tx_queue_len = 100; /* Long queues on fc */ - - memset(dev->broadcast,0xFF, FC_ALEN); - - /* New-style flags. */ - dev->flags = IFF_BROADCAST; -} - -/** - * alloc_fcdev - Register fibre channel device - * @sizeof_priv: Size of additional driver-private structure to be allocated - * for this fibre channel device - * - * Fill in the fields of the device structure with fibre channel-generic values. - * - * Constructs a new net device, complete with a private data area of - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for - * this private data area. - */ - -struct net_device *alloc_fcdev(int sizeof_priv) -{ - return alloc_netdev(sizeof_priv, "fc%d", fc_setup); -} - -EXPORT_SYMBOL(fc_setup); -EXPORT_SYMBOL(alloc_fcdev); - -#endif /* CONFIG_NET_FC */ - --- 1.91/include/linux/netdevice.h 2004-10-26 18:09:33 +02:00 +++ edited/include/linux/netdevice.h 2004-11-01 13:13:07 +01:00 @@ -910,10 +910,7 @@ /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct net_device *dev); -extern void fddi_setup(struct net_device *dev); -extern void tr_setup(struct net_device *dev); -extern void fc_setup(struct net_device *dev); -extern void fc_freedev(struct net_device *dev); + /* Support for loadable net-drivers */ extern struct net_device *alloc_netdev(int sizeof_priv, const char *name, void (*setup)(struct net_device *)); ===== net/802/fc.c 1.3 vs edited ===== --- 1.3/net/802/fc.c 2004-06-24 21:37:35 +02:00 +++ edited/net/802/fc.c 2004-11-01 13:52:59 +01:00 @@ -129,3 +129,35 @@ return ntohs(ETH_P_802_2); } + +static void fc_setup(struct net_device *dev) +{ + dev->hard_header = fc_header; + dev->rebuild_header = fc_rebuild_header; + + dev->type = ARPHRD_IEEE802; + dev->hard_header_len = FC_HLEN; + dev->mtu = 2024; + dev->addr_len = FC_ALEN; + dev->tx_queue_len = 100; /* Long queues on fc */ + dev->flags = IFF_BROADCAST; + + memset(dev->broadcast, 0xFF, FC_ALEN); +} + +/** + * alloc_fcdev - Register fibre channel device + * @sizeof_priv: Size of additional driver-private structure to be allocated + * for this fibre channel device + * + * Fill in the fields of the device structure with fibre channel-generic values. + * + * Constructs a new net device, complete with a private data area of + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for + * this private data area. + */ +struct net_device *alloc_fcdev(int sizeof_priv) +{ + return alloc_netdev(sizeof_priv, "fc%d", fc_setup); +} +EXPORT_SYMBOL(alloc_fcdev); --- 1.3/net/802/fddi.c 2003-09-29 04:23:30 +02:00 +++ edited/net/802/fddi.c 2004-11-01 13:12:14 +01:00 @@ -166,3 +166,44 @@ } EXPORT_SYMBOL(fddi_type_trans); + +static int fddi_change_mtu(struct net_device *dev, int new_mtu) +{ + if ((new_mtu < FDDI_K_SNAP_HLEN) || (new_mtu > FDDI_K_SNAP_DLEN)) + return(-EINVAL); + dev->mtu = new_mtu; + return(0); +} + +static void fddi_setup(struct net_device *dev) +{ + dev->change_mtu = fddi_change_mtu; + dev->hard_header = fddi_header; + dev->rebuild_header = fddi_rebuild_header; + + dev->type = ARPHRD_FDDI; + dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ + dev->mtu = FDDI_K_SNAP_DLEN; /* Assume max payload of 802.2 SNAP frame */ + dev->addr_len = FDDI_K_ALEN; + dev->tx_queue_len = 100; /* Long queues on FDDI */ + dev->flags = IFF_BROADCAST | IFF_MULTICAST; + + memset(dev->broadcast, 0xFF, FDDI_K_ALEN); +} + +/** + * alloc_fddidev - Register FDDI device + * @sizeof_priv: Size of additional driver-private structure to be allocated + * for this FDDI device + * + * Fill in the fields of the device structure with FDDI-generic values. + * + * Constructs a new net device, complete with a private data area of + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for + * this private data area. + */ +struct net_device *alloc_fddidev(int sizeof_priv) +{ + return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup); +} +EXPORT_SYMBOL(alloc_fddidev); --- 1.4/net/802/hippi.c 2003-09-29 04:23:30 +02:00 +++ edited/net/802/hippi.c 2004-11-01 13:53:31 +01:00 @@ -154,3 +154,92 @@ } EXPORT_SYMBOL(hippi_type_trans); + +static int hippi_change_mtu(struct net_device *dev, int new_mtu) +{ + /* + * HIPPI's got these nice large MTUs. + */ + if ((new_mtu < 68) || (new_mtu > 65280)) + return -EINVAL; + dev->mtu = new_mtu; + return(0); +} + +/* + * For HIPPI we will actually use the lower 4 bytes of the hardware + * address as the I-FIELD rather than the actual hardware address. + */ +static int hippi_mac_addr(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + if (netif_running(dev)) + return -EBUSY; + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); + return 0; +} + +static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) +{ + /* Never send broadcast/multicast ARP messages */ + p->mcast_probes = 0; + + /* In IPv6 unicast probes are valid even on NBMA, + * because they are encapsulated in normal IPv6 protocol. + * Should be a generic flag. + */ + if (p->tbl->family != AF_INET6) + p->ucast_probes = 0; + return 0; +} + +static void hippi_setup(struct net_device *dev) +{ + dev->set_multicast_list = NULL; + dev->change_mtu = hippi_change_mtu; + dev->hard_header = hippi_header; + dev->rebuild_header = hippi_rebuild_header; + dev->set_mac_address = hippi_mac_addr; + dev->hard_header_parse = NULL; + dev->hard_header_cache = NULL; + dev->header_cache_update = NULL; + dev->neigh_setup = hippi_neigh_setup_dev; + + /* + * We don't support HIPPI `ARP' for the time being, and probably + * never will unless someone else implements it. However we + * still need a fake ARPHRD to make ifconfig and friends play ball. + */ + dev->type = ARPHRD_HIPPI; + dev->hard_header_len = HIPPI_HLEN; + dev->mtu = 65280; + dev->addr_len = HIPPI_ALEN; + dev->tx_queue_len = 25 /* 5 */; + memset(dev->broadcast, 0xFF, HIPPI_ALEN); + + + /* + * HIPPI doesn't support broadcast+multicast and we only use + * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. + */ + dev->flags = 0; +} + +/** + * alloc_hippi_dev - Register HIPPI device + * @sizeof_priv: Size of additional driver-private structure to be allocated + * for this HIPPI device + * + * Fill in the fields of the device structure with HIPPI-generic values. + * + * Constructs a new net device, complete with a private data area of + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for + * this private data area. + */ + +struct net_device *alloc_hippi_dev(int sizeof_priv) +{ + return alloc_netdev(sizeof_priv, "hip%d", hippi_setup); +} + +EXPORT_SYMBOL(alloc_hippi_dev); --- 1.17/net/802/tr.c 2004-06-24 21:36:53 +02:00 +++ edited/net/802/tr.c 2004-11-01 13:14:02 +01:00 @@ -583,6 +583,43 @@ #endif +static void tr_setup(struct net_device *dev) +{ + /* + * Configure and register + */ + + dev->hard_header = tr_header; + dev->rebuild_header = tr_rebuild_header; + + dev->type = ARPHRD_IEEE802_TR; + dev->hard_header_len = TR_HLEN; + dev->mtu = 2000; + dev->addr_len = TR_ALEN; + dev->tx_queue_len = 100; /* Long queues on tr */ + + memset(dev->broadcast,0xFF, TR_ALEN); + + /* New-style flags. */ + dev->flags = IFF_BROADCAST | IFF_MULTICAST ; +} + +/** + * alloc_trdev - Register token ring device + * @sizeof_priv: Size of additional driver-private structure to be allocated + * for this token ring device + * + * Fill in the fields of the device structure with token ring-generic values. + * + * Constructs a new net device, complete with a private data area of + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for + * this private data area. + */ +struct net_device *alloc_trdev(int sizeof_priv) +{ + return alloc_netdev(sizeof_priv, "tr%d", tr_setup); +} + /* * Called during bootup. We don't actually have to initialise * too much for this. @@ -604,3 +641,4 @@ EXPORT_SYMBOL(tr_source_route); EXPORT_SYMBOL(tr_type_trans); +EXPORT_SYMBOL(alloc_trdev); --- 1.8/net/appletalk/Makefile 2004-08-18 23:35:04 +02:00 +++ edited/net/appletalk/Makefile 2004-11-01 13:22:42 +01:00 @@ -4,6 +4,6 @@ obj-$(CONFIG_ATALK) += appletalk.o -appletalk-y := aarp.o ddp.o +appletalk-y := aarp.o ddp.o dev.o appletalk-$(CONFIG_PROC_FS) += atalk_proc.o appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o --- 1.9/net/ethernet/eth.c 2004-10-05 23:51:01 +02:00 +++ edited/net/ethernet/eth.c 2004-11-01 13:54:23 +01:00 @@ -245,3 +245,64 @@ } EXPORT_SYMBOL(eth_type_trans); + +static int eth_mac_addr(struct net_device *dev, void *p) +{ + struct sockaddr *addr=p; + if (netif_running(dev)) + return -EBUSY; + memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); + return 0; +} + +static int eth_change_mtu(struct net_device *dev, int new_mtu) +{ + if ((new_mtu < 68) || (new_mtu > 1500)) + return -EINVAL; + dev->mtu = new_mtu; + return 0; +} + +/* + * Fill in the fields of the device structure with ethernet-generic values. + */ +void ether_setup(struct net_device *dev) +{ + dev->change_mtu = eth_change_mtu; + dev->hard_header = eth_header; + dev->rebuild_header = eth_rebuild_header; + dev->set_mac_address = eth_mac_addr; + dev->hard_header_cache = eth_header_cache; + dev->header_cache_update= eth_header_cache_update; + dev->hard_header_parse = eth_header_parse; + + dev->type = ARPHRD_ETHER; + dev->hard_header_len = ETH_HLEN; + dev->mtu = 1500; /* eth_mtu */ + dev->addr_len = ETH_ALEN; + dev->tx_queue_len = 1000; /* Ethernet wants good queues */ + dev->flags = IFF_BROADCAST|IFF_MULTICAST; + + memset(dev->broadcast,0xFF, ETH_ALEN); + +} +EXPORT_SYMBOL(ether_setup); + +/** + * alloc_etherdev - Allocates and sets up an ethernet device + * @sizeof_priv: Size of additional driver-private structure to be allocated + * for this ethernet device + * + * Fill in the fields of the device structure with ethernet-generic + * values. Basically does everything except registering the device. + * + * Constructs a new net device, complete with a private data area of + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for + * this private data area. + */ + +struct net_device *alloc_etherdev(int sizeof_priv) +{ + return alloc_netdev(sizeof_priv, "eth%d", ether_setup); +} +EXPORT_SYMBOL(alloc_etherdev); --- /dev/null 2004-08-20 00:05:11.000000000 +0200 +++ b/net/appletalk/dev.c 2004-11-01 13:49:02.111094544 +0100 @@ -0,0 +1,43 @@ +/* + * Moved here from drivers/net/net_init.c, which is: + * Written 1993,1994,1995 by Donald Becker. + */ + +#include +#include +#include +#include +#include + +static int ltalk_change_mtu(struct net_device *dev, int mtu) +{ + return -EINVAL; +} + +static int ltalk_mac_addr(struct net_device *dev, void *addr) +{ + return -EINVAL; +} + +void ltalk_setup(struct net_device *dev) +{ + /* Fill in the fields of the device structure with localtalk-generic values. */ + + dev->change_mtu = ltalk_change_mtu; + dev->hard_header = NULL; + dev->rebuild_header = NULL; + dev->set_mac_address = ltalk_mac_addr; + dev->hard_header_cache = NULL; + dev->header_cache_update= NULL; + + dev->type = ARPHRD_LOCALTLK; + dev->hard_header_len = LTALK_HLEN; + dev->mtu = LTALK_MTU; + dev->addr_len = LTALK_ALEN; + dev->tx_queue_len = 10; + + dev->broadcast[0] = 0xFF; + + dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; +} +EXPORT_SYMBOL(ltalk_setup); From SRS0+637e20ab50b9227e3014+435+infradead.org+hch@phoenix.srs.infradead.org Mon Nov 1 05:03:57 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 05:04:05 -0800 (PST) Received: from phoenix.infradead.org (phoenix.infradead.org [81.187.226.98]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1D3tVP017241 for ; Mon, 1 Nov 2004 05:03:56 -0800 Received: from hch by phoenix.infradead.org with local (Exim 4.42 #1 (Red Hat Linux)) id 1CObqO-00079U-BF; Mon, 01 Nov 2004 13:03:32 +0000 Date: Mon, 1 Nov 2004 13:03:32 +0000 From: Christoph Hellwig To: Christoph Hellwig Cc: davem@redhat.com, netdev@oss.sgi.com Subject: Re: [PATCH] remove net_init.c ifdef clutter Message-ID: <20041101130331.GA27476@infradead.org> References: <20041101130144.GA8727@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041101130144.GA8727@lst.de> User-Agent: Mutt/1.4.1i X-SRS-Rewrite: SMTP reverse-path rewritten from by phoenix.infradead.org See http://www.infradead.org/rpr.html X-archive-position: 11279 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hch@infradead.org Precedence: bulk X-list: netdev Content-Length: 21942 Lines: 732 On Mon, Nov 01, 2004 at 02:01:44PM +0100, Christoph Hellwig wrote: > Move the devicetype-specific functions from net_init.c to the > devicetype-specific files under net/. Signed-off-by: Christoph Hellwig > > --- 1.24/drivers/net/net_init.c 2004-04-06 00:46:26 +02:00 > +++ edited/drivers/net/net_init.c 2004-11-01 13:20:45 +01:00 > @@ -105,260 +105,6 @@ > } > EXPORT_SYMBOL(alloc_netdev); > > -/** > - * alloc_etherdev - Allocates and sets up an ethernet device > - * @sizeof_priv: Size of additional driver-private structure to be allocated > - * for this ethernet device > - * > - * Fill in the fields of the device structure with ethernet-generic > - * values. Basically does everything except registering the device. > - * > - * Constructs a new net device, complete with a private data area of > - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > - * this private data area. > - */ > - > -struct net_device *alloc_etherdev(int sizeof_priv) > -{ > - return alloc_netdev(sizeof_priv, "eth%d", ether_setup); > -} > - > -EXPORT_SYMBOL(alloc_etherdev); > - > -static int eth_mac_addr(struct net_device *dev, void *p) > -{ > - struct sockaddr *addr=p; > - if (netif_running(dev)) > - return -EBUSY; > - memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); > - return 0; > -} > - > -static int eth_change_mtu(struct net_device *dev, int new_mtu) > -{ > - if ((new_mtu < 68) || (new_mtu > 1500)) > - return -EINVAL; > - dev->mtu = new_mtu; > - return 0; > -} > - > -#ifdef CONFIG_FDDI > - > -/** > - * alloc_fddidev - Register FDDI device > - * @sizeof_priv: Size of additional driver-private structure to be allocated > - * for this FDDI device > - * > - * Fill in the fields of the device structure with FDDI-generic values. > - * > - * Constructs a new net device, complete with a private data area of > - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > - * this private data area. > - */ > - > -struct net_device *alloc_fddidev(int sizeof_priv) > -{ > - return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup); > -} > - > -EXPORT_SYMBOL(alloc_fddidev); > - > -static int fddi_change_mtu(struct net_device *dev, int new_mtu) > -{ > - if ((new_mtu < FDDI_K_SNAP_HLEN) || (new_mtu > FDDI_K_SNAP_DLEN)) > - return(-EINVAL); > - dev->mtu = new_mtu; > - return(0); > -} > - > -#endif /* CONFIG_FDDI */ > - > -#ifdef CONFIG_HIPPI > - > -static int hippi_change_mtu(struct net_device *dev, int new_mtu) > -{ > - /* > - * HIPPI's got these nice large MTUs. > - */ > - if ((new_mtu < 68) || (new_mtu > 65280)) > - return -EINVAL; > - dev->mtu = new_mtu; > - return(0); > -} > - > - > -/* > - * For HIPPI we will actually use the lower 4 bytes of the hardware > - * address as the I-FIELD rather than the actual hardware address. > - */ > -static int hippi_mac_addr(struct net_device *dev, void *p) > -{ > - struct sockaddr *addr = p; > - if (netif_running(dev)) > - return -EBUSY; > - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); > - return 0; > -} > - > -static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) > -{ > - /* Never send broadcast/multicast ARP messages */ > - p->mcast_probes = 0; > - > - /* In IPv6 unicast probes are valid even on NBMA, > - * because they are encapsulated in normal IPv6 protocol. > - * Should be a generic flag. > - */ > - if (p->tbl->family != AF_INET6) > - p->ucast_probes = 0; > - return 0; > -} > - > -static void hippi_setup(struct net_device *dev) > -{ > - dev->set_multicast_list = NULL; > - dev->change_mtu = hippi_change_mtu; > - dev->hard_header = hippi_header; > - dev->rebuild_header = hippi_rebuild_header; > - dev->set_mac_address = hippi_mac_addr; > - dev->hard_header_parse = NULL; > - dev->hard_header_cache = NULL; > - dev->header_cache_update = NULL; > - dev->neigh_setup = hippi_neigh_setup_dev; > - > - /* > - * We don't support HIPPI `ARP' for the time being, and probably > - * never will unless someone else implements it. However we > - * still need a fake ARPHRD to make ifconfig and friends play ball. > - */ > - dev->type = ARPHRD_HIPPI; > - dev->hard_header_len = HIPPI_HLEN; > - dev->mtu = 65280; > - dev->addr_len = HIPPI_ALEN; > - dev->tx_queue_len = 25 /* 5 */; > - memset(dev->broadcast, 0xFF, HIPPI_ALEN); > - > - > - /* > - * HIPPI doesn't support broadcast+multicast and we only use > - * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. > - */ > - dev->flags = 0; > -} > - > -/** > - * alloc_hippi_dev - Register HIPPI device > - * @sizeof_priv: Size of additional driver-private structure to be allocated > - * for this HIPPI device > - * > - * Fill in the fields of the device structure with HIPPI-generic values. > - * > - * Constructs a new net device, complete with a private data area of > - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > - * this private data area. > - */ > - > -struct net_device *alloc_hippi_dev(int sizeof_priv) > -{ > - return alloc_netdev(sizeof_priv, "hip%d", hippi_setup); > -} > - > -EXPORT_SYMBOL(alloc_hippi_dev); > - > -#endif /* CONFIG_HIPPI */ > - > -void ether_setup(struct net_device *dev) > -{ > - /* Fill in the fields of the device structure with ethernet-generic values. > - This should be in a common file instead of per-driver. */ > - > - dev->change_mtu = eth_change_mtu; > - dev->hard_header = eth_header; > - dev->rebuild_header = eth_rebuild_header; > - dev->set_mac_address = eth_mac_addr; > - dev->hard_header_cache = eth_header_cache; > - dev->header_cache_update= eth_header_cache_update; > - dev->hard_header_parse = eth_header_parse; > - > - dev->type = ARPHRD_ETHER; > - dev->hard_header_len = ETH_HLEN; > - dev->mtu = 1500; /* eth_mtu */ > - dev->addr_len = ETH_ALEN; > - dev->tx_queue_len = 1000; /* Ethernet wants good queues */ > - > - memset(dev->broadcast,0xFF, ETH_ALEN); > - > - /* New-style flags. */ > - dev->flags = IFF_BROADCAST|IFF_MULTICAST; > -} > -EXPORT_SYMBOL(ether_setup); > - > -#ifdef CONFIG_FDDI > - > -void fddi_setup(struct net_device *dev) > -{ > - /* > - * Fill in the fields of the device structure with FDDI-generic values. > - * This should be in a common file instead of per-driver. > - */ > - > - dev->change_mtu = fddi_change_mtu; > - dev->hard_header = fddi_header; > - dev->rebuild_header = fddi_rebuild_header; > - > - dev->type = ARPHRD_FDDI; > - dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ > - dev->mtu = FDDI_K_SNAP_DLEN; /* Assume max payload of 802.2 SNAP frame */ > - dev->addr_len = FDDI_K_ALEN; > - dev->tx_queue_len = 100; /* Long queues on FDDI */ > - > - memset(dev->broadcast, 0xFF, FDDI_K_ALEN); > - > - /* New-style flags */ > - dev->flags = IFF_BROADCAST | IFF_MULTICAST; > -} > -EXPORT_SYMBOL(fddi_setup); > - > -#endif /* CONFIG_FDDI */ > - > -#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) > - > -static int ltalk_change_mtu(struct net_device *dev, int mtu) > -{ > - return -EINVAL; > -} > - > -static int ltalk_mac_addr(struct net_device *dev, void *addr) > -{ > - return -EINVAL; > -} > - > - > -void ltalk_setup(struct net_device *dev) > -{ > - /* Fill in the fields of the device structure with localtalk-generic values. */ > - > - dev->change_mtu = ltalk_change_mtu; > - dev->hard_header = NULL; > - dev->rebuild_header = NULL; > - dev->set_mac_address = ltalk_mac_addr; > - dev->hard_header_cache = NULL; > - dev->header_cache_update= NULL; > - > - dev->type = ARPHRD_LOCALTLK; > - dev->hard_header_len = LTALK_HLEN; > - dev->mtu = LTALK_MTU; > - dev->addr_len = LTALK_ALEN; > - dev->tx_queue_len = 10; > - > - dev->broadcast[0] = 0xFF; > - > - dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; > -} > -EXPORT_SYMBOL(ltalk_setup); > - > -#endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */ > - > int register_netdev(struct net_device *dev) > { > int err; > @@ -404,90 +150,3 @@ > > EXPORT_SYMBOL(register_netdev); > EXPORT_SYMBOL(unregister_netdev); > - > -#ifdef CONFIG_TR > - > -void tr_setup(struct net_device *dev) > -{ > - /* > - * Configure and register > - */ > - > - dev->hard_header = tr_header; > - dev->rebuild_header = tr_rebuild_header; > - > - dev->type = ARPHRD_IEEE802_TR; > - dev->hard_header_len = TR_HLEN; > - dev->mtu = 2000; > - dev->addr_len = TR_ALEN; > - dev->tx_queue_len = 100; /* Long queues on tr */ > - > - memset(dev->broadcast,0xFF, TR_ALEN); > - > - /* New-style flags. */ > - dev->flags = IFF_BROADCAST | IFF_MULTICAST ; > -} > - > -/** > - * alloc_trdev - Register token ring device > - * @sizeof_priv: Size of additional driver-private structure to be allocated > - * for this token ring device > - * > - * Fill in the fields of the device structure with token ring-generic values. > - * > - * Constructs a new net device, complete with a private data area of > - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > - * this private data area. > - */ > - > -struct net_device *alloc_trdev(int sizeof_priv) > -{ > - return alloc_netdev(sizeof_priv, "tr%d", tr_setup); > -} > - > -EXPORT_SYMBOL(tr_setup); > -EXPORT_SYMBOL(alloc_trdev); > - > -#endif /* CONFIG_TR */ > - > -#ifdef CONFIG_NET_FC > - > -void fc_setup(struct net_device *dev) > -{ > - dev->hard_header = fc_header; > - dev->rebuild_header = fc_rebuild_header; > - > - dev->type = ARPHRD_IEEE802; > - dev->hard_header_len = FC_HLEN; > - dev->mtu = 2024; > - dev->addr_len = FC_ALEN; > - dev->tx_queue_len = 100; /* Long queues on fc */ > - > - memset(dev->broadcast,0xFF, FC_ALEN); > - > - /* New-style flags. */ > - dev->flags = IFF_BROADCAST; > -} > - > -/** > - * alloc_fcdev - Register fibre channel device > - * @sizeof_priv: Size of additional driver-private structure to be allocated > - * for this fibre channel device > - * > - * Fill in the fields of the device structure with fibre channel-generic values. > - * > - * Constructs a new net device, complete with a private data area of > - * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > - * this private data area. > - */ > - > -struct net_device *alloc_fcdev(int sizeof_priv) > -{ > - return alloc_netdev(sizeof_priv, "fc%d", fc_setup); > -} > - > -EXPORT_SYMBOL(fc_setup); > -EXPORT_SYMBOL(alloc_fcdev); > - > -#endif /* CONFIG_NET_FC */ > - > --- 1.91/include/linux/netdevice.h 2004-10-26 18:09:33 +02:00 > +++ edited/include/linux/netdevice.h 2004-11-01 13:13:07 +01:00 > @@ -910,10 +910,7 @@ > /* These functions live elsewhere (drivers/net/net_init.c, but related) */ > > extern void ether_setup(struct net_device *dev); > -extern void fddi_setup(struct net_device *dev); > -extern void tr_setup(struct net_device *dev); > -extern void fc_setup(struct net_device *dev); > -extern void fc_freedev(struct net_device *dev); > + > /* Support for loadable net-drivers */ > extern struct net_device *alloc_netdev(int sizeof_priv, const char *name, > void (*setup)(struct net_device *)); > ===== net/802/fc.c 1.3 vs edited ===== > --- 1.3/net/802/fc.c 2004-06-24 21:37:35 +02:00 > +++ edited/net/802/fc.c 2004-11-01 13:52:59 +01:00 > @@ -129,3 +129,35 @@ > > return ntohs(ETH_P_802_2); > } > + > +static void fc_setup(struct net_device *dev) > +{ > + dev->hard_header = fc_header; > + dev->rebuild_header = fc_rebuild_header; > + > + dev->type = ARPHRD_IEEE802; > + dev->hard_header_len = FC_HLEN; > + dev->mtu = 2024; > + dev->addr_len = FC_ALEN; > + dev->tx_queue_len = 100; /* Long queues on fc */ > + dev->flags = IFF_BROADCAST; > + > + memset(dev->broadcast, 0xFF, FC_ALEN); > +} > + > +/** > + * alloc_fcdev - Register fibre channel device > + * @sizeof_priv: Size of additional driver-private structure to be allocated > + * for this fibre channel device > + * > + * Fill in the fields of the device structure with fibre channel-generic values. > + * > + * Constructs a new net device, complete with a private data area of > + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > + * this private data area. > + */ > +struct net_device *alloc_fcdev(int sizeof_priv) > +{ > + return alloc_netdev(sizeof_priv, "fc%d", fc_setup); > +} > +EXPORT_SYMBOL(alloc_fcdev); > --- 1.3/net/802/fddi.c 2003-09-29 04:23:30 +02:00 > +++ edited/net/802/fddi.c 2004-11-01 13:12:14 +01:00 > @@ -166,3 +166,44 @@ > } > > EXPORT_SYMBOL(fddi_type_trans); > + > +static int fddi_change_mtu(struct net_device *dev, int new_mtu) > +{ > + if ((new_mtu < FDDI_K_SNAP_HLEN) || (new_mtu > FDDI_K_SNAP_DLEN)) > + return(-EINVAL); > + dev->mtu = new_mtu; > + return(0); > +} > + > +static void fddi_setup(struct net_device *dev) > +{ > + dev->change_mtu = fddi_change_mtu; > + dev->hard_header = fddi_header; > + dev->rebuild_header = fddi_rebuild_header; > + > + dev->type = ARPHRD_FDDI; > + dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ > + dev->mtu = FDDI_K_SNAP_DLEN; /* Assume max payload of 802.2 SNAP frame */ > + dev->addr_len = FDDI_K_ALEN; > + dev->tx_queue_len = 100; /* Long queues on FDDI */ > + dev->flags = IFF_BROADCAST | IFF_MULTICAST; > + > + memset(dev->broadcast, 0xFF, FDDI_K_ALEN); > +} > + > +/** > + * alloc_fddidev - Register FDDI device > + * @sizeof_priv: Size of additional driver-private structure to be allocated > + * for this FDDI device > + * > + * Fill in the fields of the device structure with FDDI-generic values. > + * > + * Constructs a new net device, complete with a private data area of > + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > + * this private data area. > + */ > +struct net_device *alloc_fddidev(int sizeof_priv) > +{ > + return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup); > +} > +EXPORT_SYMBOL(alloc_fddidev); > --- 1.4/net/802/hippi.c 2003-09-29 04:23:30 +02:00 > +++ edited/net/802/hippi.c 2004-11-01 13:53:31 +01:00 > @@ -154,3 +154,92 @@ > } > > EXPORT_SYMBOL(hippi_type_trans); > + > +static int hippi_change_mtu(struct net_device *dev, int new_mtu) > +{ > + /* > + * HIPPI's got these nice large MTUs. > + */ > + if ((new_mtu < 68) || (new_mtu > 65280)) > + return -EINVAL; > + dev->mtu = new_mtu; > + return(0); > +} > + > +/* > + * For HIPPI we will actually use the lower 4 bytes of the hardware > + * address as the I-FIELD rather than the actual hardware address. > + */ > +static int hippi_mac_addr(struct net_device *dev, void *p) > +{ > + struct sockaddr *addr = p; > + if (netif_running(dev)) > + return -EBUSY; > + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); > + return 0; > +} > + > +static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) > +{ > + /* Never send broadcast/multicast ARP messages */ > + p->mcast_probes = 0; > + > + /* In IPv6 unicast probes are valid even on NBMA, > + * because they are encapsulated in normal IPv6 protocol. > + * Should be a generic flag. > + */ > + if (p->tbl->family != AF_INET6) > + p->ucast_probes = 0; > + return 0; > +} > + > +static void hippi_setup(struct net_device *dev) > +{ > + dev->set_multicast_list = NULL; > + dev->change_mtu = hippi_change_mtu; > + dev->hard_header = hippi_header; > + dev->rebuild_header = hippi_rebuild_header; > + dev->set_mac_address = hippi_mac_addr; > + dev->hard_header_parse = NULL; > + dev->hard_header_cache = NULL; > + dev->header_cache_update = NULL; > + dev->neigh_setup = hippi_neigh_setup_dev; > + > + /* > + * We don't support HIPPI `ARP' for the time being, and probably > + * never will unless someone else implements it. However we > + * still need a fake ARPHRD to make ifconfig and friends play ball. > + */ > + dev->type = ARPHRD_HIPPI; > + dev->hard_header_len = HIPPI_HLEN; > + dev->mtu = 65280; > + dev->addr_len = HIPPI_ALEN; > + dev->tx_queue_len = 25 /* 5 */; > + memset(dev->broadcast, 0xFF, HIPPI_ALEN); > + > + > + /* > + * HIPPI doesn't support broadcast+multicast and we only use > + * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. > + */ > + dev->flags = 0; > +} > + > +/** > + * alloc_hippi_dev - Register HIPPI device > + * @sizeof_priv: Size of additional driver-private structure to be allocated > + * for this HIPPI device > + * > + * Fill in the fields of the device structure with HIPPI-generic values. > + * > + * Constructs a new net device, complete with a private data area of > + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > + * this private data area. > + */ > + > +struct net_device *alloc_hippi_dev(int sizeof_priv) > +{ > + return alloc_netdev(sizeof_priv, "hip%d", hippi_setup); > +} > + > +EXPORT_SYMBOL(alloc_hippi_dev); > --- 1.17/net/802/tr.c 2004-06-24 21:36:53 +02:00 > +++ edited/net/802/tr.c 2004-11-01 13:14:02 +01:00 > @@ -583,6 +583,43 @@ > > #endif > > +static void tr_setup(struct net_device *dev) > +{ > + /* > + * Configure and register > + */ > + > + dev->hard_header = tr_header; > + dev->rebuild_header = tr_rebuild_header; > + > + dev->type = ARPHRD_IEEE802_TR; > + dev->hard_header_len = TR_HLEN; > + dev->mtu = 2000; > + dev->addr_len = TR_ALEN; > + dev->tx_queue_len = 100; /* Long queues on tr */ > + > + memset(dev->broadcast,0xFF, TR_ALEN); > + > + /* New-style flags. */ > + dev->flags = IFF_BROADCAST | IFF_MULTICAST ; > +} > + > +/** > + * alloc_trdev - Register token ring device > + * @sizeof_priv: Size of additional driver-private structure to be allocated > + * for this token ring device > + * > + * Fill in the fields of the device structure with token ring-generic values. > + * > + * Constructs a new net device, complete with a private data area of > + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > + * this private data area. > + */ > +struct net_device *alloc_trdev(int sizeof_priv) > +{ > + return alloc_netdev(sizeof_priv, "tr%d", tr_setup); > +} > + > /* > * Called during bootup. We don't actually have to initialise > * too much for this. > @@ -604,3 +641,4 @@ > > EXPORT_SYMBOL(tr_source_route); > EXPORT_SYMBOL(tr_type_trans); > +EXPORT_SYMBOL(alloc_trdev); > --- 1.8/net/appletalk/Makefile 2004-08-18 23:35:04 +02:00 > +++ edited/net/appletalk/Makefile 2004-11-01 13:22:42 +01:00 > @@ -4,6 +4,6 @@ > > obj-$(CONFIG_ATALK) += appletalk.o > > -appletalk-y := aarp.o ddp.o > +appletalk-y := aarp.o ddp.o dev.o > appletalk-$(CONFIG_PROC_FS) += atalk_proc.o > appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o > --- 1.9/net/ethernet/eth.c 2004-10-05 23:51:01 +02:00 > +++ edited/net/ethernet/eth.c 2004-11-01 13:54:23 +01:00 > @@ -245,3 +245,64 @@ > } > > EXPORT_SYMBOL(eth_type_trans); > + > +static int eth_mac_addr(struct net_device *dev, void *p) > +{ > + struct sockaddr *addr=p; > + if (netif_running(dev)) > + return -EBUSY; > + memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); > + return 0; > +} > + > +static int eth_change_mtu(struct net_device *dev, int new_mtu) > +{ > + if ((new_mtu < 68) || (new_mtu > 1500)) > + return -EINVAL; > + dev->mtu = new_mtu; > + return 0; > +} > + > +/* > + * Fill in the fields of the device structure with ethernet-generic values. > + */ > +void ether_setup(struct net_device *dev) > +{ > + dev->change_mtu = eth_change_mtu; > + dev->hard_header = eth_header; > + dev->rebuild_header = eth_rebuild_header; > + dev->set_mac_address = eth_mac_addr; > + dev->hard_header_cache = eth_header_cache; > + dev->header_cache_update= eth_header_cache_update; > + dev->hard_header_parse = eth_header_parse; > + > + dev->type = ARPHRD_ETHER; > + dev->hard_header_len = ETH_HLEN; > + dev->mtu = 1500; /* eth_mtu */ > + dev->addr_len = ETH_ALEN; > + dev->tx_queue_len = 1000; /* Ethernet wants good queues */ > + dev->flags = IFF_BROADCAST|IFF_MULTICAST; > + > + memset(dev->broadcast,0xFF, ETH_ALEN); > + > +} > +EXPORT_SYMBOL(ether_setup); > + > +/** > + * alloc_etherdev - Allocates and sets up an ethernet device > + * @sizeof_priv: Size of additional driver-private structure to be allocated > + * for this ethernet device > + * > + * Fill in the fields of the device structure with ethernet-generic > + * values. Basically does everything except registering the device. > + * > + * Constructs a new net device, complete with a private data area of > + * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for > + * this private data area. > + */ > + > +struct net_device *alloc_etherdev(int sizeof_priv) > +{ > + return alloc_netdev(sizeof_priv, "eth%d", ether_setup); > +} > +EXPORT_SYMBOL(alloc_etherdev); > --- /dev/null 2004-08-20 00:05:11.000000000 +0200 > +++ b/net/appletalk/dev.c 2004-11-01 13:49:02.111094544 +0100 > @@ -0,0 +1,43 @@ > +/* > + * Moved here from drivers/net/net_init.c, which is: > + * Written 1993,1994,1995 by Donald Becker. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +static int ltalk_change_mtu(struct net_device *dev, int mtu) > +{ > + return -EINVAL; > +} > + > +static int ltalk_mac_addr(struct net_device *dev, void *addr) > +{ > + return -EINVAL; > +} > + > +void ltalk_setup(struct net_device *dev) > +{ > + /* Fill in the fields of the device structure with localtalk-generic values. */ > + > + dev->change_mtu = ltalk_change_mtu; > + dev->hard_header = NULL; > + dev->rebuild_header = NULL; > + dev->set_mac_address = ltalk_mac_addr; > + dev->hard_header_cache = NULL; > + dev->header_cache_update= NULL; > + > + dev->type = ARPHRD_LOCALTLK; > + dev->hard_header_len = LTALK_HLEN; > + dev->mtu = LTALK_MTU; > + dev->addr_len = LTALK_ALEN; > + dev->tx_queue_len = 10; > + > + dev->broadcast[0] = 0xFF; > + > + dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; > +} > +EXPORT_SYMBOL(ltalk_setup); > ---end quoted text--- From penberg@cs.helsinki.fi Mon Nov 1 06:29:05 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 06:29:19 -0800 (PST) Received: from mail.cs.helsinki.fi (courier.cs.helsinki.fi [128.214.9.1]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1ET3MK020656 for ; Mon, 1 Nov 2004 06:29:04 -0800 Received: from cs181096176.pp.htv.fi (cs181096176.pp.htv.fi [82.181.96.176]) (AUTH: LOGIN penberg, SSL: TLSv1/SSLv3,128bits,RC4-MD5) by mail.cs.helsinki.fi with esmtp; Mon, 01 Nov 2004 16:26:32 +0200 id 000741CF.41864798.00002A8C Subject: Re: net: generic netdev_ioaddr From: Pekka Enberg To: Krzysztof Halasa Cc: Al Viro , davem@davemloft.net, netdev@oss.sgi.com, linux-kernel@vger.kernel.org In-Reply-To: References: <1099044244.9566.0.camel@localhost> <20041029131607.GU24336@parcelfarce.linux.theplanet.co.uk> <20041029193827.GV24336@parcelfarce.linux.theplanet.co.uk> <1099129946.10961.9.camel@localhost> <1099206669.9571.10.camel@localhost> Date: Mon, 01 Nov 2004 16:27:47 +0200 Message-Id: <1099319267.9550.3.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Mailer: Evolution 2.0.2 X-archive-position: 11281 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: penberg@cs.helsinki.fi Precedence: bulk X-list: netdev Content-Length: 23942 Lines: 829 Hi, On Mon, 2004-11-01 at 00:14 +0100, Krzysztof Halasa wrote: > IMHO partially: base_addr etc should go from the core (to driver's > local structs if needed). I think no general netdev-setup thing is > needed, we have module parameters and library functions. > > No ioctl for such things is needed either. > /sbin/ifconfig shouldn't mess with hardware data such as I/O address, > IRQ etc. - it should be a configuration tool for software protocols, > not for hardware (i.e. as /sbin/ip is). > > My opinion of course. FWIW I am running this patch on my box. ifconfig doesn't mind but I am not sure about the rtnetlink part. I can start stabbing other drivers if the maintainers are interested in this cleanup... Pekka --- drivers/net/Space.c | 23 ++----- drivers/net/natsemi.c | 134 +++++++++++++++++++++---------------------- include/linux/netdevice.h | 12 --- net/core/dev.c | 141 ---------------------------------------------- net/core/rtnetlink.c | 12 --- net/ethernet/eth.c | 4 - 6 files changed, 74 insertions(+), 252 deletions(-) Index: 2.6.10-rc1-mm1/drivers/net/Space.c =================================================================== --- 2.6.10-rc1-mm1.orig/drivers/net/Space.c 2004-11-01 16:11:34.682350032 +0200 +++ 2.6.10-rc1-mm1/drivers/net/Space.c 2004-11-01 16:12:31.554704120 +0200 @@ -322,17 +322,12 @@ static void __init ethif_probe2(int unit) { - unsigned long base_addr = netdev_boot_base("eth", unit); - - if (base_addr == 1) - return; - - (void)( probe_list2(unit, m68k_probes, base_addr == 0) && - probe_list2(unit, mips_probes, base_addr == 0) && - probe_list2(unit, eisa_probes, base_addr == 0) && - probe_list2(unit, mca_probes, base_addr == 0) && - probe_list2(unit, isa_probes, base_addr == 0) && - probe_list2(unit, parport_probes, base_addr == 0)); + (void)( probe_list2(unit, m68k_probes, 1) && + probe_list2(unit, mips_probes, 1) && + probe_list2(unit, eisa_probes, 1) && + probe_list2(unit, mca_probes, 1) && + probe_list2(unit, isa_probes, 1) && + probe_list2(unit, parport_probes, 1)); } #ifdef CONFIG_TR @@ -374,11 +369,7 @@ static void __init trif_probe2(int unit) { - unsigned long base_addr = netdev_boot_base("tr", unit); - - if (base_addr == 1) - return; - probe_list2(unit, tr_probes2, base_addr == 0); + probe_list2(unit, tr_probes2, 1); } #endif Index: 2.6.10-rc1-mm1/drivers/net/natsemi.c =================================================================== --- 2.6.10-rc1-mm1.orig/drivers/net/natsemi.c 2004-11-01 16:11:33.217572712 +0200 +++ 2.6.10-rc1-mm1/drivers/net/natsemi.c 2004-11-01 16:12:31.700681928 +0200 @@ -327,7 +327,7 @@ is set, then access is permitted under spin_lock_irq(&np->lock). Thus configuration functions that want to access everything must call - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_bh(dev->xmit_lock); spin_lock_irq(&np->lock); @@ -349,7 +349,7 @@ -enum pcistuff { +enum { PCI_USES_IO = 0x01, PCI_USES_MEM = 0x02, PCI_USES_MASTER = 0x04, @@ -668,6 +668,8 @@ }; struct netdev_private { + void __iomem *mmioaddr; + unsigned int irq; /* Descriptor rings first for alignment */ dma_addr_t ring_dma; struct netdev_desc *rx_ring; @@ -770,15 +772,10 @@ static int netdev_get_eeprom(struct net_device *dev, u8 *buf); static struct ethtool_ops ethtool_ops; -static inline void __iomem *ns_ioaddr(struct net_device *dev) -{ - return (void __iomem *) dev->base_addr; -} - static void move_int_phy(struct net_device *dev, int addr) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; int target = 31; /* @@ -867,11 +864,11 @@ prev_eedata = eedata; } - dev->base_addr = (unsigned long __force) ioaddr; - dev->irq = irq; np = netdev_priv(dev); + np->mmioaddr = ioaddr; + np->irq = irq; np->pci_dev = pdev; pci_set_drvdata(pdev, dev); np->iosize = iosize; @@ -906,8 +903,6 @@ } option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; - if (dev->mem_start) - option = dev->mem_start; /* The lower four bits are the media type. */ if (option) { @@ -1073,7 +1068,8 @@ static int mii_getbit (struct net_device *dev) { int data; - void __iomem *ioaddr = ns_ioaddr(dev); + struct netdev_private *np = netdev_priv(dev); + void __iomem *ioaddr = np->mmioaddr; writel(MII_ShiftClk, ioaddr + EECtrl); data = readl(ioaddr + EECtrl); @@ -1085,7 +1081,8 @@ static void mii_send_bits (struct net_device *dev, u32 data, int len) { u32 i; - void __iomem *ioaddr = ns_ioaddr(dev); + struct netdev_private *np = netdev_priv(dev); + void __iomem *ioaddr = np->mmioaddr; for (i = (1 << (len-1)); i; i >>= 1) { @@ -1141,7 +1138,7 @@ static int mdio_read(struct net_device *dev, int reg) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; /* The 83815 series has two ports: * - an internal transceiver @@ -1156,7 +1153,7 @@ static void mdio_write(struct net_device *dev, int reg, u16 data) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; /* The 83815 series has an internal transceiver; handle separately */ if (dev->if_port == PORT_TP) @@ -1168,7 +1165,7 @@ static void init_phy_fixup(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; int i; u32 cfg; u16 tmp; @@ -1280,7 +1277,7 @@ static int switch_port_external(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; u32 cfg; cfg = readl(ioaddr + ChipConfig); @@ -1313,7 +1310,7 @@ static int switch_port_internal(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; int i; u32 cfg; u16 bmcr; @@ -1414,7 +1411,7 @@ u16 pmatch[3]; u16 sopass[3]; struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; /* * Resetting the chip causes some registers to be lost. @@ -1485,7 +1482,7 @@ static void natsemi_reload_eeprom(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; int i; writel(EepromReload, ioaddr + PCIBusCfg); @@ -1505,8 +1502,8 @@ static void natsemi_stop_rxtx(struct net_device *dev) { - void __iomem * ioaddr = ns_ioaddr(dev); struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; int i; writel(RxOff | TxOff, ioaddr + ChipCmd); @@ -1527,21 +1524,21 @@ static int netdev_open(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; int i; /* Reset the chip, just in case. */ natsemi_reset(dev); - i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); + i = request_irq(np->irq, &intr_handler, SA_SHIRQ, dev->name, dev); if (i) return i; if (netif_msg_ifup(np)) printk(KERN_DEBUG "%s: netdev_open() irq %d.\n", - dev->name, dev->irq); + dev->name, np->irq); i = alloc_ring(dev); if (i < 0) { - free_irq(dev->irq, dev); + free_irq(np->irq, dev); return i; } init_ring(dev); @@ -1576,7 +1573,7 @@ static void do_cable_magic(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem *ioaddr = ns_ioaddr(dev); + void __iomem *ioaddr = np->mmioaddr; if (dev->if_port != PORT_TP) return; @@ -1621,7 +1618,7 @@ { u16 data; struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; if (dev->if_port != PORT_TP) return; @@ -1640,7 +1637,7 @@ static void check_link(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; int duplex; u16 bmsr; @@ -1701,7 +1698,7 @@ static void init_registers(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; init_phy_fixup(dev); @@ -1780,7 +1777,7 @@ { struct net_device *dev = (struct net_device *)data; struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; int next_tick = 5*HZ; if (netif_msg_timer(np)) { @@ -1805,14 +1802,14 @@ if (netif_msg_hw(np)) printk(KERN_NOTICE "%s: possible phy reset: " "re-initializing\n", dev->name); - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_irq(&np->lock); natsemi_stop_rxtx(dev); dump_ring(dev); reinit_ring(dev); init_registers(dev); spin_unlock_irq(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); } else { /* hurry back */ next_tick = HZ; @@ -1829,10 +1826,10 @@ spin_unlock_irq(&np->lock); } if (np->oom) { - disable_irq(dev->irq); + disable_irq(np->irq); np->oom = 0; refill_rx(dev); - enable_irq(dev->irq); + enable_irq(np->irq); if (!np->oom) { writel(RxOn, ioaddr + ChipCmd); } else { @@ -1868,9 +1865,9 @@ static void tx_timeout(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_irq(&np->lock); if (!np->hands_off) { if (netif_msg_tx_err(np)) @@ -1889,7 +1886,7 @@ dev->name); } spin_unlock_irq(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); dev->trans_start = jiffies; np->stats.tx_errors++; @@ -2068,7 +2065,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; unsigned entry; /* Note: Ordering is important here, set the field with the @@ -2162,7 +2159,7 @@ { struct net_device *dev = dev_instance; struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; int boguscnt = max_interrupt_work; unsigned int handled = 0; @@ -2224,7 +2221,7 @@ int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx; s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status); unsigned int buflen = np->rx_buf_sz; - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; /* If the driver owns the next entry it's a new packet. Send it up. */ while (desc_status < 0) { /* e.g. & DescOwn */ @@ -2312,7 +2309,7 @@ static void netdev_error(struct net_device *dev, int intr_status) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; spin_lock(&np->lock); if (intr_status & LinkChange) { @@ -2371,8 +2368,8 @@ static void __get_stats(struct net_device *dev) { - void __iomem * ioaddr = ns_ioaddr(dev); struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; /* The chip only need report frame silently dropped. */ np->stats.rx_crc_errors += readl(ioaddr + RxCRCErrs); @@ -2395,17 +2392,17 @@ #ifdef CONFIG_NET_POLL_CONTROLLER static void natsemi_poll_controller(struct net_device *dev) { - disable_irq(dev->irq); - intr_handler(dev->irq, dev, NULL); - enable_irq(dev->irq); + disable_irq(np->irq); + intr_handler(np->irq, dev, NULL); + enable_irq(np->irq); } #endif #define HASH_TABLE 0x200 static void __set_rx_mode(struct net_device *dev) { - void __iomem * ioaddr = ns_ioaddr(dev); struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; u8 mc_filter[64]; /* Multicast hash filter */ u32 rx_mode; @@ -2450,9 +2447,9 @@ /* synchronized against open : rtnl_lock() held by caller */ if (netif_running(dev)) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock(&np->lock); /* stop engines */ natsemi_stop_rxtx(dev); @@ -2465,7 +2462,7 @@ /* restart engines */ writel(RxOn | TxOn, ioaddr + ChipCmd); spin_unlock(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); } return 0; } @@ -2612,7 +2609,7 @@ static int netdev_set_wol(struct net_device *dev, u32 newval) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; u32 data = readl(ioaddr + WOLCmd) & ~WakeOptsSummary; /* translate to bitmasks this chip understands */ @@ -2642,7 +2639,7 @@ static int netdev_get_wol(struct net_device *dev, u32 *supported, u32 *cur) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; u32 regval = readl(ioaddr + WOLCmd); *supported = (WAKE_PHY | WAKE_UCAST | WAKE_MCAST | WAKE_BCAST @@ -2678,7 +2675,7 @@ static int netdev_set_sopass(struct net_device *dev, u8 *newval) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; u16 *sval = (u16 *)newval; u32 addr; @@ -2710,7 +2707,7 @@ static int netdev_get_sopass(struct net_device *dev, u8 *data) { struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; u16 *sval = (u16 *)data; u32 addr; @@ -2894,7 +2891,8 @@ int j; u32 rfcr; u32 *rbuf = (u32 *)buf; - void __iomem * ioaddr = ns_ioaddr(dev); + struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; /* read non-mii page 0 of registers */ for (i = 0; i < NATSEMI_PG0_NREGS/2; i++) { @@ -2944,7 +2942,8 @@ { int i; u16 *ebuf = (u16 *)buf; - void __iomem * ioaddr = ns_ioaddr(dev); + struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; /* eeprom_read reads 16 bits, and indexes by 16 bits */ for (i = 0; i < NATSEMI_EEPROM_SIZE/2; i++) { @@ -3016,8 +3015,8 @@ static void enable_wol_mode(struct net_device *dev, int enable_intr) { - void __iomem * ioaddr = ns_ioaddr(dev); struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; if (netif_msg_wol(np)) printk(KERN_INFO "%s: remaining active for wake-on-lan\n", @@ -3049,8 +3048,8 @@ static int netdev_close(struct net_device *dev) { - void __iomem * ioaddr = ns_ioaddr(dev); struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; if (netif_msg_ifdown(np)) printk(KERN_DEBUG @@ -3070,16 +3069,16 @@ */ del_timer_sync(&np->timer); - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_irq(&np->lock); /* Disable interrupts, and flush posted writes */ writel(0, ioaddr + IntrEnable); readl(ioaddr + IntrEnable); np->hands_off = 1; spin_unlock_irq(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); - free_irq(dev->irq, dev); + free_irq(np->irq, dev); /* Interrupt disabled, interrupt handler released, * queue stopped, timer deleted, rtnl_lock held @@ -3126,7 +3125,8 @@ static void __devexit natsemi_remove1 (struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - void __iomem * ioaddr = ns_ioaddr(dev); + struct netdev_private *np = netdev_priv(dev); + void __iomem * ioaddr = np->mmioaddr; unregister_netdev (dev); pci_release_regions (pdev); @@ -3164,13 +3164,13 @@ { struct net_device *dev = pci_get_drvdata (pdev); struct netdev_private *np = netdev_priv(dev); - void __iomem * ioaddr = ns_ioaddr(dev); + void __iomem * ioaddr = np->mmioaddr; rtnl_lock(); if (netif_running (dev)) { del_timer_sync(&np->timer); - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_irq(&np->lock); writel(0, ioaddr + IntrEnable); @@ -3179,7 +3179,7 @@ netif_stop_queue(dev); spin_unlock_irq(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); /* Update the error counts. */ __get_stats(dev); @@ -3222,13 +3222,13 @@ natsemi_reset(dev); init_ring(dev); - disable_irq(dev->irq); + disable_irq(np->irq); spin_lock_irq(&np->lock); np->hands_off = 0; init_registers(dev); netif_device_attach(dev); spin_unlock_irq(&np->lock); - enable_irq(dev->irq); + enable_irq(np->irq); mod_timer(&np->timer, jiffies + 1*HZ); } Index: 2.6.10-rc1-mm1/include/linux/netdevice.h =================================================================== --- 2.6.10-rc1-mm1.orig/include/linux/netdevice.h 2004-11-01 16:11:34.683349880 +0200 +++ 2.6.10-rc1-mm1/include/linux/netdevice.h 2004-11-01 16:12:31.625693328 +0200 @@ -272,15 +272,6 @@ char name[IFNAMSIZ]; /* - * I/O specific fields - * FIXME: Merge these and struct ifmap into one - */ - unsigned long mem_end; /* shared mem end */ - unsigned long mem_start; /* shared mem start */ - unsigned long base_addr; /* device I/O address */ - unsigned int irq; /* device IRQ number */ - - /* * Some hardware also needs these fields, but they are not * part of the usual set specified in Space.c. */ @@ -522,9 +513,6 @@ extern struct net_device *dev_base; /* All devices */ extern rwlock_t dev_base_lock; /* Device list lock */ -extern int netdev_boot_setup_add(char *name, struct ifmap *map); -extern int netdev_boot_setup_check(struct net_device *dev); -extern unsigned long netdev_boot_base(const char *prefix, int unit); extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); extern struct net_device *dev_getfirstbyhwtype(unsigned short type); Index: 2.6.10-rc1-mm1/net/core/dev.c =================================================================== --- 2.6.10-rc1-mm1.orig/net/core/dev.c 2004-11-01 16:11:35.376244544 +0200 +++ 2.6.10-rc1-mm1/net/core/dev.c 2004-11-01 16:12:31.559703360 +0200 @@ -343,129 +343,6 @@ synchronize_net(); } -/****************************************************************************** - - Device Boot-time Settings Routines - -*******************************************************************************/ - -/* Boot time configuration table */ -static struct netdev_boot_setup dev_boot_setup[NETDEV_BOOT_SETUP_MAX]; - -/** - * netdev_boot_setup_add - add new setup entry - * @name: name of the device - * @map: configured settings for the device - * - * Adds new setup entry to the dev_boot_setup list. The function - * returns 0 on error and 1 on success. This is a generic routine to - * all netdevices. - */ -int netdev_boot_setup_add(char *name, struct ifmap *map) -{ - struct netdev_boot_setup *s; - int i; - - s = dev_boot_setup; - for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { - if (s[i].name[0] == '\0' || s[i].name[0] == ' ') { - memset(s[i].name, 0, sizeof(s[i].name)); - strcpy(s[i].name, name); - memcpy(&s[i].map, map, sizeof(s[i].map)); - break; - } - } - - return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1; -} - -/** - * netdev_boot_setup_check - check boot time settings - * @dev: the netdevice - * - * Check boot time settings for the device. - * The found settings are set for the device to be used - * later in the device probing. - * Returns 0 if no settings found, 1 if they are. - */ -int netdev_boot_setup_check(struct net_device *dev) -{ - struct netdev_boot_setup *s = dev_boot_setup; - int i; - - for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { - if (s[i].name[0] != '\0' && s[i].name[0] != ' ' && - !strncmp(dev->name, s[i].name, strlen(s[i].name))) { - dev->irq = s[i].map.irq; - dev->base_addr = s[i].map.base_addr; - dev->mem_start = s[i].map.mem_start; - dev->mem_end = s[i].map.mem_end; - return 1; - } - } - return 0; -} - - -/** - * netdev_boot_base - get address from boot time settings - * @prefix: prefix for network device - * @unit: id for network device - * - * Check boot time settings for the base address of device. - * The found settings are set for the device to be used - * later in the device probing. - * Returns 0 if no settings found. - */ -unsigned long netdev_boot_base(const char *prefix, int unit) -{ - const struct netdev_boot_setup *s = dev_boot_setup; - char name[IFNAMSIZ]; - int i; - - sprintf(name, "%s%d", prefix, unit); - - /* - * If device already registered then return base of 1 - * to indicate not to probe for this interface - */ - if (__dev_get_by_name(name)) - return 1; - - for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) - if (!strcmp(name, s[i].name)) - return s[i].map.base_addr; - return 0; -} - -/* - * Saves at boot time configured settings for any netdevice. - */ -int __init netdev_boot_setup(char *str) -{ - int ints[5]; - struct ifmap map; - - str = get_options(str, ARRAY_SIZE(ints), ints); - if (!str || !*str) - return 0; - - /* Save settings */ - memset(&map, 0, sizeof(map)); - if (ints[0] > 0) - map.irq = ints[1]; - if (ints[0] > 1) - map.base_addr = ints[2]; - if (ints[0] > 2) - map.mem_start = ints[3]; - if (ints[0] > 3) - map.mem_end = ints[4]; - - /* Add new entry to the list */ - return netdev_boot_setup_add(str, &map); -} - -__setup("netdev=", netdev_boot_setup); /******************************************************************************* @@ -2404,23 +2281,6 @@ NETDEV_CHANGEADDR, dev); return 0; - case SIOCGIFMAP: - ifr->ifr_map.mem_start = dev->mem_start; - ifr->ifr_map.mem_end = dev->mem_end; - ifr->ifr_map.base_addr = dev->base_addr; - ifr->ifr_map.irq = dev->irq; - ifr->ifr_map.dma = dev->dma; - ifr->ifr_map.port = dev->if_port; - return 0; - - case SIOCSIFMAP: - if (dev->set_config) { - if (!netif_device_present(dev)) - return -ENODEV; - return dev->set_config(dev, &ifr->ifr_map); - } - return -EOPNOTSUPP; - case SIOCADDMULTI: if (!dev->set_multicast_list || ifr->ifr_hwaddr.sa_family != AF_UNSPEC) @@ -3264,7 +3124,6 @@ EXPORT_SYMBOL(dev_change_name); EXPORT_SYMBOL(dev_set_mtu); EXPORT_SYMBOL(free_netdev); -EXPORT_SYMBOL(netdev_boot_setup_check); EXPORT_SYMBOL(netdev_set_master); EXPORT_SYMBOL(netdev_state_change); EXPORT_SYMBOL(netif_receive_skb); Index: 2.6.10-rc1-mm1/net/core/rtnetlink.c =================================================================== --- 2.6.10-rc1-mm1.orig/net/core/rtnetlink.c 2004-11-01 16:11:32.428692640 +0200 +++ 2.6.10-rc1-mm1/net/core/rtnetlink.c 2004-11-01 16:12:31.755673568 +0200 @@ -181,18 +181,6 @@ RTA_PUT(skb, IFLA_WEIGHT, sizeof(weight), &weight); } - if (1) { - struct rtnl_link_ifmap map = { - .mem_start = dev->mem_start, - .mem_end = dev->mem_end, - .base_addr = dev->base_addr, - .irq = dev->irq, - .dma = dev->dma, - .port = dev->if_port, - }; - RTA_PUT(skb, IFLA_MAP, sizeof(map), &map); - } - if (dev->addr_len) { RTA_PUT(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr); RTA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast); Index: 2.6.10-rc1-mm1/net/ethernet/eth.c =================================================================== --- 2.6.10-rc1-mm1.orig/net/ethernet/eth.c 2004-11-01 16:11:34.687349272 +0200 +++ 2.6.10-rc1-mm1/net/ethernet/eth.c 2004-11-01 16:12:31.560703208 +0200 @@ -62,10 +62,6 @@ #include #include -extern int __init netdev_boot_setup(char *str); - -__setup("ether=", netdev_boot_setup); - /* * Create the Ethernet MAC header for an arbitrary protocol layer * From zaitcev@redhat.com Mon Nov 1 08:28:20 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 08:28:25 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1GSK9O028509 for ; Mon, 1 Nov 2004 08:28:20 -0800 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iA1GS3FP018297 for ; Mon, 1 Nov 2004 11:28:03 -0500 Received: from devserv.devel.redhat.com (devserv.devel.redhat.com [172.16.58.1]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iA1GS3r30546 for ; Mon, 1 Nov 2004 11:28:03 -0500 Received: from lembas.zaitcev.lan (vpn50-9.rdu.redhat.com [172.16.50.9]) by devserv.devel.redhat.com (8.12.11/8.12.10) with SMTP id iA1GRxap016581; Mon, 1 Nov 2004 11:27:59 -0500 Date: Mon, 1 Nov 2004 08:27:57 -0800 From: Pete Zaitcev To: netdev@oss.sgi.com Cc: jgarzik@redhat.com, zaitcev@redhat.com Subject: The boot time failure in tulip Message-ID: <20041101082757.64583eb2@lembas.zaitcev.lan> Organization: Red Hat, Inc. X-Mailer: Sylpheed-Claws 0.9.12cvs126.2 (GTK+ 2.4.13; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-archive-position: 11282 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: zaitcev@redhat.com Precedence: bulk X-list: netdev Content-Length: 1448 Lines: 39 I have finally figured how the failure develops. I poked Jeff about it before, but nothing could be done because it looked impossible to reproduce without reboots. Just asking for negotiation with mii-tool would always yield a working link. Also, this only happens with a dumb hub (tried several), but works dandy when talking to a switch. So, here's the deal. The Fedora startup has a segment which works like this: ip link set dev $1 up >/dev/null 2>&1 timeout=0 while [ $timeout -le 10 ]; do check_mii_tool $1 m=$? check_ethtool $1 e=$? if [ $m -eq 1 ] || [ $e -eq 1 ] ; then return 1 fi if [ $m -eq 2 ] && [ $e -eq 2 ] ; then return 1 fi usleep 500000 timeout=$((timeout+1)) done It appears that the negotiation will not happen after "ip link set ... up" if we keep beating the interface with mii-tool (despite the 0.5s delay). Weird, huh? It's enough to fix things if a 3s delay is inserted after the ip ... up. I think the bug here is that polling with mii-tool disrupts the autonegotiation. It is ok to return failure after a reset, but eventually this has to resolve itself despite the polling. I suspect that 3c59x has the same failure as well. But I haven't played with it much. -- Pete From shemminger@osdl.org Mon Nov 1 09:19:04 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 09:19:10 -0800 (PST) Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1HJ3Pj030004 for ; Mon, 1 Nov 2004 09:19:04 -0800 Received: from zqx3.pdx.osdl.net (fw.osdl.org [65.172.181.6]) (authenticated bits=0) by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id iA1HIbPE007190 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Nov 2004 09:18:37 -0800 Date: Mon, 1 Nov 2004 09:20:27 -0800 From: Stephen Hemminger To: Michael Vittrup Larsen Cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] tcp: efficient port randomisation Message-Id: <20041101092027.2a741e82@zqx3.pdx.osdl.net> In-Reply-To: <200411011058.23141.michael.vittrup.larsen@ericsson.com> References: <20041027092531.78fe438c@guest-251-240.pdx.osdl.net> <200410291048.01955.michael.vittrup.larsen@ericsson.com> <20041029102828.123502e7@zqx3.pdx.osdl.net> <200411011058.23141.michael.vittrup.larsen@ericsson.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i686-suse-linux) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MIMEDefang-Filter: osdl$Revision: 1.93 $ X-Scanned-By: MIMEDefang 2.36 X-archive-position: 11283 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev Content-Length: 1346 Lines: 31 On Mon, 1 Nov 2004 11:58:23 +0200 Michael Vittrup Larsen wrote: > On Friday 29 October 2004 19:28, Stephen Hemminger wrote: > > Provide port randomization for incoming connections using variation of > > existing sequence number hash. Replace tcp_portalloc_lock and > > tcp_port_rover with atomic operation to allow better parallelism. > > > > This is based on > > http://www.ietf.org/internet-drafts/draft-larsen-tsvwg-port-randomisation-0 > >0.txt (with confirmation of of no IPR issues). > > I have looked through this, and have a few comments: > > * It is probably a good strategy to set 'tcp_rover_next' such that > the next search is resumed from the previous port found to be free. > (similar to the old algorithm). I don't see this in your patch, > but of course I could have missed it. It was intentional since it would require holding a lock around the search. The tradeoff is better SMP performance in the sparsely filled port space (more typical) vs. better UP performance in the case of a mostly full port space. > * connect_port_offset() does not (at least from an algorithm point > of view) need to return an u32, an u16 is sufficient. If it is truncated to u16, then compiler has to take extra effort to truncate is unnecessary given later modulo operation. > Michael Larsen From nacc@us.ibm.com Mon Nov 1 09:31:20 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 09:31:24 -0800 (PST) Received: from e3.ny.us.ibm.com (e3.ny.us.ibm.com [32.97.182.103]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1HVD0P030602 for ; Mon, 1 Nov 2004 09:31:20 -0800 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.12.10/8.12.9) with ESMTP id iA1HUpPJ733244; Mon, 1 Nov 2004 12:30:51 -0500 Received: from localhost.localdomain (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id iA1HUnU5222144; Mon, 1 Nov 2004 12:30:50 -0500 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.11/8.12.11/Debian-5) with ESMTP id iA1IVIEd001786; Mon, 1 Nov 2004 10:31:19 -0800 Received: (from nacc@localhost) by localhost.localdomain (8.12.11/8.12.11/Debian-5) id iA1IVI5M001783; Mon, 1 Nov 2004 10:31:18 -0800 X-Authentication-Warning: localhost.localdomain: nacc set sender to nacc@us.ibm.com using -f Date: Mon, 1 Nov 2004 10:31:18 -0800 From: Nishanth Aravamudan To: Jeff Garzik Cc: janitor@sternwelten.at, netdev@oss.sgi.com Subject: Re: [patch 05/18] net/s2io: replace schedule_timeout() with msleep() Message-ID: <20041101183118.GA1730@us.ibm.com> References: <4184C7EE.5070107@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4184C7EE.5070107@pobox.com> X-Operating-System: Linux 2.6.9 (i686) User-Agent: Mutt/1.5.6+20040722i X-archive-position: 11284 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nacc@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 657 Lines: 20 On Sun, Oct 31, 2004 at 06:09:34AM -0500, Jeff Garzik wrote: > janitor@sternwelten.at wrote: > >@@ -2846,11 +2838,10 @@ static int s2io_ethtool_idnic(struct net > > sp->id_timer.data = (unsigned long) sp; > > } > > mod_timer(&sp->id_timer, jiffies); > >- set_current_state(TASK_INTERRUPTIBLE); > > if (data) > >- schedule_timeout(data * HZ); > >+ msleep_interruptible(data * 1000); > > > clearly wants ssleep() here Even though ssleep() is in TASK_UNINTERRUPTIBLE? In cases where the existing code used TASK_INTERRUPTIBLE, but was sleeping in terms of seconds, I left it as msleep_interruptible, since ssleep_interruptible() doesn't exist. -Nish From rddunlap@osdl.org Mon Nov 1 09:33:04 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 09:33:09 -0800 (PST) Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1HX3k2030836 for ; Mon, 1 Nov 2004 09:33:03 -0800 Received: from [172.20.1.27] (fw.osdl.org [65.172.181.6]) (authenticated bits=0) by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id iA1HWWPE008900 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 1 Nov 2004 09:32:32 -0800 Message-ID: <418670AC.7010801@osdl.org> Date: Mon, 01 Nov 2004 09:21:48 -0800 From: "Randy.Dunlap" Organization: OSDL User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jeff Garzik CC: netdev@oss.sgi.com, rl@hellgate.ch Subject: [PATCH] via-rhine: references __init code during resume References: <4179543F.1020407@osdl.org> <418390F2.7080901@pobox.com> In-Reply-To: <418390F2.7080901@pobox.com> Content-Type: multipart/mixed; boundary="------------060901020707080309020307" X-MIMEDefang-Filter: osdl$Revision: 1.93 $ X-Scanned-By: MIMEDefang 2.36 X-archive-position: 11285 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 Content-Length: 1310 Lines: 44 This is a multi-part message in MIME format. --------------060901020707080309020307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit [Does it work if the patch description is inline & the patch is attached?] Fix __init section usage: rhine_resume calls enable_mmio, so latter cannot be __devinit; Error: ./drivers/net/via-rhine.o .text refers to 0000000000000925 R_X86_64_PC32 .init.text+0xfffffffffffffffc Signed-off-by: Randy Dunlap diffstat:= drivers/net/via-rhine.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) -- ~Randy --------------060901020707080309020307 Content-Type: text/x-patch; name="via_rhine_mmio.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="via_rhine_mmio.patch" diff -Naurp ./drivers/net/via-rhine.c~via_rhine_mmio ./drivers/net/via-rhine.c --- ./drivers/net/via-rhine.c~via_rhine_mmio 2004-10-18 14:55:28.000000000 -0700 +++ ./drivers/net/via-rhine.c 2004-10-22 10:10:58.928311448 -0700 @@ -627,7 +627,7 @@ static void rhine_chip_reset(struct net_ } #ifdef USE_MMIO -static void __devinit enable_mmio(long pioaddr, u32 quirks) +static void enable_mmio(long pioaddr, u32 quirks) { int n; if (quirks & rqRhineI) { --------------060901020707080309020307-- From mdomsch@lists.us.dell.com Mon Nov 1 09:35:09 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 09:35:15 -0800 (PST) Received: from lists.us.dell.com (linux.us.dell.com [143.166.224.162]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1HZ8n6031326 for ; Mon, 1 Nov 2004 09:35:09 -0800 Received: from lists.us.dell.com (localhost.localdomain [127.0.0.1]) by lists.us.dell.com (8.12.10/8.12.10/Dell.IT.3.31.03) with ESMTP id iA1HYZMU012622; Mon, 1 Nov 2004 11:34:35 -0600 Received: (from mdomsch@localhost) by lists.us.dell.com (8.12.10/8.12.10/Submit) id iA1HYYIX012620; Mon, 1 Nov 2004 11:34:34 -0600 Date: Mon, 1 Nov 2004 11:34:34 -0600 From: Matt Domsch To: netdev@oss.sgi.com Cc: jamal , Herbert Xu Subject: Re: [PATCH 2.6] dev.c: clear SIOCGIFHWADDR buffer if !dev->addr_len Message-ID: <20041101173434.GA12437@lists.us.dell.com> References: <20041030013700.GA21540@lists.us.dell.com> <20041030030936.GA25102@lists.us.dell.com> <1099163419.1039.97.camel@jzny.localdomain> <20041101044433.GA18772@lists.us.dell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041101044433.GA18772@lists.us.dell.com> User-Agent: Mutt/1.4.1i X-archive-position: 11286 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Matt_Domsch@dell.com Precedence: bulk X-list: netdev Content-Length: 2011 Lines: 52 On Sun, Oct 31, 2004 at 10:44:33PM -0600, Matt Domsch wrote: > I think -EOVERFLOW would be appropriate return for dev->addr_len > > sizeof sa_data, yes? > > I'd prefer though, that an "obsolete" function, be marked as such > somehow (perhaps print a net_ratelimit()ed KERN_DEBUG message when > it's called telling apps to move to rtnetlink), and that the behaviour > for everything except overflow be consistent with the prior > implementation, at least until such a time that all the apps in the > distros are converted to rtnetlink. How's this look? This makes ioctl(SIOCIFHWADDR) behavior in 2.6 consistent with that of previous kernels wherever possible. It returns -EOVERFLOW if it can't represent the address, zeros the data if dev->addr_len is zero, and prints a KERN_DEBUG message telling people to fix their applications to use rtnetlink. Compiles on x86 and x86-64 cleanly. Signed-off-by: Matt Domsch -- Matt Domsch Sr. Software Engineer, Lead Engineer Dell Linux Solutions linux.dell.com & www.dell.com/linux Linux on Dell mailing lists @ http://lists.us.dell.com ===== net/core/dev.c 1.169 vs edited ===== --- 1.169/net/core/dev.c 2004-10-26 11:09:33 -05:00 +++ edited/net/core/dev.c 2004-11-01 11:20:25 -06:00 @@ -2375,8 +2375,16 @@ return dev_set_mtu(dev, ifr->ifr_mtu); case SIOCGIFHWADDR: - memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, - min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); + if (net_ratelimit()) + printk(KERN_DEBUG "Warning: %s uses obsolete ioctl(SIOCGIFHWADDR), please convert it to rtnetlink(3,7)\n", current->comm); + + if ((size_t) dev->addr_len > sizeof ifr->ifr_hwaddr.sa_data) + return -EOVERFLOW; + else if (!dev->addr_len) + memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data); + else + memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, + min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); ifr->ifr_hwaddr.sa_family = dev->type; return 0; From jgarzik@pobox.com Mon Nov 1 10:03:47 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:03:57 -0800 (PST) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1I3iML032379 for ; Mon, 1 Nov 2004 10:03:46 -0800 Received: from rdu74-155-169.nc.rr.com ([24.74.155.169] helo=[10.10.10.88]) by www.linux.org.uk with asmtp (TLSv1:AES256-SHA:256) (Exim 4.33) id 1COgWb-00077m-Rp; Mon, 01 Nov 2004 18:03:25 +0000 Message-ID: <41867A5E.4040301@pobox.com> Date: Mon, 01 Nov 2004 13:03:10 -0500 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nishanth Aravamudan CC: janitor@sternwelten.at, netdev@oss.sgi.com Subject: Re: [patch 05/18] net/s2io: replace schedule_timeout() with msleep() References: <4184C7EE.5070107@pobox.com> <20041101183118.GA1730@us.ibm.com> In-Reply-To: <20041101183118.GA1730@us.ibm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 11287 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: jgarzik@pobox.com Precedence: bulk X-list: netdev Content-Length: 747 Lines: 29 Nishanth Aravamudan wrote: > On Sun, Oct 31, 2004 at 06:09:34AM -0500, Jeff Garzik wrote: > >>janitor@sternwelten.at wrote: >> >>>@@ -2846,11 +2838,10 @@ static int s2io_ethtool_idnic(struct net >>> sp->id_timer.data = (unsigned long) sp; >>> } >>> mod_timer(&sp->id_timer, jiffies); >>>- set_current_state(TASK_INTERRUPTIBLE); >>> if (data) >>>- schedule_timeout(data * HZ); >>>+ msleep_interruptible(data * 1000); >> >> >>clearly wants ssleep() here > > > Even though ssleep() is in TASK_UNINTERRUPTIBLE? In cases where the > existing code used TASK_INTERRUPTIBLE, but was sleeping in terms of > seconds, I left it as msleep_interruptible, since ssleep_interruptible() > doesn't exist. Right: create ssleep_interruptible() :) Jeff From nacc@us.ibm.com Mon Nov 1 10:08:59 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:09:03 -0800 (PST) Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.133]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1I8xoo000382 for ; Mon, 1 Nov 2004 10:08:59 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e35.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id iA1I8M8m606240 for ; Mon, 1 Nov 2004 13:08:23 -0500 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by westrelay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id iA1I8EBb134230 for ; Mon, 1 Nov 2004 11:08:16 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1I8D0K012010 for ; Mon, 1 Nov 2004 11:08:14 -0700 Received: from localhost.localdomain (DYN318967BLD.beaverton.ibm.com [9.47.21.82]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1I8D4k011957; Mon, 1 Nov 2004 11:08:13 -0700 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.11/8.12.11/Debian-5) with ESMTP id iA1J8gDN001969; Mon, 1 Nov 2004 11:08:42 -0800 Received: (from nacc@localhost) by localhost.localdomain (8.12.11/8.12.11/Debian-5) id iA1J8fVk001966; Mon, 1 Nov 2004 11:08:41 -0800 X-Authentication-Warning: localhost.localdomain: nacc set sender to nacc@us.ibm.com using -f Date: Mon, 1 Nov 2004 11:08:41 -0800 From: Nishanth Aravamudan To: Jeff Garzik Cc: netdev@oss.sgi.com, kernel-janitors@lists.osdl.org Subject: [PATCH] net/gt96100eth: replace gt96100_delay() with msleep_interruptible() Message-ID: <20041101190841.GB1730@us.ibm.com> References: <4184C72F.8000905@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4184C72F.8000905@pobox.com> X-Operating-System: Linux 2.6.9 (i686) User-Agent: Mutt/1.5.6+20040722i X-archive-position: 11288 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nacc@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 3015 Lines: 90 On Sun, Oct 31, 2004 at 06:06:23AM -0500, Jeff Garzik wrote: > janitor@sternwelten.at wrote: > >@@ -528,7 +517,7 @@ abort(struct net_device *dev, u32 abort_ > > // wait for abort to complete > > while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) { > > // snooze for 20 msec and check again > >- gt96100_delay(1); > >+ msleep_interruptible(20); > > > > if (--timedout == 0) { > > > don't change the behavior of the driver, even if it disagrees with the > comment. Ok, please find the corrected patch below. Description: Uses msleep_interruptible() instead of gt96100_delay() to guarantee the task delays as expected. Removes prototype and definition of now unused gt96100_delay() function. Corrects one comment to correspond to the code. Signed-off-by: Nishanth Aravamudan --- 2.6.10-rc1-vanilla/drivers/net/gt96100eth.c 2004-10-30 15:33:30.000000000 -0700 +++ 2.6.10-rc1/drivers/net/gt96100eth.c 2004-11-01 11:05:37.000000000 -0800 @@ -59,7 +59,6 @@ // prototypes static void* dmaalloc(size_t size, dma_addr_t *dma_handle); static void dmafree(size_t size, void *vaddr); -static void gt96100_delay(int msec); static int gt96100_add_hash_entry(struct net_device *dev, unsigned char* addr); static void read_mib_counters(struct gt96100_private *gp); @@ -183,16 +182,6 @@ static void dmafree(size_t size, void *v free_pages((unsigned long)vaddr, get_order(size)); } -static void gt96100_delay(int ms) -{ - if (in_interrupt()) - return; - else { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(ms*HZ/1000); - } -} - static int parse_mac_addr(struct net_device *dev, char* macstr) { @@ -238,7 +227,7 @@ read_MII(int phy_addr, u32 reg) // wait for last operation to complete while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) { // snooze for 1 msec and check again - gt96100_delay(1); + msleep_interruptible(1); if (--timedout == 0) { printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__); @@ -252,7 +241,7 @@ read_MII(int phy_addr, u32 reg) // wait for read to complete while (!((smir = GT96100_READ(GT96100_ETH_SMI_REG)) & smirReadValid)) { // snooze for 1 msec and check again - gt96100_delay(1); + msleep_interruptible(1); if (--timedout == 0) { printk(KERN_ERR "%s: timeout!!\n", __FUNCTION__); @@ -304,7 +293,7 @@ write_MII(int phy_addr, u32 reg, u16 dat // wait for last operation to complete while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) { // snooze for 1 msec and check again - gt96100_delay(1); + msleep_interruptible(1); if (--timedout == 0) { printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__); @@ -527,8 +516,8 @@ abort(struct net_device *dev, u32 abort_ // wait for abort to complete while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) { - // snooze for 20 msec and check again - gt96100_delay(1); + // snooze for 1 msec and check again + msleep_interruptible(1); if (--timedout == 0) { err("%s: timeout!!\n", __FUNCTION__); From nacc@us.ibm.com Mon Nov 1 10:14:47 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:14:51 -0800 (PST) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.104]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1IEiUM000855 for ; Mon, 1 Nov 2004 10:14:47 -0800 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e4.ny.us.ibm.com (8.12.10/8.12.9) with ESMTP id iA1IENCE396636; Mon, 1 Nov 2004 13:14:23 -0500 Received: from localhost.localdomain (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id iA1IELDC231800; Mon, 1 Nov 2004 13:14:22 -0500 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.11/8.12.11/Debian-5) with ESMTP id iA1JEosC002023; Mon, 1 Nov 2004 11:14:51 -0800 Received: (from nacc@localhost) by localhost.localdomain (8.12.11/8.12.11/Debian-5) id iA1JEoMC002020; Mon, 1 Nov 2004 11:14:50 -0800 X-Authentication-Warning: localhost.localdomain: nacc set sender to nacc@us.ibm.com using -f Date: Mon, 1 Nov 2004 11:14:50 -0800 From: Nishanth Aravamudan To: Jeff Garzik Cc: janitor@sternwelten.at, netdev@oss.sgi.com Subject: Re: [patch 05/18] net/s2io: replace schedule_timeout() with msleep() Message-ID: <20041101191450.GC1730@us.ibm.com> References: <4184C7EE.5070107@pobox.com> <20041101183118.GA1730@us.ibm.com> <41867A5E.4040301@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41867A5E.4040301@pobox.com> X-Operating-System: Linux 2.6.9 (i686) User-Agent: Mutt/1.5.6+20040722i X-archive-position: 11289 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nacc@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 985 Lines: 30 On Mon, Nov 01, 2004 at 01:03:10PM -0500, Jeff Garzik wrote: > Nishanth Aravamudan wrote: > >On Sun, Oct 31, 2004 at 06:09:34AM -0500, Jeff Garzik wrote: > > > >>janitor@sternwelten.at wrote: > >> > >>>@@ -2846,11 +2838,10 @@ static int s2io_ethtool_idnic(struct net > >>> sp->id_timer.data = (unsigned long) sp; > >>> } > >>> mod_timer(&sp->id_timer, jiffies); > >>>- set_current_state(TASK_INTERRUPTIBLE); > >>> if (data) > >>>- schedule_timeout(data * HZ); > >>>+ msleep_interruptible(data * 1000); > >> > >> > >>clearly wants ssleep() here > > > > > >Even though ssleep() is in TASK_UNINTERRUPTIBLE? In cases where the > >existing code used TASK_INTERRUPTIBLE, but was sleeping in terms of > >seconds, I left it as msleep_interruptible, since ssleep_interruptible() > >doesn't exist. > > Right: create ssleep_interruptible() :) Ok, will do :) I wasn't sure by your e-mail whether you meant to use ssleep() or create ssleep_interruptible(). Patch will follow shortly. -Nish From nacc@us.ibm.com Mon Nov 1 10:22:28 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:22:33 -0800 (PST) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.132]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1IMSgX001381 for ; Mon, 1 Nov 2004 10:22:28 -0800 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e34.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id iA1IM6J8342880 for ; Mon, 1 Nov 2004 13:22:06 -0500 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id iA1IM5PM182682 for ; Mon, 1 Nov 2004 11:22:05 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1ILhIa017360 for ; Mon, 1 Nov 2004 11:21:43 -0700 Received: from localhost.localdomain (DYN318967BLD.beaverton.ibm.com [9.47.21.82]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1ILggo017305; Mon, 1 Nov 2004 11:21:43 -0700 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.11/8.12.11/Debian-5) with ESMTP id iA1JMBrf002099; Mon, 1 Nov 2004 11:22:11 -0800 Received: (from nacc@localhost) by localhost.localdomain (8.12.11/8.12.11/Debian-5) id iA1JMA98002096; Mon, 1 Nov 2004 11:22:10 -0800 X-Authentication-Warning: localhost.localdomain: nacc set sender to nacc@us.ibm.com using -f Date: Mon, 1 Nov 2004 11:22:10 -0800 From: Nishanth Aravamudan To: Jeff Garzik Cc: kernel-janitors@lists.osdl.org, netdev@oss.sgi.com Subject: [PATCH] linux/ibmtr.h: add constants for appropriate delays Message-ID: <20041101192210.GD1730@us.ibm.com> References: <4184C66B.8040501@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4184C66B.8040501@pobox.com> X-Operating-System: Linux 2.6.9 (i686) User-Agent: Mutt/1.5.6+20040722i X-archive-position: 11290 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nacc@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 2280 Lines: 63 On Sun, Oct 31, 2004 at 06:03:07AM -0500, Jeff Garzik wrote: > janitor@sternwelten.at wrote: > >Any comments would be appreciated. > > > >Description: Use msleep() / msleep_interruptible() [as appropriate] > >instead of schedule_timeout() to guarantee the task delays as expected. > > > >Signed-off-by: Nishanth Aravamudan > >Signed-off-by: Maximilian Attems > > > >--- > > > > linux-2.6.10-rc1-max/drivers/net/tokenring/ibmtr.c | 11 +++++------ > > 1 files changed, 5 insertions(+), 6 deletions(-) > >- schedule_timeout(TR_RST_TIME); /* wait 50ms */ > >+ msleep(jiffies_to_msecs(TR_RST_TIME)); /* wait 50ms */ > >- current->state=TASK_UNINTERRUPTIBLE; > >- schedule_timeout(TR_RST_TIME); /* wait 50ms */ > >+ msleep(jiffies_to_msecs(TR_RST_TIME)); /* wait 50ms */ > >- current->state=TASK_INTERRUPTIBLE; > >- i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */ > >- if(i!=0) break; /*prob. a signal, like the i>24*HZ case > >above */ > >+ if(msleep_interruptible(jiffies_to_msecs(TR_RETRY_INTERVAL))) > >+ break; /*prob. a signal, like the i>24*HZ case above > It makes more sense to convert the constants to msecs in the source > code, instead of converting them at runtime. This required changing both the .h and .c files, the first of which is attached below. Description: Adds constant definitions for timeout variables in terms of milliseconds to avoid run-time constant conversion. Signed-off-by: Nishanth Aravamudan --- 2.6.10-rc1-vanilla/include/linux/ibmtr.h 2004-10-30 15:34:03.000000000 -0700 +++ 2.6.10-rc1/include/linux/ibmtr.h 2004-11-01 11:13:41.000000000 -0800 @@ -6,8 +6,10 @@ /* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ -#define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */ -#define TR_RST_TIME (HZ/20) /* 5 on PC = 50 ms */ +#define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s (in jiffies) */ +#define TR_RETRY_INTERVAL (30000) /* 500 on PC = 5 s */ +#define TR_RST_TIME (HZ/20) /* 5 on PC = 50 ms (in jiffies) */ +#define TR_RST_TIME_MS (50) /* 5 on PC = 50 ms */ #define TR_BUSY_INTERVAL (HZ/5) /* 5 on PC = 200 ms */ #define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ From nacc@us.ibm.com Mon Nov 1 10:27:33 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:27:37 -0800 (PST) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.132]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1IRXX8001796 for ; Mon, 1 Nov 2004 10:27:33 -0800 Received: from westrelay04.boulder.ibm.com (westrelay04.boulder.ibm.com [9.17.193.32]) by e34.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id iA1IRBJ8466992 for ; Mon, 1 Nov 2004 13:27:11 -0500 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by westrelay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id iA1IRBBb121298 for ; Mon, 1 Nov 2004 11:27:11 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1IRA7I012089 for ; Mon, 1 Nov 2004 11:27:11 -0700 Received: from localhost.localdomain (DYN318967BLD.beaverton.ibm.com [9.47.21.82]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id iA1IRAHj012053; Mon, 1 Nov 2004 11:27:10 -0700 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.11/8.12.11/Debian-5) with ESMTP id iA1JRdlU002121; Mon, 1 Nov 2004 11:27:39 -0800 Received: (from nacc@localhost) by localhost.localdomain (8.12.11/8.12.11/Debian-5) id iA1JRc61002118; Mon, 1 Nov 2004 11:27:38 -0800 X-Authentication-Warning: localhost.localdomain: nacc set sender to nacc@us.ibm.com using -f Date: Mon, 1 Nov 2004 11:27:38 -0800 From: Nishanth Aravamudan To: Jeff Garzik Cc: kernel-janitors@lists.osdl.org, netdev@oss.sgi.com Subject: [PATCH] net/ibmtr: replace schedule_timeout() with msleep()/msleep_interruptible() Message-ID: <20041101192738.GE1730@us.ibm.com> References: <4184C66B.8040501@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4184C66B.8040501@pobox.com> X-Operating-System: Linux 2.6.9 (i686) User-Agent: Mutt/1.5.6+20040722i X-archive-position: 11291 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: nacc@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 3086 Lines: 88 On Sun, Oct 31, 2004 at 06:03:07AM -0500, Jeff Garzik wrote: > janitor@sternwelten.at wrote: > >Any comments would be appreciated. > > > >Description: Use msleep() / msleep_interruptible() [as appropriate] > >instead of schedule_timeout() to guarantee the task delays as expected. > > > >Signed-off-by: Nishanth Aravamudan > >Signed-off-by: Maximilian Attems > > > >--- > > > > linux-2.6.10-rc1-max/drivers/net/tokenring/ibmtr.c | 11 +++++------ > > 1 files changed, 5 insertions(+), 6 deletions(-) > > > >- schedule_timeout(TR_RST_TIME); /* wait 50ms */ > >+ msleep(jiffies_to_msecs(TR_RST_TIME)); /* wait 50ms */ > >- current->state=TASK_UNINTERRUPTIBLE; > >- schedule_timeout(TR_RST_TIME); /* wait 50ms */ > >+ msleep(jiffies_to_msecs(TR_RST_TIME)); /* wait 50ms */ > >- current->state=TASK_INTERRUPTIBLE; > >- i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */ > >- if(i!=0) break; /*prob. a signal, like the i>24*HZ case > >above */ > >+ if(msleep_interruptible(jiffies_to_msecs(TR_RETRY_INTERVAL))) > >+ break; /*prob. a signal, like the i>24*HZ case above > It makes more sense to convert the constants to msecs in the source > code, instead of converting them at runtime. Here is the patch to ibmtr.c which completes these changes... Description: Uses msleep()/msleep_interruptible() [as appropriate] to guarantee the task delays as expected. This patch depends on the corresponding addition of the millisecond-unit constants to ibmtr.h. Signed-off-by: Nishanth Aravamudan --- 2.6.10-rc1-vanilla/drivers/net/tokenring/ibmtr.c 2004-10-30 15:33:28.000000000 -0700 +++ 2.6.10-rc1/drivers/net/tokenring/ibmtr.c 2004-11-01 11:18:10.000000000 -0800 @@ -130,6 +130,7 @@ in the event that chatty debug messages #include #include #include +#include #include @@ -317,7 +318,7 @@ static void ibmtr_cleanup_card(struct ne if (dev->base_addr) { outb(0,dev->base_addr+ADAPTRESET); - schedule_timeout(TR_RST_TIME); /* wait 50ms */ + msleep(TR_RST_TIME_MS); outb(0,dev->base_addr+ADAPTRESETREL); } @@ -858,8 +859,7 @@ static int tok_init_card(struct net_devi writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN); outb(0, PIOaddr + ADAPTRESET); - current->state=TASK_UNINTERRUPTIBLE; - schedule_timeout(TR_RST_TIME); /* wait 50ms */ + msleep(TR_RST_TIME_MS); outb(0, PIOaddr + ADAPTRESETREL); #ifdef ENABLE_PAGING @@ -912,9 +912,8 @@ static int tok_open(struct net_device *d DPRINTK("Adapter is up and running\n"); return 0; } - current->state=TASK_INTERRUPTIBLE; - i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */ - if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */ + if(msleep_interruptible(TR_RETRY_INTERVAL_MS)) break; + /*prob. a signal, like the i>24*HZ case above */ } outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/ DPRINTK("TERMINATED via signal\n"); /*BMS useful */ From kaber@trash.net Mon Nov 1 10:41:21 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:41:27 -0800 (PST) Received: from kaber.coreworks.de ([62.206.217.67]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1IfKcn002523 for ; Mon, 1 Nov 2004 10:41:21 -0800 Received: from localhost ([127.0.0.1] ident=kaber) by kaber.coreworks.de with esmtp (Exim 4.34) id 1COh6p-0008Tv-VX; Mon, 01 Nov 2004 19:40:52 +0100 Message-ID: <41868333.7050602@trash.net> Date: Mon, 01 Nov 2004 19:40:51 +0100 From: Patrick McHardy User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041008 Debian/1.7.3-5 X-Accept-Language: en MIME-Version: 1.0 To: Christoph Hellwig CC: davem@redhat.com, netdev@oss.sgi.com Subject: Re: [PATCH] remove dead skb_iter* functions References: <20041101115653.GA7714@lst.de> In-Reply-To: <20041101115653.GA7714@lst.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-archive-position: 11292 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: kaber@trash.net Precedence: bulk X-list: netdev Content-Length: 4710 Lines: 173 Harald is working on code for pattern-matching inside non-linear skbs for conntrack helpers. This code needs the skb_iter* functions. Regards Patrick Christoph Hellwig wrote: >Signed-off-by: Christoph Hellwig > > > >--- 1.56/include/linux/skbuff.h 2004-10-05 23:51:01 +02:00 >+++ edited/include/linux/skbuff.h 2004-10-30 21:04:33 +02:00 >@@ -592,7 +592,6 @@ > /* > * Insert a packet on a list. > */ >-extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk); > static inline void __skb_insert(struct sk_buff *newsk, > struct sk_buff *prev, struct sk_buff *next, > struct sk_buff_head *list) >@@ -1120,22 +1119,6 @@ > > extern void skb_init(void); > extern void skb_add_mtu(int mtu); >- >-struct skb_iter { >- /* Iteration functions set these */ >- unsigned char *data; >- unsigned int len; >- >- /* Private to iteration */ >- unsigned int nextfrag; >- struct sk_buff *fraglist; >-}; >- >-/* Keep iterating until skb_iter_next returns false. */ >-extern void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i); >-extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i); >-/* Call this if aborting loop before !skb_iter_next */ >-extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); > > #ifdef CONFIG_NETFILTER > static inline void nf_conntrack_put(struct nf_conntrack *nfct) >--- 1.39/net/core/skbuff.c 2004-10-20 06:56:24 +02:00 >+++ edited/net/core/skbuff.c 2004-10-30 21:04:33 +02:00 >@@ -929,72 +929,7 @@ > return -EFAULT; > } > >-/* Keep iterating until skb_iter_next returns false. */ >-void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i) >-{ >- i->len = skb_headlen(skb); >- i->data = (unsigned char *)skb->data; >- i->nextfrag = 0; >- i->fraglist = NULL; >-} >- >-int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i) >-{ >- /* Unmap previous, if not head fragment. */ >- if (i->nextfrag) >- kunmap_skb_frag(i->data); >- >- if (i->fraglist) { >- fraglist: >- /* We're iterating through fraglist. */ >- if (i->nextfrag < skb_shinfo(i->fraglist)->nr_frags) { >- i->data = kmap_skb_frag(&skb_shinfo(i->fraglist) >- ->frags[i->nextfrag]); >- i->len = skb_shinfo(i->fraglist)->frags[i->nextfrag] >- .size; >- i->nextfrag++; >- return 1; >- } >- /* Fragments with fragments? Too hard! */ >- BUG_ON(skb_shinfo(i->fraglist)->frag_list); >- i->fraglist = i->fraglist->next; >- if (!i->fraglist) >- goto end; >- >- i->len = skb_headlen(i->fraglist); >- i->data = i->fraglist->data; >- i->nextfrag = 0; >- return 1; >- } >- >- if (i->nextfrag < skb_shinfo(skb)->nr_frags) { >- i->data = kmap_skb_frag(&skb_shinfo(skb)->frags[i->nextfrag]); >- i->len = skb_shinfo(skb)->frags[i->nextfrag].size; >- i->nextfrag++; >- return 1; >- } >- >- i->fraglist = skb_shinfo(skb)->frag_list; >- if (i->fraglist) >- goto fraglist; >- >-end: >- /* Bug trap for callers */ >- i->data = NULL; >- return 0; >-} >- >-void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i) >-{ >- /* Unmap previous, if not head fragment. */ >- if (i->data && i->nextfrag) >- kunmap_skb_frag(i->data); >- /* Bug trap for callers */ >- i->data = NULL; >-} >- > /* Checksum skb data. */ >- > unsigned int skb_checksum(const struct sk_buff *skb, int offset, > int len, unsigned int csum) > { >@@ -1318,25 +1253,6 @@ > } > > >-/** >- * skb_insert - insert a buffer >- * @old: buffer to insert before >- * @newsk: buffer to insert >- * >- * Place a packet before a given packet in a list. The list locks are taken >- * and this function is atomic with respect to other list locked calls >- * A buffer cannot be placed on two lists at the same time. >- */ >- >-void skb_insert(struct sk_buff *old, struct sk_buff *newsk) >-{ >- unsigned long flags; >- >- spin_lock_irqsave(&old->list->lock, flags); >- __skb_insert(newsk, old->prev, old, old->list); >- spin_unlock_irqrestore(&old->list->lock, flags); >-} >- > #if 0 > /* > * Tune the memory allocator for a new MTU size. >@@ -1444,7 +1360,6 @@ > EXPORT_SYMBOL(pskb_expand_head); > EXPORT_SYMBOL(skb_checksum); > EXPORT_SYMBOL(skb_clone); >-EXPORT_SYMBOL(skb_clone_fraglist); > EXPORT_SYMBOL(skb_copy); > EXPORT_SYMBOL(skb_copy_and_csum_bits); > EXPORT_SYMBOL(skb_copy_and_csum_dev); >@@ -1456,13 +1371,8 @@ > EXPORT_SYMBOL(skb_under_panic); > EXPORT_SYMBOL(skb_dequeue); > EXPORT_SYMBOL(skb_dequeue_tail); >-EXPORT_SYMBOL(skb_insert); > EXPORT_SYMBOL(skb_queue_purge); > EXPORT_SYMBOL(skb_queue_head); > EXPORT_SYMBOL(skb_queue_tail); > EXPORT_SYMBOL(skb_unlink); > EXPORT_SYMBOL(skb_append); >-EXPORT_SYMBOL(skb_split); >-EXPORT_SYMBOL(skb_iter_first); >-EXPORT_SYMBOL(skb_iter_next); >-EXPORT_SYMBOL(skb_iter_abort); > > > From greearb@candelatech.com Mon Nov 1 10:59:22 2004 Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 10:59:28 -0800 (PST) Received: from www.lanforge.com (ns1.lanforge.com [66.165.47.210]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1IxL4l003308 for ; Mon, 1 Nov 2004 10:59:22 -0800 Received: from [4.35.49.74] (evrtwa1-ar2-4-35-049-074.evrtwa1.dsl-verizon.net [4.35.49.74]) (authenticated bits=0) by www.lanforge.com (8.12.8/8.12.8) with ESMTP id iA1J6vLH013685; Mon, 1 Nov 2004 11:06:57 -0800 Message-ID: <4186876E.50