Re: [PATCH] Maximal eth devices and [NOPATCH :-)] current kernel versions

Krzysztof Halasa (khc@intrepid.pm.waw.pl)
02 Aug 1999 13:48:18 +0200


"Nico Schmoigl" <cts@writemail.com> writes:

> somebody in here, told that he uses more than 16 devices and that
> the kernel causes problems. I just made a quick patch, making the
> number of eth devices configurable. Please test it out.

We should rather make it dynamic - some drivers already do that.
Of course, that means disposing the table from Space.c.

OTOH most drivers use separate (kmalloced) stats memory - I think the best
we can do to prevent wasting &fragmenting RAM is to allocate it in one chunk:

struct netdevice {
struct device netdev; /* Must be first item */
struct net_device_stats stats;
char name[IFNAMSIZ];
};

register_network_device_with_stats_and_possibly_other_things (char *name):
{
struct netdevice *dev = kmalloc(sizeof(struct netdevice), GFP_KERNEL);

if (dev==NULL)
return NULL;

memset(dev, 0, sizeof(struct netdevice));
dev->netdev.name=dev->name;
if (dev_alloc_name(&hdlc->netdev, name))
{
kfree(dev);
return NULL;
}

if (register_netdevice(&dev->netdev)!=0)
{
kfree(dev);
return NULL;
}

return dev;
}

Or should we just merge all fields (device, stats, name) into one struct?

-- 
Krzysztof Halasa
Network Administrator

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/