提交 ac7cc624 编写于 作者: J John Ferlan

nodedev: Fix missing network devices

Commit id '8708ca01' added a check to determine whether the NIC had
Switchdev capabilities; however, in doing so inadvertently would cause
network devices without a PCI device to not be added to the node device
database. Thus, network devices having a "computer" as a parent, such
as "net_lo*", "net_virbr*", "net_tun*", "net_vnet*", etc. were not added.

Alter the check to not even check for Switchdev bits if no PCI device found.
上级 7a995c6b
......@@ -3236,6 +3236,14 @@ virNetDevSwitchdevFeature(const char *ifname,
if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
goto cleanup;
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);
/* No PCI device, then no feature bit to check/add */
if (pci_device_ptr == NULL) {
ret = 0;
goto cleanup;
}
if (!(nl_msg = nlmsg_alloc_simple(family_id,
NLM_F_REQUEST | NLM_F_ACK))) {
virReportOOMError();
......@@ -3248,11 +3256,6 @@ virNetDevSwitchdevFeature(const char *ifname,
gmsgh->cmd = DEVLINK_CMD_ESWITCH_GET;
gmsgh->version = DEVLINK_GENL_VERSION;
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);
if (pci_device_ptr == NULL)
goto cleanup;
pci_name = virPCIDeviceGetName(pci_device_ptr);
if (nla_put(nl_msg, DEVLINK_ATTR_BUS_NAME, strlen("pci")+1, "pci") < 0 ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册