Hi Friends,
A brief description before i put in my queries.... :)
Background :- ----------------- Assume that a motherboard has 'N' physical ethernet devices (eth devices). For each of these devices the linux kernel assign a particular ID. e.g. eth0, eth1, eth2, etc ....... These device ID's are assigned when the linux kernel has come up and done some basic initialization. Also these device ID's do not change while the linux kernel is up and running. With the same kernel version and driver version the eth device number assigned to a particular physical port does not change over multiple system reboots.
Query :- --------- I would like to know a few things, with the second query being most important.
1) When i make changes to the kernel code (not related to eth devices) i need to recompile the kernel and give it a new number. For this the eth driver also needs to be recompiled with the newer number. Sometimes after compilation the kernel mapping of ethernet ID (eth0, eth1, etc ....) to the physical port changes. And this behaviour is a "sometimes behaviour". ie. If i build kernel and driver and if the mapping changes, the mapping remains same for the kernel version number. But if rebuild the kernel then mapping again changes with this newer mapping remaining constant for this newer version.
2) How does the linux kernel map the ethernet device ID to the physical port. For e.g. :- How does it detect that port 'X' will have eth4 as device ID.
Ashutosh.
Kernel assigns the number to ethernet devices in the order it finds it. Consider 2 cases.
1. You have 2 ethernet cards of different type (requiring different network device driver). Depending on which gets loaded first kernel will assign the eth0 to that device.
2. You have 2 ethernet cards of same type (requiring same network device driver). Each network device driver has a auto-probe configuration where it probes the bus (PCI, ISA, etc.) for devices. This probe depends on the IO addresses/IRQs etc. So whichever device is searched first will get loaded first.
The order of the devices getting registered in the kernel also depends on whether the driver has been compiled in or is loaded as a module. If all network drivers are compiled in, then the order will depend on the way kernel initializes various drivers. (drivers/net/Space.c)
If all the drivers are loaded as modules, you can control the naming of devices by specifying the device order in /etc/moprobe.conf. For ethernet devices using same driver, you have to specify additional options which will distinguish them and you can number them correctly.
Amitay.
On Wed, 2004-07-07 at 16:32, Nasikkar,Ashutosh wrote:
Hi Friends,
A brief description before i put in my queries.... :)
Background :-
Assume that a motherboard has 'N' physical ethernet devices (eth devices). For each of these devices the linux kernel assign a particular ID. e.g. eth0, eth1, eth2, etc ....... These device ID's are assigned when the linux kernel has come up and done some basic initialization. Also these device ID's do not change while the linux kernel is up and running. With the same kernel version and driver version the eth device number assigned to a particular physical port does not change over multiple system reboots.
Query :-
I would like to know a few things, with the second query being most important.
When i make changes to the kernel code (not related to eth devices) i need to recompile the kernel and give it a new number. For this the eth driver also needs to be recompiled with the newer number. Sometimes after compilation the kernel mapping of ethernet ID (eth0, eth1, etc ....) to the physical port changes. And this behaviour is a "sometimes behaviour". ie. If i build kernel and driver and if the mapping changes, the mapping remains same for the kernel version number. But if rebuild the kernel then mapping again changes with this newer mapping remaining constant for this newer version.
How does the linux kernel map the ethernet device ID to the physical port. For e.g. :- How does it detect that port 'X' will have eth4 as device ID.
Ashutosh.
Amitay.