From patchwork Thu Aug 20 22:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348653 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=ObcuwAfL; 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 4BXfxK2PC1z9sPf for ; Fri, 21 Aug 2020 08:50:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3476786BC4; Thu, 20 Aug 2020 22:50: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 uWoIOcJ1yJIq; Thu, 20 Aug 2020 22:50:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6D43B86BB3; Thu, 20 Aug 2020 22:50:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 60D30C0889; Thu, 20 Aug 2020 22:50:08 +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 CC43EC0889 for ; Thu, 20 Aug 2020 22:50:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B9CD886B8A for ; Thu, 20 Aug 2020 22:50:05 +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 0qeHBdX0oaQA for ; Thu, 20 Aug 2020 22:50:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E444186B7B for ; Thu, 20 Aug 2020 22:50:03 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id k13so1591250plk.13 for ; Thu, 20 Aug 2020 15:50:03 -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=B7MMPUvMMVPJ+wZPqlj4NF6HVVWEWzVlfHvF/mYCm8U=; b=ObcuwAfLVo8g7lZrlAgdhZ5grFUcwin2CMeA6Uksq46AaNt1Hp3nNMHdj0S/nvp3o/ qpEws2aWjKMUt+DxGRPFnLgEtzsvza8cpAzqw4DFjy346auTW2aVM4FygHwuDbX5YZdE P4lnUnhtZJtmXnNdnUDzADbVmMm2giNY2GBTKuvDNZCZUy3gy+J0J9cc0xn016dZ94ch QsZfcaONcYbWF5s6qnEXzMGimvm31Q/tKif8kSx/+W73hr1LZyuA6/y4kB6iHfdL+5C1 pmZT3UDlpMnGR7uOI3tCQhdOolw4RdyfhHUSXjlip9PAVRbFZN2qLNADc2DxaARwDnYD o7vQ== 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=B7MMPUvMMVPJ+wZPqlj4NF6HVVWEWzVlfHvF/mYCm8U=; b=TrfN6bi6KQXKeVo/olvEbnwzIutAzqybxV+D9cRh0lnRF9uEb3UzPzDS8ZreWT1k7j k7SUWk10pG7bsft/zMz4inalgeZiajSXLMThFg4agFG2WoKxDATxWolWdl4PltcTzjuX aHJG8MqqSNsth1vbhTwtrJyJqGKSCrE5jHRYLFqtOGTGzcEENx6dkPfgKJqFHMLQ3A7B qKdEzvVJZFQGUI/hdSaTM/h+qRW8lZn0DhNF8Q60yLgCgBzrNugjDPuHwW33hTC4WF3x v6D6YS9ACn+Kjn7GoK0RZNJJ+tx444JAnUWSP1M5A6KdZmxHLDTmfLjpuK8YXP40gzdY C+iA== X-Gm-Message-State: AOAM532L+AVfPIfr22P9IQ1EF4hSqeiSa/t52hAOvU4lc31SDCv2CSen LGoATZDn7LtWCcXCmdXHEpnpknlJr+lmwg== X-Google-Smtp-Source: ABdhPJzR6pj2q3qwrTc81aKLTlq0WqHuRySozjthdW8CqabhmAVKZU3QzgrD3eRA+T7JX81z1AVZFg== X-Received: by 2002:a17:90a:e995:: with SMTP id v21mr115432pjy.12.1597963802127; Thu, 20 Aug 2020 15:50:02 -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.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:01 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:28 -0700 Message-Id: <1597963790-12362-2-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 01/23] acinclude: Enable builds up to Linux 5.9 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" Allow building openvswitch against Linux kernels up to and including version 5.9. Signed-off-by: Greg Rose squash --- acinclude.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 84f344d..263c9f4 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -167,10 +167,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ AC_MSG_RESULT([$kversion]) if test "$version" -ge 5; then - if test "$version" = 5 && test "$patchlevel" -le 5; then + if test "$version" = 5 && test "$patchlevel" -le 9; then : # Linux 5.x else - AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.5.x is not supported (please refer to the FAQ for advice)]) + AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.9.x is not supported (please refer to the FAQ for advice)]) fi elif test "$version" = 4; then : # Linux 4.x From patchwork Thu Aug 20 22:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348652 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=tiLXFWLo; 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 4BXfxJ5458z9sPB for ; Fri, 21 Aug 2020 08:50:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E2C4B88527; Thu, 20 Aug 2020 22:50:09 +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 mkdboCpUxmah; Thu, 20 Aug 2020 22:50:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B549C88522; Thu, 20 Aug 2020 22:50:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 943A2C089F; Thu, 20 Aug 2020 22:50:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F03E3C0051 for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DB9A3875FE for ; Thu, 20 Aug 2020 22:50:04 +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 53I2Ns3n80iD for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5A1B5875DC for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id o5so67716pgb.2 for ; Thu, 20 Aug 2020 15:50:04 -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=+yaP/fcLQX0vjUMM7xcSw7h9Ktfa5weVQh2OyQJA13Q=; b=tiLXFWLojKdBYP9gCWhtZbZWXvRVI8Sc/Ha/F+uy6koQz8en1XUgkgS6o8+zvUXsAr CtLSu8NGmzFA8XGdInYqxFedc/3Qm34zJBdYuH70Z//rTB3Yysmdn0GGTtF2DpwJu2ln vM3Bt69T3hoXKFbNAVZn//zjdHtOfZbac9X1Hpz28zPaoEvy+uaUOs4h0zC1mj9HsU6U CK6DMgnOD0vtQ6BnsNHE7TUBX9Ifv3wVQY2ks5NukHkxd/gEbmhRTZ61zta1beRTUgor 07lV5Yk1oYjUG2QNpHciqfuT1Edv2FxbjAmMxRPmmKVwst2Hr4dpZNiY9+WVVMzLC/2m DHsw== 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=+yaP/fcLQX0vjUMM7xcSw7h9Ktfa5weVQh2OyQJA13Q=; b=c6yP+ZxEfiahlVphvCU51wXTZ5ZQGJY2ryeSMy3MlEs5dJWtBYyXVls694DkS/u4LO LarpDvc1YIaGq7VHwsSDR2Gc0AZBOjch8m0wHdlb3LaVF8z5lNcd/0gSn4abEOaYf8xE 5A3/F/fa4lVNH3QcEsOarxolKV/lmOBehSLhgsn6ZSI3xsnR1H0Qya+Ozzw5t5tXpfn5 715CTd8WmVHriBVcFZq+11QbjFmykN3+fnqijcGlpfWhB0Mg0l6Nda6jE1IQsbl7qXxS bdNEMoShgM0muiSNier9eNBMaDx3n3MBhQUMDQHSgkY8JobdCyxyU+2NG4cdoFQ/v8QX txYA== X-Gm-Message-State: AOAM531es2RpEXfxdDeSZrAMuJAZgOxafOMDm7xJKLAM9x+v1nRgCQTX P7Prn67ceKzRda6twx9eyPOmodNOzmueYQ== X-Google-Smtp-Source: ABdhPJxCrzW9+cnsq1tdbWql0U3beJpkiX0/WJRvxDeOca5eoZWPJkqnCOaIQUVc19xAGdk6X++Lzw== X-Received: by 2002:a63:33cf:: with SMTP id z198mr246763pgz.348.1597963803643; Thu, 20 Aug 2020 15:50:03 -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.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:02 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:29 -0700 Message-Id: <1597963790-12362-3-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 02/23] datapath: return an error instead of doing BUG_ON() 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: Eelco Chaudron Upstream commit: commit a734d1f4c2fc962ef4daa179e216df84a8ec5f84 Author: Eelco Chaudron Date: Thu May 2 16:12:38 2019 -0400 net: openvswitch: return an error instead of doing BUG_ON() For all other error cases in queue_userspace_packet() the error is returned, so it makes sense to do the same for these two error cases. Reported-by: Davide Caratti Signed-off-by: Eelco Chaudron Acked-by: Flavio Leitner Signed-off-by: David S. Miller Cc: Eelco Chaudron Signed-off-by: Greg Rose --- datapath/datapath.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 05c1e42..d604bfd 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -469,7 +469,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, upcall->dp_ifindex = dp_ifindex; err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb); - BUG_ON(err); + if (err) + goto out; if (upcall_info->userdata) __nla_put(user_skb, OVS_PACKET_ATTR_USERDATA, @@ -486,7 +487,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, } err = ovs_nla_put_tunnel_info(user_skb, upcall_info->egress_tun_info); - BUG_ON(err); + if (err) + goto out; + nla_nest_end(user_skb, nla); } From patchwork Thu Aug 20 22:49:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348665 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.136; helo=silver.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=EhCCsv3p; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfyd0mHhz9sT6 for ; Fri, 21 Aug 2020 08:51:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 53E6B24E36; Thu, 20 Aug 2020 22:51:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xe7lli2jc3uJ; Thu, 20 Aug 2020 22:51:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id C3EBD23042; Thu, 20 Aug 2020 22:50:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AFB9EC08A9; Thu, 20 Aug 2020 22:50:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9926CC0051 for ; Thu, 20 Aug 2020 22:50:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5E3FF22FC6 for ; Thu, 20 Aug 2020 22:50:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EThTm2N+y76V for ; Thu, 20 Aug 2020 22:50:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by silver.osuosl.org (Postfix) with ESMTPS id A208822CC6 for ; Thu, 20 Aug 2020 22:50:06 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id m71so105222pfd.1 for ; Thu, 20 Aug 2020 15:50:06 -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=e69d8OwbLhO9LDXDRTR2xk5C+/y1/bwUCXNLltuw45E=; b=EhCCsv3piTbxeOlVtqK1ZaSi2h4GBSwCirhd0itpdXkhjV9UPxVnjNWtiFJXH29Dwb s50FctkSuxzNMJFlWGaXsudIHJcKQnyiIXXEKuUpETtJTPTOGWDK/pC1a/owVd0od+GX Lczw/AjuQsBn/Z7wCNfqe8qR6ivKKyu9R6dkQvBuOZAiwtG5myzCynU/hJvvYopCffMf VaxbcrXfeg6/ltjoVnbesfDXS0p8MHysntHdJ2Zz2/RKMgxzSXucP5O0bwI/ofU3KydU 4Si+QA0EXsYf6DHS1C9U4qY1m8TalnQv1Yq0jXnUE7JABJuPyEkVjBNiy0YXD6A/WFRk nc/A== 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=e69d8OwbLhO9LDXDRTR2xk5C+/y1/bwUCXNLltuw45E=; b=ZajiKmZ9mpTkBVhID/enDUAnQjSTlJDTqgBKdUaqO9rWo13RVDfUcmLrLKTtCDXvKC HZgjSuoeJiAEnAV39nAtlvJL7E44aSSAm5HxkS6GTsySn+DWOzr5jRN+C0M2o5VrCb3y LmcntENJnH5XYvEdeFw7pctCZUEX+pF8S2on/WzM6R4VrVI3FDM2ybyKI7R4b5o248Hf NxrU12QA4p3hXpHb8tgM0lh5FYAvORmF6s7iS4+j9V9oEND2LQLMMsGsuyZyz33Dm9t0 2JybeQB/DLLQdgffYeUTClxP2ZjHiIziTH67vJd6hzw7Bvt2yA6BTSriJOcfNqmyf5a3 bKRg== X-Gm-Message-State: AOAM533YYLYdtV6e1X5B0LtfPYQakgigUWPjcHucF8sw6tBiNzXltyZN bgHpRmzIGTDWvEYKl+qR+J6mPZw8CuAPpQ== X-Google-Smtp-Source: ABdhPJz2VAW0m86i8Ga4QCgQSxJVKR02+DUnH9b/sLDjDSZpscbe0uhAPFN3p++PjCJtnrJQyP9zSA== X-Received: by 2002:a65:67c8:: with SMTP id b8mr248596pgs.206.1597963805226; Thu, 20 Aug 2020 15:50:05 -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.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:04 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:30 -0700 Message-Id: <1597963790-12362-4-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> Cc: Enrico Weigelt Subject: [ovs-dev] [PATCH 03/23] datapath: drop unneeded likely() call around IS_ERR() 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: Enrico Weigelt Upstream commit: commit b90f5aa4d6268e81dd1fd51e5ef89d2892bf040d Author: Enrico Weigelt Date: Wed Jun 5 23:06:40 2019 +0200 net: openvswitch: drop unneeded likely() call around IS_ERR() IS_ERR() already calls unlikely(), so this extra likely() call around the !IS_ERR() is not needed. Signed-off-by: Enrico Weigelt Signed-off-by: David S. Miller Cc: Enrico Weigelt Signed-off-by: Greg Rose --- datapath/datapath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index d604bfd..4c485c8 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1402,7 +1402,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) &flow->id, info, false, ufid_flags); if (likely(reply)) { - if (likely(!IS_ERR(reply))) { + if (!IS_ERR(reply)) { rcu_read_lock(); /*To keep RCU checker happy. */ err = ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex, reply, info->snd_portid, From patchwork Thu Aug 20 22:49:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348663 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=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=kbdnvwVD; 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 4BXfyB2PcSz9sPB for ; Fri, 21 Aug 2020 08:50:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CA213885F2; Thu, 20 Aug 2020 22:50:56 +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 aIEaju5FY35o; Thu, 20 Aug 2020 22:50:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 6AA8788507; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8E6EEC0051; Thu, 20 Aug 2020 22:50:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6B4E4C0051 for ; Thu, 20 Aug 2020 22:50:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4019388447 for ; Thu, 20 Aug 2020 22:50:10 +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 l94Qzwxg1dOF for ; Thu, 20 Aug 2020 22:50:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 005CC88404 for ; Thu, 20 Aug 2020 22:50:08 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id ds1so94781pjb.1 for ; Thu, 20 Aug 2020 15:50:08 -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=q7Yy9//Fyi3QNhCVYKvYeHrq+MY1vVHU1fPpl6mtOdA=; b=kbdnvwVDKEpyv7s+c8jyKH8aWyIbYwL7sAww+j70TB33oIXEIOVn8orNeIYvKMRR3o msosTaIe73/muyQKGm6vVWinM2+Iu+zzEuPJ5h0HxdMmRPiAX7uWb79xYvDpuyuEhtHq gyyB4vZOdZsvZuqiiwqBUBehQZwQ0PROZ8SyUrIX7QVfCR/sfVTXubpJ82Ry3Nt1Ymsv qEIwDz4LGATpT0Rrg9D9zVEcJdaUU34H6QY+UqBNufIN0Fql/2n37zqRs/L7HVkq0o5x O2nKadWd+ANtM87YT4OG7Gyg/rbaDEupO4icPzS1e9H73QYavmhA74zzXuYJdUBhdTPJ ftZQ== 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=q7Yy9//Fyi3QNhCVYKvYeHrq+MY1vVHU1fPpl6mtOdA=; b=d2pVL/J4aEVXK/tOTFCJSq4crrdwFdVQ+ORr6Voz5kYqWnNufBwrKkGSwkQPMQ89NH AWQDlJ86DdFcOrhn7SEICstW4K7s34kuy6JiVZglRWj9lh6YMWP2mCvsB44EtR1zk9+f bzPYQxul9u3RsmUR0CGWh1xWQMpuq9KQt9YNeSv94N5azEpxaBquGBNjif/YzznLKFAr 4Ty6cg87w0d1Am3Vn4AwCZIcH8LAqiz0MTx0JzBqu+PWCK8X9TDOh/AmTQdyVlqYUqNq uDHsxAZxORdM8Vp45s6BNeIM2g0+OZorLSvCAoA/7BLvsZNG9liKyyVYlrXhGgviXAY/ mTdA== X-Gm-Message-State: AOAM530KKIoBhx5r30cps398WXvyn+3qpzcUtjCDi1xxARec1wbZ1swG j7vIPVMFa+dULqDcTrFL66Kko+pgPiRAYA== X-Google-Smtp-Source: ABdhPJyf5VrdIdbj7KUNs5HNVkH2SjZphQIoxtc86aSRzuev3XxHF1pyD18z40p0WUExEOhr6cPnAw== X-Received: by 2002:a17:902:aa8e:: with SMTP id d14mr1137plr.147.1597963807570; Thu, 20 Aug 2020 15:50:07 -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.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:06 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:31 -0700 Message-Id: <1597963790-12362-5-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 04/23] datapath: do not update max_headroom if new headroom is equal to old headroom 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: Taehee Yoo Upstream commit: commit 6b660c4177aaebdc73df7a3378f0e8b110aa4b51 Author: Taehee Yoo Date: Sat Jul 6 01:08:09 2019 +0900 net: openvswitch: do not update max_headroom if new headroom is equal to old headroom When a vport is deleted, the maximum headroom size would be changed. If the vport which has the largest headroom is deleted, the new max_headroom would be set. But, if the new headroom size is equal to the old headroom size, updating routine is unnecessary. Signed-off-by: Taehee Yoo Tested-by: Greg Rose Reviewed-by: Greg Rose Signed-off-by: David S. Miller Cc: Taehee Yoo Signed-off-by: Greg Rose --- datapath/datapath.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 4c485c8..2879f24 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -2072,10 +2072,9 @@ static struct vport *lookup_vport(struct net *net, } -/* Called with ovs_mutex */ -static void update_headroom(struct datapath *dp) +static unsigned int ovs_get_max_headroom(struct datapath *dp) { - unsigned dev_headroom, max_headroom = 0; + unsigned int dev_headroom, max_headroom = 0; struct net_device *dev; struct vport *vport; int i; @@ -2089,10 +2088,19 @@ static void update_headroom(struct datapath *dp) } } - dp->max_headroom = max_headroom; + return max_headroom; +} + +/* Called with ovs_mutex */ +static void ovs_update_headroom(struct datapath *dp, unsigned int new_headroom) +{ + struct vport *vport; + int i; + + dp->max_headroom = new_headroom; for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node) - netdev_set_rx_headroom(vport->dev, max_headroom); + netdev_set_rx_headroom(vport->dev, new_headroom); } static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) @@ -2103,6 +2111,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) struct sk_buff *reply; struct vport *vport; struct datapath *dp; + unsigned int new_headroom; u32 port_no; int err; @@ -2165,8 +2174,10 @@ restart: OVS_VPORT_CMD_NEW); BUG_ON(err < 0); - if (netdev_get_fwd_headroom(vport->dev) > dp->max_headroom) - update_headroom(dp); + new_headroom = netdev_get_fwd_headroom(vport->dev); + + if (new_headroom > dp->max_headroom) + ovs_update_headroom(dp, new_headroom); else netdev_set_rx_headroom(vport->dev, dp->max_headroom); @@ -2235,11 +2246,12 @@ exit_unlock_free: static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) { - bool must_update_headroom = false; + bool update_headroom = false; struct nlattr **a = info->attrs; struct sk_buff *reply; struct datapath *dp; struct vport *vport; + unsigned int new_headroom; int err; reply = ovs_vport_cmd_alloc_info(); @@ -2265,13 +2277,17 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) /* the vport deletion may trigger dp headroom update */ dp = vport->dp; if (netdev_get_fwd_headroom(vport->dev) == dp->max_headroom) - must_update_headroom = true; + update_headroom = true; + netdev_reset_rx_headroom(vport->dev); ovs_dp_detach_port(vport); - if (must_update_headroom) - update_headroom(dp); + if (update_headroom) { + new_headroom = ovs_get_max_headroom(dp); + if (new_headroom < dp->max_headroom) + ovs_update_headroom(dp, new_headroom); + } ovs_unlock(); ovs_notify(&dp_vport_genl_family, &ovs_dp_vport_multicast_group, reply, info); From patchwork Thu Aug 20 22:49:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348656 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=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=jIUYQZVc; 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 4BXfxm5ZgCz9sPf for ; Fri, 21 Aug 2020 08:50:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8C50988554; Thu, 20 Aug 2020 22:50:34 +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 lDmRZ4snBx0C; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 231B18846E; Thu, 20 Aug 2020 22:50:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05FCBC0894; Thu, 20 Aug 2020 22:50:13 +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 4F7DEC0051 for ; Thu, 20 Aug 2020 22:50:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2BC6D8852F for ; Thu, 20 Aug 2020 22:50:12 +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 xfLvkYPnS33k for ; Thu, 20 Aug 2020 22:50:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0DB978854C for ; Thu, 20 Aug 2020 22:50:11 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id k13so1591434plk.13 for ; Thu, 20 Aug 2020 15:50:11 -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=TTFnTuoJGZe/16btTXbXcmPFwjRNb/PSLx6UBh4ze7U=; b=jIUYQZVcwPLTt5fviQsvWDoZmvTYpTAEAjAVFAb7uYtpLjnMPTbPb7hqq9N+bb0BL2 fZf0EdjQCv52tUZV3uVmpETdKhmueZp5QOL0L7a9tvx5Cg24lZwgXL2nSxSm4jI56fHo yGWQ8Xo/jD95c2hiwacdA810BwNpw3hfIk2mRHF6pX2tv96D1nYO8bOysounycUHWNrb 5g7qB0SxGdvd5gN7IYhgGfigZmOgbmd7HwNcKiBW5YlqpJceFRjKyjTo33Y/J5SpGu7h oXwfaC/F0mg6km4rk5Xw36KEpLMmMNindsncghAgklCzLYSU+ShX1MnSTcTU028AdhLw Sw9A== 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=TTFnTuoJGZe/16btTXbXcmPFwjRNb/PSLx6UBh4ze7U=; b=F7OSa/88Y/lhHUuLWYM/BSi2QzOW9WNUNuMYtOxfBt8wOVUYF1qJSGXkxye8tm8DNJ 4FUs3mD++x+Ozmuu4dp8ST03Bmd0xxD6EeIAdJiDwBJvqQXaRgMI/+glh3KkAH1BD3nM IhZE7u/HDiv+ZtjVf04jYnV61DlPl20yK0oaWpjQDYQDNzDIGiieE8wuzleAyppTynA1 6hIzegJYcLmLofFxkIAshWA0fALaUwVVxpcJNg+RkDQG8Qy0masSnst89FiLGagQjOOs bOOKtviosAC0Tsa4L0Jyd41qa2iSyKoCLTRj+O6xNnkuCbBMvWMNW9mlvAqH2ECsyG0d 7tew== X-Gm-Message-State: AOAM530ziwDmJSARbtUHe51iV6dILF27UoJaSixkf9jkBZvK48NqnBPy 2gctRDUiCtii7ogz94SK9r+mVO2svD8fLw== X-Google-Smtp-Source: ABdhPJxLMTWJpaJPt2+SWfsFGhKAzdjkbyLNDxoh7OGd/UVonkVOFCIbMIk01w9dDFF2Z228HdbBjw== X-Received: by 2002:a17:902:6f01:: with SMTP id w1mr10818plk.49.1597963810093; Thu, 20 Aug 2020 15:50:10 -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.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:08 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:32 -0700 Message-Id: <1597963790-12362-6-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 05/23] datapath: Print error when ovs_execute_actions() fails 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: Yifeng Sun Upstream commit: commit aa733660dbd8d9192b8c528ae0f4b84f3fef74e4 Author: Yifeng Sun Date: Sun Aug 4 19:56:11 2019 -0700 openvswitch: Print error when ovs_execute_actions() fails Currently in function ovs_dp_process_packet(), return values of ovs_execute_actions() are silently discarded. This patch prints out an debug message when error happens so as to provide helpful hints for debugging. Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Yifeng Sun Signed-off-by: Greg Rose Reviewed-by: Yifeng Sun --- datapath/datapath.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 2879f24..c8c21d7 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -240,6 +240,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) struct dp_stats_percpu *stats; u64 *stats_counter; u32 n_mask_hit; + int error; stats = this_cpu_ptr(dp->stats_percpu); @@ -248,7 +249,6 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) &n_mask_hit); if (unlikely(!flow)) { struct dp_upcall_info upcall; - int error; memset(&upcall, 0, sizeof(upcall)); upcall.cmd = OVS_PACKET_CMD_MISS; @@ -265,7 +265,10 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) ovs_flow_stats_update(flow, key->tp.flags, skb); sf_acts = rcu_dereference(flow->sf_acts); - ovs_execute_actions(dp, skb, sf_acts, key); + error = ovs_execute_actions(dp, skb, sf_acts, key); + if (unlikely(error)) + net_dbg_ratelimited("ovs: action execution error on datapath %s: %d\n", + ovs_dp_name(dp), error); stats_counter = &stats->n_hit; From patchwork Thu Aug 20 22:49:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348661 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.136; helo=silver.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=WIAqHIT0; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfy54fTrz9sPB for ; Fri, 21 Aug 2020 08:50:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1292F23E8D; Thu, 20 Aug 2020 22:50:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cB+yofFjOj40; Thu, 20 Aug 2020 22:50:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 2F7FA22DEC; Thu, 20 Aug 2020 22:50:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B66AC08A5; Thu, 20 Aug 2020 22:50:16 +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 DE512C0051 for ; Thu, 20 Aug 2020 22:50:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CD05686BED for ; Thu, 20 Aug 2020 22:50:14 +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 Rfw7pSUZMi1Y for ; Thu, 20 Aug 2020 22:50:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id DD88086BC2 for ; Thu, 20 Aug 2020 22:50:12 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id mt12so88294pjb.4 for ; Thu, 20 Aug 2020 15:50:12 -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=nB+NmXHjKEJ0Jug+bH8RS4VQXjURzbhSmJ4s/9oMpaY=; b=WIAqHIT0qoMW4XeADb4SdGo4iPFiFxxYQ4r//eUqVXJyD4ceW9/qoor5/VSRYNSoEH XGrw29RXFUJ2g8fo0spGu99Q5SG3skiM6HfqVE6ads7JTH17oxBpLRKUYSNnAQdnWIng 28mPoR9afJmk22dAlv0F90n2cfsvzh3Or7p7750+qi90Myv4NIWPA/oq2J7f7tIC0MMQ K260nQhZtKg9M45xe0OBI1+9jv3WWVPtVEFbcYMucVAXWD/BgjcnC0t6sFs3RI3prJQo 4AjX+11g5mghin1JEEne8Eq/G+W4RTKwynrejlf/gmVSNfIeFN7Eub2d2CgVmq0YJiRi e7SA== 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=nB+NmXHjKEJ0Jug+bH8RS4VQXjURzbhSmJ4s/9oMpaY=; b=r3fF2OTLusOXKJmX8yziTPKzlxgJPT+hI5tGfh9qXIH/UtLnKq02knXE1xzU/DvpEh AYJs3nADYcpf3RXvkg2fHY+jQuEMavG/v28bRwUA26wjT9nVs8jJ/1CaTlvRJqImQu1s yu5XeyEcZeJNi8b9qYvMXbpmDPX5ceCavUBowPpqn8aqqkqdL8EyhhS70XZsgzBMgkED P3ZkAqOqt0linCt7jLZhIR63dUsHA2x6HajG/2YDQBCcHDUUO5D8iMbBGEppaHBTTRiG PYsS/b45OPeIoWAvSkhkLrEKmATyHlyRWMDjO2k02q/zWFMt5mI2Ff7c1isB0xr5Stp5 yM7g== X-Gm-Message-State: AOAM530E1vSIesIRzE2JgbWjuAQjRoqKUlWMnhyzp6/r3JwZauZ1XQcK FlwMDif9Y5mSTTGGhZcbPx8uNvsBQHtQfQ== X-Google-Smtp-Source: ABdhPJyoLHYJUjdDZ9c6Komd5lKU7nJXU0IlmCJorGn8sB5LGhNDUQ21SOakmh8fJMgtuZKmsu5Szw== X-Received: by 2002:a17:902:7689:: with SMTP id m9mr21479pll.240.1597963811896; Thu, 20 Aug 2020 15:50:11 -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.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:10 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:33 -0700 Message-Id: <1597963790-12362-7-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 06/23] datapath: Set OvS recirc_id from tc chain index 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: Paul Blakey Upstream commit: commit 95a7233c452a58a4c2310c456c73997853b2ec46 Author: Paul Blakey Date: Wed Sep 4 16:56:37 2019 +0300 net: openvswitch: Set OvS recirc_id from tc chain index Offloaded OvS datapath rules are translated one to one to tc rules, for example the following simplified OvS rule: recirc_id(0),in_port(dev1),eth_type(0x0800),ct_state(-trk) actions:ct(),recirc(2) Will be translated to the following tc rule: $ tc filter add dev dev1 ingress \ prio 1 chain 0 proto ip \ flower tcp ct_state -trk \ action ct pipe \ action goto chain 2 Received packets will first travel though tc, and if they aren't stolen by it, like in the above rule, they will continue to OvS datapath. Since we already did some actions (action ct in this case) which might modify the packets, and updated action stats, we would like to continue the proccessing with the correct recirc_id in OvS (here recirc_id(2)) where we left off. To support this, introduce a new skb extension for tc, which will be used for translating tc chain to ovs recirc_id to handle these miss cases. Last tc chain index will be set by tc goto chain action and read by OvS datapath. Signed-off-by: Paul Blakey Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Backport the local datapath changes from this patch and add compat layer fixup for the DECLARE_STATIC_KEY_FALSE macro. Cc: Paul Blakey Signed-off-by: Greg Rose --- acinclude.m4 | 3 +++ datapath/datapath.c | 34 +++++++++++++++++++++--- datapath/datapath.h | 2 ++ datapath/flow.c | 13 +++++++++ datapath/linux/compat/include/linux/static_key.h | 7 +++++ 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 263c9f4..1410c31 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -631,6 +631,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_UPSTREAM_STATIC_KEY])]) OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE], [OVS_DEFINE([HAVE_DEFINE_STATIC_KEY])]) + OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], + [DECLARE_STATIC_KEY_FALSE], + [OVS_DEFINE([HAVE_DECLARE_STATIC_KEY])]) OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random]) OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy]) diff --git a/datapath/datapath.c b/datapath/datapath.c index c8c21d7..36f1e78 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1635,10 +1635,34 @@ static void ovs_dp_reset_user_features(struct sk_buff *skb, struct genl_info *in dp->user_features = 0; } -static void ovs_dp_change(struct datapath *dp, struct nlattr *a[]) +DEFINE_STATIC_KEY_FALSE(tc_recirc_sharing_support); + +static int ovs_dp_change(struct datapath *dp, struct nlattr *a[]) { - if (a[OVS_DP_ATTR_USER_FEATURES]) - dp->user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]); + u32 user_features = 0; + + if (a[OVS_DP_ATTR_USER_FEATURES]) { + user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]); + + if (user_features & ~(OVS_DP_F_VPORT_PIDS | + OVS_DP_F_UNALIGNED | + OVS_DP_F_TC_RECIRC_SHARING)) + return -EOPNOTSUPP; + +#if !IS_ENABLED(CONFIG_NET_TC_SKB_EXT) + if (user_features & OVS_DP_F_TC_RECIRC_SHARING) + return -EOPNOTSUPP; +#endif + } + + dp->user_features = user_features; + + if (dp->user_features & OVS_DP_F_TC_RECIRC_SHARING) + static_branch_enable(&tc_recirc_sharing_support); + else + static_branch_disable(&tc_recirc_sharing_support); + + return 0; } static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) @@ -1700,7 +1724,9 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) parms.port_no = OVSP_LOCAL; parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID]; - ovs_dp_change(dp, a); + err = ovs_dp_change(dp, a); + if (err) + goto err_destroy_meters; /* So far only local changes have been made, now need the lock. */ ovs_lock(); diff --git a/datapath/datapath.h b/datapath/datapath.h index f99db1f..c377e9b 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -251,6 +251,8 @@ extern struct notifier_block ovs_dp_device_notifier; extern struct genl_family dp_vport_genl_family; extern const struct genl_multicast_group ovs_dp_vport_multicast_group; +DECLARE_STATIC_KEY_FALSE(tc_recirc_sharing_support); + void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key); void ovs_dp_detach_port(struct vport *); int ovs_dp_upcall(struct datapath *, struct sk_buff *, diff --git a/datapath/flow.c b/datapath/flow.c index 6dc7402..5a00c23 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -874,6 +874,9 @@ static int key_extract_mac_proto(struct sk_buff *skb) int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, struct sk_buff *skb, struct sw_flow_key *key) { +#if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) + struct tc_skb_ext *tc_ext; +#endif int res, err; /* Extract metadata from packet. */ @@ -904,7 +907,17 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, if (res < 0) return res; key->mac_proto = res; + +#if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) + if (static_branch_unlikely(&tc_recirc_sharing_support)) { + tc_ext = skb_ext_find(skb, TC_SKB_EXT); + key->recirc_id = tc_ext ? tc_ext->chain : 0; + } else { + key->recirc_id = 0; + } +#else key->recirc_id = 0; +#endif err = key_extract(skb, key); if (!err) diff --git a/datapath/linux/compat/include/linux/static_key.h b/datapath/linux/compat/include/linux/static_key.h index 7e43a49..432fecc 100644 --- a/datapath/linux/compat/include/linux/static_key.h +++ b/datapath/linux/compat/include/linux/static_key.h @@ -74,6 +74,13 @@ static inline void rpl_static_key_disable(struct static_key *key) #define static_branch_enable(x) rpl_static_key_enable(&(x)->key) #define static_branch_disable(x) rpl_static_key_disable(&(x)->key) +#ifndef HAVE_DECLARE_STATIC_KEY +#define DECLARE_STATIC_KEY_TRUE(name) \ + extern struct static_key_true name +#define DECLARE_STATIC_KEY_FALSE(name) \ + extern struct static_key_false name +#endif + #endif /* HAVE_UPSTREAM_STATIC_KEY */ #endif /* _STATIC_KEY_WRAPPER_H */ From patchwork Thu Aug 20 22:49:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348662 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=lPOA4W6d; 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 4BXfy62DQbz9sPf for ; Fri, 21 Aug 2020 08:50:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CC40F86C56; Thu, 20 Aug 2020 22:50:52 +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 oCizpK7rRqLL; Thu, 20 Aug 2020 22:50:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id DBF6786C5E; Thu, 20 Aug 2020 22:50:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A5407C08A5; Thu, 20 Aug 2020 22:50:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0E10AC0895 for ; Thu, 20 Aug 2020 22:50:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D4B7423B28 for ; Thu, 20 Aug 2020 22:50:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bSL7tOS0-sWO for ; Thu, 20 Aug 2020 22:50:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by silver.osuosl.org (Postfix) with ESMTPS id 5C23522D0D for ; Thu, 20 Aug 2020 22:50:15 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id bh1so1593725plb.12 for ; Thu, 20 Aug 2020 15:50:15 -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=xW/vElZ+ZWMe+TBtkj+RmB9V1EnWNWbR6UuIfoH1UOo=; b=lPOA4W6dn0gJYysJIySQ+BVGKhWLFjCbj+LhDG9Q5vqqD5RBBWgO+DhoSeU9nQIRmB WDMM2pvOclXchw6fXNGt93yCgPA89fAgR7TzuYj2QhRkMCBBE/c1hvUrc95c+yuAMTjr a5SEANwEe1muf+5DnFoOD9SRywb4HMkvuWTPiXDkHbYudE7n9/bX8p8/ztCfzo7uMLWJ Ke4dM7/yT/Y8RXF65D5QSXtF89gnzrLuEbxMsv1CPCEJT7uOmsaI9zaTtL1MwS/FIFxr Qs2cHa1h/JOP6Me7ZH/4y57WYTOxx3pX09isEnCOF2yXbX6GI0gpidyf+it64BD4o8+o Ab5w== 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=xW/vElZ+ZWMe+TBtkj+RmB9V1EnWNWbR6UuIfoH1UOo=; b=oKPQsucoy46+MMhA08DukWHXuyXS5tPOZvJzGTQGUrjxgS2ixSr3D4Puu3ybA4iW1d XhHQVAbzhwQUFLMEAF7w+iIJkp22GebTvBaeIK1q/hxEaXtR/rdh1MeAcxZO/vus1Q3h nEU1XnGfasYFMzNygAAGVCEukYePqVZsalALhHC7+L9nX1cP9y5ErDlKmjmB+/9sBi3m FmhHtWp2CECMKrTU+PtM9CbzU1fE3ONlREW1W9PNBVtLL4uKDMDHLExRmKa68qtNWaSm T4lxr85vdPas5KtCkBvBaClatvkUgCK8nr1EWISdSVjdutmXVbJZsVuXlxAj3SmrLdc6 Aogg== X-Gm-Message-State: AOAM531ajw9Zrxb/MpzTcwZSU+sz2087w7AHiHRa1Zqrx6AQHwWvTnx9 MPoWQjnWfTxnV7Z6m0YqMzx5bqO02ZP95w== X-Google-Smtp-Source: ABdhPJyc7PylZ8m2ljtACpss1EX0UeOknpBpHuL9ZxaY9QDphTKfv1OknMEk6dCuBG5QC8JJPZzyGQ== X-Received: by 2002:a17:90a:39c8:: with SMTP id k8mr12203pjf.19.1597963814420; Thu, 20 Aug 2020 15:50:14 -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.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:12 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:34 -0700 Message-Id: <1597963790-12362-8-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> Cc: Guillaume Nault Subject: [ovs-dev] [PATCH 07/23] datapath: fix GFP flags in rtnl_net_notifyid() 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: Guillaume Nault Upstream commit: commit d4e4fdf9e4a27c87edb79b1478955075be141f67 Author: Guillaume Nault Date: Wed Oct 23 18:39:04 2019 +0200 netns: fix GFP flags in rtnl_net_notifyid() In rtnl_net_notifyid(), we certainly can't pass a null GFP flag to rtnl_notify(). A GFP_KERNEL flag would be fine in most circumstances, but there are a few paths calling rtnl_net_notifyid() from atomic context or from RCU critical sections. The later also precludes the use of gfp_any() as it wouldn't detect the RCU case. Also, the nlmsg_new() call is wrong too, as it uses GFP_KERNEL unconditionally. Therefore, we need to pass the GFP flags as parameter and propagate it through function calls until the proper flags can be determined. In most cases, GFP_KERNEL is fine. The exceptions are: * openvswitch: ovs_vport_cmd_get() and ovs_vport_cmd_dump() indirectly call rtnl_net_notifyid() from RCU critical section, * rtnetlink: rtmsg_ifinfo_build_skb() already receives GFP flags as parameter. Also, in ovs_vport_cmd_build_info(), let's change the GFP flags used by nlmsg_new(). The function is allowed to sleep, so better make the flags consistent with the ones used in the following ovs_vport_cmd_fill_info() call. Found by code inspection. Fixes: 9a9634545c70 ("netns: notify netns id events") Signed-off-by: Guillaume Nault Acked-by: Nicolas Dichtel Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Backport the datapath.c portion of this fix. Cc: Guillaume Nault Signed-off-by: Greg Rose --- datapath/datapath.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 36f1e78..1235c4e 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1990,7 +1990,7 @@ static struct genl_family dp_datapath_genl_family __ro_after_init = { /* Called with ovs_mutex or RCU read lock. */ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, struct net *net, u32 portid, u32 seq, - u32 flags, u8 cmd) + u32 flags, u8 cmd, gfp_t gfp) { struct ovs_header *ovs_header; struct ovs_vport_stats vport_stats; @@ -2012,7 +2012,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, #ifdef HAVE_PEERNET2ID_ALLOC if (!net_eq(net, dev_net(vport->dev))) { - int id = peernet2id_alloc(net, dev_net(vport->dev)); + int id = peernet2id_alloc(net, dev_net(vport->dev), gfp); if (nla_put_s32(skb, OVS_VPORT_ATTR_NETNSID, id)) goto nla_put_failure; @@ -2054,11 +2054,12 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, struct net *net, struct sk_buff *skb; int retval; - skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) return ERR_PTR(-ENOMEM); - retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd); + retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd, + GFP_KERNEL); BUG_ON(retval < 0); return skb; @@ -2200,7 +2201,7 @@ restart: err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), info->snd_portid, info->snd_seq, 0, - OVS_VPORT_CMD_NEW); + OVS_VPORT_CMD_NEW, GFP_KERNEL); BUG_ON(err < 0); new_headroom = netdev_get_fwd_headroom(vport->dev); @@ -2260,7 +2261,7 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), info->snd_portid, info->snd_seq, 0, - OVS_VPORT_CMD_SET); + OVS_VPORT_CMD_SET, GFP_KERNEL); BUG_ON(err < 0); ovs_unlock(); @@ -2300,7 +2301,7 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), info->snd_portid, info->snd_seq, 0, - OVS_VPORT_CMD_DEL); + OVS_VPORT_CMD_DEL, GFP_KERNEL); BUG_ON(err < 0); /* the vport deletion may trigger dp headroom update */ @@ -2347,7 +2348,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info) goto exit_unlock_free; err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), info->snd_portid, info->snd_seq, 0, - OVS_VPORT_CMD_GET); + OVS_VPORT_CMD_GET, GFP_ATOMIC); BUG_ON(err < 0); rcu_read_unlock(); @@ -2383,7 +2384,8 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, - OVS_VPORT_CMD_GET) < 0) + OVS_VPORT_CMD_GET, + GFP_ATOMIC) < 0) goto out; j++; From patchwork Thu Aug 20 22:49:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348672 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.136; helo=silver.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=rb5pjNqG; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXg0124W1z9sPf for ; Fri, 21 Aug 2020 08:52:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 64D6023340; Thu, 20 Aug 2020 22:52:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wo+Rn3E6NBkh; Thu, 20 Aug 2020 22:52:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 28888233B9; Thu, 20 Aug 2020 22:50:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DDEAEC0051; Thu, 20 Aug 2020 22:50:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79BF0C089F for ; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BDECE884F6 for ; Thu, 20 Aug 2020 22:50:28 +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 eA7VsO6tixxD for ; Thu, 20 Aug 2020 22:50:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id D8FF188484 for ; Thu, 20 Aug 2020 22:50:16 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id u20so106882pfn.0 for ; Thu, 20 Aug 2020 15:50:16 -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=xvgls63EPMvkaCK9aLLPOG/qJlre0KKuaEBeTfM166Y=; b=rb5pjNqGM0z1M3ZrFQJLd4Y6k3qm250S0+05HhXvCqGj5jlanBOEEDq8C5xPa3KgY5 GAIL6kmykTFUX14ycH6zupjizv4GfjTXUDKAQKJrILAVdmH33uZHU8f23p9dJuDKwabm gWxAO4pTqv4n7bqNSQUkvBfnDgotoUULCTaBycwebiXFwpRzFK+4V/gQDR1fjJiPelcc 20ZQ9oXIxJaceh8BVNa7nE0RyQVtkAGzQq4mQhOPi6dHL7mc+LxI/Dq5OuvZwjetqXsQ lNq/Sg8Ojw/GIEikL7jmKmCAJfTx/b03GpZWxv6FX8yJ4Whwa22t5RD5aeKI57kPN1Ku CaWA== 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=xvgls63EPMvkaCK9aLLPOG/qJlre0KKuaEBeTfM166Y=; b=UTjL6xV3sUGtWYHTlUZO5PSP3tn7Kky1gWlmFRjiD+0moY9zMGBTCeau7At73nLQjN /iR/UCz0RRNKTWmb7WhUtTYMkaab+VEoqkkcTcPFsJKujGmuV4PGc21M0cTQda1divQL YAQiC5heM3oi+s2Yk9C7vl20H5/elCDIo0/YklQBAL2fZ8IY8qw9O9kzTE7YX8GenlJx Hjff8I1qLsGXxYjbHndDtr36CYWYGnu+qYQQY6t5/zpeXBuiT/gssRJmmI2XFfoYs8xZ mYHeZJ0mPQzX4vhXdCQaLN+RfC4ec9DA3CFB9qQ6bq5mVzIymhzXBGkv4qwcLirCrDRj xsmg== X-Gm-Message-State: AOAM532jbgiKYQJJ0IEHMRtWZO46o5CbtjWYXFjDQJrXDcMdiA2CNYsr sMEBab0ZquV0rDFAhncUVDuZjK9Wa4/ONw== X-Google-Smtp-Source: ABdhPJxj8HlkjZhpsV2imlKQgemPDKO7WD1X/v0o3rcJ5gRT4xzkIPai9o4wt/xMelqReqnwEqSfCA== X-Received: by 2002:a65:5a8d:: with SMTP id c13mr248632pgt.268.1597963815704; Thu, 20 Aug 2020 15:50:15 -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.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:14 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:35 -0700 Message-Id: <1597963790-12362-9-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 08/23] datapath: don't unlock mutex when changing the user_features fails 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 4c76bf696a608ea5cc555fe97ec59a9033236604 Author: Tonghao Zhang Date: Fri Nov 1 22:23:53 2019 +0800 net: openvswitch: don't unlock mutex when changing the user_features fails Unlocking of a not locked mutex is not allowed. Other kernel thread may be in critical section while we unlock it because of setting user_feature fail. Fixes: 95a7233c4 ("net: openvswitch: Set OvS recirc_id from tc chain index") Cc: Paul Blakey Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: William Tu Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/datapath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 1235c4e..c222ef8 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1746,6 +1746,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) ovs_dp_reset_user_features(skb, info); } + ovs_unlock(); goto err_destroy_meters; } @@ -1762,7 +1763,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) return 0; err_destroy_meters: - ovs_unlock(); ovs_meters_exit(dp); err_destroy_ports_array: kfree(dp->ports); From patchwork Thu Aug 20 22:49:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348657 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=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=S8ThfFgw; 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 4BXfxp0NvRz9sPB for ; Fri, 21 Aug 2020 08:50:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 900A888568; Thu, 20 Aug 2020 22:50:36 +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 2laCVrT9nKWY; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id C74A688494; Thu, 20 Aug 2020 22:50:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B05FFC08A2; Thu, 20 Aug 2020 22:50:20 +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 3DE70C0051 for ; Thu, 20 Aug 2020 22:50:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2BF5F88575 for ; Thu, 20 Aug 2020 22:50:19 +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 3qrBL-QcTuwe for ; Thu, 20 Aug 2020 22:50:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 80AB588553 for ; Thu, 20 Aug 2020 22:50:18 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id v16so3746plo.1 for ; Thu, 20 Aug 2020 15:50:18 -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=8Tgf/Sb5B/o19WQu3xUIuscVh0OjCV9HkxkkaO9+EM0=; b=S8ThfFgwpuIGizU+fPcI7iyHznSnRBydJhoZa2Pgw2sNOH1PQLolnvsXgb2zIR+oRo /2nPv5VGNpGIjnlMzgbeN6SlHamDM/OQLdkVsiDkgi6r6CAkszfdO3TN5LhdbStTiS37 BxI/lvQhRuiYKgJHMDOhigbGIOTzHtK1k5lwEwU7XandURbnTfL5CQ8PPqWeO/8JKDUh 0YBPazanc13/GzMV9/2fGDXS5xua832LUFB3T9HchFI1+SSZv04QuHksqZKgvjbBqpHo Z0qcot3MQRbhKViMOZdoLAVOfFzDjSJsdJ3xNmVFeWTac9EDAfHSh/YAAjxGKsgPcLVc H6bg== 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=8Tgf/Sb5B/o19WQu3xUIuscVh0OjCV9HkxkkaO9+EM0=; b=AC6Q1UH3c9EXBbRW0zpPPE/gNFrGCk2HxexupXhwtc6D7DZFJBIb+v4jlAW+kevAsE 5Hp7hb8Ny9wsTgeyVpv3SZ5UlvuGPkYf08reEcx9r+kErV2T8uBWVAiMWVDfeU9Yt4DX O2qJ2dCasSkAI3VwHvVo9ORBSjG5StZdiBY7WazT4ltcVo8pSTbyhj35BHyDL3fZteNL Ok8V4XAH7rUj74FPNej9fHxHkstPTozwunKkYWUNm+CbJf9rN3BWHknvNBmj7bMTMiKs q3m9qkjrVXVe0EsN3DmAwOmvAjnXC7YkLkR7dibEHHWfy7zZgYlwnsXjH4xBUf3JWwIj huSQ== X-Gm-Message-State: AOAM5336tXxWMp+SpWRtu8KYxHyp6l/tIjoRrNxZQkH1d3l7JKTuehQ5 aCf8unCGEgnT2bXqDwT7in09SK7OL16vEA== X-Google-Smtp-Source: ABdhPJwbZWWrTS/nqQXs+LHdLAY1cM+yrBbdYmI2JhigYxMyy586v5h3qpe6HfPE4D6lPQtwzrCIDg== X-Received: by 2002:a17:90b:20d1:: with SMTP id ju17mr399645pjb.219.1597963817540; Thu, 20 Aug 2020 15:50:17 -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.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:16 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:36 -0700 Message-Id: <1597963790-12362-10-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 09/23] datapath: optimize flow-mask looking up 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 57f7d7b9164426c496300d254fd5167fbbf205ea Author: Tonghao Zhang Date: Fri Nov 1 22:23:49 2019 +0800 net: openvswitch: optimize flow-mask looking up The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. One bad case, for example: M means flow-mask is valid and NULL of flow-mask means deleted. +-------------------------------------------+ | M | NULL | ... | NULL | M| +-------------------------------------------+ In that case, without this patch, openvswitch will traverses all mask array, because there will be one flow-mask in the tail. This patch changes the way of flow-mask inserting and deleting, and the mask array will be keep as below: there is not a NULL hole. In the fast path, we can "break" "for" (not "continue") in flow_lookup when we get a NULL flow-mask. "break" v +-------------------------------------------+ | M | M | NULL |... | NULL | NULL| +-------------------------------------------+ This patch don't optimize slow or control path, still using ma->max to traverse. Slow path: * tbl_mask_array_realloc * ovs_flow_tbl_lookup_exact * flow_mask_find Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/flow_table.c | 103 ++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 76b390e..62d726d 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -540,8 +540,8 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, u32 *n_mask_hit, u32 *index) { - struct sw_flow_mask *mask; struct sw_flow *flow; + struct sw_flow_mask *mask; int i; if (*index < ma->max) { @@ -560,7 +560,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, mask = rcu_dereference_ovsl(ma->masks[i]); if (!mask) - continue; + break; flow = masked_flow_lookup(ti, key, mask, n_mask_hit); if (flow) { /* Found */ @@ -716,7 +716,7 @@ int ovs_flow_tbl_num_masks(const struct flow_table *table) struct mask_array *ma; ma = rcu_dereference_ovsl(table->mask_array); - return ma->count; + return READ_ONCE(ma->count); } static struct table_instance *table_instance_expand(struct table_instance *ti, @@ -725,21 +725,33 @@ static struct table_instance *table_instance_expand(struct table_instance *ti, return table_instance_rehash(ti, ti->n_buckets * 2, ufid); } -static void tbl_mask_array_delete_mask(struct mask_array *ma, - struct sw_flow_mask *mask) +static void tbl_mask_array_del_mask(struct flow_table *tbl, + struct sw_flow_mask *mask) { - int i; + struct mask_array *ma = ovsl_dereference(tbl->mask_array); + int i, ma_count = READ_ONCE(ma->count); /* Remove the deleted mask pointers from the array */ - for (i = 0; i < ma->max; i++) { - if (mask == ovsl_dereference(ma->masks[i])) { - RCU_INIT_POINTER(ma->masks[i], NULL); - ma->count--; - kfree_rcu(mask, rcu); - return; - } + for (i = 0; i < ma_count; i++) { + if (mask == ovsl_dereference(ma->masks[i])) + goto found; } + BUG(); + return; + +found: + WRITE_ONCE(ma->count, ma_count -1); + + rcu_assign_pointer(ma->masks[i], ma->masks[ma_count -1]); + RCU_INIT_POINTER(ma->masks[ma_count -1], NULL); + + kfree_rcu(mask, rcu); + + /* Shrink the mask array if necessary. */ + if (ma->max >= (MASK_ARRAY_SIZE_MIN * 2) && + ma_count <= (ma->max / 3)) + tbl_mask_array_realloc(tbl, ma->max / 2); } /* Remove 'mask' from the mask list, if it is not needed any more. */ @@ -753,18 +765,8 @@ static void flow_mask_remove(struct flow_table *tbl, struct sw_flow_mask *mask) BUG_ON(!mask->ref_count); mask->ref_count--; - if (!mask->ref_count) { - struct mask_array *ma; - - ma = ovsl_dereference(tbl->mask_array); - tbl_mask_array_delete_mask(ma, mask); - - /* Shrink the mask array if necessary. */ - if (ma->max >= (MASK_ARRAY_SIZE_MIN * 2) && - ma->count <= (ma->max / 3)) - tbl_mask_array_realloc(tbl, ma->max / 2); - - } + if (!mask->ref_count) + tbl_mask_array_del_mask(tbl, mask); } } @@ -828,6 +830,29 @@ static struct sw_flow_mask *flow_mask_find(const struct flow_table *tbl, return NULL; } +static int tbl_mask_array_add_mask(struct flow_table *tbl, + struct sw_flow_mask *new) +{ + struct mask_array *ma = ovsl_dereference(tbl->mask_array); + int err, ma_count = READ_ONCE(ma->count); + + if (ma_count >= ma->max) { + err = tbl_mask_array_realloc(tbl, ma->max + + MASK_ARRAY_SIZE_MIN); + if (err) + return err; + + ma = ovsl_dereference(tbl->mask_array); + } + + BUG_ON(ovsl_dereference(ma->masks[ma_count])); + + rcu_assign_pointer(ma->masks[ma_count], new); + WRITE_ONCE(ma->count, ma_count +1); + + return 0; +} + /* Add 'mask' into the mask list, if it is not already there. */ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, const struct sw_flow_mask *new) @@ -836,9 +861,6 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, mask = flow_mask_find(tbl, new); if (!mask) { - struct mask_array *ma; - int i; - /* Allocate a new mask if none exsits. */ mask = mask_alloc(); if (!mask) @@ -848,28 +870,9 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, mask->range = new->range; /* Add mask to mask-list. */ - ma = ovsl_dereference(tbl->mask_array); - if (ma->count >= ma->max) { - int err; - - err = tbl_mask_array_realloc(tbl, ma->max + - MASK_ARRAY_SIZE_MIN); - if (err) { - kfree(mask); - return err; - } - ma = ovsl_dereference(tbl->mask_array); - } - - for (i = 0; i < ma->max; i++) { - struct sw_flow_mask *t; - - t = ovsl_dereference(ma->masks[i]); - if (!t) { - rcu_assign_pointer(ma->masks[i], mask); - ma->count++; - break; - } + if (tbl_mask_array_add_mask(tbl, mask)) { + kfree(mask); + return -ENOMEM; } } else { From patchwork Thu Aug 20 22:49:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348668 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.136; helo=silver.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=UXc77fUZ; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfyx29x1z9sPB for ; Fri, 21 Aug 2020 08:51:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D54B623100; Thu, 20 Aug 2020 22:51:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M15HapD6iVnx; Thu, 20 Aug 2020 22:51:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 9C125230ED; Thu, 20 Aug 2020 22:50:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F0EAC08A9; Thu, 20 Aug 2020 22:50:23 +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 4AC51C08A6 for ; Thu, 20 Aug 2020 22:50:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4513386C2C for ; Thu, 20 Aug 2020 22:50:22 +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 mEuw6BLx5QPe for ; Thu, 20 Aug 2020 22:50:21 +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 fraxinus.osuosl.org (Postfix) with ESMTPS id 1849D86BE1 for ; Thu, 20 Aug 2020 22:50:19 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id o5so68047pgb.2 for ; Thu, 20 Aug 2020 15:50:19 -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=TDN0bcfJCLtzAI5WBhcGbIkKsdcWnb9o9SHRo4FNm/4=; b=UXc77fUZY8outsbF0HTanixj7f3j/zpfMSOqWLguXAcXpsoQRkIDyKKPrngO4d3On2 MGMXkIFxBicST3iGlGgX9tMhDyjz5dQYaQAlHo7TB+gEv0Eb0p/67or0W8LsNad5T1Gj RKIBtVSy4/WJJvMBZbIgZc4qOl0NPXpM3JJ3UE3KwJoGtaYXuLlRqk4CyhWmq6/PAZJh BYrZvS7GUC94rJq/ajQw3jpnqbZ0ZRBaWTLAiJM3cUgu8g+k1tIQV1AA5JPu6Socy8ag xeLMy0doOwf10E3eQuQRCVo75FVyQ0ZRrRBqxE1XA2CkjLIxmcuuCiA101vvT8wZq7fA FIhw== 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=TDN0bcfJCLtzAI5WBhcGbIkKsdcWnb9o9SHRo4FNm/4=; b=rvuAnzp4AsF3Y7ImZg8qBn5Wtiw4ULK8wVxboitlPs8S/bhmaXtMN9iBwh+f0mL2cT UKEqRCEJq2B+A6p+5nH18sFkGRPHPfwe6jV8Dn3S9JyU9TPZXdB/HcgPT9YrjcTbnf9/ JQjQZlkIcVm2Dbsrc8M0tnFGXH1bWzT2wk8ApA61HHUZNUSF9oJgvGiUgah4Q8eIwJO4 XEa3W0POzcLiIm70xiIZORxNq99yq12bpsA2p6o1avRw/DE57xQ+RFfAHowNmms6lZXt bWutAZnsoITXEiI9v4wegk9ZscmCOWzXSjOgM8jETxNrMfHl+FZifEfRlSQnA21kHdmh 7RsA== X-Gm-Message-State: AOAM530sbc0BeqfYEvXhj3v88NwMdPyCT6UBgNdUY74GfLd3shP+9p/P SbRjzFfsHqb4NeBVoGOsL/TOxaeUrfPY3A== X-Google-Smtp-Source: ABdhPJwbOM/i20CWFQkYXFrQjt5B8DWxiQOSKhy0iZ+g6uXxKB2MitjclBuNDWc7Gi7kZXeSEJXIWg== X-Received: by 2002:a62:53c2:: with SMTP id h185mr57039pfb.53.1597963819009; Thu, 20 Aug 2020 15:50:19 -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.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:18 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:37 -0700 Message-Id: <1597963790-12362-11-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 10/23] datapath: simplify the flow_hash 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 515b65a4b99197ae062a795ab4de919e6d04be04 Author: Tonghao Zhang Date: Fri Nov 1 22:23:50 2019 +0800 net: openvswitch: simplify the flow_hash Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: William Tu Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/flow_table.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 62d726d..7efaa80 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -455,13 +455,10 @@ err_free_ti: static u32 flow_hash(const struct sw_flow_key *key, const struct sw_flow_key_range *range) { - int key_start = range->start; - int key_end = range->end; - const u32 *hash_key = (const u32 *)((const u8 *)key + key_start); - int hash_u32s = (key_end - key_start) >> 2; + const u32 *hash_key = (const u32 *)((const u8 *)key + range->start); /* Make sure number of hash bytes are multiple of u32. */ - BUILD_BUG_ON(sizeof(long) % sizeof(u32)); + int hash_u32s = range_n_bytes(range) >> 2; return jhash2(hash_key, hash_u32s, 0); } From patchwork Thu Aug 20 22:49:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348681 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.136; helo=silver.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=Ag5s5xbj; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXg4V0QJgz9sPB for ; Fri, 21 Aug 2020 08:56:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 37F5C22E3F; Thu, 20 Aug 2020 22:56:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G77WIAivyUA0; Thu, 20 Aug 2020 22:56:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 70FF024BEF; Thu, 20 Aug 2020 22:51:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 46AC4C08A6; Thu, 20 Aug 2020 22:51:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A2F61C0894 for ; Thu, 20 Aug 2020 22:51:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 803FD24BE6 for ; Thu, 20 Aug 2020 22:51:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4ME8-HM0+LVo for ; Thu, 20 Aug 2020 22:51:05 +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 silver.osuosl.org (Postfix) with ESMTPS id 9E51423039 for ; Thu, 20 Aug 2020 22:50:21 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id r11so83079pfl.11 for ; Thu, 20 Aug 2020 15:50:21 -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=E0drZVeVbZgspvJfN7scw8ild6W58u3pdaw4p4uyuqI=; b=Ag5s5xbjklE1K4lFEo2VRanJu2zOrW9bofsXQp8j5W763/u+6BkF3QJ9fNcZxnh6lT kCmgn+ERRJ638oUeF800xa+Lj0BURsWubCkc4OQEZDTyYpUAnYzSknXq865lqqFfm7Bj J5Kgn+fJNKTiJoalUGo/9BRgRK1Pvib/H55040WxjG8S+b4b0gEBhXj6StTsNpx4ruuF A70G3jqGThKiwRwQQoJa/MqdURa9GThyVQHQwDIfvD/0LGMffzUQi6XP9/5Uu0ij4nf5 9mgzCwPVYEkzSUHgJs+y1w+QcKJ2qsGC58Tko+91czkNTYqxww3TYpgy1OEMPYZd80O7 Z/Gw== 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=E0drZVeVbZgspvJfN7scw8ild6W58u3pdaw4p4uyuqI=; b=niLJKtBjjC7PUZEVGxgxP2ciuSL9X+Ysx0igXQNnQj0yhvxh7asX8HfSJQmWlRkX/W ykIKK0FA/yTJrWM8Ecis8/HIdf/7yBMjqJAY1cgQsG59kqURIHD6xiBuHLUq64Wt/YoZ PNUipB2is3UsXjQRJAnIL9jPxUr9OSIuJLFLQaawOo/2j/i7Zaag7DWRCN+t4B/kOW3u sPID72ro06yTR+15Ow7BBVanrHWz0fk+TOoQQRW6BGOylGAFOX46vBvIRN9OJEjFi8wa Xz+0IXbAgfqjeunnQsCceWijd6rvObjMZaaNcsNILpH/GiFC1SP0QYc31H1y0rC+1ZCi 8CvQ== X-Gm-Message-State: AOAM533KUDE/2OW3oP1csoqzav6mziEDb0wwQ23jeHM0SkpszPLnLcuj hR5uR0ymjeio4MjXDx2kdhc+uf4kRNDLEg== X-Google-Smtp-Source: ABdhPJyzQgdaBzO/KNNPUeS0DxGbEBReBP4FzGk2co9stDLvp6AGGbOdkvrAV9TK49+PrunwJ9iomA== X-Received: by 2002:a63:444a:: with SMTP id t10mr231334pgk.33.1597963820661; Thu, 20 Aug 2020 15:50:20 -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.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:19 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:38 -0700 Message-Id: <1597963790-12362-12-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 11/23] datapath: add likely in flow_lookup 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 0a3e01371db17d753dd92ec4d0fc6247412d3b01 Author: Tonghao Zhang Date: Fri Nov 1 22:23:51 2019 +0800 net: openvswitch: add likely in flow_lookup The most case *index < ma->max, and flow-mask is not NULL. We add un/likely for performance. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: William Tu Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/flow_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 7efaa80..ca2efe9 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -541,7 +541,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, struct sw_flow_mask *mask; int i; - if (*index < ma->max) { + if (likely(*index < ma->max)) { mask = rcu_dereference_ovsl(ma->masks[*index]); if (mask) { flow = masked_flow_lookup(ti, key, mask, n_mask_hit); @@ -556,7 +556,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, continue; mask = rcu_dereference_ovsl(ma->masks[i]); - if (!mask) + if (unlikely(!mask)) break; flow = masked_flow_lookup(ti, key, mask, n_mask_hit); From patchwork Thu Aug 20 22:49:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348659 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=JtX5VDpo; 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 4BXfxv5W6Lz9sPB for ; Fri, 21 Aug 2020 08:50:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0E7CD885E3; Thu, 20 Aug 2020 22:50: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 opMxV9KGSYLK; Thu, 20 Aug 2020 22:50:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id A2992885EC; Thu, 20 Aug 2020 22:50:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7F954C08A6; Thu, 20 Aug 2020 22:50:32 +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 C64A9C08A8 for ; Thu, 20 Aug 2020 22:50:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 73E9E86C2D for ; Thu, 20 Aug 2020 22:50:28 +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 uhagPlbIRXiD for ; Thu, 20 Aug 2020 22:50:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4551386BEF for ; Thu, 20 Aug 2020 22:50:23 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id d188so102770pfd.2 for ; Thu, 20 Aug 2020 15:50:23 -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=FrCJxLP3b5RVndhAlM0SAvoAuqaSzuc1gZI8rQegPUE=; b=JtX5VDpoihau8urRfO8SHE354rCo3/3G6ZRtNCSFi5eTlfFBjq8U0bTz6TDQna0y29 5C9xPQm5CnEi9XayChcb5OJKM45bd7AKATAND4AZ/DE8n5Fmk0I5Qmi5Y+nXL0fi2++W XHAJtqvnXwqMIyaf63nhY3uepIpHnhCiSGA4Jkyi4N9DeiWg3JxwtQg2KizLk+9PjNFQ HNIho7L3GrPVUWnZLQC0uKbII8lNh4dsPLSzgpyOyetbjvtAvGeLhcUeLKxxpcx390SP ZzdSg+HJ2TPUcJdeSl1TXHjalvLx/WK+OSoAuUe8GS5lUapLgZmX3DGv/3SWRsbmBElM Ig9Q== 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=FrCJxLP3b5RVndhAlM0SAvoAuqaSzuc1gZI8rQegPUE=; b=WLSUEdqWXMEx3LFo9rxrmQuWoGbE0lbNp6yVTTMM426FJ6ImUTKMi4Szzo+QFbN0Eq 9yVmWvZ/jp50jdc87X+E1XTL7XRj9mkAoQiWkEtjWGEY4bitzBTaVBo4Iybs8DDrVyCN b0VPQ28Q68KM9BZYRWTOXyduTbQv29KnB2TtwtCXpGJulRb2EpXJzUaQsV0sGw4qRjJA 7EztRo3TIAuFTzN2ttJQ1VRxule2dDgLCl/D34wk+6Tvl7WOAvPQiYwHq4DgBajkoOFk rPrGXRKVP1PQbSlzD55Uwh6cQ1sQi22o+VwDxoVsnjElzYFxAvsg3vacG7Et7GZYmRFX mHDQ== X-Gm-Message-State: AOAM5332bhF7RYACkWJ27ygpzsIIVy4vMK6LoRx9ee4Jv6ObWAxoPeVE XVlBih3O98QH96ZpdYJllnhTdUEnV31ECQ== X-Google-Smtp-Source: ABdhPJxDzy2i1HPPal19mho+VpzAkJ1qkmSWnjDF93VvP3x67GkikS6vW5yGiltu5oHPjWLhf4K/eg== X-Received: by 2002:a65:52c3:: with SMTP id z3mr215607pgp.417.1597963822213; Thu, 20 Aug 2020 15:50:22 -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.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:21 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:39 -0700 Message-Id: <1597963790-12362-13-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 12/23] datapath: fix possible memleak on destroy flow-table 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 50b0e61b32ee890a75b4377d5fbe770a86d6a4c1 Author: Tonghao Zhang Date: Fri Nov 1 22:23:52 2019 +0800 net: openvswitch: fix possible memleak on destroy flow-table When we destroy the flow tables which may contain the flow_mask, so release the flow mask struct. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Added additional compat layer fixup for WRITE_ONCE() Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/flow_table.c | 186 +++++++++++++------------ datapath/linux/compat/include/linux/compiler.h | 13 ++ 2 files changed, 111 insertions(+), 88 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index ca2efe9..bd05dd3 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -234,6 +234,74 @@ static int tbl_mask_array_realloc(struct flow_table *tbl, int size) return 0; } +static int tbl_mask_array_add_mask(struct flow_table *tbl, + struct sw_flow_mask *new) +{ + struct mask_array *ma = ovsl_dereference(tbl->mask_array); + int err, ma_count = READ_ONCE(ma->count); + + if (ma_count >= ma->max) { + err = tbl_mask_array_realloc(tbl, ma->max + + MASK_ARRAY_SIZE_MIN); + if (err) + return err; + + ma = ovsl_dereference(tbl->mask_array); + } + + BUG_ON(ovsl_dereference(ma->masks[ma_count])); + + rcu_assign_pointer(ma->masks[ma_count], new); + WRITE_ONCE(ma->count, ma_count +1); + + return 0; +} + +static void tbl_mask_array_del_mask(struct flow_table *tbl, + struct sw_flow_mask *mask) +{ + struct mask_array *ma = ovsl_dereference(tbl->mask_array); + int i, ma_count = READ_ONCE(ma->count); + + /* Remove the deleted mask pointers from the array */ + for (i = 0; i < ma_count; i++) { + if (mask == ovsl_dereference(ma->masks[i])) + goto found; + } + + BUG(); + return; + +found: + WRITE_ONCE(ma->count, ma_count -1); + + rcu_assign_pointer(ma->masks[i], ma->masks[ma_count -1]); + RCU_INIT_POINTER(ma->masks[ma_count -1], NULL); + + kfree_rcu(mask, rcu); + + /* Shrink the mask array if necessary. */ + if (ma->max >= (MASK_ARRAY_SIZE_MIN * 2) && + ma_count <= (ma->max / 3)) + tbl_mask_array_realloc(tbl, ma->max / 2); +} + +/* Remove 'mask' from the mask list, if it is not needed any more. */ +static void flow_mask_remove(struct flow_table *tbl, struct sw_flow_mask *mask) +{ + if (mask) { + /* ovs-lock is required to protect mask-refcount and + * mask list. + */ + ASSERT_OVSL(); + BUG_ON(!mask->ref_count); + mask->ref_count--; + + if (!mask->ref_count) + tbl_mask_array_del_mask(tbl, mask); + } +} + int ovs_flow_tbl_init(struct flow_table *table) { struct table_instance *ti, *ufid_ti; @@ -280,7 +348,28 @@ static void flow_tbl_destroy_rcu_cb(struct rcu_head *rcu) __table_instance_destroy(ti); } -static void table_instance_destroy(struct table_instance *ti, +static void table_instance_flow_free(struct flow_table *table, + struct table_instance *ti, + struct table_instance *ufid_ti, + struct sw_flow *flow, + bool count) +{ + hlist_del_rcu(&flow->flow_table.node[ti->node_ver]); + if (count) + table->count--; + + if (ovs_identifier_is_ufid(&flow->id)) { + hlist_del_rcu(&flow->ufid_table.node[ufid_ti->node_ver]); + + if (count) + table->ufid_count--; + } + + flow_mask_remove(table, flow->mask); +} + +static void table_instance_destroy(struct flow_table *table, + struct table_instance *ti, struct table_instance *ufid_ti, bool deferred) { @@ -297,13 +386,12 @@ static void table_instance_destroy(struct table_instance *ti, struct sw_flow *flow; struct hlist_head *head = &ti->buckets[i]; struct hlist_node *n; - int ver = ti->node_ver; - int ufid_ver = ufid_ti->node_ver; - hlist_for_each_entry_safe(flow, n, head, flow_table.node[ver]) { - hlist_del_rcu(&flow->flow_table.node[ver]); - if (ovs_identifier_is_ufid(&flow->id)) - hlist_del_rcu(&flow->ufid_table.node[ufid_ver]); + hlist_for_each_entry_safe(flow, n, head, + flow_table.node[ti->node_ver]) { + + table_instance_flow_free(table, ti, ufid_ti, + flow, false); ovs_flow_free(flow, deferred); } } @@ -328,7 +416,7 @@ void ovs_flow_tbl_destroy(struct flow_table *table) free_percpu(table->mask_cache); kfree(rcu_dereference_raw(table->mask_array)); - table_instance_destroy(ti, ufid_ti, false); + table_instance_destroy(table, ti, ufid_ti, false); } struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti, @@ -444,7 +532,7 @@ int ovs_flow_tbl_flush(struct flow_table *flow_table) flow_table->count = 0; flow_table->ufid_count = 0; - table_instance_destroy(old_ti, old_ufid_ti, true); + table_instance_destroy(flow_table, old_ti, old_ufid_ti, true); return 0; err_free_ti: @@ -722,51 +810,6 @@ static struct table_instance *table_instance_expand(struct table_instance *ti, return table_instance_rehash(ti, ti->n_buckets * 2, ufid); } -static void tbl_mask_array_del_mask(struct flow_table *tbl, - struct sw_flow_mask *mask) -{ - struct mask_array *ma = ovsl_dereference(tbl->mask_array); - int i, ma_count = READ_ONCE(ma->count); - - /* Remove the deleted mask pointers from the array */ - for (i = 0; i < ma_count; i++) { - if (mask == ovsl_dereference(ma->masks[i])) - goto found; - } - - BUG(); - return; - -found: - WRITE_ONCE(ma->count, ma_count -1); - - rcu_assign_pointer(ma->masks[i], ma->masks[ma_count -1]); - RCU_INIT_POINTER(ma->masks[ma_count -1], NULL); - - kfree_rcu(mask, rcu); - - /* Shrink the mask array if necessary. */ - if (ma->max >= (MASK_ARRAY_SIZE_MIN * 2) && - ma_count <= (ma->max / 3)) - tbl_mask_array_realloc(tbl, ma->max / 2); -} - -/* Remove 'mask' from the mask list, if it is not needed any more. */ -static void flow_mask_remove(struct flow_table *tbl, struct sw_flow_mask *mask) -{ - if (mask) { - /* ovs-lock is required to protect mask-refcount and - * mask list. - */ - ASSERT_OVSL(); - BUG_ON(!mask->ref_count); - mask->ref_count--; - - if (!mask->ref_count) - tbl_mask_array_del_mask(tbl, mask); - } -} - /* Must be called with OVS mutex held. */ void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) { @@ -774,17 +817,7 @@ void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) struct table_instance *ufid_ti = ovsl_dereference(table->ufid_ti); BUG_ON(table->count == 0); - hlist_del_rcu(&flow->flow_table.node[ti->node_ver]); - table->count--; - if (ovs_identifier_is_ufid(&flow->id)) { - hlist_del_rcu(&flow->ufid_table.node[ufid_ti->node_ver]); - table->ufid_count--; - } - - /* RCU delete the mask. 'flow->mask' is not NULLed, as it should be - * accessible as long as the RCU read lock is held. - */ - flow_mask_remove(table, flow->mask); + table_instance_flow_free(table, ti, ufid_ti, flow, true); } static struct sw_flow_mask *mask_alloc(void) @@ -827,29 +860,6 @@ static struct sw_flow_mask *flow_mask_find(const struct flow_table *tbl, return NULL; } -static int tbl_mask_array_add_mask(struct flow_table *tbl, - struct sw_flow_mask *new) -{ - struct mask_array *ma = ovsl_dereference(tbl->mask_array); - int err, ma_count = READ_ONCE(ma->count); - - if (ma_count >= ma->max) { - err = tbl_mask_array_realloc(tbl, ma->max + - MASK_ARRAY_SIZE_MIN); - if (err) - return err; - - ma = ovsl_dereference(tbl->mask_array); - } - - BUG_ON(ovsl_dereference(ma->masks[ma_count])); - - rcu_assign_pointer(ma->masks[ma_count], new); - WRITE_ONCE(ma->count, ma_count +1); - - return 0; -} - /* Add 'mask' into the mask list, if it is not already there. */ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, const struct sw_flow_mask *new) diff --git a/datapath/linux/compat/include/linux/compiler.h b/datapath/linux/compat/include/linux/compiler.h index 65f3ba6..e15c61d 100644 --- a/datapath/linux/compat/include/linux/compiler.h +++ b/datapath/linux/compat/include/linux/compiler.h @@ -15,4 +15,17 @@ #define READ_ONCE(x) (x) #endif +#ifndef WRITE_ONCE +#define __WRITE_ONCE(x, val) \ +do { \ + *(volatile typeof(x) *)&(x) = (val); \ +} while (0) + +#define WRITE_ONCE(x, val) \ +do { \ + __WRITE_ONCE(x, val); \ +} while (0) +#endif + + #endif From patchwork Thu Aug 20 22:49:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348655 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=utDzD8D3; 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 4BXfxk4WgZz9sPf for ; Fri, 21 Aug 2020 08:50:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B923386C6E; Thu, 20 Aug 2020 22:50:32 +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 vjcRvmUaeFAk; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7CAD386C5A; Thu, 20 Aug 2020 22:50:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 581DEC0889; Thu, 20 Aug 2020 22:50:27 +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 B1DDBC0051 for ; Thu, 20 Aug 2020 22:50:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 95DFE885BA for ; Thu, 20 Aug 2020 22:50:25 +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 RJ1MqCBNNKsN for ; Thu, 20 Aug 2020 22:50:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 6F533885AD for ; Thu, 20 Aug 2020 22:50:24 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id f5so1704721plr.9 for ; Thu, 20 Aug 2020 15:50:24 -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=wyHL8Qyzto0X/9z/JC6XbnxL46oKqu3ppxAOrUK5ZBA=; b=utDzD8D3PwdDBJkn9DaOpDnBawP7RJwkSpQzfyzjOGfq3oX0liaR16vcmPA+4n9ZCI 2OhtadfcxbQ13MaU7xv5rTp/9AOOd/bH5/iVMj4tlklwFaZ+MIeet4kCQSR/NWGm0xG1 /nLt2TjD3W5K+rFF7k7j/vWpfhvLjAI+gR78bA4/tHtr+ICvIp/7kqTXdWosdqQkl1L9 F1dSODB6Spz3JeE38MgXiVaO5HobudxFRHzjtg4Gh7WHWXwxiBl+6iM1jKIGyyygk4P3 sEf0arJakN2KJR5lWf6rwtI9kTn1lEm67hQihl16GQ/S5N1EoxF2Si0Gc6Em8Vt4lndP 4pbA== 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=wyHL8Qyzto0X/9z/JC6XbnxL46oKqu3ppxAOrUK5ZBA=; b=O7Znfy4Vs4X02/iNIBW+80jSOy9uY5zpjVkNbjJehRkV41ArXreKYaxA4yUFgHRFNm xZoaUrCUoVgichkWZpK05Y01WEsUpmtnCrwE1t2M+w+nFPwTYxPL2qQ17iSYS/CcDghA xSPcq2a9vbctnaQxVu6dYMcPjLq+Y0OO9rZdoXlYWrwRS498UrPkIiAu3ZCZzYMjex93 GURYX7EGzyJKQsITKc09FXpBwWuK6VlxD8gEGVY4otcFhhrGuOGE3Sd2/RukyiYh6KHx dyq+qIbfXWoY8QyNIRHJ2jDcitNxErAEQCz/LF0PGGK6/tc+/XUyrefSv/EN2/rx5Rz0 NKRw== X-Gm-Message-State: AOAM533jmZaMXRqape1NlsAgGocbpKLTF5gDGRw1Oa0k8UEn9R16YQ6Z qOhlkHUw1Ale+IoyisRlBtMH+R4qodMmXA== X-Google-Smtp-Source: ABdhPJws9cWnKoGZgTJAHFw2m3ZtmxvIh1kR138dTjCwKFJsVq35iWvQAsZj3hsqMt81X8hTELq4QA== X-Received: by 2002:a17:90a:aa8e:: with SMTP id l14mr90945pjq.67.1597963823628; Thu, 20 Aug 2020 15:50:23 -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.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:22 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:40 -0700 Message-Id: <1597963790-12362-14-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 13/23] datapath: simplify the ovs_dp_cmd_new 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 eec62eadd1d757b0743ccbde55973814f3ad396e Author: Tonghao Zhang Date: Fri Nov 1 22:23:54 2019 +0800 net: openvswitch: simplify the ovs_dp_cmd_new use the specified functions to init resource. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/datapath.c | 60 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index c222ef8..f04ce21 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1665,6 +1665,31 @@ static int ovs_dp_change(struct datapath *dp, struct nlattr *a[]) return 0; } +static int ovs_dp_stats_init(struct datapath *dp) +{ + dp->stats_percpu = netdev_alloc_pcpu_stats(struct dp_stats_percpu); + if (!dp->stats_percpu) + return -ENOMEM; + + return 0; +} + +static int ovs_dp_vport_init(struct datapath *dp) +{ + int i; + + dp->ports = kmalloc_array(DP_VPORT_HASH_BUCKETS, + sizeof(struct hlist_head), + GFP_KERNEL); + if (!dp->ports) + return -ENOMEM; + + for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) + INIT_HLIST_HEAD(&dp->ports[i]); + + return 0; +} + static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) { struct nlattr **a = info->attrs; @@ -1673,7 +1698,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) struct datapath *dp; struct vport *vport; struct ovs_net *ovs_net; - int err, i; + int err; err = -EINVAL; if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID]) @@ -1686,35 +1711,26 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) err = -ENOMEM; dp = kzalloc(sizeof(*dp), GFP_KERNEL); if (dp == NULL) - goto err_free_reply; + goto err_destroy_reply; ovs_dp_set_net(dp, sock_net(skb->sk)); /* Allocate table. */ err = ovs_flow_tbl_init(&dp->table); if (err) - goto err_free_dp; + goto err_destroy_dp; - dp->stats_percpu = netdev_alloc_pcpu_stats(struct dp_stats_percpu); - if (!dp->stats_percpu) { - err = -ENOMEM; + err = ovs_dp_stats_init(dp); + if (err) goto err_destroy_table; - } - dp->ports = kmalloc_array(DP_VPORT_HASH_BUCKETS, - sizeof(struct hlist_head), - GFP_KERNEL); - if (!dp->ports) { - err = -ENOMEM; - goto err_destroy_percpu; - } - - for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) - INIT_HLIST_HEAD(&dp->ports[i]); + err = ovs_dp_vport_init(dp); + if (err) + goto err_destroy_stats; err = ovs_meters_init(dp); if (err) - goto err_destroy_ports_array; + goto err_destroy_ports; /* Set up our datapath device. */ parms.name = nla_data(a[OVS_DP_ATTR_NAME]); @@ -1764,15 +1780,15 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) err_destroy_meters: ovs_meters_exit(dp); -err_destroy_ports_array: +err_destroy_ports: kfree(dp->ports); -err_destroy_percpu: +err_destroy_stats: free_percpu(dp->stats_percpu); err_destroy_table: ovs_flow_tbl_destroy(&dp->table); -err_free_dp: +err_destroy_dp: kfree(dp); -err_free_reply: +err_destroy_reply: kfree_skb(reply); err: return err; 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); From patchwork Thu Aug 20 22:49:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348658 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=N87zNIHo; 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 4BXfxp37Jvz9sPf for ; Fri, 21 Aug 2020 08:50:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B76808855F; Thu, 20 Aug 2020 22:50:36 +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 lgFMxTlVC95g; Thu, 20 Aug 2020 22:50:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 6A178885B5; Thu, 20 Aug 2020 22:50:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4FC0DC08A8; Thu, 20 Aug 2020 22:50:31 +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 86EBEC08A2 for ; Thu, 20 Aug 2020 22:50:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6E4438853D for ; Thu, 20 Aug 2020 22:50:28 +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 6keBsOe3YFzz for ; Thu, 20 Aug 2020 22:50:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by hemlock.osuosl.org (Postfix) with ESMTPS id A4AEA8856C for ; Thu, 20 Aug 2020 22:50:27 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id kr4so93084pjb.2 for ; Thu, 20 Aug 2020 15:50:27 -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=l1C40JIK8GpqHiXirctRDKmrElQBebl3B0hZsxDuKps=; b=N87zNIHoxYGrrPpIskZE8AQHQrEGcOsi2dpKfOrlTLtxvw/lo8XvADB3wQXb5YJxfL RVZUStT0vImOBbzLSlKX99ML6rB7gg3rqYoIjzCX0uQjDEKCOWJ/1hYGtOuttIXEpKuJ TNwj7GMzahv0iW4FwIfvYlq/7AoSA3TRhfe3Xy2o8QleMSO7skOyQHUKTxqeEGJJMAcc Fx1DQwnlo8MzrMuSMr9S2uFkTwcg05f1IzM/SGDafd3M2Zhr6iCcXmydiO8VYPxm0cgv 9Zoxpv+w8MLcSStS24S7oFKBweyWUyPVlJjACRRQz1z3/Qvodm1EzxAR23PKNAetKJ9n r1Iw== 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=l1C40JIK8GpqHiXirctRDKmrElQBebl3B0hZsxDuKps=; b=iOVyQKJ430vPfdXSS4FWucgUPVJflCBE133cxMz70kuF5LjrcaI3rBRiszfzGQvnJG d+3yQBJD/X5lpbLCPisVVGVziJsg2Oe80o3XLBcbCgq3Zqc7Ool0fQno/M4D95aDag5O JKosJDLOKdrhKIw0ILuRnMlz3MXCYcsoylbY8BzuJT3S9nPaHVDjfFOtP0QGTmHOcE05 GZ8aW0CmlDEmbvtlh2SZGwTStN9ZZrpO2bdfeDelDImz2OLd27v65OXlCDMRODxTg5u/ hU3NFvunfSImdgGXxkpqmXzMtOwU8FReW/jF5mLsvIz3fTUo/HQ/h7HrQ+yEJ53gAdqP 3BTQ== X-Gm-Message-State: AOAM531PvFFvl86PjKP7bPyMh/qcJzuCtMGGMQfQvi9EtMlTVepLY5sH ro8/OPC86b4On/nnzcoXL8r4RVcpeLO2Dg== X-Google-Smtp-Source: ABdhPJyvGjg+mZpWWr1529F2s6O2Bv8pwCqtsEFgUtYBrycTR8IrRNwNJHwOpxKiVqoXRTK2HSkLnQ== X-Received: by 2002:a17:902:c212:: with SMTP id 18mr22248pll.250.1597963826889; Thu, 20 Aug 2020 15:50:26 -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.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:26 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:42 -0700 Message-Id: <1597963790-12362-16-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 15/23] datapath: don't call pad_packet if not necessary 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 61ca533c0e94104c35fcb7858a23ec9a05d78143 Author: Tonghao Zhang Date: Thu Nov 14 23:51:08 2019 +0800 net: openvswitch: don't call pad_packet if not necessary The nla_put_u16/nla_put_u32 makes sure that *attrlen is align. The call tree is that: nla_put_u16/nla_put_u32 -> nla_put attrlen = sizeof(u16) or sizeof(u32) -> __nla_put attrlen -> __nla_reserve attrlen -> skb_put(skb, nla_total_size(attrlen)) nla_total_size returns the total length of attribute including padding. Cc: Joe Stringer Cc: William Tu 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/datapath.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index f04ce21..b9ac676 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -512,23 +512,17 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, } /* Add OVS_PACKET_ATTR_MRU */ - if (upcall_info->mru) { - if (nla_put_u16(user_skb, OVS_PACKET_ATTR_MRU, - upcall_info->mru)) { - err = -ENOBUFS; - goto out; - } - pad_packet(dp, user_skb); + if (upcall_info->mru && + nla_put_u16(user_skb, OVS_PACKET_ATTR_MRU, upcall_info->mru)) { + err = -ENOBUFS; + goto out; } /* Add OVS_PACKET_ATTR_LEN when packet is truncated */ - if (cutlen > 0) { - if (nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN, - skb->len)) { - err = -ENOBUFS; - goto out; - } - pad_packet(dp, user_skb); + if (cutlen > 0 && + nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN, skb->len)) { + err = -ENOBUFS; + goto out; } /* Add OVS_PACKET_ATTR_HASH */ From patchwork Thu Aug 20 22:49:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348670 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=u8n+eiEK; 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 4BXfzK0LqLz9sPB for ; Fri, 21 Aug 2020 08:51:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 91F5586C2B; Thu, 20 Aug 2020 22:51:55 +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 1Axjs0Y_1ywr; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4AB186BA3; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B8DD7C0894; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8D859C0051 for ; Thu, 20 Aug 2020 22:51:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 50FAE22B20 for ; Thu, 20 Aug 2020 22:51:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hQ4cf7m4AiYE for ; Thu, 20 Aug 2020 22:51:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by silver.osuosl.org (Postfix) with ESMTPS id 8C04622C51 for ; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id kr4so93109pjb.2 for ; Thu, 20 Aug 2020 15:50:29 -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=7awIBLTMVn7gn5J/owbZt6uiaZGm0ko5Fdgz76OonQI=; b=u8n+eiEKy0+gj6WkpqNvgK5F3Y64yHGTv9KLDlv9R4b0RsKdVb2eLA2e5GOQqGsf8O gGNMudyjM9wV/LXVvLT+V8DaAZ/rX+LukKYm2GQ7vNPxLqi03QiVio/iGXkBCl98LEGo hP+xDqZNUyPeoI6lmaSHAt1W7SBnTyVrcL4Zl7lS0GcD0gYbeK63yo6FBCYQxXjZoYqd 2QTEhzA2/l4xG6xtnm8Z6qt0y2mNxu9htwJ5JtlgzRXOXnBLrwNiLgI3chvlBqNN2H2m a8aCvSdzKWbcpU20FVe3A7qphfg4+640/fb61cEPDsyv7lmxdUOX0FcA2DUL59Yi4QTF eAAg== 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=7awIBLTMVn7gn5J/owbZt6uiaZGm0ko5Fdgz76OonQI=; b=EsVQVaJS3p7Jsq471GpFcUzixWwiruFR8wWDhmzxvFqPKLm0ThvGmGJwX4BeUC0aVG 9EkDCpVHbPQQIcdIpKhUcyJlx7297rqMmbgh1mYH4wLDe4T25ddDhbMpkANqfjBCvhHy eDvsPlP1BWusRauoQZMAdqdHlQ7cGHzAOzuC4efxDbuP74SnKDdvpygSjguvLhrrg2AE Fx+mk7fXkOuUvfvIbd4DvGnTrxPStcK4Dlbap0wnusuKPpPNm8cZHubz6mCrXRkulwsr YoJ1wWWVnBwbNynKlHNXBCK3TVNmz5pFXveztIxZurDhR0Vb663VqVgmgrmTZBJPEmQZ dvAg== X-Gm-Message-State: AOAM532RAy7+Pzj2Xxo3zPXLAVPwvo4IbSbnTQ7kDeRVyY3PU6CZMFZ0 3k2ZCz78wX9cvWlxshXVNGVjK/4w4q+dXg== X-Google-Smtp-Source: ABdhPJxRz0GkbwhfNQDAYvvWAMJtZlt3jPdqUXmcDFnacp/EH54LOqWajAc+XuzbmXYHPcShoWa7eQ== X-Received: by 2002:a17:90a:aa90:: with SMTP id l16mr17609pjq.210.1597963828536; Thu, 20 Aug 2020 15:50:28 -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.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:27 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:43 -0700 Message-Id: <1597963790-12362-17-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH 16/23] datapath: fix flow command message size 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: Paolo Abeni Upstream commit: commit 4e81c0b3fa93d07653e2415fa71656b080a112fd Author: Paolo Abeni Date: Tue Nov 26 12:55:50 2019 +0100 openvswitch: fix flow command message size When user-space sets the OVS_UFID_F_OMIT_* flags, and the relevant flow has no UFID, we can exceed the computed size, as ovs_nla_put_identifier() will always dump an OVS_FLOW_ATTR_KEY attribute. Take the above in account when computing the flow command message size. Fixes: 74ed7ab9264c ("openvswitch: Add support for unique flow IDs.") Reported-by: Qi Jun Ding Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index b9ac676..047b331 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -763,9 +763,13 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts, { size_t len = NLMSG_ALIGN(sizeof(struct ovs_header)); - /* OVS_FLOW_ATTR_UFID */ + /* OVS_FLOW_ATTR_UFID, or unmasked flow key as fallback + * see ovs_nla_put_identifier() + */ if (sfid && ovs_identifier_is_ufid(sfid)) len += nla_total_size(sfid->ufid_len); + else + len += nla_total_size(ovs_key_attr_size()); /* OVS_FLOW_ATTR_KEY */ if (!sfid || should_fill_key(sfid, ufid_flags)) From patchwork Thu Aug 20 22:49:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348671 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=R0bNfXEJ; 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 4BXfzX5jZQz9sPB for ; Fri, 21 Aug 2020 08:52:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5925686BEC; Thu, 20 Aug 2020 22:52:07 +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 ISEenWnqysKK; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id D3EB286C78; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BB525C0889; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6B74C0051 for ; Thu, 20 Aug 2020 22:52:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B44CD25351 for ; Thu, 20 Aug 2020 22:52:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ulpTjvT1odig for ; Thu, 20 Aug 2020 22:51:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by silver.osuosl.org (Postfix) with ESMTPS id 9927C232BD for ; Thu, 20 Aug 2020 22:50:31 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id 17so87587pfw.9 for ; Thu, 20 Aug 2020 15:50:31 -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=9etBSQ7JIQ6y9CxL1NFQnmHQir8YITBb9xr/yGYQXCo=; b=R0bNfXEJPsleKBtKLMPxPXoq710DVlbD/vtQXGPSGwXuGsqTtJre1VV+/rd91fIA+g cFUHDHWha7kHmUKf2JXVX93zpSrGWKgBSXDwY7l+070u6ye3Z7ymMypHzH+NcR7mYY0H LrjpEwlW0T7lN8ZOUSOeMejQLtM/RJfifGjpUGTWLe45Oja0EpIFfRMIxv29dnI+pq3i sb0FVSAUfAtVPAmoXwyIdT5/sXOhDJ6fBrmixFVn2bswP0/7ExErWY9/iKLnIOiWhtVT 6+/RVp6KqZbbjD8Z4UcihWmAtbKu9M6OaBUrLnOvoYswL4r/1gGrzVV+9xGr7XRBeLWI EYzQ== 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=9etBSQ7JIQ6y9CxL1NFQnmHQir8YITBb9xr/yGYQXCo=; b=Cu00zovWoi2XyOwUavc6b9mRS9VpZc7UydAE4tdPXzPt8J7eTZYUvBzrzwZchg45JB 3rXp5ngt4125bYR4CAP8gCg08dpcChGzwglfg5uxCkzamE3H6/Y861+AeIOHzg6tQDvs o8LNcL3Ai4LcRWTTZP+Hjtf4yoOm0dbv1B29xMmXY+BId3kwMoXw4l1Q+1Za4s2XYhjX 2Bz5ewhywgSx6REr28Ynsjg83yS1hnK3RJoSZMs9esy6qjuKcKyo6EK5bZOD1wl6UZr7 k5oaEyiwk/XH0yevgluOFN1Gl84oixdoIYuicb4qTUX+XavWho8dAH2UAlpW0GtwqCXU y1dA== X-Gm-Message-State: AOAM533n3ZflCOrf2L06ehT4dNz1vGmXMrTW8kiYQ4CVByvC125zh9lN b9ztx+L8cccrFpqLBhiifktBuxVnMblQ4A== X-Google-Smtp-Source: ABdhPJziaW0L3ho1jfAifiC5+lJsrdrRtQsVWYfSbxl8FHTUhyvGBAJ0FbrAKoWYix2rCapJWia/rg== X-Received: by 2002:aa7:984e:: with SMTP id n14mr65309pfq.272.1597963830137; Thu, 20 Aug 2020 15:50:30 -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.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:29 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:44 -0700 Message-Id: <1597963790-12362-18-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH 17/23] datapath: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() 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: Paolo Abeni Upstream commit: commit 8ffeb03fbba3b599690b361467bfd2373e8c450f Author: Paolo Abeni Date: Sun Dec 1 18:41:24 2019 +0100 openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() All the callers of ovs_flow_cmd_build_info() already deal with error return code correctly, so we can handle the error condition in a more gracefull way. Still dump a warning to preserve debuggability. v1 -> v2: - clarify the commit message - clean the skb and report the error (DaveM) Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.") Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 047b331..877c8bd 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -946,7 +946,10 @@ static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow, retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb, info->snd_portid, info->snd_seq, 0, cmd, ufid_flags); - BUG_ON(retval < 0); + if (WARN_ON_ONCE(retval < 0)) { + kfree_skb(skb); + skb = ERR_PTR(retval); + } return skb; } From patchwork Thu Aug 20 22:49:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348669 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=QLPSZCB4; 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 4BXfz04vVhz9sPB for ; Fri, 21 Aug 2020 08:51:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5849C8854C; Thu, 20 Aug 2020 22:51:38 +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 5ydOCx8Yizav; Thu, 20 Aug 2020 22:51:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 9C52288612; Thu, 20 Aug 2020 22:51:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 788CDC0894; Thu, 20 Aug 2020 22:51:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0EA43C0889 for ; Thu, 20 Aug 2020 22:51:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E3D288865D for ; Thu, 20 Aug 2020 22:51:16 +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 d3pRO6uruc0a for ; Thu, 20 Aug 2020 22:51:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id EBDC388557 for ; Thu, 20 Aug 2020 22:50:33 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id 189so45886pgg.13 for ; Thu, 20 Aug 2020 15:50:33 -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=hmZXcG40f0yJJFflewfqCQj9P+u7UGcv2bh82vlpjKQ=; b=QLPSZCB44mV+3XvGtiWzbmcwMVrZDkPaLCQhp4ge5rWFIUnVqhU59TqO37s3A6GYqD GxPK/aoWDCFVor5qsfmqgKm20GPVwHR0DJKO6iHVrbWvZPY7D3f1cijqzS5YDVh74+6D z1x080GqYx+Vt3lI/gZVVRz4hk2G38eRbXof5zT60JL2qmPbA4Ld+gYurZuQiWdYvVH0 aYMY+IWI/mAiee/aLji1xGfmmXKbMVkJUTn50l/yIWPi6HkwESersS4YKBSRjRB60qZr WsCkYpBDwe2ZdzXz4Y9r4/8IrUW/FRq/ZGr/DZMsUyLH9CSeRUF4YANYKONtkhH/2ujf K44g== 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=hmZXcG40f0yJJFflewfqCQj9P+u7UGcv2bh82vlpjKQ=; b=hQ6xNkmWhezLUa7+Ffn92u23Qooufugbtb0mNDXSearYaUHuI6EwIUcJfpudb5WEr5 FaZ/wwyD88xZvig8YRssu7c0i1AEVbQxxTXDPziYrUYsCoLQPYBUFIMEAriwk3PPCr1O IzdQT/pwdAuGSKr/+DJxZhK0XdTNJUzSC+lOZU3YXEfbBsS+N2ivdo835ZldfMpowWkB tIbbwnc1qxH4HANZvvDukNADmOy2R5uJJGEBU67tGpJrwTkEPaDsBw9p65IXFezaDcCh DlLpdr/8DB1V9Z97mgjONgy0he7WV5/EVyh0Q4XCjDwM3uIsHtriftNHspYeUJPu9vdL uZ4g== X-Gm-Message-State: AOAM532blDOGT6k3xANtSvCDDhiM2G5/re+zFbmSfD6405+U5TENYPut juE4wDtYM+frlwfyvvqFqHCmh7sK8rg58Q== X-Google-Smtp-Source: ABdhPJydxRUNzCIiL3Sw82GYD+PKiJO7F8NC6PitNW9EfRt+4xhjsYwCD6M1iJc0EsyncMkRKy43dg== X-Received: by 2002:a62:7c87:: with SMTP id x129mr51189pfc.165.1597963833055; Thu, 20 Aug 2020 15:50:33 -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.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:31 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:45 -0700 Message-Id: <1597963790-12362-19-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH 18/23] datapath: remove another BUG_ON() 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: Paolo Abeni Upstream commit: commit 8a574f86652a4540a2433946ba826ccb87f398cc Author: Paolo Abeni Date: Sun Dec 1 18:41:25 2019 +0100 openvswitch: remove another BUG_ON() If we can't build the flow del notification, we can simply delete the flow, no need to crash the kernel. Still keep a WARN_ON to preserve debuggability. Note: the BUG_ON() predates the Fixes tag, but this change can be applied only after the mentioned commit. v1 -> v2: - do not leak an skb on error Fixes: aed067783e50 ("openvswitch: Minimize ovs_flow_cmd_del critical section.") Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 877c8bd..deffb3a 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1414,7 +1414,10 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) OVS_FLOW_CMD_DEL, ufid_flags); rcu_read_unlock(); - BUG_ON(err < 0); + if (WARN_ON_ONCE(err < 0)) { + kfree_skb(reply); + goto out_free; + } ovs_notify(&dp_flow_genl_family, &ovs_dp_flow_multicast_group, reply, info); } else { genl_set_err(&dp_flow_genl_family, sock_net(skb->sk), 0, @@ -1423,6 +1426,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) } } +out_free: ovs_flow_free(flow, true); return 0; unlock: From patchwork Thu Aug 20 22:49:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348673 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.136; helo=silver.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=CF0ry0X4; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXg266n98z9sPB for ; Fri, 21 Aug 2020 08:54:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5D9C0236B5; Thu, 20 Aug 2020 22:54:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V1OdByqb8Ic6; Thu, 20 Aug 2020 22:54:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id BC09D22D0D; Thu, 20 Aug 2020 22:50:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9BE4EC0895; Thu, 20 Aug 2020 22:50:48 +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 197EBC0894 for ; Thu, 20 Aug 2020 22:50:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EF817886A8 for ; 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 0pSWa3uiJQZm for ; Thu, 20 Aug 2020 22:50:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by hemlock.osuosl.org (Postfix) with ESMTPS id CA44288629 for ; Thu, 20 Aug 2020 22:50:35 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id s15so56519pgc.8 for ; Thu, 20 Aug 2020 15:50:35 -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=+DYW+Nt9KfC6fcnYq9kMAEfZIkOO3ET86e+41oUiZzg=; b=CF0ry0X4Y5b4bTdlqvjx133zbfzR7Usu0nHZIJCgzngOxVTDqgKElkOOtWOGWx5jAc ra60b1F8jqoeky5EOhirNkNmrm6MpQvZK1U1Zct/InzT1Bh6xqTZeQ3egft5TgX/BWKw m4s+umIeH/gDFkJHN+enIhKnWNQLxXdG6qT0+L4DjFDnup4iAcHswNmiK/3dI45Zp+1N 67peMLpY7Y16dtc6MfwbAwzs3/V2EKO+1lWtsOgfZFHZqkkk6AexChFCG+X18T39c7+L DQXCse7D+zK0qXHrZLUuGpXd6IiI068OeyQQV2oOczpb8NUacSEgqJNriPXNKANWyHvK fXbA== 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=+DYW+Nt9KfC6fcnYq9kMAEfZIkOO3ET86e+41oUiZzg=; b=T3qMtK/AXAEAJUDXxtOIV++nMdSR56fzjYqFuiLyTm+whin8daDoqR9djwDNGk8Vxi 7bfeb5Ggt097wtyYWZjQU6GxKFxa9wxvj3iJcs3geNQxo0Zy53joghZyq4vSKRwUAQak 3eJi1tolhS9NepDgRil4H02F9HypAVM7Ms/xVAKsXbrwaDCQyMq6yfRdTopIXW2Ju0oJ pCMyzUGxLaJDgHtyTm0N0FNasotzE69PvizxZCZsxurWiVAop5QOKHYhX5rKdKCY3GzP Z3+eJSbGX02f/SP7/dXjXl3c3nAQYF2rtScj6vA1LFQAVrw05lWY99Fh1rJEB03kTLKN 3tGg== X-Gm-Message-State: AOAM533UDDIx65h7tHNyNE6DzT7U1svr5rsPdKcQYqBwR2uHo9EDOMg8 8zLpKF4qbBcB2U7e2X09JtH6RViiyUFVrA== X-Google-Smtp-Source: ABdhPJy83Nfz4zkIPYfGiyBk8lXMkHVmMprXogIEYc+nLH+fz8tgPzv0rWRtZC5fkqxdVCaBLo2wwA== X-Received: by 2002:a63:fb4a:: with SMTP id w10mr247877pgj.114.1597963834609; Thu, 20 Aug 2020 15:50:34 -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.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:33 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:46 -0700 Message-Id: <1597963790-12362-20-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 19/23] datapath: support asymmetric conntrack 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: aaron conole Upstream commit: commit 5d50aa83e2c8e91ced2cca77c198b468ca9210f4 author: aaron conole date: tue dec 3 16:34:13 2019 -0500 openvswitch: support asymmetric conntrack the openvswitch module shares a common conntrack and nat infrastructure exposed via netfilter. it's possible that a packet needs both snat and dnat manipulation, due to e.g. tuple collision. netfilter can support this because it runs through the nat table twice - once on ingress and again after egress. the openvswitch module doesn't have such capability. like netfilter hook infrastructure, we should run through nat twice to keep the symmetry. fixes: 05752523e565 ("openvswitch: interface with nat.") signed-off-by: aaron conole signed-off-by: david s. miller Fixes: c5f6c06b58d6 ("datapath: Interface with NAT.") Cc: aaron conole Signed-off-by: Greg Rose Acked-by: Aaron Conole --- datapath/conntrack.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 5b4d6cc..c7a318b 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -978,6 +978,17 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, } err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); + if (err == NF_ACCEPT && + ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) { + if (maniptype == NF_NAT_MANIP_SRC) + maniptype = NF_NAT_MANIP_DST; + else + maniptype = NF_NAT_MANIP_SRC; + + err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, + maniptype); + } + /* Mark NAT done if successful and update the flow key. */ if (err == NF_ACCEPT) ovs_nat_update_key(key, skb, maniptype); From patchwork Thu Aug 20 22:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348683 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.136; helo=silver.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=LqW4w+Ps; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXg5x2Q0cz9sPB for ; Fri, 21 Aug 2020 08:57:41 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A689C22FD5; Thu, 20 Aug 2020 22:57:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SNRAw5NqIBFq; Thu, 20 Aug 2020 22:57:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 5239824F8D; Thu, 20 Aug 2020 22:51:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2A745C08A6; Thu, 20 Aug 2020 22:51:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9E70EC0051 for ; Thu, 20 Aug 2020 22:51:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8CF158857E for ; Thu, 20 Aug 2020 22:51:26 +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 ikCumEK5kYxF for ; Thu, 20 Aug 2020 22:51:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id F29218858F for ; Thu, 20 Aug 2020 22:50:37 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id p37so65872pgl.3 for ; Thu, 20 Aug 2020 15:50:37 -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=6MwFrFjex2QKEHDtxRl1AlmhjLbVEEXRaxTf0hEtjvE=; b=LqW4w+PsDeVfVlf2x7EfkBj7gAeo7QD7mnEnVpIVhmHybW8uWkq3+/41kP47lrpr7r 20A+HoecPqPae9qoBXBCB7cKPY/i9Xq8bCnQ0liSZAEQrKzXhiZ5eOpxn2Jc4oyJjHiI VhSo69nqaFYU+mDPsbRpLFwlKvNwKxyTVQ6wgEcXPnCwFrWj0vge/GrKUtj9oUbLE07E bNGhHTHtDw/dtufTmwwd+rRU0KYi0BO6Pdj9onGPcK/AThs7hZyLC8xOYncWT3+7YB5e 4bbxUiqirOYxuK34QSF+sJH6YBTsKwWhDsPpBSwhKFHK2lSs0FYndRcuDtblsYXfJM1g Zcvg== 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=6MwFrFjex2QKEHDtxRl1AlmhjLbVEEXRaxTf0hEtjvE=; b=VFwrKe8nw7XD9+0nIsKcMY/F2wwqimkxT1tMHhJy+2/0rHWZlHVbRGfpS55RHCf82e cJqM/yo5a+estRCol+SEFz8zWLa2VPMyoXjoi4UGt5bn3aX8YCNHzqrD5rHfmw9d0HtI EABFyZrbknaLs/gOR3elwiL83RfVO4riCZSu1xtbskqfQ22vW2BQ3KEnhrwZtrDOfn3g sjugdtRH7wUqVmVTVMC8uu2X0tVJZae2z3aexl0xYoxiBhiA3YfG1a4GlD52kiPiNah8 qAQs5RKUt6BBUXprXm5xzUcKx+F8/FLeIUSC5nbXYMr5JA0mXV2ZmIcCyspixyCRU/5z /1fg== X-Gm-Message-State: AOAM532JzlTDx81C/i2t6MxtyP8LB+jP8iTjK/AlKutAGHa1T08g0rwr ygd7P5fZ9sbq3WCyHNOPpPgnaj/EYmUu9g== X-Google-Smtp-Source: ABdhPJz5iQJ3X8n89I5KtZvpvpDbDuTWiy4w7R8N4nqjyF9YBKSaaimMl9JbyYU/td+MqHbw2auXqQ== X-Received: by 2002:a63:488:: with SMTP id 130mr241135pge.92.1597963836755; Thu, 20 Aug 2020 15:50:36 -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.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:35 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:47 -0700 Message-Id: <1597963790-12362-21-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> Cc: "Jason A. Donenfeld" Subject: [ovs-dev] [PATCH 20/23] datapath: use skb_list_walk_safe helper for gso segments 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: "Jason A. Donenfeld" Upstream commit: commit 2cec4448db38758832c2edad439f99584bb8fa0d Author: Jason A. Donenfeld Date: Mon Jan 13 18:42:29 2020 -0500 net: openvswitch: use skb_list_walk_safe helper for gso segments This is a straight-forward conversion case for the new function, keeping the flow of the existing code as intact as possible. Signed-off-by: Jason A. Donenfeld Signed-off-by: David S. Miller Cc: Jason A. Donenfeld Signed-off-by: Greg Rose --- datapath/datapath.c | 11 ++++------- datapath/linux/compat/include/linux/skbuff.h | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index deffb3a..4b71e2c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -343,8 +343,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, } #endif /* Queue all of the segments. */ - skb = segs; - do { + skb_list_walk_safe(segs, skb, nskb) { *OVS_CB(skb) = ovs_cb; #ifdef HAVE_SKB_GSO_UDP if (gso_type & SKB_GSO_UDP && skb != segs) @@ -354,17 +353,15 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, if (err) break; - } while ((skb = skb->next)); + } /* Free all of the segments. */ - skb = segs; - do { - nskb = skb->next; + skb_list_walk_safe(segs, skb, nskb) { if (err) kfree_skb(skb); else consume_skb(skb); - } while ((skb = nskb)); + } return err; } diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h index 6d248b3..204ce54 100644 --- a/datapath/linux/compat/include/linux/skbuff.h +++ b/datapath/linux/compat/include/linux/skbuff.h @@ -487,4 +487,11 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) } #endif +#ifndef skb_list_walk_safe +/* Iterate through singly-linked GSO fragments of an skb. */ +#define skb_list_walk_safe(first, skb, next_skb) \ + for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \ + (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL) +#endif + #endif From patchwork Thu Aug 20 22:49:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348667 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=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=C3lNHtHy; 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 4BXfyw1GXHz9sPB for ; Fri, 21 Aug 2020 08:51:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9490588628; Thu, 20 Aug 2020 22:51:34 +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 87KO4uiCwoND; Thu, 20 Aug 2020 22:51:27 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 29CDC8847B; Thu, 20 Aug 2020 22:50:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E6479C089F; Thu, 20 Aug 2020 22:50:42 +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 01C32C0051 for ; Thu, 20 Aug 2020 22:50:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E64B286BEA for ; Thu, 20 Aug 2020 22:50:41 +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 wOiFb9XklBQg for ; Thu, 20 Aug 2020 22:50:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B35AD86C48 for ; Thu, 20 Aug 2020 22:50:39 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id i10so70197pgk.1 for ; Thu, 20 Aug 2020 15:50:39 -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 :mime-version:content-transfer-encoding; bh=B3kh4qB0prpCDASqOZ16SrvGGpcGEb+An65Wn8FHduI=; b=C3lNHtHyHUQVR81VGCZZwv3+h8beZgHPwDUtyYZjsltfIVoNTfsLXmMFS4tYlgUeZO w+Emi+CRI3Udw0z/N5OdyjK9DJBShCHlRVCmeKcKPWJKcFW6ZdtI81hdLDc6sXVLnvsH CfO5Li/NyVciouVusEF2i9DSfHOpR6+nfvI7g1Pipfmfqk7x8KeKU8mGr/TAG2EUIzz+ PgfbPYYdoYDDqvIK5oaYixcJBi9hAPesKwTowmU5Ah4fFKxyr2gpPreL2uzTyYZByDNg h6pRIA/wMzhsLODSg07mokwqsVtSB2XdK9BofIOWcGiTJv11YUROVVY/aX5/qVJR9uXa pDvA== 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:mime-version:content-transfer-encoding; bh=B3kh4qB0prpCDASqOZ16SrvGGpcGEb+An65Wn8FHduI=; b=n18pRcOQ9Bq9Y8+Ce2B8moykPbonG32mq2PZ2yHGGyClYHmOWMcBA9UTd4KIvJu6N4 mph4W84Y5ETJxvH/fVezG4eB8mN/00mHr4eJAiVDcIbF1VzsiGlainAUc3/x+zngV+St eUGr17TGHeiV0uRwMzHvQK9EILELIN+7wY5vdP6ks85rzhuhHF7p22yAwpqP/+dasHHD i0BfdB058sb8NKhzhwpGFeyf2BZxyXvSBxIV+Q6OYLHF1uOY9fwCpWkauHYpTphCcPTl Bs5QR1Fy7wXqCjG0XbgHWXBS8YhHX5YiTrHbvsSzC+5ZGZgjfvhVXTmKkV4HXBGE7KP4 r6VQ== X-Gm-Message-State: AOAM530CxzYwHydbvnRsxYbZ3CctXT0oi7wr+i4CFOzLHt1tHinoWiYP G1HQ+e+5AAVEGmbt1s0uu3UrC5O7q/YOwg== X-Google-Smtp-Source: ABdhPJyLSyUvgiB4Qp3iqfXkW+YsNrJaz7pKa5a66eX9FI0yYN4sYPRh5IUkrHRs5LA7lV+rvBFWfA== X-Received: by 2002:a63:6e01:: with SMTP id j1mr224749pgc.147.1597963838496; Thu, 20 Aug 2020 15:50:38 -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.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:37 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:48 -0700 Message-Id: <1597963790-12362-22-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> MIME-Version: 1.0 Cc: Kees Cook Subject: [ovs-dev] [PATCH 21/23] datapath: Distribute switch variables for initialization 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: Kees Cook Upstream commit: commit 16a556eeb7ed2dc3709fe2c5be76accdfa4901ab Author: Kees Cook Date: Wed Feb 19 22:23:09 2020 -0800 openvswitch: Distribute switch variables for initialization Variables declared in a switch statement before any case statements cannot be automatically initialized with compiler instrumentation (as they are not part of any execution flow). With GCC's proposed automatic stack variable initialization feature, this triggers a warning (and they don't get initialized). Clang's automatic stack variable initialization (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also doesn't initialize such variables[1]. Note that these warnings (or silent skipping) happen before the dead-store elimination optimization phase, so even when the automatic initializations are later elided in favor of direct initializations, the warnings remain. To avoid these problems, move such variables into the "case" where they're used or lift them up into the main function body. net/openvswitch/flow_netlink.c: In function ‘validate_set’: net/openvswitch/flow_netlink.c:2711:29: warning: statement will never be executed [-Wswitch-unreachable] 2711 | const struct ovs_key_ipv4 *ipv4_key; | ^~~~~~~~ [1] https://bugs.llvm.org/show_bug.cgi?id=44916 Signed-off-by: Kees Cook Signed-off-by: David S. Miller Cc: Kees Cook Signed-off-by: Greg Rose --- datapath/flow_netlink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index d3fd771..9960416 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -2700,10 +2700,6 @@ static int validate_set(const struct nlattr *a, return -EINVAL; switch (key_type) { - const struct ovs_key_ipv4 *ipv4_key; - const struct ovs_key_ipv6 *ipv6_key; - int err; - case OVS_KEY_ATTR_PRIORITY: case OVS_KEY_ATTR_SKB_MARK: case OVS_KEY_ATTR_CT_MARK: @@ -2715,7 +2711,9 @@ static int validate_set(const struct nlattr *a, return -EINVAL; break; - case OVS_KEY_ATTR_TUNNEL: + case OVS_KEY_ATTR_TUNNEL: { + int err; + #ifndef USE_UPSTREAM_TUNNEL if (eth_p_mpls(eth_type)) return -EINVAL; @@ -2728,8 +2726,10 @@ static int validate_set(const struct nlattr *a, if (err) return err; break; + } + case OVS_KEY_ATTR_IPV4: { + const struct ovs_key_ipv4 *ipv4_key; - case OVS_KEY_ATTR_IPV4: if (eth_type != htons(ETH_P_IP)) return -EINVAL; @@ -2749,8 +2749,10 @@ static int validate_set(const struct nlattr *a, return -EINVAL; } break; + } + case OVS_KEY_ATTR_IPV6: { + const struct ovs_key_ipv6 *ipv6_key; - case OVS_KEY_ATTR_IPV6: if (eth_type != htons(ETH_P_IPV6)) return -EINVAL; @@ -2777,7 +2779,7 @@ static int validate_set(const struct nlattr *a, return -EINVAL; break; - + } case OVS_KEY_ATTR_TCP: if ((eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6)) || From patchwork Thu Aug 20 22:49:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348664 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=nJrMLs48; 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 4BXfyC4j5Bz9sPB for ; Fri, 21 Aug 2020 08:50:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CA9A086C95; Thu, 20 Aug 2020 22:50:56 +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 bA53QI9KLhVT; Thu, 20 Aug 2020 22:50:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 29B6486CA6; Thu, 20 Aug 2020 22:50:54 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA477C089F; Thu, 20 Aug 2020 22:50:53 +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 518F2C0051 for ; Thu, 20 Aug 2020 22:50:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 42E7088603 for ; Thu, 20 Aug 2020 22:50:52 +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 UyORToUo1aOr for ; Thu, 20 Aug 2020 22:50:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id C2E57885C1 for ; Thu, 20 Aug 2020 22:50:41 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id 128so63056pgd.5 for ; Thu, 20 Aug 2020 15:50: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=p8nmMaS3Ps12BATIc6RIcr+vkNhRi87G6clO4DHDiVc=; b=nJrMLs485PXdXuLF3SGQ3mo9HJAIw7fvUR12Xolm1HTqpOoC5bX+mAyo/8OD8euvrZ JoXrcLr+PRDmCh91yIX/MUBjQKDT3NeyFICkJ60XnBhfEWqqB+FOCkfVfpevQCLmCkbw pwCBnJ9UWL08VetDCIPu816hWcQ3Y8QzFIj8gx77svZS7XOd4OYNqV2bzbLlLj2Isu3x leygZvfmT10D95GqlmX8BfKGl2IeKPvKLF9WBZUobqc2BGAKPUgg67MfuDgWA3g67w6b edS7K7KBDLbw1IRFN0AQD20yePeDwNCP/W+Pd9WBugWeP+dOuGM6Td4saLL3BvWMhQWP sG/w== 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=p8nmMaS3Ps12BATIc6RIcr+vkNhRi87G6clO4DHDiVc=; b=L4/HUDJ1m7rz/1Snm7oN9o6o+f8Oo/yVRiipzn7ZQP8M+aJAepT/BoAz5pOhyv9Nlo l3P1jklPBUKHuVWwhbG9bUrwOWlwxt8vf5kh4rJJgB3C95qESpJhnCvnwa9NyplKaKIz zTnzF6D5GHtwjwgvC05BORkXuhjkdy51DvmInSOM9Uyi/F8SXgeZJ/Wjp0QBpah/v1FX 4qGIVdy+nJy6zuQbSNqSIFmvqu+WWLdIDsYoYUhqOuItfrecuVJZvftwHS+H2l3HZz2b ROdLqgZ2MderRMby4kGIa7R/76sCxcCZqocsuOiFHDE4IsXubDjcBl/2FJE4PeNdJ3A0 lAPQ== X-Gm-Message-State: AOAM53173bR+z2N/Xlk45XSVBYTUYJBFmyy31AkLq6mz25C6UlMplRdm sN9GJc0rtdAzLUlbxTlBgw2odrU6fVsfsg== X-Google-Smtp-Source: ABdhPJyLIARTNOz23BV24wcf7hnGtiUd8mkLF+uOPcV8VrU3fAXbMm/GBJ3AbYYpL/AmevgbXen2QA== X-Received: by 2002:a65:67c8:: with SMTP id b8mr250208pgs.206.1597963840928; Thu, 20 Aug 2020 15:50:40 -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.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:40 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:49 -0700 Message-Id: <1597963790-12362-23-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 22/23] datapath: use hlist_for_each_entry_rcu instead of hlist_for_each_entry 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 64948427a63f49dd0ce403388d232f22cc1971a8 Author: Tonghao Zhang Date: Thu Mar 26 04:27:24 2020 +0800 net: openvswitch: use hlist_for_each_entry_rcu instead of hlist_for_each_entry The struct sw_flow is protected by RCU, when traversing them, use hlist_for_each_entry_rcu. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose Reviewed-by: Greg Rose Signed-off-by: David S. Miller Compat fixup - OVS doesn't support lockdep_ovsl_is_held() yet Cc: Tonghao Zhang Signed-off-by: Greg Rose Reviewed-by: Tonghao Zhang --- datapath/flow_table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index bd05dd3..650338f 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -485,12 +485,12 @@ static void flow_table_copy_flows(struct table_instance *old, struct hlist_head *head = &old->buckets[i]; if (ufid) - hlist_for_each_entry(flow, head, - ufid_table.node[old_ver]) + hlist_for_each_entry_rcu(flow, head, + ufid_table.node[old_ver]) ufid_table_instance_insert(new, flow); else - hlist_for_each_entry(flow, head, - flow_table.node[old_ver]) + hlist_for_each_entry_rcu(flow, head, + flow_table.node[old_ver]) table_instance_insert(new, flow); } From patchwork Thu Aug 20 22:49:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348666 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=WfcKvrqA; 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 4BXfyt37qXz9sPB for ; Fri, 21 Aug 2020 08:51:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2A50486C52; Thu, 20 Aug 2020 22:51:32 +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 mPkNThESRZ44; Thu, 20 Aug 2020 22:51:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 97E3B86C18; Thu, 20 Aug 2020 22:51:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 86060C08A5; Thu, 20 Aug 2020 22:51:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1E332C08A5 for ; Thu, 20 Aug 2020 22:51:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 141E38855B for ; Thu, 20 Aug 2020 22:51:28 +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 duGSuIAgnuTi for ; Thu, 20 Aug 2020 22:51:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by whitealder.osuosl.org (Postfix) with ESMTPS id B913F88473 for ; Thu, 20 Aug 2020 22:50:42 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id 2so86648pjx.5 for ; Thu, 20 Aug 2020 15:50:42 -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=yT2cTbk9fWz33EQB2lcG7HzeoADC53iutpfIz5W2/IM=; b=WfcKvrqAW7sDkVnSJXk4MCcshbotwe6mWGGCYmVusUI5uncXM5/VKy4qCkd/EXgyFj 1MYl+R/HQjZPc1itqo1PvHAjAJA/geNTfbv2A089lW9+DM3PM0dLjyRH9J1cFpGx2bIn DtVZwEVidx2dzK0N4HWoun+d5dg813JtuLuTQp3PZCq7Ffl3xJbpjSKZU5lZaMCQAuvo RzSIIbxweLG4Dp947k08RuFE5swUtznSYMJ3dSgBu5FretPryltUvwNkwTSfSJGVcd3w ZLJW+lRsRSIV2TPbetTWl32YAtnQgfEkbN22kPDSUsu1QegIhmTwMKnHL2D39obLbj5P tquw== 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=yT2cTbk9fWz33EQB2lcG7HzeoADC53iutpfIz5W2/IM=; b=cHBdH4Tx9y0Ny+hN8+7ZXRU6D4sMyPpWiFihcVltzre80iBJGaIPlfziqLNN35/O05 rj1wDrO6n1c3gyO639Mzcvk9FxuebpgQHE776NS6iLodST18zeNQTwHdppBRElNUAXgU thd4Ty3FmtgZiu/OZQF5Fe2V/mAK5+Y97F8bIm6lkt2+LPg/UnvRuZxY3+2t6yMlTXD7 EVdKlFjFMVfv/sZYF3QFMoKbQ54Lm4MmEqUsKTfpaMY8PiVs7gVzvhFs79cpFVp5PIUb OCBZAksi4l1DZriWEr6UojZlzUitQ3M+rQbIWTXjU5k9IpMz5PFFCBW0oqXAQVBn6mTh LFZA== X-Gm-Message-State: AOAM533rNu9upgVtMTVggMvfsXCUe/VBIAyAZ0OoSXYSysydfHHIdB07 gRMjIK0+wwzKGfk+4KVz2uwmLV+7Mig1OQ== X-Google-Smtp-Source: ABdhPJzFeSd+2OYAzYWU4XQY0z8GKRLpdtmkP2i1Hva9B+U38/YJ+bT+uZUNITx1mIoz8LRX3hwCng== X-Received: by 2002:a17:90a:d24c:: with SMTP id o12mr113943pjw.60.1597963842021; Thu, 20 Aug 2020 15:50:42 -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.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:41 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:50 -0700 Message-Id: <1597963790-12362-24-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 23/23] Documentation: Update faq and NEWS for kernel 5.9 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" Update the NEWS and faq now that we will support up to Linux kernel 5.9. Signed-off-by: Greg Rose --- Documentation/faq/releases.rst | 2 +- NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/faq/releases.rst b/Documentation/faq/releases.rst index 9d5d2c3..ac3878a 100644 --- a/Documentation/faq/releases.rst +++ b/Documentation/faq/releases.rst @@ -71,7 +71,7 @@ Q: What Linux kernel versions does each Open vSwitch release work with? 2.11.x 3.16 to 4.18 2.12.x 3.16 to 5.0 2.13.x 3.16 to 5.0 - 2.14.x 3.16 to 5.5 + 2.14.x 3.16 to 5.9 ============ ============== Open vSwitch userspace should also work with the Linux kernel module built diff --git a/NEWS b/NEWS index 2f67d50..be4788e 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Post-v2.14.0 --------------------- + - Linux datapath: + * Support for kernel versions up to 5.9.x. v2.14.0 - 17 Aug 2020