Table of Contents
Piotr Jaroszyński: Usermode debugging under Linux
Week 12 [ Aug 9 - Aug 15 2010 ]
drivers in userspace
Josh did a thorough review of the drivers branch, thanks Josh! Apart from smaller things the two bigger issues were:
- Implementing bus_to_phys() as some drivers do need it (mostly indirectly via bus_to_virt())
That required an addition on the UIO-DMA side. Will try to push it upstream as it might be useful for others UIO-DMA users as well.
- More consistent settings support
Till recently only the tap driver accepted additional netdevice-scoped settings like:
$ ./gpxe.linux --net tap,if=tap3,mac=00:0c:29:c5:39:a1
Now it's also possible for the lpci driver:
$ ./gpxe.linux --net lpci,dev=09:00.0,ssid=foo,key=blah
Supporting options for lpci devices isn't straight-forward as lpci devices don't directly map to net devices like the tap devices and pci devices do. They are used under the hood by various APIs so that the probing of PCI devices can find the real hardware. To make that work, we have to save the extra settings to be applied in the lpci device and then later after the PCI probing is done, go over the lpci devices, find the corresponding net device for each one and apply the settings to it. This is implemented as a late startup function.
/** Apply lpci settings to corresponding net devices */ void lpci_apply_settings(void) { struct lpci_device *lpci; struct net_device *ndev; /* Look for the net_device corresponding to each lpci device */ for_each_lpci(lpci) { for_each_netdev(ndev) { if (ndev->dev->desc.bus_type == BUS_TYPE_PCI && ndev->dev->desc.location == (unsigned int)PCI_BUSDEVFN(lpci->bus, lpci->devfn)) { /* Apply the lpci settings to the net device */ linux_apply_settings(lpci->settings, &ndev->settings.settings); } } } } struct startup_fn lpci_apply_settings_startup_fn __startup_fn(STARTUP_LATE) = { .startup = lpci_apply_settings, };
A small refactoring of the settings handling in general allowed to very easily support global settings as well:
$ ./gpxe.linux --net tap,if=tap3,mac=00:0c:29:c5:39:a1 --settings use-cached=1
With all the issues addressed I'm waiting for a final ACK from Josh before I post all the userspace changes to -devel for review.
bnx2
update soon