From patchwork Mon Aug 17 01:27:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang_y_yi X-Patchwork-Id: 1345547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=163.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=ZImRWPGl; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVGdb32KNz9sTM for ; Mon, 17 Aug 2020 11:28:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B385C87C5F; Mon, 17 Aug 2020 01:28:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t2gH8F7cQNSP; Mon, 17 Aug 2020 01:28:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id AEF2F87C7E; Mon, 17 Aug 2020 01:28:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7B4BCC0891; Mon, 17 Aug 2020 01:28:12 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5DDA2C07FF for ; Mon, 17 Aug 2020 01:28:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5809F86362 for ; Mon, 17 Aug 2020 01:28:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZrVkl4IE1uJO for ; Mon, 17 Aug 2020 01:28:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-m973.mail.163.com (mail-m973.mail.163.com [123.126.97.3]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8D716862B4 for ; Mon, 17 Aug 2020 01:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=YsSID jwin27o869N6Jevgar9ULd5tHnT+cYvYYwkSQc=; b=ZImRWPGlDjdCgrujuSXVI NyT+A0kPmEtcg0FlIJefnq1+QKA9l9elNX8A51tg/TfHCZP3r5JbMGd1FE4P5f1b EqxAQotoP4s6+3EVG17/TBm1dr/zUbkubrci74lQvEhACvCFtG1sFu6AHkpKFPpT M22OiQzvGI0k9OcODf+/Ik= Received: from yangyi0100.home.langchao.com (unknown [111.207.123.58]) by smtp3 (Coremail) with SMTP id G9xpCgB326QR3Tlf2LT2AA--.27S3; Mon, 17 Aug 2020 09:27:47 +0800 (CST) From: yang_y_yi@163.com To: ovs-dev@openvswitch.org Date: Mon, 17 Aug 2020 09:27:42 +0800 Message-Id: <20200817012745.160200-2-yang_y_yi@163.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20200817012745.160200-1-yang_y_yi@163.com> References: <20200817012745.160200-1-yang_y_yi@163.com> MIME-Version: 1.0 X-CM-TRANSID: G9xpCgB326QR3Tlf2LT2AA--.27S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxGF13KF4xXFWDtw47Ww45Wrg_yoW7Gr15pa 1DGFn8Jr18Xr43Wr1DXa4kK3W5WF1kCrW7Ca4jy34Svrn0qryFgFWUK347Ary3u345GFyf Ar1UZa48u34rJ3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UlLvtUUUUU= X-Originating-IP: [111.207.123.58] X-CM-SenderInfo: 51dqwsp1b1xqqrwthudrp/1tbiqBSDi1c7RZPpDwAAso Cc: i.maximets@ovn.org, yang_y_yi@163.com, fbl@sysclose.org Subject: [ovs-dev] [PATCH V1 1/4] Use pmd thread to handle system interfaces 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: Yi Yang Currently all the interfaces are handled by single thread ovs-vswitchd in userspace datapath, this is unscalable, especially in Openstack case, there are many tap and veth interfaces attached to bridge to handle routing and floating ip. But ovs-netdev can't be handled by pmd thread, otherwise, it will result in deadlock. Bridge itself also needn't pmd thread to handle, that is unnecessary. This patch enabled pmd support for tap and other system interfacses, it can make sure performance scalability, more pdm threads, more scalable, better performance. Signed-off-by: Yi Yang --- lib/dpif-netdev.c | 3 +++ lib/netdev-linux.c | 4 ++-- lib/netdev-provider.h | 1 + lib/netdev.c | 8 +++++++- lib/netdev.h | 1 + vswitchd/bridge.c | 9 +++++++-- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 02df8f1..493cc1d 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2110,6 +2110,9 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type, if (error) { return error; } + if (port_no == ODPP_LOCAL) { + netdev_set_internal(port->netdev); + } hmap_insert(&dp->ports, &port->node, hash_port_no(port_no)); seq_change(dp->port_seq); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index fe7fb9b..8d64003 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -3551,7 +3551,7 @@ exit: const struct netdev_class netdev_linux_class = { NETDEV_LINUX_CLASS_COMMON, .type = "system", - .is_pmd = false, + .is_pmd = true, .construct = netdev_linux_construct, .destruct = netdev_linux_destruct, .get_stats = netdev_linux_get_stats, @@ -3567,7 +3567,7 @@ const struct netdev_class netdev_linux_class = { const struct netdev_class netdev_tap_class = { NETDEV_LINUX_CLASS_COMMON, .type = "tap", - .is_pmd = false, + .is_pmd = true, .construct = netdev_linux_construct_tap, .destruct = netdev_linux_destruct, .get_stats = netdev_tap_get_stats, diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index 73dce2f..614566e 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -54,6 +54,7 @@ struct netdev { char *name; /* Name of network device. */ const struct netdev_class *netdev_class; /* Functions to control this device. */ + bool is_internal; /* Is interface type internal? */ /* If this is 'true' the user did not specify a netdev_class when * opening this device, and therefore got assigned to the "system" class */ diff --git a/lib/netdev.c b/lib/netdev.c index 91e9195..9822f82 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -124,7 +124,13 @@ netdev_n_rxq(const struct netdev *netdev) bool netdev_is_pmd(const struct netdev *netdev) { - return netdev->netdev_class->is_pmd; + return netdev->is_internal ? false: netdev->netdev_class->is_pmd; +} + +void +netdev_set_internal(struct netdev *netdev) +{ + netdev->is_internal = true; } bool diff --git a/lib/netdev.h b/lib/netdev.h index fb50730..f7cdfda 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -150,6 +150,7 @@ bool netdev_is_reserved_name(const char *name); int netdev_n_txq(const struct netdev *netdev); int netdev_n_rxq(const struct netdev *netdev); bool netdev_is_pmd(const struct netdev *netdev); +void netdev_set_internal(struct netdev *netdev); bool netdev_has_tunnel_push_pop(const struct netdev *netdev); /* Open and close. */ diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index a3e7fac..35382c7 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2034,6 +2034,7 @@ iface_do_create(const struct bridge *br, struct netdev *netdev = NULL; int error; const char *type; + const char *iface_type; if (netdev_is_reserved_name(iface_cfg->name)) { VLOG_WARN("could not create interface %s, name is reserved", @@ -2042,14 +2043,17 @@ iface_do_create(const struct bridge *br, goto error; } - type = ofproto_port_open_type(br->ofproto, - iface_get_type(iface_cfg, br->cfg)); + iface_type = iface_get_type(iface_cfg, br->cfg); + type = ofproto_port_open_type(br->ofproto, iface_type); error = netdev_open(iface_cfg->name, type, &netdev); if (error) { VLOG_WARN_BUF(errp, "could not open network device %s (%s)", iface_cfg->name, ovs_strerror(error)); goto error; } + if (strcmp(iface_type, "internal") == 0) { + netdev_set_internal(netdev); + } error = iface_set_netdev_config(iface_cfg, netdev, errp); if (error) { @@ -2142,6 +2146,7 @@ iface_create(struct bridge *br, const struct ovsrec_interface *iface_cfg, error = netdev_open(port->name, "internal", &netdev); if (!error) { ofp_port_t fake_ofp_port = OFPP_NONE; + netdev_set_internal(netdev); ofproto_port_add(br->ofproto, netdev, &fake_ofp_port); netdev_close(netdev); } else {