From patchwork Wed Nov 6 16:34:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1190547 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.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mvPBIFDD"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 477XF62hQ5z9sP6 for ; Thu, 7 Nov 2019 03:34:49 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 79831CD1; Wed, 6 Nov 2019 16:34:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 447E6B4B for ; Wed, 6 Nov 2019 16:34:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A919D189 for ; Wed, 6 Nov 2019 16:34:42 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id e3so9561058plt.7 for ; Wed, 06 Nov 2019 08:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qK2dQSoweQbBBKHZOM7uNxvQiTxKcXN16AkZs90CTPw=; b=mvPBIFDDvlPAyFSjNne+7EcmXRpvCoQf5Es9SvuLssHr4t9fBXAiCw9BPnbNx12cJ1 0aWh+klGwEHfzR/wLR3pEq90xwlm4LzrTLc8qiKu+ZOVjUo277f9PVJSyCSLrniUjCj4 UBjFNEJex/Wp+FmQYL1Q1gHH9jBN6BScTikJM238CLPoQp4cAYszOqnyUhdhZWaJIK7z p5F6/6f4HbEgKlQDNpm2lXrH/CLo2yJahoMc5l154dWnP3hNnB8v//sr0mjuEbE/CIrt Y0X74yphim3vp/XO1UyUQcR/BESVW/uP+bEBhIi1SVkSX29GGG14YYArT41SiZlq+EJ9 uldQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qK2dQSoweQbBBKHZOM7uNxvQiTxKcXN16AkZs90CTPw=; b=I38eK/0XBt9/eagYNp0FQqstdjKNv18tzNlmJyz8sSSyGgHlhN/DZpakw0K48OpxM6 65WjR+8oIo+RQCErxaNlwdn7FYELpIPdQVgAW87Y/qkm+J37reuqE/LMnYKGn+nLu/aB ISTvc623JW7v070GSSZwG0WkSzoQKsh+DoYlRSdUCWdJPLdWZ/R0cfpEBXI23a5/uyRw QpZNWctz/4TUBQl45Y8QZV9VB7OAfF1ueCAwFABQ5pVuuFTw9YWWtdE18i81uoQ2YIAd n8wPK4dkSF/O5hN0d+gywVkKXNF2GWu9+Q2b0PMFsrVa2ZRVB/vItT5cAyMm4fRWaPhK R8Gw== X-Gm-Message-State: APjAAAXPaQriS8CI1Qcx/zcQtUDWpO1BYnyX+m0dNu86HFwHHwlZHlVM OS21fPHgtYkMGExwVB07xblXuVkXCUI= X-Google-Smtp-Source: APXvYqz+kua88HsIlshoFzYFIrRMGNCGedCM93HhJqGZZwDdMkeYKsJhwXOlFi7U0dhvf2gjK+HF7A== X-Received: by 2002:a17:902:a987:: with SMTP id bh7mr3425837plb.181.1573058082214; Wed, 06 Nov 2019 08:34:42 -0800 (PST) Received: from local.opencloud.tech.localdomain ([1.203.173.208]) by smtp.gmail.com with ESMTPSA id m67sm3261390pje.32.2019.11.06.08.34.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Nov 2019 08:34:41 -0800 (PST) From: xiangxia.m.yue@gmail.com To: ee07b291@gmail.com, pshelar@ovn.org Date: Thu, 7 Nov 2019 00:34:28 +0800 Message-Id: <1573058068-7073-1-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: dev@openvswitch.org, netdev@vger.kernel.org Subject: [ovs-dev] [PATCH net-next v2] net: openvswitch: select vport upcall portid directly X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Tonghao Zhang The commit 69c51582ff786 ("dpif-netlink: don't allocate per thread netlink sockets"), in Open vSwitch ovs-vswitchd, has changed the number of allocated sockets to just one per port by moving the socket array from a per handler structure to a per datapath one. In the kernel datapath, a vport will have only one socket in most case, if so select it directly in fast-path. Signed-off-by: Tonghao Zhang Acked-by: Pravin B Shelar --- v2: drectly -> directly in the commit title --- net/openvswitch/vport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 3fc38d16c456..5da9392b03d6 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -403,8 +403,9 @@ u32 ovs_vport_find_upcall_portid(const struct vport *vport, struct sk_buff *skb) ids = rcu_dereference(vport->upcall_portids); - if (ids->n_ids == 1 && ids->ids[0] == 0) - return 0; + /* If there is only one portid, select it in the fast-path. */ + if (ids->n_ids == 1) + return ids->ids[0]; hash = skb_get_hash(skb); ids_index = hash - ids->n_ids * reciprocal_divide(hash, ids->rn_ids);