提交 6452e2f5 编写于 作者: R Radoslaw Biernacki 提交者: Michal Privoznik

util: fixing wrong assumption that PF has to have netdev assigned

libvirt wrongly assumes that VF netdev has to have the
netdev assigned to PF. There is no such requirement in SRIOV standard.
This patch change the virNetDevSwitchdevFeature() function to deal
with SRIOV devices which does not have netdev on PF. Also corrects
one comment about PF netdev assumption.

One example of such devices is ThunderX VNIC.
By applying this change, VF device is used for virNetlinkCommand() as
it is the only netdev assigned to VNIC.
Signed-off-by: NRadoslaw Biernacki <radoslaw.biernacki@linaro.org>
Signed-off-by: Ndann frazier <dann.frazier@canonical.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 fb01e1a4
......@@ -1355,9 +1355,8 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
}
if (!*pfname) {
/* this shouldn't be possible. A VF can't exist unless its
* PF device is bound to a network driver
*/
/* The SRIOV standard does not require VF netdevs to have
* the netdev assigned to a PF. */
virReportError(VIR_ERR_INTERNAL_ERROR,
_("The PF device for VF %s has no network device name"),
ifname);
......@@ -3178,8 +3177,12 @@ virNetDevSwitchdevFeature(const char *ifname,
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret;
if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
goto cleanup;
if (is_vf == 1) {
/* Ignore error if PF does not have netdev assigned.
* In that case pfname == NULL. */
if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
virResetLastError();
}
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册