1 Star 0 Fork 71

tzr/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libvirt-virNetDevSwitchdevFeature-Make-failure-to-get-family.patch 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
From 7581a0bbd552d63d654a88f0ad2a68e99fa8b54a Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Sun, 19 Apr 2020 07:25:34 +0200
Subject: [PATCH 7/8] virNetDevSwitchdevFeature: Make failure to get
'family_id' non-fatal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry-picked from commit 423664a6)
Signed-off-by: AlexChen <alex.chen@huawei.com>
---
src/util/virnetdev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 3431aaf6a9..ff86aa1fc9 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3146,9 +3146,7 @@ virNetDevSwitchdevFeature(const char *ifname,
int is_vf = -1;
int ret = -1;
uint32_t family_id;
-
- if (virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id) <= 0)
- return ret;
+ int rv;
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret;
@@ -3168,6 +3166,9 @@ virNetDevSwitchdevFeature(const char *ifname,
goto cleanup;
}
+ if ((rv = virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id)) <= 0)
+ return rv;
+
if (!(nl_msg = nlmsg_alloc_simple(family_id,
NLM_F_REQUEST | NLM_F_ACK))) {
virReportOOMError();
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tom0392/libvirt.git
git@gitee.com:tom0392/libvirt.git
tom0392
libvirt
libvirt
master

搜索帮助