From patchwork Wed Sep 9 19:20:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1360972 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.137; helo=fraxinus.osuosl.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.a=rsa-sha256 header.s=20161025 header.b=UDh08UvY; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmsLY3YfQz9sTN for ; Thu, 10 Sep 2020 05:20:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1145186E36; Wed, 9 Sep 2020 19:20:49 +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 GVshvms3l_vH; Wed, 9 Sep 2020 19:20:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6E1E786C32; Wed, 9 Sep 2020 19:20:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4A866C0859; Wed, 9 Sep 2020 19:20:44 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A4A08C0891 for ; Wed, 9 Sep 2020 19:20:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9E8A2874D2 for ; Wed, 9 Sep 2020 19:20:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JZlBS+3CGAsj for ; Wed, 9 Sep 2020 19:20:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id 052F487502 for ; Wed, 9 Sep 2020 19:20:42 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id 34so2760810pgo.13 for ; Wed, 09 Sep 2020 12:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mFDWqY21lPdb0l912wrfXyvqtPVGuYns1a3cIw3i0us=; b=UDh08UvYHG46nTAGngo/TPvKy97yTYgUHLAdKDgkulUFW38ZnNbSSGLUwPwVZlc7nc a1FwK9u8MwG/NZuTI9h0WiuSKWd9u7Bdg85VHz93KJsWG+s+vvvb59XMSWhIHbk2l/zW W6SiTGVMuGcEWcMiXjLROB2PN/dS98TOJX5JwQmOnWGDg5kTmGHAR5Xk1HsdYvihulYc HU/wrHGgq1zYdkAOe63vfUQ2zsnZcqAqtQ/AXWX1XTPon1KBRwhge08U9ndeCvSgU0Qr iIHsynNSF2ticBlK1t3mxdz5OyvArErjQRMbjqGo/WSZvjrGjanUHhNLw6Lg0CrrDw4N aZJA== 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:in-reply-to :references; bh=mFDWqY21lPdb0l912wrfXyvqtPVGuYns1a3cIw3i0us=; b=Lp2qz09c4Zw6P+vjPpJpIXVigLgHLFZDQg0CnMtGIxs/risqAL+6vycln0Kx4xSpOi /Sf3xifnkoKlJ38kIYjctwFesPd18614PkVa85GvNWLLz2t0tx5PUKrr5b57syIbrY0v OHD3VzDkt6ord34C53p7mDtMAI0uYQpUk3cv7qWitM0Jg6P7xLso5ta5N+6b4IHGNTe6 ok2x4Bm/hU7R6ZxBiE9RrKI+YCh5ctiP5YFenPJC7yVYoLiolMMS3OXda07hJyWgE4uk Qq7ibNugDfQ/68vCxI/UrVM2rGA1lsXDvbneRAP/gUM0eqBXLcdzg5jO0E9/69Y9cRTU HBgQ== X-Gm-Message-State: AOAM5329z1EmYOtE8APtWKa8H86b0DlHKjYGah0f1bcmm7bOO9Mw+pmb cU9ESwzgXP/QkepQ3T82cIE2dQCWYR9I6A== X-Google-Smtp-Source: ABdhPJw0sDVWPE3fAL3hIY/n2o8RIGZmKQHi8F4+HysFgtvVJQ7YrdpaPPb9Eg/xII0MgeZ5CkbKew== X-Received: by 2002:a17:902:b28b:b029:d0:89f1:9e34 with SMTP id u11-20020a170902b28bb02900d089f19e34mr2428371plr.16.1599679241151; Wed, 09 Sep 2020 12:20:41 -0700 (PDT) Received: from VMware-box.domain ([97.115.183.169]) by smtp.googlemail.com with ESMTPSA id x29sm2866338pga.23.2020.09.09.12.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 12:20:40 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Wed, 9 Sep 2020 12:20:10 -0700 Message-Id: <20200909192021.9545-14-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200909192021.9545-1-gvrose8192@gmail.com> References: <20200909192021.9545-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH v2 13/24] datapath: select vport upcall portid directly 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang Upstream commit: commit 90ce9f23a886bdef7a4b7a9bd52c7a50a6a81635 Author: Tonghao Zhang Date: Thu Nov 7 00:34:28 2019 +0800 net: openvswitch: select vport upcall portid directly 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 Signed-off-by: David S. Miller Cc: Tonghao Zhang Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- datapath/vport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index f929282dc..bd62c5612 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -507,8 +507,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);