From patchwork Sun Oct 3 09:34:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miter X-Patchwork-Id: 1535799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=outlook.com header.i=@outlook.com header.a=rsa-sha256 header.s=selector1 header.b=olnfbaQt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HMdx52pTRz9sX3 for ; Sun, 3 Oct 2021 20:35:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CD389426EE; Sun, 3 Oct 2021 09:35:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L7ctUA89RXAH; Sun, 3 Oct 2021 09:35:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id E54F2426D1; Sun, 3 Oct 2021 09:35:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B36B1C000F; Sun, 3 Oct 2021 09:35:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 35DEFC000D for ; Sun, 3 Oct 2021 09:34:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 014D36078A for ; Sun, 3 Oct 2021 09:34:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=outlook.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eT7HmaTRrIUN for ; Sun, 3 Oct 2021 09:34:57 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2182.outbound.protection.outlook.com [40.92.62.182]) by smtp3.osuosl.org (Postfix) with ESMTPS id A2A0A605EE for ; Sun, 3 Oct 2021 09:34:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gSrfK6qDwOw7lFs2mJk/8eF6paneUVbsckI8HpJhCotx6rMleUzwoNJZcwMjTFbdcpxYQBE0NNt6K10pn5IV1Ebxmcb4Ac1xM7Y9MLTMk27JU23GKpdvRp2pUdAdqW/1WHA12VUZa9veGQxWZ0A4vymS9VR0FtzbnlsEVUIiiwrhgvjGSQxYnpEwTjEBEZ463GfVH3R33+bV3aXGdpWNDgEsTkSC56Qm4zCa28dSVW81GwGn05bsA/uQW5n0vU5eBuX+EZanCN/fnoy2ZDhSYNlgrVxpDLuygY8Y4hO+z2NJnrdydvdoHVEzv3HFF52JUhwmgEq1Gm4d5J0Ln/cNRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1MUDyHlfDE4DBr9rWI/jUNEEPJFHluYyMTjUyluKaRU=; b=i7bDxzVbd2m2XNnA58t/77nr+dVdupiEVeOLUnmBR1y9O0gvO725Q/zrL3lYaXp4ltyY0A9rqyy5SPFqXBEvx4sQ5ZPDGh904LIgBKyrGHVFZWka9rJUgnILHpiH9JTJ/Yo0SMU9XeiQi488HXM8LGcKQHaM7XV7ZlOSJLNNYVEHk4POvSpEtV6v8WpHy2IftF07UOIbyG9eybJPllnaDwb/lCGlglI27vICdsCTv5Q5rwcI6ZU84lRBekV1rWpkMVHwyKIeNn2S96Oqy1RspoDRaoE6iN9IonJp1+Ql/2Hq84S8QY/Xr9G/u3vmLUGU+ThMXxHtmdZNBLhYDrbHHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MUDyHlfDE4DBr9rWI/jUNEEPJFHluYyMTjUyluKaRU=; b=olnfbaQtLpctJBakuHTBVd4gW6Fhdwoiz4qAWLMxHOPLLp2yy3AQiJYx16cT2xzDiZ77jVmYPGK+1wK/+6mpYwn9P8x0cmZzn+sVOZK8+auIlSB1HGnUNvMlz3kAlcLFDAtMtfP/CcQtS7cCy5H1z6bH1PFm8AeDU17eifN5FuP3i6YzqYWlu9Lxz0tDYBatmQW5qWdV1KmDKKAvu6GHtzodz0JHI6Yrj26FQibTcIChnNyB5cy/gXqaArwQzLhiB4uW6PuZq1FSFsx9xk4rmzGvebCoI4cOmSifHV5e7EMaCpIA2d7DtX7fuM++ahRBXnpYWun1KGfDmjXMgqz7Fg== Received: from MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:15b::24) by ME3P282MB2859.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:138::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17; Sun, 3 Oct 2021 09:34:51 +0000 Received: from MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM ([fe80::31f7:780a:9782:eddb]) by MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM ([fe80::31f7:780a:9782:eddb%7]) with mapi id 15.20.4566.022; Sun, 3 Oct 2021 09:34:51 +0000 From: lin huang To: "dev@openvswitch.org" Thread-Topic: [PATCH v1] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs. Thread-Index: AQHXuDnqyuQlRlkz9k6k3Awem3axTQ== Date: Sun, 3 Oct 2021 09:34:51 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: b6eb83e8-488f-82fd-c0f6-ee0392e259c9 x-tmn: [qeaHx5UJaTYwLb66er528s9g0198fN9r] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd5b19c5-1dea-4f5b-0141-08d986510ca4 x-ms-traffictypediagnostic: ME3P282MB2859: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f0zqoS/6j1PN3zBEvmUvUu4QKlDWVcCg/94kML6CZSEHVM8YI/VFE1qrpmIKq0IlUkx0SGNCy0FSpxFsb6/psapi778G/aq/ZQSHYCQsx2YaIHIDohqNx6cNfNIP0iK7dVd7QdtYhYCVmhSWTqHUpltM3HnqTvQg7Gwx9J7j6uvvcXin6Zx4iFPFzwrvw64ngWf/pCDjLne6eQ+PivJzKLKeKl4UrWxqSz0NJYOu6Eomiv8kW/AXSA9NGITtSWD1vl7tksBYT1PTrFttpQWwfzR6hDKdb4d/FFoHmMnmjdhJof7waSCCBZD+MCFMPFNdH1yegb5X+vD/ugx4ynESPhv7e61xC1Rm/YnB+NjxG29nZBv/i+1CQK7rsNU+8Ncb39TMlSjwH6qvyAUpreM+NtxtrrPnKXzRdtX1Gvy50Tx1fRpL1SpNMooSZ4d4Eqh4 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: LulfS+2n2655Y2iOENRm1T02j9P/63kRGalkMvE/B+zIG5fx2czeqIU3iZtWl9whmYigLidHUHRCjQ+Dw0qz1fyDoZIx9o7W7f/UzOGLJeXEgMnt9OT73f/GWmB9Y6Fx5qQt3K7ffqifc1MPr9NXmg== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: bd5b19c5-1dea-4f5b-0141-08d986510ca4 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2021 09:34:51.1416 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: ME3P282MB2859 Cc: "david.marchand@redhat.com" , "i.maximets@ovn.org" Subject: [ovs-dev] [PATCH v1] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: linhuang 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 "2021-08-29T09:17:39.830Z|00059|netdev_linux|INFO|ioctl(SIOCGIFINDEX) 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 --- lib/netdev-offload.c | 6 ++++-- lib/netdev-vport.c | 3 ++- vswitchd/bridge.c | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c index 8075cfbd8..00b7515cf 100644 --- a/lib/netdev-offload.c +++ b/lib/netdev-offload.c @@ -577,7 +577,9 @@ netdev_ports_insert(struct netdev *netdev, const char *dpif_type, struct dpif_port *dpif_port) { struct port_to_netdev_data *data; - int ifindex = netdev_get_ifindex(netdev); + int ifindex; + + netdev_set_dpif_type(netdev, dpif_type); ovs_rwlock_wrlock(&netdev_hmap_rwlock); if (netdev_ports_lookup(dpif_port->port_no, dpif_type)) { @@ -589,6 +591,7 @@ netdev_ports_insert(struct netdev *netdev, const char *dpif_type, data->netdev = netdev_ref(netdev); dpif_port_clone(&data->dpif_port, dpif_port); + ifindex = netdev_get_ifindex(netdev); if (ifindex >= 0) { data->ifindex = ifindex; hmap_insert(&ifindex_to_port, &data->ifindex_node, ifindex); @@ -596,7 +599,6 @@ netdev_ports_insert(struct netdev *netdev, const char *dpif_type, data->ifindex = -1; } - netdev_set_dpif_type(netdev, dpif_type); hmap_insert(&port_to_netdev, &data->portno_node, netdev_ports_hash(dpif_port->port_no, dpif_type)); diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 499c0291c..411ac343a 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -1151,8 +1151,9 @@ netdev_vport_get_ifindex(const struct netdev *netdev_) { char buf[NETDEV_VPORT_NAME_BUFSIZE]; 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 (strcmp(type, "netdev")) ? linux_get_ifindex(name) : -ENODEV; } #define NETDEV_VPORT_GET_IFINDEX netdev_vport_get_ifindex diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index c790a56ad..473d79acd 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;