Thread (3 messages) flat view 3 messages, 2 authors, 2012-02-16

RE: SR-IOV setup race between PCI and rtnetlink

From: Ben Hutchings <hidden>
Date: 2012-02-16 21:25:28

On Thu, 2012-02-16 at 19:55 +0000, Rose, Gregory V wrote:
[...]
quoted
However we really need the VFs to be configurable immediately, so that
the VF driver can communicate with the PF driver (sfc).  I could add an
separate flag to keep the RTNL interface disabled while the inter-driver
interface is enabled, but that doesn't seem like the right thing to do.

Perhaps there should be a net device op to return the number of VFs,
which the net driver must then only change while holding the RTNL lock?
RTNL would then use that instead of dev_num_vf().
Intel drivers aren't subject to this problem at this time because the
number of VFs are configured on driver load and don't change until you
unload the driver and then reload it with a new max_vfs parameter. 
sfc also fixes the number of VFs at driver load, but this race can occur
*during* driver load if the driver calls pci_enable_sriov() after
register_netdevice().

It looks like most other drivers with SR-IOV capability avoid this
problem by calling pci_enable_sriov() before registering the net device.
(cxgb4 is an exception and should also suffer from this.)

The reason for the current ordering in sfc is that we also use VFs for
user-level networking and in that case the VF driver's probe function
needs to identify the corresponding net device.  If the net device isn't
registered until later then we'll have to defer that to a netdevice
notifier.
However, if/when I get some patches done that allow the user to set
the number of VFs via ethtool instead of just the module parameter
that will change and this change would be very helpful in that
circumstance also.
Wouldn't it make more sense to do that through rtnetlink, along with the
configuration of the individual VFs?

Ben.
Sounds like a good idea to me.

- Greg
-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help