From patchwork Sun Nov 3 06:59:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1190395 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="BwRluK8a"; 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 477Rcd4V1hz9sPK for ; Thu, 7 Nov 2019 00:06:24 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 318F1CC1; Wed, 6 Nov 2019 13:02:58 +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 98F4ECAD for ; Wed, 6 Nov 2019 13:02:56 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 510A2189 for ; Wed, 6 Nov 2019 13:02:56 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id p24so12321462pfn.4 for ; Wed, 06 Nov 2019 05:02:56 -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=+6IhpubehfBA0fyJjLMHiNK4Ws0tjewQBWjUKRYVdLw=; b=BwRluK8aUtLLdcxG2z8/nph89NqKM7PzqM2Y3bEnjidQLVVaFI7ajGDX/sdwwmKU/6 zi0jeKGdvDiBoyBKLBrz3SduZjt2kBcwvwAQ++8bbLKR5srdaGO5NekFt6y7br6jOTuy 8/8hho6+P398artNk2iCDr2uBbfq0RT5YPaVioud0SI6s2EK3/8AEznU3exyxjpt0A8B xW08equWTJCztCuCqsBbVFD3m8665fB3iGmlA/3KyIUH3E14OA1g5TMObTdxtOlzgIX+ Lsil1oBMAnR3abMl1iupai6WEWkTSCF106RumpXbhBWXA7l/g7G23UQLefdsLXipk4Zz GoUw== 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=+6IhpubehfBA0fyJjLMHiNK4Ws0tjewQBWjUKRYVdLw=; b=KuWk5+ZBv5nAypwtv50SlziV1pTk9NnQt927UcXXlzUsdpjMScgBLjwibbSKM2lD0K gZ6zXGVV6XOoFFZsxCovIGTfpdzGObdKgoCLMH3RAZd+iC4RWoLswukx0aOjkRTjdvbg eohzmwAxIV4RRldm7YjaMoNZmVl8qt0ZaTdm9Vg3GCVMfaeHyl6eCdu0+FSiKdha3kaY EjiCZMvt0kaTw+DNJxVj3qPHODws2iPOEKfQd+Fkxh9sFF7ohjTbfhbFk7hmsO8ri2eH dWrIoBLPL+dNaH9EgBWdn3PIDjEDsmbo0BbfEeTkN0iEduxNqSp/grwJnlKOLgXr08o3 zeLw== X-Gm-Message-State: APjAAAXvb7sDSRcGqcyUDbtwxGTXelv4z8/fbLU9zz/h1FMj/DCQh515 UlOJwM4+cgrnn2yfpn//830= X-Google-Smtp-Source: APXvYqy7x0s4utY6gJRlVq6qhvBzfoGtbX3vso05sKYlYcqFahKR1GZLIJsSgx6V1h/sWUllWbfACg== X-Received: by 2002:a63:1e59:: with SMTP id p25mr2687705pgm.361.1573045375871; Wed, 06 Nov 2019 05:02:55 -0800 (PST) Received: from local.opencloud.tech.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id i13sm21560pfo.39.2019.11.06.05.02.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Nov 2019 05:02:55 -0800 (PST) From: xiangxia.m.yue@gmail.com To: ee07b291@gmail.com, pshelar@ovn.org Date: Sun, 3 Nov 2019 14:59:44 +0800 Message-Id: <1572764384-130234-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] net: openvswitch: select vport upcall portid drectly 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 --- 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);