[VLAN] Using a switch fabric to emulate multiple NICs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alex Zeffertt wrote:
> Hi list,
> 
> I need the vlan code to do something rather unusual, and I think I know how to do it but I thought
> I'd check it with you first to see if it is sane....
> 
> We've designed a PowerPC based embedded board whose integrated MII bus is attached to a switch
> fabric containing 10 other ports.  What we want is for this to be made to look like 10 seperate
> NICs, namely eth0, eth1, ..., eth9.
> 
> My idea is to configure the switch fabric to tag each frame entering the PHY from the outside world
> with a VID which identifies the port on which it entered.  In the other direction frames from
> the CPU would have their tags removed by the switch fabric and used to determine to which
> port they should be sent. This way all I need to do is to use the vlan module to create 10
> net_devices over the top of the original net_device.
> 
> This leaves two remaining problems:
> 
> 	i) How do I make the vlan devices look like eth0 ... eth9
> 
> 	ii) How do I enable mii-tool ethN to configure portN of the switch fabric.
> 
> Here are my ideas... please let me know what you think of them:
> 
> i)  I need to add a new VLAN_NAME_TYPE, say VLAN_NAME_TYPE_NEXT_ETH_N.  This will require changing
> vlan.c, vlanproc.c, and vconfig.c.  If this is selected then vlan_name_type will be rewritten to
> "eth%d".  I also need to ensure my original device is called something other than eth0, say raw0.

How about just using user-space tools to rename the interface?  Since it will actually
be passed (and receive) 802.1Q VLAN frames, you might want to leave it named vlan.foo.

> ii) I need to add an ioctl handler to vlan.c and set newdev->do_ioctl.  This handler needs
> to pass all ioctls on to realdev->do_ioctl() EXCEPT for SIOCGMIIPHY and SIOCDEVPRIVATE.  These
> latter ioctls ask the driver what the PHYs MDIO address is.  The original driver cannot know this
> since the device to which it is connected contains several PHYs and responds to several MDIO phy
> addresses.
> 
> Therefore I think this needs to be specified when the vlan device is created with an optional extra
> parameter, e.g.
> 
> 	vconfig add <interface-name> <vlan_id> [<phy_addr>]

I would rather keep this out of the official VLAN code, though you are welcome to hack
your private coppies, of course.  My suggestion here is to use your switch0 device to handle
the custom IOCTLs.

> When mii-tool is run it will first ask the vlan module what the phy address is.  The vlan module
> will then respond with the phy address specified on the vconfig command line.  Then mii-tool will
> ask the vlan module to read or write some data using the phy_address it just obtained.  The vlan
> module will then just relay this command to realdev->do_ioctl() which controls the MDIO hardware.

Since this would require user-space to know the address anyway (when it creates the VLAN),
just get the mii to get the physical address from where-ever the creator of the VLAN would
have gotten it from.  Instead of having vlan relay the ioctl, just send it directly to your
raw device.

Btw, sounds like an interesting device...is this available for public consumption?

Ben

-- 
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux