From patchwork Thu Aug 20 22:49:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348660 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.133; helo=hemlock.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=Om2tz+Lk; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfy03srxz9sPB for ; Fri, 21 Aug 2020 08:50:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9B7B18869E; Thu, 20 Aug 2020 22:50:46 +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 1w9r6CpVKnPv; Thu, 20 Aug 2020 22:50:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 969088861F; Thu, 20 Aug 2020 22:50:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7751FC089F; Thu, 20 Aug 2020 22:50:35 +0000 (UTC) X-Original-To: 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 E0F6FC0051 for ; Thu, 20 Aug 2020 22:50:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CE7B386B7D for ; Thu, 20 Aug 2020 22:50:30 +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 m-TxEcs05NOM for ; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 093CC86B7B for ; Thu, 20 Aug 2020 22:50:26 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id k18so91950pfp.7 for ; Thu, 20 Aug 2020 15:50:26 -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=rK+0WPlApMImVJA+i71ossj+GBe1YANga461aXvzSzE=; b=Om2tz+LkcnR8CqQvsQAd4zhyFcWdmhqGXr/N1+oAnT7EXzr5UQqomU434OS8LRVSbE 8dCG5x57GlifJHrwBsXrFaGcsB/Ww2H4Vvmdy14tZHF4cRmcytIurbHX3QoNHAj8QQ01 jFKLGwML1+qQS/bzFv904vk7j9GFHuJVRmHVYXlTHNvER2IM0aj4E+dfX36fwdlqc8QK g9hOuJNFC4N0n5y8oVjquNnigY2BFSts03JH4upr7zLDThCfQzKmNizRKACSkNQ4OBHa SKBfgJ9f+r4L6oUXBpLi9dvN8WreyFvV3RvEaMrbk7SZD4KEKfidUWa5SSM2lInGjYll 8pAA== 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=rK+0WPlApMImVJA+i71ossj+GBe1YANga461aXvzSzE=; b=qNID6sEvV50H6ZQG/x8VUgInbYwN+iL0iPBdMWHSgHIVtmYzB0m2+J//MH08F9In2d L8t01zesqIfm5zPEDh3WzukjHUPtX5gQ4CpNGCWyDMBG7Uca6SF9zoouCFkV8pQZaYaV Uei55sYJ9imnykrFnACK7jghfPzT2TcUUGckvdDouBRLXypLBi5fe34nHhiOMbFDNy+8 LsxsNUZw+GrOXqanbRtNpyw8owbZ+KKC6+Z/BPKSyTWuZVkyjIsp40gXIjSw9BPNEgc2 SFijBbhQqBSy8w5sISZH5XfzMLo7w4RbSLC3A85w6+bOEskgQyT7frI0axN9CaR3yOiK J5hg== X-Gm-Message-State: AOAM530VbwjHDoyGnTjIcamMeJqNoUTwQ/kjo5Q8lJniIA6s2VV3naH3 NfDBjDgUBdCYY9LauZoZ3jabqJx8T5dcAQ== X-Google-Smtp-Source: ABdhPJxVmJwWONxjyjTz7uzzvtRmXGhauSu0tNlH5vP7sL+03iCl0r07RI1bWZ+2Ptxtd7ueVKFBzg== X-Received: by 2002:aa7:84d4:: with SMTP id x20mr104597pfn.96.1597963825052; Thu, 20 Aug 2020 15:50:25 -0700 (PDT) Received: from gizo.domain (97-115-99-106.ptld.qwest.net. [97.115.99.106]) by smtp.gmail.com with ESMTPSA id y6sm116866pfr.61.2020.08.20.15.50.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:24 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:41 -0700 Message-Id: <1597963790-12362-15-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> References: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH 14/23] 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 Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/vport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index f929282..bd62c56 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);