diff mbox series

[ovs-dev] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs.

Message ID MEYP282MB33027147D2A980E355E2602FCDA99@MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM
State Superseded
Headers show
Series [ovs-dev] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs. | expand


Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

miter Sept. 29, 2021, 2:33 p.m. UTC
From: linhuang <linhuang@ruijie.com.cn>

Userspace tunnel doesn't have a valid device in the kernel. So
get_ifindex() function (ioctl) always get error during
adding a port, deleting a port or updating a port status.

The info log is
on vxlan_sys_4789 device failed: No such device"

If there are a lot of userspace tunnel ports on a bridge, the
iface_refresh_netdev_status() function will spend a lot of time.

So ignore userspace tunnel port ioctl(SIOCGIFINDEX) operation, just
return ifindex=0.

Signed-off-by: linhuang <linhuang@ruijie.com.cn>
 lib/netdev-vport.c | 3 ++-
 vswitchd/bridge.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff mbox series


diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 499c0291c..90e21f213 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -1151,8 +1151,9 @@  netdev_vport_get_ifindex(const struct netdev *netdev_)
     const char *name = netdev_vport_get_dpif_port(netdev_, buf, sizeof(buf));
+    const char *type = netdev_get_dpif_type(netdev_);

-    return linux_get_ifindex(name);
+    return (strncmp(type, "netdev", 6)) ? linux_get_ifindex(name) : 0;

 #define NETDEV_VPORT_GET_IFINDEX netdev_vport_get_ifindex
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index cb7c5cb76..1325f80c0 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2052,6 +2052,8 @@  iface_do_create(const struct bridge *br,
         goto error;

+    netdev_set_dpif_type(netdev, br->type);
     error = iface_set_netdev_config(iface_cfg, netdev, errp);
     if (error) {
         goto error;