How igb ports are numbered

How this job is done by driver? What should I do in order to change the beginning number of ports numbering?
 
The ports are numbered in the order in which they are detected. I'm not sure what you're trying to do by changing the starting number.
 
SirDice said:
I'm not sure what you're trying to do by changing the starting number.

In fact, we have two ports named em (em0, em1) which are handled by em driver. And there are four ports named igb (ig0, igb1, igb2, igb3) which are handled by the igb driver. I want these ports to be named like foo0, foo1, foo2, foo3, foo4, foo5. The first two interfaces are the old em ports and the others are old igb ports, I want the igb driver to number igb ports from the last em port number.
 
You cannot change the numbers on the interfaces but you can define a name on an interface.

Code:
root@armitage:~# ifconfig vtnet0
vtnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c06bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO6,LRO,VLAN_HWTSO,LINKSTATE>
        ether 52:54:00:53:67:3c
        inet x.x.x.x netmask 0xffffff00 broadcast 185.10.51.255
        inet6 fe80::5054:ff:fe53:673c%vtnet0 prefixlen 64 scopeid 0x2
        inet6 y:y:y:y::1 prefixlen 48
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 1000baseT <full-duplex>
        status: active
root@armitage:~# ifconfig vtnet0 name eth0
root@armitage:~# ifconfig eth0
eth0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c06bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO6,LRO,VLAN_HWTSO,LINKSTATE>
        ether 52:54:00:53:67:3c
        inet x.x.x.x netmask 0xffffff00 broadcast 185.10.51.255
        inet6 fe80::5054:ff:fe53:673c%eth0 prefixlen 64 scopeid 0x2
        inet6 y:y:y:y::1 prefixlen 48
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 1000baseT <full-duplex>
        status: active
 
SirDice said:
You cannot change the numbers on the interfaces but you can define a name on an interface.

Thanks, but I'm trying to change the igb driver to do so. All I need is to know how the igb driver numbers ports so I can change the first number e.g. start numbering from 2 so we will have igb2, igb3, ...
 
Why do you want to do that? Why risk breaking everything by modifying the source?
 
SirDice said:
Why do you want to do that? Why risk breaking everything by modifying the source?

Defining name for interfaces e.g. changing em0 to eth0 just changes its visual name and it is still em0 for system calls as in the output of sysctl -a command. I don't want this to happen, I want to change their names basically. And I think that it's not a much risky job cause I suppose that it's just a simple change in the source, please let me know if there is something more than that.

Thanks.
 
j4ck said:
And I think that it's not a much risky job cause I suppose that it's just a simple change in the source,
I really don't think it's as simple as you think it is.
 
Finally I found the related function which initiates port names. In /usr/src/sys/dev/e1000/if_igb.c there's a function named igb_setup_interface(device_t dev, struct adapter *adapter), the first job of this function is to initiate port names, this is done by if_initname. The second argument for this function is the port number, which is accessible by using pci_get_device_unit(device_t). In order to change the initiating number to e.g. 2, just adding an offset to the second argument is needed:
Code:
if_initname(ifp, device_get_unit(dev) + offset);
 
Back
Top