提交 423664a6 编写于 作者: M Michal Privoznik

virNetDevSwitchdevFeature: Make failure to get 'family_id' non-fatal

I've just got a new machine and I'm still converging on the
kernel config. Anyway, since I don't have enabled any of SRIO-V
drivers, my kernel doesn't have NET_DEVLINK enabled (i.e.
virNetDevGetFamilyId() returns 0). But this makes nodedev driver
ignore all interfaces, because when enumerating all devices via
udev, the control reaches virNetDevSwitchdevFeature() eventually
and subsequently virNetDevGetFamilyId() which 'fails'. Well, it's
not really a failure - the virNetDevSwitchdevFeature() stub
simply returns 0.

Also, move the call a few lines below, just around the place
where it's needed.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 ca616274
...@@ -3146,9 +3146,7 @@ virNetDevSwitchdevFeature(const char *ifname, ...@@ -3146,9 +3146,7 @@ virNetDevSwitchdevFeature(const char *ifname,
int is_vf = -1; int is_vf = -1;
int ret = -1; int ret = -1;
uint32_t family_id; uint32_t family_id;
int rv;
if (virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id) <= 0)
return ret;
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0) if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret; return ret;
...@@ -3168,6 +3166,9 @@ virNetDevSwitchdevFeature(const char *ifname, ...@@ -3168,6 +3166,9 @@ virNetDevSwitchdevFeature(const char *ifname,
goto cleanup; goto cleanup;
} }
if ((rv = virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id)) <= 0)
return rv;
if (!(nl_msg = nlmsg_alloc_simple(family_id, if (!(nl_msg = nlmsg_alloc_simple(family_id,
NLM_F_REQUEST | NLM_F_ACK))) { NLM_F_REQUEST | NLM_F_ACK))) {
virReportOOMError(); virReportOOMError();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册