Hello,
I have a driver for 5-port switch, representing the switch as one eth0 device from the OS perspective. I would like to make it have eth0..eth4 ports respectively, so that I could treat each port individually.
As far as I understand, the kernel network machinery for Ethernet works like this:
struct net_device *dev; alloc_netdev(sizeof(private_structure), "eth%d", ether_setup); ... register_netdev(dev); ...
Am I right that I have to implement this sequence for each interface I register in the system's data structures? So for the 5-port switch it'd be something like:
int switch_init(int unit) { struct net_device *dev; alloc_netdev(sizeof(private_structure), "eth", ether_setup); sprintf(dev->name, "eth", unit); ... register_netdev(dev); }
.. or the whole thing is a way more complicated than I think?
Thanks.