diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
commit | 012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch) | |
tree | 87efc733f9b164e8c85c0336f92c8fb7eff6d183 /net/core | |
parent | 625a1589d3d6464b5d90b8a0918789e3afffd220 (diff) |
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found
that this kernel will only boot SMP on Origin; the UP kernel freeze
soon after bootup with SCSI timeout messages. I commit this anyway
since I found that the last CVS versions had the same problem.
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 90 | ||||
-rw-r--r-- | net/core/sock.c | 7 |
2 files changed, 39 insertions, 58 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index a6ee7367a..e6f440cf4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -295,37 +295,20 @@ int netdev_boot_setup_add(char *name, struct ifmap *map) * netdev_boot_setup_check - check boot time settings * @dev: the netdevice * - * Check boot time settings for the device. If device's name is a - * mask (eg. eth%d) and settings are found then this will allocate - * name 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. + * 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; - char buf[IFNAMSIZ + 1]; - int i, mask = 0; - - memset(buf, 0, sizeof(buf)); - strcpy(buf, dev->name); - if (strchr(dev->name, '%')) { - *strchr(buf, '%') = '\0'; - mask = 1; - } + 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] != ' ' && - !strncmp(buf, s[i].name, mask ? strlen(buf) : - strlen(s[i].name))) { - if (__dev_get_by_name(s[i].name)) { - if (!mask) - return 0; - continue; - } - memset(dev->name, 0, IFNAMSIZ); - strcpy(dev->name, s[i].name); + !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; @@ -333,7 +316,6 @@ int netdev_boot_setup_check(struct net_device *dev) return 1; } } - return 0; } @@ -868,25 +850,6 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) br_read_unlock(BR_NETPROTO_LOCK); } -/* - * Fast path for loopback frames. - */ - -void dev_loopback_xmit(struct sk_buff *skb) -{ - struct sk_buff *newskb=skb_clone(skb, GFP_ATOMIC); - if (newskb==NULL) - return; - - newskb->mac.raw = newskb->data; - skb_pull(newskb, newskb->nh.raw - newskb->data); - newskb->pkt_type = PACKET_LOOPBACK; - newskb->ip_summed = CHECKSUM_UNNECESSARY; - if (newskb->dst==NULL) - printk(KERN_DEBUG "BUG: packet without dst looped back 1\n"); - netif_rx(newskb); -} - /** * dev_queue_xmit - transmit a buffer * @skb: buffer to transmit @@ -1178,6 +1141,7 @@ static void net_tx_action(struct softirq_action *h) struct net_device *dev = head; head = head->next_sched; + smp_mb__before_clear_bit(); clear_bit(__LINK_STATE_SCHED, &dev->state); if (spin_trylock(&dev->queue_lock)) { @@ -2482,27 +2446,26 @@ int __init net_dev_init(void) dev->iflink = -1; dev_hold(dev); + /* + * Allocate name. If the init() fails + * the name will be reissued correctly. + */ + if (strchr(dev->name, '%')) + dev_alloc_name(dev, dev->name); + /* * Check boot time settings for the device. */ - if (!netdev_boot_setup_check(dev)) { - /* - * No settings found - allocate name. If the init() - * fails the name will be reissued correctly. - */ - if (strchr(dev->name, '%')) - dev_alloc_name(dev, dev->name); - } + netdev_boot_setup_check(dev); if (dev->init && dev->init(dev)) { /* - * It failed to come up. Unhook it. + * It failed to come up. It will be unhooked later. + * dev_alloc_name can now advance to next suitable + * name that is checked next. */ - write_lock_bh(&dev_base_lock); - *dp = dev->next; dev->deadbeaf = 1; - write_unlock_bh(&dev_base_lock); - dev_put(dev); + dp = &dev->next; } else { dp = &dev->next; dev->ifindex = dev_new_index(); @@ -2515,6 +2478,21 @@ int __init net_dev_init(void) } } + /* + * Unhook devices that failed to come up + */ + dp = &dev_base; + while ((dev = *dp) != NULL) { + if (dev->deadbeaf) { + write_lock_bh(&dev_base_lock); + *dp = dev->next; + write_unlock_bh(&dev_base_lock); + dev_put(dev); + } else { + dp = &dev->next; + } + } + #ifdef CONFIG_PROC_FS proc_net_create("dev", 0, dev_get_info); create_proc_read_entry("net/softnet_stat", 0, 0, dev_proc_stats, NULL); diff --git a/net/core/sock.c b/net/core/sock.c index 1afd0619c..8503e364f 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -7,7 +7,7 @@ * handler for protocols to use and generic option handler. * * - * Version: $Id: sock.c,v 1.98 2000/08/16 16:09:15 davem Exp $ + * Version: $Id: sock.c,v 1.100 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, <bir7@leland.Stanford.Edu> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> @@ -609,7 +609,9 @@ void __init sk_init(void) { sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0, SLAB_HWCACHE_ALIGN, 0, 0); - + if (!sk_cachep) + printk(KERN_CRIT "sk_init: Cannot create sock SLAB cache!"); + if (num_physpages <= 4096) { sysctl_wmem_max = 32767; sysctl_rmem_max = 32767; @@ -1142,6 +1144,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) } else sk->sleep = NULL; + sk->dst_lock = RW_LOCK_UNLOCKED; sk->callback_lock = RW_LOCK_UNLOCKED; sk->state_change = sock_def_wakeup; |