Messages in this thread Patch in this message |  | | Date | Wed, 6 Sep 2000 09:49:34 +0300 (EEST) | From | "Pekka Riikonen [Adm]" <> | Subject | Re: 2.2 / 2.4 ethernet detection order |
| |
On Tue, 5 Sep 2000, Andries Brouwer wrote:
: I described the cause on Mon, 14 Aug 2000, and soon afterwards : priikone@poseidon.pspt.fi sent a corrected (I hope - didnt check) : patch to l-k. (Look for: Pekka Riikonen, Re: devfs / eth micro-problems) : : I see that this patch didnt make it into 2.4.0test7. : Perhaps it should be resubmitted. : Ok, here it is again, and is going to Alan and Linus as well:
-----snip----- diff -uNr ./drivers/net/net_init.c ../linux-2.4-new/drivers/net/net_init.c --- ./drivers/net/net_init.c Sat Jul 15 00:46:30 2000 +++ ../linux-2.4-new/drivers/net/net_init.c Tue Aug 22 12:28:44 2000 @@ -117,17 +117,15 @@ if (dev->name[0] == '\0' || dev->name[0] == ' ') { strcpy(dev->name, mask); - if (!netdev_boot_setup_check(dev)) { - if (dev_alloc_name(dev, mask)<0) { - if (new_device) - kfree(dev); - return NULL; - } + if (dev_alloc_name(dev, mask)<0) { + if (new_device) + kfree(dev); + return NULL; } - } else { - netdev_boot_setup_check(dev); + } - + netdev_boot_setup_check(dev); + /* * Configure via the caller provided setup function then * register if needed. diff -uNr ./net/core/dev.c ../linux-2.4-new/net/core/dev.c --- ./net/core/dev.c Wed Jun 21 00:32:27 2000 +++ ../linux-2.4-new/net/core/dev.c Tue Aug 22 12:29:13 2000 @@ -303,28 +303,12 @@ 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; @@ -365,6 +349,7 @@ __setup("netdev=", netdev_boot_setup); + /***************************************************************************************** Device Interface Subroutines @@ -2481,27 +2466,26 @@ 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(); @@ -2511,6 +2495,21 @@ dev->rebuild_header = default_rebuild_header; dev_init_scheduler(dev); set_bit(__LINK_STATE_PRESENT, &dev->state); + } + } + + /* + * 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; } } -----snip----- Pekka ________________________________________________________________________ Pekka Riikonen | Email: priikone@poseidon.pspt.fi SSH Communications Security Corp. | http://poseidon.pspt.fi/~priikone Tel. +358 (0)40 580 6673 | Kasarmikatu 11 A4, SF-70110 Kuopio PGP KeyID A924ED4F: http://poseidon.pspt.fi/~priikone/pubkey.asc
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |