temp.vm-help.com
http://www.vm-help.com/forum/

Create multiple net_device's for a SINGLE function device
http://www.vm-help.com/forum/viewtopic.php?f=34&t=4440
Page 1 of 1

Author:  robertgraham1906 [ Wed Oct 09, 2013 3:05 pm ]
Post subject:  Create multiple net_device's for a SINGLE function device

Greetings,

I have a SINGLE function device that contains a BAR that has 4 MACs. In my driver, I create 4 net device object, and register them using register_netdev(dev). This works fine in Linux as each device is named "eth%d", and the kernel replaces the %d with a new number. However, in ESXi 5+, it only recognizes and starts one of the net devices (which somehow happens to always be port 4). How do I get it to recognize all 4 devices that I've registered?

Thanks in advance.

Author:  robertgraham1906 [ Tue Nov 12, 2013 1:03 pm ]
Post subject:  Re: Create multiple net_device's for a SINGLE function devic

I fixed the issue...in order to support multiple ports on a single-function device, this is what I did in my PCI probe function for every net_device that I created. Hope this helps

/* We give the device a name with the "%d" so the kernel
* can replace it with a respectable name, such as eth0.
*/
strcpy(netdev->name, "test_nic%d");

/* Set the PCI device as the parent of the net device. */
SET_NETDEV_DEV(netdev, &pdev->dev);

/* Make this netdevice a Pseudo-NIC.
* We do this in VMware since multi-port devices are
* expected to be multi-function devices under VMware. By
* setting the device as a Pseudo-NIC, VMware creates
* the net_device as a "virtual" device when register_netdev
* is called, and ## of devices show up
* under ESXi and are all opened. If we don't do this, ESXi
* only opens the last device created, thus limiting us to
* having only one port. I have not yet seen any adverse
* effects to having the devices be "virtual" devices. These
* steps are recommended by VMware in the DDK documentation.
*/
netdev->pdev->netdev = NULL;
netdev->pdev_pseudo = netdev->pdev;
netdev->pdev = NULL;
netdev->features |= NETIF_F_PSEUDO_REG;

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/