From patchwork Mon Oct 12 20:24:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381133 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=lwbs+Tvs; 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 4C99Cl3RV7z9sTL for ; Tue, 13 Oct 2020 07:25:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 3624E87902; Mon, 12 Oct 2020 20:25:20 +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 cXY9YLQpXank; Mon, 12 Oct 2020 20:25:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 7FD3C878DB; Mon, 12 Oct 2020 20:25:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 660BFC0052; Mon, 12 Oct 2020 20:25:19 +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 C0D33C0051 for ; Mon, 12 Oct 2020 20:25:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A207422926 for ; Mon, 12 Oct 2020 20:25:17 +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 q+uply5hezn8 for ; Mon, 12 Oct 2020 20:25:16 +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 silver.osuosl.org (Postfix) with ESMTPS id D8058228F1 for ; Mon, 12 Oct 2020 20:25:16 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id i2so15490284pgh.7 for ; Mon, 12 Oct 2020 13:25: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=yhwd80OrJSBMb6pSIY7Z4LcluF0kS5sHd2hZMWa8e4c=; b=lwbs+TvsRRKW3fvzf5Kl9pUqJ+Z1nd78psUCgBSZfi83CurCdHmXWqsfXMyTbwAdi5 rvmfnCoA5hGajXgFBwmL6x75nzN1AJRNC3S6waUacGVtpiQ9cZ1cVWp6DcnIKz8mg7cE lqHDilLI5D4xRDCZy5Cs7LS8GCJdYrx1VYRg6f9Ok9Mrqljro4O2JgDoYNl6ST6h3Tw3 sjLTL7jEzy3IqMTSjNJSpJ21e/375vpnfDzzFPWsUaGE5pvN1Id6iMEEqxZttJHU+OBV 3alfNmlP/k2RY5VeD9z/Hl6W69FcGz9st5So7O6eOB54EWhUJa5hV1T11bZPEyy49nx4 bUwQ== 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=yhwd80OrJSBMb6pSIY7Z4LcluF0kS5sHd2hZMWa8e4c=; b=UcekCuzAPFJ4nj4Wk4lmCagTZ654Mx4u6MSxnqbcgrNd7TKt5bR2AFaT1mmAmM+QEv HXdgR5s59TAdn+KHsby0KC3bdb0RAtaap9kwc1wvOK5doX7S0NRWbs/rBqBY5TqhPj76 d3rps1nnrFPt/y/YBhRyB/HQWvhruvLYmD97c6kyNIv7VahC18LGh6RHsqoBFLlQ72Ou ilAUlJKxpNTMwxq4fuvCIwdBTyxpdqfyAXGYuXvi59L00rKEyk9U6i+8k8/HoYCBfC6j qUtKLZEwvJ2VmL2GYXf65QELLcmydAkdWd5G1s9TwUTXgZRIrVwDWtpWqCFMdJGe58BP UyYQ== X-Gm-Message-State: AOAM5306oa/N9HsuVV7v/A2/0NRTLxiGlUSJ1rM+x2bO5N31Gp0Ov4Ch 5WM7jup1GlR5f6+CNJ9DwNueZ99ueMSZzA== X-Google-Smtp-Source: ABdhPJwL04CItUfi/hYqsMLT2PChFvGkNhlA2tdZeDdOoMrWPwl8kWknCGhqDgjv1+ngKVAXPcs/Rw== X-Received: by 2002:a05:6a00:1585:b029:142:2501:35ed with SMTP id u5-20020a056a001585b0290142250135edmr25565696pfk.77.1602534316063; Mon, 12 Oct 2020 13:25:16 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:15 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:48 -0700 Message-Id: <20201012202511.21000-2-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 01/24] 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 Acked-by: 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 05c1e4274..d604bfd36 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 Mon Oct 12 20:24: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: 1381134 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=UlSTy6qF; 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 4C99Cn3NDsz9sTL for ; Tue, 13 Oct 2020 07:25:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E865186C19; Mon, 12 Oct 2020 20:25:23 +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 5GsPf7wKdLz6; Mon, 12 Oct 2020 20:25:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 9C27B86BD6; Mon, 12 Oct 2020 20:25:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3745DC1AD8; Mon, 12 Oct 2020 20:25: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 74BF7C0893 for ; Mon, 12 Oct 2020 20:25:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6246B878D7 for ; Mon, 12 Oct 2020 20:25:18 +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 HPWJxVcbubMU for ; Mon, 12 Oct 2020 20:25:18 +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 F078F878C1 for ; Mon, 12 Oct 2020 20:25:17 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id o3so5495635pgr.11 for ; Mon, 12 Oct 2020 13:25:17 -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=zxokFfbwGFrjoasyQvAf1En2ciKBcPVZnAqJXLd49XU=; b=UlSTy6qFf5AATn9HJjP1OPduPdSSKfSHe/9fYMk9yqtftFbsrNUkfW1E4+QWTJ35Qr SJKl6oJIZEmFV+GKyZztZmI+5zuY1YMXtGdvMuBDwe/jl2/hKvwsJiueLkpESRUmOIUf 6N1GqXaeBdLxHy4qBCzVJLo+lq/tVJB6Jl4niY/wAyZbHS3LpdgF1T3kaiKf0Gy0TDCF dTKos+ulVl3l0yHMEfTq2CbJjmm8VT0S5JtWNY09b7YZDDZMR12rdbjoWN4Na6n1Kkwk VwGv7a7wlKqMXh71PlnRHaLyT6aZi4Su4UtbcEaMlVZub0PUm8yf4qUpGbcnPB3Ry/7F EfeA== 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=zxokFfbwGFrjoasyQvAf1En2ciKBcPVZnAqJXLd49XU=; b=qOBI1cxbzfOh2iEq4QRz6MDOEooZ4bw/mG78zErlSopbSBjMT+dQ6EsD9Jw2EMhyqq 3zL4Kr1AL8u6BDmh2zy+U2RoI0kf4daMtgssvf4vIdMrR9zVySLNz38rLEafpYQpl0I6 zN0U6TOwYu+ZopYSyHpzEK6gPCIQm3FNl+6DQH13qBOlyg3QaZJuvFspXRNO4RlN31no 1hoW//BeGKFAzvzEe6BvqtwwKTwb2XTFwc2AgnRsnMOQdqOykE9LFuS4dWD4x3VmeoPq nZXosYFtz9ZzZH/eBMNz6kTy/vZ2hpZdGcmc9Qj76YIazyd8aTiTjtzwAddjQ+4xIBGA drMA== X-Gm-Message-State: AOAM532GsP7dOLbKnbyNpEFj0hHvle3axa5ve0l+8tfL8WR8yh7uSbwW 1GtEHItPbwzqKoAF+NAQk6S1E3NspA/BTA== X-Google-Smtp-Source: ABdhPJzdkoIM0EMq6FZ1zbWnwrnq9L6TyoEYdMpFH0Mk+bEm4fTg71zfYQS423R/HbGtnG7D76g6dQ== X-Received: by 2002:a62:5f02:0:b029:13c:1611:6536 with SMTP id t2-20020a625f020000b029013c16116536mr24031414pfb.8.1602534317332; Mon, 12 Oct 2020 13:25:17 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:16 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:49 -0700 Message-Id: <20201012202511.21000-3-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Enrico Weigelt Subject: [ovs-dev] [PATCH V4 02/24] 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 d604bfd36..4c485c88a 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 Mon Oct 12 20:24: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: 1381140 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=uDwo0Ks7; 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 4C99DC1Xj5z9sTt for ; Tue, 13 Oct 2020 07:25:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6F26B2D47F; Mon, 12 Oct 2020 20:25:45 +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 uLGCcMwjOSAD; Mon, 12 Oct 2020 20:25:25 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 15AD422DEC; Mon, 12 Oct 2020 20:25:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EF57AC1AD7; Mon, 12 Oct 2020 20:25:21 +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 9EB62C1ADA for ; Mon, 12 Oct 2020 20:25:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9A39286BD3 for ; Mon, 12 Oct 2020 20:25:20 +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 xO73CClNZFmD for ; Mon, 12 Oct 2020 20:25:19 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 84EA886BBF for ; Mon, 12 Oct 2020 20:25:19 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id e7so5654245pfn.12 for ; Mon, 12 Oct 2020 13:25: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=eQzw9Thz3KXhG9GSvVi3KtbgjfDviXc/3MQ5f08vefI=; b=uDwo0Ks7gaim3JDGxCHoQogW/Rr4JgCG+efJrl6I4NoH0rC6pf9NdzoJK8fwcSWNZP /DtMr8CNIAfFs7cvscjWlrUV8+QH2YIFpjk8r8n0+PU++H1Le8XRfoNjSwhaCXAr4Ld/ QfrqFkZvn08MWPvjFL1VnwWawlJEyWryfe3wP4BXtPTG4j4p5DcmYpT8gMbNWRpont+h 0enFExxog887Uz24lrRHQcjsM2KdcIqEYNRzXQPFq6qrL2QZvnLEe8Y7PKvx3OMS5Nzv vvE+gsf8USzHIjut61jUQnOw8UNIY0J1GbQWGPwB7Kg1AymbfzBPmwfVF44atyipg9fZ 4tgA== 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=eQzw9Thz3KXhG9GSvVi3KtbgjfDviXc/3MQ5f08vefI=; b=SXTagl+7/swT2RE5waZ50gBa1EgaGLlJ7VdNJYbBx76wmdfSenrV4iHsjOM9LsSfeo lt8+BTJrL7c8cQp1HImxick+8M1F+gUWtiHvbRIcxJKBX66oyC9O9snanA27llQjGPeo xOhJTNM1nPckJuq1k1iwC7LdgheCMQMW0AUH0WG0WDq95DEyy7/ChFW3w2lARgGiRxm1 ZmhnGjJcgiataM92IwJWEj6FnvsSDfxTKfjGQYiZHC8wc8FicsmZShGSh+k6vn6p2X0y CyM8zlbn1qs+Xd0C0NLQc0zGD/gKFbF61UxeE/+aNm74mUMYBWaBvQfJnwP7S6C6/p1/ yQFw== X-Gm-Message-State: AOAM531KcrfDL79ij00g2BvyoNqfzXivUcsjjU4Cqz0wjlJ+O+mhwR+K euI5MBBH6VBaxWaNmeKpqmdlCHLzWRUl2A== X-Google-Smtp-Source: ABdhPJzkEboxC8fbpc5tLZqzuCWeU7WyysIN9gToDP0vw1zJHBxC8xSdg64mqPgDNOPvT7Q3yA7R3g== X-Received: by 2002:a17:90a:d983:: with SMTP id d3mr21820749pjv.144.1602534318375; Mon, 12 Oct 2020 13:25:18 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:17 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:50 -0700 Message-Id: <20201012202511.21000-4-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 03/24] 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 4c485c88a..2879f24ef 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 Mon Oct 12 20:24:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381135 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=Un0sTysg; 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 4C99Cp5vZLz9sSn for ; Tue, 13 Oct 2020 07:25:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 18A638658A; Mon, 12 Oct 2020 20:25:25 +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 yVsPV3v7MNs6; Mon, 12 Oct 2020 20:25:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1BD4586505; Mon, 12 Oct 2020 20:25:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DB384C1ADA; Mon, 12 Oct 2020 20:25:22 +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 8AC61C0052 for ; Mon, 12 Oct 2020 20:25:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 76FA886BE9 for ; Mon, 12 Oct 2020 20:25:21 +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 fLN1C+ssKcqL for ; Mon, 12 Oct 2020 20:25:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1FC6086BD0 for ; Mon, 12 Oct 2020 20:25:20 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id 144so14670803pfb.4 for ; Mon, 12 Oct 2020 13:25:20 -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=Dj8SsE9H2iURXj86A8sFz/qWEf1tERJE1N/MZAc7WnU=; b=Un0sTysgJNEScaPeOLjaUiyrF154JNN4GbqxVbRdeyS2mwV1ij55hwxQkGDN1Blp9g O2ZgG6rFm8ANOeVIgdXlsGl14tUhaIBR/e2fSFepDTdobJFOjXraqXHgyNXZXLdZKHQo 7xCqNZNdDQzoaUY/h4z5ZvQ3SYijRoxpfkay4oY4Qt2YSLiDLWzgS9Jc33tAuzBkcocc C4yZwTse4yAYy/WQkWiQ4mm/oWW50nbMENQ7f2cLCgistYixgAsoTVEQW7OuoDRZXcWW Mvd6tdk9MxBRrPoonV/pVcD3NGbVit+71FYt/H394kFotwO5bAY9MubmqjKmo67RFOCR DUsw== 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=Dj8SsE9H2iURXj86A8sFz/qWEf1tERJE1N/MZAc7WnU=; b=IX+sCr/uWrKh0GbnB5NE9oD9z+qj/s7VINEVEhASgGqpJjpFYP559es5S0HQ20sOlG YC/BjUuf20pJ91/h6paSqOaPlEVP2JnfQsTSte9Hupe2MNhzHHQdhagMvDM6KoH9CIZ4 /jh5ivJAglHSJwYf2W7tPvsdK48ZMAGBPzpKctqmmH8VI8ywKrRoQ4/Ngxx9WSecRyNv fzutcnqv/hgE7elMuKgSGDV2ck0xSCA7+EhfmDx2LOH1+PwMgly4ymSZkANmwoqW5UsL ecx0E/q/mk6gvL18mqeocG1H5KOMkOLTscvIrJ4qMEyab8NNWvLBbwsMoFp4ttPi89Zn DZYw== X-Gm-Message-State: AOAM532BMY+QS+vZRdgVX3rZQFPgYOF3Qlnl0FaT+Pzcc6OWAMLTGr3v Fc+i/FM9RD0oRrmbN/Cns9AGXQu5IMR5Lg== X-Google-Smtp-Source: ABdhPJxlCIrgU8mn5ASscJb1DxrdNx1aVmdgXnSV0gp52ts0lvN8tqEyICLBvvUDC3SQa95gLr8AiA== X-Received: by 2002:aa7:979b:0:b029:152:4223:1b47 with SMTP id o27-20020aa7979b0000b029015242231b47mr24766792pfp.44.1602534319420; Mon, 12 Oct 2020 13:25:19 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:18 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:51 -0700 Message-Id: <20201012202511.21000-5-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 04/24] 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 Reviewed-by: Yifeng Sun 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 2879f24ef..c8c21d774 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 Mon Oct 12 20:24:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381137 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=KkSAZ4bN; 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 4C99Cy01PRz9sSn for ; Tue, 13 Oct 2020 07:25:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 31C3187991; Mon, 12 Oct 2020 20:25:32 +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 BddLK-DUn44C; Mon, 12 Oct 2020 20:25:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 6E0C287940; Mon, 12 Oct 2020 20:25:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3CBEFC0893; Mon, 12 Oct 2020 20:25:26 +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 60DBDC0051 for ; Mon, 12 Oct 2020 20:25:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4AAD186BE9 for ; Mon, 12 Oct 2020 20:25:24 +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 z3ifP4qXtlAE for ; Mon, 12 Oct 2020 20:25:21 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 2ECE386BE0 for ; Mon, 12 Oct 2020 20:25:21 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id n14so14668269pff.6 for ; Mon, 12 Oct 2020 13:25: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=aqlvNfFBCflRTC/vBNFoMF892d6qmTMmN6w2WkqF5bw=; b=KkSAZ4bNx40F+11iIRs85yYepI3G72rKKzl7q4sLz9Q8vVmhjiRfjaGDD56XoKGRQb 6m+RzU3iQ8JMVDitNwa7YxjksiCN3Cq191BM75EWbzSLCW4ozKrd5uY1mVbXajvFbMyl mp47pc8fmGwdj0XtBnc00Do6p/liGTrZ4iq/3YvTes5Hh+J0qLW/9FmYaDB/NQ3zgjI7 TJw3SDuSGNN0enW3t0faNuo62/PyqVxLg4f5Nheh9XqyU2In24lojU+SF1NZQ70tJMhF pgirfhSPaT/g34syX1UD9d5A/uqGwDvhULZd7sq3ZMiHHtRUoF9S9wFc4goP23jk+Q9m YgPQ== 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=aqlvNfFBCflRTC/vBNFoMF892d6qmTMmN6w2WkqF5bw=; b=YqVLR4RIFy2L6So6WaQa9MnQuwkEjW1LFAx3GqbnR5+IJ8wMqn10sitDSZ8+cNBypo sjASKITPOAwzyil/WDgYI4e4v7PyZzxEVARvUa4kc+fUXB11PhmkyRbhvi+z214odG1U ikLDR+fmh5Sie+qdc/aJnQyLhCZgfx26sxQuzjN6Mpn4RhcL4bfh7p6A92CiQ3I4TXHb rAr2G6lQHobkl/cCdcz5nlJyIXH1rBaI34fN7YN6I+pft6Q8LQtYr24+yJrebAKiPbu8 Wxc6PeV3tS14lQLc9+Kt+q7+gBeE8efWBzrkPFjtlzghtQV3x2dcDpcW17V0ZOl5mx2x Pc3w== X-Gm-Message-State: AOAM530ZdgjL8GKQGhn1uPthpa0tXriWz5cbsRvH8FmycQgRcAauQiNd 7iUUVqABcsQ9NUjP5GhBmTCdEwROh1axCA== X-Google-Smtp-Source: ABdhPJz1RAdw1xs6g+P4CLP4zjBTo5iRQq92RTQs+Mj2Tm30znI76UzmU+iklLBwQPr88XTBURaW7Q== X-Received: by 2002:a63:7a55:: with SMTP id j21mr14619626pgn.218.1602534320424; Mon, 12 Oct 2020 13:25:20 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:19 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:52 -0700 Message-Id: <20201012202511.21000-6-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 05/24] 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 Acked-by: Yi-Hung Wei --- V4 - Add in portion of commit for ovs_dp_cmd_set which was missed in first patch. --- acinclude.m4 | 3 ++ datapath/datapath.c | 38 ++++++++++++++++--- datapath/datapath.h | 2 + datapath/flow.c | 13 +++++++ .../linux/compat/include/linux/static_key.h | 7 ++++ 5 files changed, 58 insertions(+), 5 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 84f344da0..3d56510a0 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 c8c21d774..009887691 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(); @@ -1825,7 +1851,9 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info) if (IS_ERR(dp)) goto err_unlock_free; - ovs_dp_change(dp, info->attrs); + err = ovs_dp_change(dp, info->attrs); + if (err) + goto err_unlock_free; err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, info->snd_seq, 0, OVS_DP_CMD_GET); diff --git a/datapath/datapath.h b/datapath/datapath.h index f99db1fde..c377e9b24 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 6dc7402d5..5a00c238c 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 7e43a49e8..432feccb9 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 Mon Oct 12 20:24:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381142 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=SYU2ooZc; 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 4C99DG1vZbz9sTt for ; Tue, 13 Oct 2020 07:25:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 94AB986FE2; Mon, 12 Oct 2020 20:25:48 +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 k3j4SiO7l8B4; Mon, 12 Oct 2020 20:25:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 3129586BE9; Mon, 12 Oct 2020 20:25:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DBC0AC1D91; Mon, 12 Oct 2020 20:25:29 +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 730F9C0052 for ; Mon, 12 Oct 2020 20:25:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6C1CB86C59 for ; Mon, 12 Oct 2020 20:25: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 2q1uNANslvoU for ; Mon, 12 Oct 2020 20:25:22 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 41C3386BC2 for ; Mon, 12 Oct 2020 20:25:22 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id c6so9292021plr.9 for ; Mon, 12 Oct 2020 13:25:22 -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=Krp5Qrl7+hAfX0BICqdOIPZqu+WV4bOVNVKxB+E/sI4=; b=SYU2ooZccV6W4hU1SJ/wX5TuaIr8BXzsHP7N+YbK1xJJv7ERdNi2rZ5cwHnBZaDdPc xYu0dU3csNDoO9dCeZL0lPHS2hGXhsucSGxCpt2GsVF4incrEVB2s+pXcMZpPOMrgclF 3HbZe3jQBuyHzlVI0cxUioBNsWcOsYXLqDtjAVISbs21lHwZUx+lfxQP3QxlosQXFyTO KemPbeJU2wT8I+KM9EaoiwUA5m+oTgbyq2xjpILf3LDLpHiLc90Org3fBsF+1jCGaNqp xByzz6AvwqiEBSMdGJiprEJ3+QnMPKIztefxIjtTUkV0ckia8xkD+9+tbZLffZdhdW3c U1Gg== 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=Krp5Qrl7+hAfX0BICqdOIPZqu+WV4bOVNVKxB+E/sI4=; b=t4EZuIQmFDlo+Zc6AY1qLI1yZrho1kmJS9d4jyAHeUmi3EHuXK4nlxY89ftLkSTCcR X9wjgWFv3nJRWGInBAu5DtlATr6WHuTRDJQbWTJe2/ahC9xAn6FGzFHjKtzxebORxh6k 6IS5sWjIKJyiMbF9qpzPk0cexY/O9TkQVru6SeNdf0pVR/dvpNmx+yU92t1Jwvv1KXA0 B1FnmGgT6DYp1qbBs74TjsxIMSvd1I9dZ0E0wfaTnGXZx0H7qNZbmmSdirzkBZExw9Jk wKu7RHJuA6++CyKw6KgaHvi3oY7fsPV2SblyLQuivwO+P9nl2Qwo5P0C3DaBUvqxMOfa 2gRQ== X-Gm-Message-State: AOAM530nRW1itWGbzZnnzGYB2/hjD/WEwyUh2M66hJ+QoRDboP/5irwh PgTUP4p/8K4zS4sYhpmFaPY/geLFKHqiBQ== X-Google-Smtp-Source: ABdhPJx0P6AUauamJQ+R7VLk1D4/2RkbAaE/4QSXECmFVvL9Mqb1gB39MO0LuvypDoioUZLL74IIZw== X-Received: by 2002:a17:902:14f:b029:d2:562d:e84 with SMTP id 73-20020a170902014fb02900d2562d0e84mr24575107plb.64.1602534321508; Mon, 12 Oct 2020 13:25:21 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:20 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:53 -0700 Message-Id: <20201012202511.21000-7-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Guillaume Nault Subject: [ovs-dev] [PATCH V4 06/24] 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 009887691..aceb655bd 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1992,7 +1992,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; @@ -2014,7 +2014,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; @@ -2056,11 +2056,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; @@ -2202,7 +2203,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); @@ -2262,7 +2263,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(); @@ -2302,7 +2303,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 */ @@ -2349,7 +2350,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(); @@ -2385,7 +2386,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 Mon Oct 12 20:24:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381136 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=rJRVcdFi; 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 4C99Cv51lsz9sSn for ; Tue, 13 Oct 2020 07:25:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BC2F886672; Mon, 12 Oct 2020 20:25:29 +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 NgEq_9s8R7pM; Mon, 12 Oct 2020 20:25:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id B95F08651D; Mon, 12 Oct 2020 20:25:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8D87FC1ADE; Mon, 12 Oct 2020 20:25: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 94D80C0051 for ; Mon, 12 Oct 2020 20:25:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 820C686C2F for ; Mon, 12 Oct 2020 20:25:25 +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 0dvK5AIcaO6p for ; Mon, 12 Oct 2020 20:25:23 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 3639986BDD for ; Mon, 12 Oct 2020 20:25:23 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id t18so9291793plo.1 for ; Mon, 12 Oct 2020 13:25: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=A/A1yPYSHSbtuwihgX42CedEN/OsA7Zm74KzKX4SRhQ=; b=rJRVcdFihKcfxzivnwCkBlRYHAjuwS9MxtfBRs92pT5+Hh9WbwfZKw9G4vwDLcrMxq YJ9z3dVVwBLdYIFRCZdmu7IIV3PloWp91dukiW4jOE3GKkJHzqhZ3pNV78XL+bO/p00s +o11zboXdRqOif7Neo2wAs/hQ4KYZB4HYxMwz6etT6vNf00vKS2UNEiYOViFS21aWU7D h99TPyM0K1V94rjFudQsDJggtLtk7g2tfMfR1tDVz1xkZMt63S6MnK1UBJJMjnaAJOjN Uw2mfMiRrcg6r+rPiSwLkvpQStn9w2PXKZYuckjEj2HeA5n5X2BEWEfaIZOPvMBOkDZd q7Gg== 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=A/A1yPYSHSbtuwihgX42CedEN/OsA7Zm74KzKX4SRhQ=; b=MlN05n3hMFeW0ttAcfddPOz3OeO9aEiNK6qxcPYQtu8oWdDtldNLoSe0Q+/N8icacS SrzG+bBkTXJZ7Bg2Ha1GZ+mbVgOqo7MgKsuTSM4q1HuYmULP5f1h6jt9SqIjfwaZRoVS QDyho17+j0uF7UB6vTpUB1nJ88glucCaubjKyuzpJZPUw98NKNnYYi61TMtAwtJsUmgh 9BtjRpjl9q6cATI4vvzqwdb9o3PJ9NlKNYfJ+J1mTAq3rSkjvjNWv/5n0ChfyJZjyKAo 81Rb0S3DUQHrpTmPEosgEN3aGdkVKc893iPZYAVtHrL/pm4FcrWDkLT876sHhZe3H6kl NO0w== X-Gm-Message-State: AOAM5300UhN1kR88kvrpQ66hvHC+ybs5klDKBslkdVxZXliswoWbPEZ9 enIWphWq9XOc/KJ7l9X4fZa7jhFn77EORg== X-Google-Smtp-Source: ABdhPJxNwwSt54rJm2F4nw9XmCOYHQaXo80zqMhKimbHV+iabn68tIeqOPUj5IFgOw/T4frhrZAg3Q== X-Received: by 2002:a17:902:ba83:b029:d4:cb9f:b35f with SMTP id k3-20020a170902ba83b02900d4cb9fb35fmr12376163pls.41.1602534322562; Mon, 12 Oct 2020 13:25:22 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:21 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:54 -0700 Message-Id: <20201012202511.21000-8-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 07/24] 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 Reviewed-by: Tonghao Zhang 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 aceb655bd..cf216c8ec 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 Mon Oct 12 20:24:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381141 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=prc9vW8T; 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 4C99DF1tkpz9sTr for ; Tue, 13 Oct 2020 07:25:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A7712879AB; Mon, 12 Oct 2020 20:25:47 +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 FMjLrLdQ1luC; Mon, 12 Oct 2020 20:25:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 6167A8794F; Mon, 12 Oct 2020 20:25:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4522CC1AD8; Mon, 12 Oct 2020 20:25:34 +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 ACA30C1D86 for ; Mon, 12 Oct 2020 20:25:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9875786C52 for ; Mon, 12 Oct 2020 20:25:29 +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 mwWt0oJqINRn for ; Mon, 12 Oct 2020 20:25:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6C71B86BD6 for ; Mon, 12 Oct 2020 20:25:24 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id r10so15486957pgb.10 for ; Mon, 12 Oct 2020 13:25: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=xfTRTtlI1C5pPMN6/dFS8eePVEem5YlA/CHIRjjRPGY=; b=prc9vW8TVBSTOhOZ8trAHFsW0CxunXr70eFJpgLPMuy5A5hSyNoOKXLQVMrlzSpKN1 josBVLMpVYc0yOvCEOqlXxREzn+GkpBnd2cvfo52B6DNk16bU9CCC8bNEx/JCMF94QkJ SGJSPClHNGW58Je5civ3xx/qydn2KmfP9zr7sQ+0IWO6QUFSl1rHTjxDkrOzQKKYUDaG +7GWQlHqVhlA4x3GcutQaG7RZH+2rpI/piz5QUX8CM94ePt0BGK9z0KsjD6ZeLGomg5Y 5LcS4AlmxR57LpRePjHmPlp4dHOJMYDqZXr3DdRJWfEg3GQzudlrJn1TYW03Y6PmYPPo JT3A== 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=xfTRTtlI1C5pPMN6/dFS8eePVEem5YlA/CHIRjjRPGY=; b=PRZBV4Yj6Fv0RKOL+5c41sI8slO23UBfON9rJXDmEnoVf0RqXORLbIpdPWGKFbDMKM BGX0n1Z7YjXRg7GmqoPSiEzsmHPHBO+EaCevDecJnw3xEJbx0scIi6LHjY67Yy7jz4Uj DDBLQQz9EcfhpCS31mG8xmXkxvB0wniMhfc3qBZR0JQbLSL62O1HNGNyAcaqLgaJfdTA ge71+CIiFZmZSWXIW6eHK6O/3H6+ZYRiFcn/yjqLfU6LyhWa0s1UMHcuhnw2Mr71PqKp 2urLjKJ1LPFG83wpCZ6aga/LXVkF+IC9+bhz5JgfTHPieXxXXEMvA3IMjnKjXnFEsTJU 7UGQ== X-Gm-Message-State: AOAM531BJ9eB+HC/JchRMsXfK2WF4SgfWfeaO0NiJmZ5vGqAI0qr3Cbs RfT012XFuElibw/7+3wiWv835bWuslFoIQ== X-Google-Smtp-Source: ABdhPJwO3EQENXKmalKTYP10Z8GnuqZMQ3Xbh4khbqYbAta6d36L3XRYQWl0ZA8o798Rgv7QW9+BMA== X-Received: by 2002:a63:d905:: with SMTP id r5mr13322982pgg.300.1602534323588; Mon, 12 Oct 2020 13:25:23 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:23 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:55 -0700 Message-Id: <20201012202511.21000-9-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 08/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- 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 76b390e9c..62d726ddd 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 Mon Oct 12 20:24:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381138 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=kV4yz3yg; 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 4C99D135sMz9sTR for ; Tue, 13 Oct 2020 07:25:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0781986B10; Mon, 12 Oct 2020 20:25:36 +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 fy2Xu8IoS1N5; Mon, 12 Oct 2020 20:25:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id B37088688A; Mon, 12 Oct 2020 20:25:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8E092C1AE8; Mon, 12 Oct 2020 20:25:31 +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 A653FC0052 for ; Mon, 12 Oct 2020 20:25:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3219E864CD for ; Mon, 12 Oct 2020 20:25:26 +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 eOt6mBJHSH3t for ; Mon, 12 Oct 2020 20:25:25 +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 529F68650A for ; Mon, 12 Oct 2020 20:25:25 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id b26so14687425pff.3 for ; Mon, 12 Oct 2020 13:25:25 -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=SpwRwdc8GRf/bNpGJm+51hL05PPN6W8I4zPpCZiS/Es=; b=kV4yz3ygZbggkJOgbj8jwYg7FTzVD+yHGArPu1yoVCVhxKJe6Ju25k9hMxOvsVUdjZ Z8x6mlSp1YaZ5yaEmITXo7tuoSVNLSM2vb2rTGqPnLEthOcz2Yvng5DbgDILw9L1LlAc eXFQpg+7KYnvE/43TfaGgdkx39IdoOBRqiz48/wk0Sy+5QwOIFRhTgtxLIDOIt/8i611 fnbsgYagFuCT3UK1YCHRcGVs8JMVM6wMiHU2yNdpQdGOWVi7FIh9sxiNLw3Ua+pM1bD1 ipauD8Y0pEuIFdo/AtsJgHWhbxN1QH+NLaEVMQjM5Z84tAM1AOf4xkvZkrxlxCQy4iWS z57g== 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=SpwRwdc8GRf/bNpGJm+51hL05PPN6W8I4zPpCZiS/Es=; b=ImqHzkJQDaQ6N100BSEolfH09wJDeZaJv1rH2niAyLSljd4486xiaKUyc1qztQTU9k qBiN9KPLUmBbE5okujXgqaXZ38ZhPCzzSAVOZkIhIdMgbLZgnWDsVWvKDbc2NcEcPNJx WkZ9vAM4N4ydwsXCXauUgc2HBirvABZ5tiQRRk9b6SPfKtz0KueGSK+kWsOUfOlLF653 zHYhuPOJa+zDV7hTfnKq5B+iihZEi6dixp1VQsGK1vEuav2ykASmBN5MWLi9niccACx8 UBhDU7qJPGYPExJVUfWsw/h3ZFqSHEGoN3EGwijL1q4KOsOnYKk69T4o2VIyiS1RvA7n ylPg== X-Gm-Message-State: AOAM530FGgTvhsULGc6GTnWfmgjVxNn2f4Dhd0F3N36Vk39BE5FyAnt1 ED0uXsMJnMMxJ538YbhetKCVs9PAJDLOqw== X-Google-Smtp-Source: ABdhPJxSkHq+7LXmgHpWu8TxGhEgLNwogV6AAiyAXtjefUccgv5AiP8EcNlFlniaSSgnEAmsJ4G2/Q== X-Received: by 2002:a17:90b:14d4:: with SMTP id jz20mr21418542pjb.106.1602534324688; Mon, 12 Oct 2020 13:25:24 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:24 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:56 -0700 Message-Id: <20201012202511.21000-10-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 09/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- 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 62d726ddd..7efaa8044 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 Mon Oct 12 20:24:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381139 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=KU/0DhcC; 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 4C99D85Xhmz9sTf for ; Tue, 13 Oct 2020 07:25:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1FD0D8792D; Mon, 12 Oct 2020 20:25:43 +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 CFOT4l5rCfwm; Mon, 12 Oct 2020 20:25:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B833C8797E; Mon, 12 Oct 2020 20:25:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8A7AFC1ADF; Mon, 12 Oct 2020 20:25: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 5CC14C1AD9 for ; Mon, 12 Oct 2020 20:25:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3C25D86521 for ; Mon, 12 Oct 2020 20:25:27 +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 6XPhcddB02aD for ; Mon, 12 Oct 2020 20:25:26 +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 7296F8651D for ; Mon, 12 Oct 2020 20:25:26 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id w21so14666219pfc.7 for ; Mon, 12 Oct 2020 13:25: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=lOj88cfM2V378OAgBsACsv0lIPyC0sLeySIkvxWsHFM=; b=KU/0DhcCA+b1IQOhJFAQMs2mfajjoFqGjEfa98SHZ3PQDmqh7AL885LgIbUTSHYxsj QrnagiG8ZlvX7Od9Pw+mK2KvaVe+Kzq77wnMNGbdJ71ZACmzRgFiy8mkXfwzWRMqgjTx LSVcvpWeRxXndR0g1d3PGkkBskoVH0MON5sM+VJFFhMEBrtMy5hh7GPzvglxh/PNUJT8 l1g2LNnRQ76yvEwxtAziXev3TQBbNjFrblqgY02G4XFiD7H3F/pUh4QKVeojhk4MdlTb GXP1+WIYQZvodtdKZjnbVcW1YGqRwIbEUm5RoBDX/apWNR2803yF5HJ46fi6cNa7Ppnd BmSA== 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=lOj88cfM2V378OAgBsACsv0lIPyC0sLeySIkvxWsHFM=; b=STyBigu8r/4XBgQZavKAnQpSN6h/XmReXy/rFvJC5oPDIEYVnLRJSjDudR/kcYPQpD slP8PanuKf/DgEQDNBzq3Ds7xyDZKdDkUF8+o0yrxERukVqIzRGp4XUDxfmPpUNZOBKq dkKF8ArNhFHgL6mUkFZJ4RzLAQzcBZ3ZdqPWWwtxGppJZV4HCkEaVjnMpV1kZqJ3bEjN 5ly7FdHO2JsPsKO/hDtGdqljfnirq1bipjYu2DIYdhwrBQdb0ybsIisSlPHJ7TEbu1Cg Hh4jB0JGHpDI1Es2aksZKuEeRKQIT2l2ypJnFBL9jDbCR/RYfqbPO1aogJHhPo2XKp3n mwrA== X-Gm-Message-State: AOAM531UolLZDeHu4Lb6G22VzpeBgwLjYA6MfuLMhU5+XeC7rweQwWY9 LSyZUZYbYHopmITBnxo77SLLIASmk6ZF2A== X-Google-Smtp-Source: ABdhPJzuzPYBz6iAho2BLdSihas7vYT+L151f01cn2tjq4fJWX836xZH+FUlMSCC6DUOUEAbL5svHA== X-Received: by 2002:a62:16ce:0:b029:155:2e1d:9c06 with SMTP id 197-20020a6216ce0000b02901552e1d9c06mr22879100pfw.6.1602534325790; Mon, 12 Oct 2020 13:25:25 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:25 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:57 -0700 Message-Id: <20201012202511.21000-11-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 10/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- 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 7efaa8044..ca2efe94d 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 Mon Oct 12 20:24:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381147 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=qwCKzxJ6; 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 4C99Dv2CFkz9sSn for ; Tue, 13 Oct 2020 07:26:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C55C986BDA; Mon, 12 Oct 2020 20:26:21 +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 aPYnefpg9mYb; Mon, 12 Oct 2020 20:26:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id F2ACD86E38; Mon, 12 Oct 2020 20:25:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C9401C1D9F; Mon, 12 Oct 2020 20:25:42 +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 205F4C1ADD for ; Mon, 12 Oct 2020 20:25:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EB80986BDA for ; Mon, 12 Oct 2020 20:25:41 +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 QAOwjwPCTuCm for ; Mon, 12 Oct 2020 20:25:35 +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 whitealder.osuosl.org (Postfix) with ESMTPS id C4CB486D1D for ; Mon, 12 Oct 2020 20:25:27 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id b26so14687538pff.3 for ; Mon, 12 Oct 2020 13:25: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=Y3ImB+cZ5l6bEvQVLxdEQVhrnRa0lOmb7pRVT54ssaM=; b=qwCKzxJ6TZSRxeohEmn3cwAu84YcAmUfCE6XdfYgUEg7i8g1KxwRTFWpMVBHebDewu mrRUPXEtB6S0hgY72G8XiMEIjo467ljTud20naHIDkP4mG56Fk8HEOcKbKuCwQdL8PNB SYB7jczi+sGBbTBtVB5M3QMHfl01zV7iYB1e8rb1pleOvjo57n7hCXiWyGNctgZgKLP5 4ErTe4/nPU+eylRHhhgPmkIHEbdcQbAH+//aibgIM0fklV+COR9iMZvtzuijkmeXUFbV 8H0k1fYeMhrQFeH1I2OsMmot7qK6RyAs3rzQIB5+qFzJH1XUhW5Bds+ICRUe5aPJyRoM HmZw== 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=Y3ImB+cZ5l6bEvQVLxdEQVhrnRa0lOmb7pRVT54ssaM=; b=S4OozSoKpRMH133upFnKfZ3dRUzAETrjsEYclOwM3362+B5yKoWCbgA89LGf7m6Rb+ OdznVATTJVjay7QyRagArtCwmPOlSDI8Y1WSgPqDfJD/81zHi7Vdwxc70u5JiLLyM634 +2KbpoMUkgLtx13ATyzTilObGFN6ZgJAJpwWWw2J2SwqrIsTqDkWt/zGpL7Enktgy3/I wftjcmUAGm6xpKWYXBAUFxIoZ/igMZTvdSh5oG90uPIhCe2MZcQwrphhxPYwK+JwPnQU HmXjDrayBhDmN7USecIt4ulxG8lLghuZS6KP8PXNEAq2eKR3o6TM6BmkBz7AwP2xBwcu AcAw== X-Gm-Message-State: AOAM530NQohNSJIbIeCmpmcEVwAh2Af60qsw04aUyyD4eQbVNbGJV8SW bLTG8x3ao53ykFGGbX6jTUxnsq9toMwuyg== X-Google-Smtp-Source: ABdhPJw4lpr4GM0nyr9c7szc3WpykoltR1KIpVxjE5tCg/1SHWpE++RiBtuZZSgJ3ztXgT4QHKRThA== X-Received: by 2002:a63:ea4f:: with SMTP id l15mr14203763pgk.434.1602534327012; Mon, 12 Oct 2020 13:25:27 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:26 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:58 -0700 Message-Id: <20201012202511.21000-12-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 11/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose Acked-by: Yi-Hung Wei --- V4 - Simplify the WRITE_ONCE macro implemention as suggested by Yihung. --- datapath/flow_table.c | 186 +++++++++--------- .../linux/compat/include/linux/compiler.h | 8 + 2 files changed, 106 insertions(+), 88 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index ca2efe94d..bd05dd394 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 65f3ba6f4..59b506fd4 100644 --- a/datapath/linux/compat/include/linux/compiler.h +++ b/datapath/linux/compat/include/linux/compiler.h @@ -15,4 +15,12 @@ #define READ_ONCE(x) (x) #endif +#ifndef WRITE_ONCE +#define WRITE_ONCE(x, val) \ +do { \ + *(volatile typeof(x) *)&(x) = (val); \ +} while (0) +#endif + + #endif From patchwork Mon Oct 12 20:24:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381143 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=ZBONOKsC; 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 4C99DH1hlMz9sTf for ; Tue, 13 Oct 2020 07:25:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9939E86896; Mon, 12 Oct 2020 20:25:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1UdB_BC655oO; Mon, 12 Oct 2020 20:25:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9EB1C8685B; Mon, 12 Oct 2020 20:25:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7FE07C1DA8; Mon, 12 Oct 2020 20:25: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 6E756C1DA3 for ; Mon, 12 Oct 2020 20:25:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5090A86783 for ; Mon, 12 Oct 2020 20:25: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 eQStRtaPGlEV for ; Mon, 12 Oct 2020 20:25:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E14E486490 for ; Mon, 12 Oct 2020 20:25:28 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id o3so5496302pgr.11 for ; Mon, 12 Oct 2020 13:25:28 -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=Ipi2GOzprzRNQSAIylrOJ+uSPaVkmJIzwIriWqrVl+0=; b=ZBONOKsC7LJXR2eMH7I1pYnx9RSYExD3QDLr2m0/cud3fsl7esrGYZy5VCx1zfggqc S/GG2r6MtdRWBOVR4ixsuYzCB3nEx8QEK0sZIZaR0o4jsAeZ6m4qwgEeZkCtjaH3oGd1 qXsUApTHLEZrDb9Qfj0wm5znkI3GtKnNsNynfUtW56qkx4XY6MUhMd5V62AFuHZ4mfsb BvFI2DLBfluCaN/Nh+bHBGxOSLnZJI2Mj7uUNR2bXI9mIIlKGF7yBbAKrlGvXrp8L/Ud utYfbf4eT9XKmmzZpT/Pc9QiYj0igaf6WZhDXI1BzXJhSqDvbYUMEk503QNNU95ApKPN pN+Q== 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=Ipi2GOzprzRNQSAIylrOJ+uSPaVkmJIzwIriWqrVl+0=; b=iwJZqOOgzgwDItLegXpNopoM3mzW7SLzvHSuHUEdquCGBzwOZC+GffZBf8X+1MB/jR eUWg/yOmKZ5oSDYG1enJFvIIE4Vm1iMdhSxg5+4/qHg/Fjku1QrQOOU0JB3FNYqOBO7P l/MXlxOUK8GRUvN/L/n/60aerNP+S/Y1haoCOU1YPCP+I/kAvFdPpNx1WON3TKcTGLSy sd6jMV72jIoN09KPTZhrlE2OyXfFRl3YUcJbO8rzIs1zhlR1IUo303q3CxgVuNYknoUs PQlbb5xotaQdHdr43u9wp+hmcNTi3DRDDrHlzVmLp3fCHByvW5GKjgbVb5505QNenpVV Ir9Q== X-Gm-Message-State: AOAM530BdWTqLF7HiE8zrY5wSqdwLD1VqgbD64FMIDLA479ub+dsjCQc YLM6j5eXBv4ee6Zp25D2+mOdbiQJojScGw== X-Google-Smtp-Source: ABdhPJzIm5KEVBhQmphJZ60dxBtQBt9T6Wj1fmJq/UOoYATs4E8XGv3tV0jaRrcmpbqCd6KYohUPWQ== X-Received: by 2002:a62:e915:0:b029:156:551a:c948 with SMTP id j21-20020a62e9150000b0290156551ac948mr2543391pfh.50.1602534327986; Mon, 12 Oct 2020 13:25:27 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:27 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:24:59 -0700 Message-Id: <20201012202511.21000-13-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 12/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- datapath/datapath.c | 60 ++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index cf216c8ec..22a08baa3 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 Mon Oct 12 20:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381145 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=gn9y2T0C; 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 4C99Dc59FRz9sTK for ; Tue, 13 Oct 2020 07:26:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4CCD586DD1; Mon, 12 Oct 2020 20:26: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 FT3Z9IYkXXV3; Mon, 12 Oct 2020 20:26:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id D984286DF2; Mon, 12 Oct 2020 20:25:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B2FD7C1D81; Mon, 12 Oct 2020 20:25:44 +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 B227CC1D84 for ; Mon, 12 Oct 2020 20:25:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8F6DD86BDA for ; Mon, 12 Oct 2020 20:25:42 +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 gQwzENkEq6De for ; Mon, 12 Oct 2020 20:25:39 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 07ED086BC8 for ; Mon, 12 Oct 2020 20:25:30 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id 10so5154960pfp.5 for ; Mon, 12 Oct 2020 13:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mFDWqY21lPdb0l912wrfXyvqtPVGuYns1a3cIw3i0us=; b=gn9y2T0CJqFsmjSJOp/oR5OJe0Ip0i50NhS+Nw+fKWFkqFKf8/Yu+VDHxTR4ZXJuM/ ex/bLHJZcegkEwuUSBykDmw4yqsTgsJAME7pZDB54zdpbsCCE0dj3qSwxMIpgvEZ6cLY s9VSnriw7uNYmFmTGq1UmKH+I0dj6fS9GwuXMVhryzjvEdzOulYDLrGJOnjWODmOnzLd LewK2fITcZgozhz8oio+YO8h8gyyAB2yrJ2OB41kkybhsRW40iQ+EW6AQkDYEVZ03P/V nPckFGWlPk68+1W8CqgqG4i9nCpKPQ8X+h0MKIZmn3AGDO32BhGi+zcvrZ0L/68JvLqS B7Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mFDWqY21lPdb0l912wrfXyvqtPVGuYns1a3cIw3i0us=; b=hS5qhNiUz4hA4MjlKzfx4ea9Q3S3lRFAXLSnNf8QWfFRuPTtvxySUqsRWFoqXnUzIn 0XqMiLRu/3tSeieNzeCmolI4fbgyAGzKQwgfRoxZcirDEFp3DhnsT/MiLSPAvpNIBY70 d4qCZlk9rU0LMRHbF8LQNjw5rq6kzeZbllPt7Eu54rvCjW8bgCf2pHz4Zx9RZ14yLlM+ s2UkwuSNsJssbwwEwOHDOuT4O5Wz+pNl80bl5//j0KMiYe1y0eos5vdzComc+nXTsjRx LZmyq+ZiTi/saKN/271ppair2eHWcXac5uPQlNfFu8S5bN3cz+8uxQ/WGJWlbNAYH1ae JZ+w== X-Gm-Message-State: AOAM5337OzZmuglGSGgEDddpdZv1kHnnjdOoohA0SbCgM7aPB6Pjy3Px 0GZ6B5515mz/9PnlWOKzzr43l0jBZx53bQ== X-Google-Smtp-Source: ABdhPJxQKwZBUQBAEeA9Xx4zYLt9oXjBZ4xv5WJ+0BOKi3nvWI47MSyyeFqZGyUV94jiq/WKSlic2A== X-Received: by 2002:a63:d111:: with SMTP id k17mr13601348pgg.299.1602534329189; Mon, 12 Oct 2020 13:25:29 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:28 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:00 -0700 Message-Id: <20201012202511.21000-14-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 13/24] datapath: select vport upcall portid directly X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang Upstream commit: commit 90ce9f23a886bdef7a4b7a9bd52c7a50a6a81635 Author: Tonghao Zhang Date: Thu Nov 7 00:34:28 2019 +0800 net: openvswitch: select vport upcall portid directly The commit 69c51582ff786 ("dpif-netlink: don't allocate per thread netlink sockets"), in Open vSwitch ovs-vswitchd, has changed the number of allocated sockets to just one per port by moving the socket array from a per handler structure to a per datapath one. In the kernel datapath, a vport will have only one socket in most case, if so select it directly in fast-path. Signed-off-by: Tonghao Zhang Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Tonghao Zhang Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- datapath/vport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index f929282dc..bd62c5612 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -507,8 +507,9 @@ u32 ovs_vport_find_upcall_portid(const struct vport *vport, struct sk_buff *skb) ids = rcu_dereference(vport->upcall_portids); - if (ids->n_ids == 1 && ids->ids[0] == 0) - return 0; + /* If there is only one portid, select it in the fast-path. */ + if (ids->n_ids == 1) + return ids->ids[0]; hash = skb_get_hash(skb); ids_index = hash - ids->n_ids * reciprocal_divide(hash, ids->rn_ids); From patchwork Mon Oct 12 20:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381152 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=e/0nbtsh; 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 4C99FN733Rz9sSn for ; Tue, 13 Oct 2020 07:26:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 606F687022; Mon, 12 Oct 2020 20:26:47 +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 LJzus2b5mQeE; Mon, 12 Oct 2020 20:26:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 12C4087023; Mon, 12 Oct 2020 20:25:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E5B91C0893; Mon, 12 Oct 2020 20:25:50 +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 54BE9C1ADF for ; Mon, 12 Oct 2020 20:25:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 485638700D for ; Mon, 12 Oct 2020 20:25:49 +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 h3gPjZcK-Lxm for ; Mon, 12 Oct 2020 20:25:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 35AC286D58 for ; Mon, 12 Oct 2020 20:25:31 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id j7so4736810pgk.5 for ; Mon, 12 Oct 2020 13:25: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=E+Ei5Eu06lmFSOT655SybWpEnNQXJSPN5QxHSo2NcVI=; b=e/0nbtshQNxQpPJof3R3l4EBUcnyAT4b9qD67NXjNn7Q6J7EVzu4K3mjhqQ+Us1bNl KSEVQihh1ncXOm23RPYjxe3+f7yAysGUGPt0pVz01WOFP07qWuARCP9fDcrBcM40dU5O 6Tf6lcQT2Kt8IjfnVHuqLac6k8C5vmXHnrUoXzCI332bfnubVJh+i6tVCYIlS1MAip92 bSss10OVAQ/FznY6j8jcQuwbqO2xPIXhBNih1jjFHYOvhqANs5ZYHenDZoguvcQYMztu iTS3oikXccSyzH0j5Eo24a/vSWfwvacLn2O5Dgbax0P97v18HfKWnnNriNUVdIyUxlkU DMyQ== 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=E+Ei5Eu06lmFSOT655SybWpEnNQXJSPN5QxHSo2NcVI=; b=M+XReJnZjIlUZOeeXB6TPonTbDeGYcZeHdbdNYeoF8PV+w/ZBRmwohsA8u2AZQl/xG JkPyjQNCex3sKK1olW6T3Pf1bMhjSPCPLB/q9eo9QW4zDhjAbxNJfWRna9noGfhfZzTk BbSsaRZgUK9YSnZwH4dDuAkHuMixoICybN4A9GBiuyGeNE9boQIoeCzdG1pDkgwbR5Kx aIRJjphtGxt0qITb0Q/goHHt9YSy0KhNEZfUnEw8HC3ed9Nkyy3rev5GZojGkjfD2VjK 1dr0X10h/pkeSGTqW6q4G7wfFFwNCuISsrYfKUJGc43Pg+I/fPJGg1s+BtZSV/lqAAKX oR+Q== X-Gm-Message-State: AOAM5304NzrQjRAOk0k0B8a0Lo6u7YNHZ4hMOeGBLUjBNuofL9g+PNR7 8aF/I5Gk9UxElgaPwWP+ODKpzudcQeRiHw== X-Google-Smtp-Source: ABdhPJzorgtXTjjh2IoFmFrjUuoH4rpSBemBKi3/poHvS+ZYouBJwUzYHTBjcniz2dFF0J9w6ay9TA== X-Received: by 2002:a17:90a:ac2:: with SMTP id r2mr22456372pje.71.1602534330505; Mon, 12 Oct 2020 13:25:30 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:29 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:01 -0700 Message-Id: <20201012202511.21000-15-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 14/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- datapath/datapath.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 22a08baa3..ddc0b4491 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 Mon Oct 12 20:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381144 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=q1ji+lhL; 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 4C99DP5WCKz9sTf for ; Tue, 13 Oct 2020 07:25:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 28A6687943; Mon, 12 Oct 2020 20:25:56 +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 GX6-Kwb3jxYn; Mon, 12 Oct 2020 20:25:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id A4B7C879C5; Mon, 12 Oct 2020 20:25:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92F05C1DA2; Mon, 12 Oct 2020 20:25:37 +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 BD2D6C0052 for ; Mon, 12 Oct 2020 20:25:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A153486B8D for ; Mon, 12 Oct 2020 20:25:36 +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 b7RAbmFZmyEx for ; Mon, 12 Oct 2020 20:25:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 576C48689C for ; Mon, 12 Oct 2020 20:25:32 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id j7so4736866pgk.5 for ; Mon, 12 Oct 2020 13:25:32 -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=IwcnNvfPu+9e4OCOe/HwV0GV1zew87r13Eo4HA4wBBw=; b=q1ji+lhLQSojd7Zg0GluNk9UU9z3U7ZasarFk25V+zLKC6n5oQhzaoBcwiQ6zX3gp1 w2zB+7F98jWC5OlXCZK4i4ibc3HlcySCsBx/KYoPknrsSORsJI88ho1hJ90OIsvRw1pM oqAy6qx4rsTr08jdk4wihu9oT47fFxxdYqEwpACOSytoAYBJFxdFmD6V8vtm69xbTCKN 2p8PD5sIX6Jc3ApxpvjHhyQOEMdv7E5zA0nAvAJLDnnv3iaantftygIwsThzWh6YFeg+ gSfwga+6yERu1jhfe0LL9O3Z92gK7qRbxGy0VVuLQBcdLYlkaMa/oOUgB+prZGP9FMnM VFxQ== 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=IwcnNvfPu+9e4OCOe/HwV0GV1zew87r13Eo4HA4wBBw=; b=uFINOkpMuCHt5z7yDnRBS0rCaSgCX7+w2M6tWdsKSnao1QRxYoBhZztrgoK0p0QTTd CERK69wHuWxRfWd2y8kdNZ1B4Nd+SMa0c5Cj6LmTqyCQIXUDnxHG03GsjY3a5zOBuZ5/ /gfH8WQYmD1AVHVWbArXbQj8EcsrEPOQC7rqgIaFqIBhQFFuHxygbaPsCjA5QfqFtqzT w2bpEVSpOeySLd1A9fr28Zugsy/kCN3kYMywoBnBK99zd8NzkAPXn/G0/JjR5Gayhste JL3lnUk08MvId+ms3Z3ABLL6CAmEX/RtKAn3VtKv/fK/nrGkJsFg/cytEfpLA7d2MDN+ Y2fg== X-Gm-Message-State: AOAM533MzMLPuOh/HYLLdmlhpgYR09BfE06HINol6Mqs6jH/iEvuCJz1 Mh5dQfy08f6twjFmX0T00XueQ2iVHHCknQ== X-Google-Smtp-Source: ABdhPJzpiLTBsxR3YRu/RPF+5FMlVana1IIzDJnKTDVwm8TfjRHl7Y9O+NCGc4RxTzbr8T4vaNyl+w== X-Received: by 2002:a63:1b57:: with SMTP id b23mr13913563pgm.81.1602534331559; Mon, 12 Oct 2020 13:25:31 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:31 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:02 -0700 Message-Id: <20201012202511.21000-16-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH V4 15/24] 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 ddc0b4491..1020fee41 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 Mon Oct 12 20:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381154 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=d7bfQlbg; 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 4C99PB2LrGz9sSn for ; Tue, 13 Oct 2020 07:33:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6651A2342E; Mon, 12 Oct 2020 20:33:32 +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 91rjquacLSOa; Mon, 12 Oct 2020 20:33:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 4350F2E409; Mon, 12 Oct 2020 20:26:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0E7EDC1ADD; Mon, 12 Oct 2020 20:26:41 +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 A2B1EC0051 for ; Mon, 12 Oct 2020 20:26:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 77A932E409 for ; Mon, 12 Oct 2020 20:26: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 O1+OgiZTuDh6 for ; Mon, 12 Oct 2020 20:26:33 +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 93AEA271D9 for ; Mon, 12 Oct 2020 20:25:33 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id e7so5655005pfn.12 for ; Mon, 12 Oct 2020 13:25: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=B+0oulbJ+rNVyGy/G4KqpBwEfocywlVnndVeikJigf4=; b=d7bfQlbguDrghXQNXIPl7RSyXXO/adNJnduvNChGz0Bw2F+ViPpYJiG8yWtD+X8GRB tqCI1zJOwzq6Un1DAp2bb+TyVnpnBgpKMq5BNrmMEvwMJutKoRTPbLNvTlCwCoJfN3aD jXfLwqWJqwGdZGGf6ftVsB8He8OL/G4wDcenUTpsNx6J7JbAb6/yJ86366w7l3yxNZeD 4UePIAV3OGq2AfSvSK5iWqerJFKfP49n4m61WHDCIgq5C1eJ+iW2bTLuzjBBHCfAchiI qgRkHAh4dgYnbZavdV16ezdSAUD5W1auGdCvPEhp4pzbW13ekWSLiC4QCjD7ip2YGzKh kq8w== 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=B+0oulbJ+rNVyGy/G4KqpBwEfocywlVnndVeikJigf4=; b=ORMpA6WhAYFp2c1L0i4IeP/W0RPwLMoatoFLuQN1WpCqblUtUMvLxLRTEccAuHfSO0 aRSVqb2P8vv7Mqy+QHOCegSRDyJNMGtuUS93r2ZFA8eO/TCi6aOqsYlN+vdzFOP/t/0g JsnDJTLHIsYwCtnTuil+7pqd2I9+InKQ5ZrgwavHvueYK2neOgWkFFRKxEr5vSYQhMKD BdQ+IxK2jyuBm9mwqrQgnNfAG/oDkt1zt7JyNq/iQ/LW2U2mBcIKGPsbIvfaWkDKBprv sWbTgMpuMTh8NfleuDqQ6Cly3pOyhRtyIznKp+U+x09yOv4QqfrGCBbBVw2vyiDLGNct ujPw== X-Gm-Message-State: AOAM532tK1F+QuoEWtfdWqkSNe8oIQqS8uQucb/jIgBv6mq3R5dRHeoP eDnEtVkYa5NMffX23GhON8MzF7jXHkHBhA== X-Google-Smtp-Source: ABdhPJxmuQx/7r5LCH4/AVU1wqDWsIpmdJpyjmFEp7vCUwfFlZirCrblbFxFT8v1HKG6tWevpF81Lg== X-Received: by 2002:a17:90a:b285:: with SMTP id c5mr20971297pjr.44.1602534332554; Mon, 12 Oct 2020 13:25:32 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:32 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:03 -0700 Message-Id: <20201012202511.21000-17-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH V4 16/24] 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 1020fee41..9448a4c1a 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 Mon Oct 12 20:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381150 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=V0xkYASf; 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 4C99FK0qbzz9sSn for ; Tue, 13 Oct 2020 07:26:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 789F48725D; Mon, 12 Oct 2020 20:26:43 +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 1YB39zBBNsRl; Mon, 12 Oct 2020 20:26:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 0C6C586FB1; Mon, 12 Oct 2020 20:25:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DE68EC1D7C; Mon, 12 Oct 2020 20:25:47 +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 E6930C1D7C for ; Mon, 12 Oct 2020 20:25:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D3C3F87A0D for ; Mon, 12 Oct 2020 20:25:44 +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 qy7ChrtX+dy2 for ; Mon, 12 Oct 2020 20:25:43 +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 hemlock.osuosl.org (Postfix) with ESMTPS id 457678794A for ; Mon, 12 Oct 2020 20:25:34 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id c20so4069480pfr.8 for ; Mon, 12 Oct 2020 13:25:34 -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=PJHZYWEssPk/fE1RuDftRJvOIkP5IyY8RlkZWMiXxck=; b=V0xkYASf1b7kmJSa6no4IV1rw3MVv8/tHVk5K4RAyxUws/KgqgEc6UM1q/j1QRU67s 6mPbpPdKSXTQnXAKH95r7VJrxPXwHCgIqXfBnHZ6FW0RVJp1Pup4pMdrugd3n1UoQe+U C702m+dOomZjjUG5otwXwJLp85rDwZqbrTh/KCs7T7boiEaPw1+mYVqYDEMDYk+mSEcK sWfBoNciY6Z07SO9VUrNEx7nt3FCvlFIH9+49EnxcwCc6uecYvhlGLKmcnW8D321VvAS yZtQPXqMHASCMhQ/kOK0N0Xa2Kn9u2GqHrrhscMiOiOHdhrCQsUVxHvDkK2ZJ3izaBJB PvEA== 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=PJHZYWEssPk/fE1RuDftRJvOIkP5IyY8RlkZWMiXxck=; b=EHJj7fT9tDB77i+Pje4/PrLPMRSZJwxct4srUQ68SrElZuf0u8NER/W1lAkMjRtv3G wRFD2CBOZ5yS0qHi7epgiqGqmQGVdPn9uu38bHVgP1jnCRcg2oymqG5DCZuWM1McoWgX BB28CMU0awOWeVovDbKSqxiJYWieja2+QKlURIhRJOkg5O/Pu4psh0TKTCw6AWFlee87 Lqx+bcKZ28sn6L3LJAdWX5haaUUbeG3xqyygnr/GsCB1fFjAlX6IWNEZs8n8iVxnZD5v KgEOeuEuTKWRTVLLWOIrYskpEMdR/RapyYSFzUD375R5D5VK4OrMJDaL1eGVujV6/8AU BPww== X-Gm-Message-State: AOAM530S2dCGasGDWvicGR5WfIwPCDGIQ/OawZ9y31o7savqV4LPuokY NkCViGTVcVgFp5NKAjLQosHgkFsbnpS/cA== X-Google-Smtp-Source: ABdhPJwG+zHgAhWIBoc6pimCj16DgLL9IGv28wo9fFI+QUMU5ga5Eoc3ayFslZMeitV9gZwUdJit0w== X-Received: by 2002:a63:e804:: with SMTP id s4mr14051334pgh.165.1602534333525; Mon, 12 Oct 2020 13:25:33 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:33 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:04 -0700 Message-Id: <20201012202511.21000-18-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH V4 17/24] 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 9448a4c1a..1bc8e1439 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 Mon Oct 12 20:25:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381159 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=JbS7AvLW; 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 4C99Qs5Qptz9sTK for ; Tue, 13 Oct 2020 07:35:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E5F31236B5; Mon, 12 Oct 2020 20:34:59 +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 jROr0nIHI76D; Mon, 12 Oct 2020 20:34:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 6212C2E447; Mon, 12 Oct 2020 20:27:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 37D4AC0052; Mon, 12 Oct 2020 20:27:00 +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 82A5AC0893 for ; Mon, 12 Oct 2020 20:26:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8C5D12E444 for ; Mon, 12 Oct 2020 20:26:57 +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 dfbvXSmDOKng for ; Mon, 12 Oct 2020 20:26:48 +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 silver.osuosl.org (Postfix) with ESMTPS id A04DC272F5 for ; Mon, 12 Oct 2020 20:25:35 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id p11so9290844pld.5 for ; Mon, 12 Oct 2020 13:25: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=LVxVEKhce76HNGd/mLVBHOi02hTkjeBKJTsRuBzpBio=; b=JbS7AvLWFH2LRPXd6LBNTTeCG33nFh31gXCtyZlcnQ6/EOJ0XfqMbQ2xrmCDO3uGH2 F4Btu+4dec2hDMaqBKqkHDiePpxWddrvTtLVwrT6OBaFhfiTGJAHiaKg0Fl+Kc3em3iC cecC2GtEyKIMUh2eBxMYAb0IK4rI7X208TTI+gH6mJz9v75aVozA5xiU6SgsUpGiFfsx QYEmLIjF31cBmuY1ajO2EsxNLYqAIU1y9GANT/7iBbDmD+i7LSiDdO9XVlBtTTac0Feb GnyvBRqscu7qAvvwApKR88bTJZFWx6WpURDa93fqLPHpG2evwhSFvSnrumrA+pZcl1T9 sHeQ== 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=LVxVEKhce76HNGd/mLVBHOi02hTkjeBKJTsRuBzpBio=; b=FbgMNtEmM0LPlSQx/gfoe++sf0oPo4MiTrl8GNNc8NebLb0KnwV2Cov9mSQ84KMgJj SmskQOqr5fshXjoa05uolw9pm02Ba1bls0YuT6lJiTQizvkR/o15Tru1QMYeUZJWs4QH AGEYh2tiRdFVBbrqPr5lqST65gzH5P/2uk+I1wrNLkYT9sPf2P1H02UtCZJeZy9AAN6h WWx4bWLEE2wPqz+5oumnoc6POmysfW9WPnP1kY0btz3IGCEBujZL8eXeYOydw5WMILwe 9pCSdw0vtj/tHf5C/0/qtQxPPVDqjRRyUhLrc0gZB184BMKabyuPVPYfQ8Ts6ZKMKE0T s9ww== X-Gm-Message-State: AOAM532kwa88/XJQ/ywbsIhiURCovIysiABISHeS/l58SVmSlK3vxQv5 DDjnSeSEMw+YaIP4awRqfqNgRJt39uTaTQ== X-Google-Smtp-Source: ABdhPJxIifosliQpCfKAV/AXBZMlC1Ke91RNkQwXoKGkJrEuUH2R27nIW7bNfBvwAsAAo64gz9u0bQ== X-Received: by 2002:a17:902:7001:b029:d3:f0d8:d271 with SMTP id y1-20020a1709027001b02900d3f0d8d271mr25212343plk.48.1602534334714; Mon, 12 Oct 2020 13:25:34 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:34 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:05 -0700 Message-Id: <20201012202511.21000-19-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 18/24] 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 Acked-by: Aaron Conole Signed-off-by: Greg Rose --- datapath/conntrack.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 5b4d6cce0..c7a318baf 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 Mon Oct 12 20:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381146 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=Y/zbV8zQ; 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 4C99Dn0m6Gz9sSn for ; Tue, 13 Oct 2020 07:26:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A93E0868B4; Mon, 12 Oct 2020 20:26:15 +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 VWxcpGkZ4cZH; Mon, 12 Oct 2020 20:26:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 50AA7868AF; Mon, 12 Oct 2020 20:25:54 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 280E7C0052; Mon, 12 Oct 2020 20:25:54 +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 A0378C0052 for ; Mon, 12 Oct 2020 20:25:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 84499879B6 for ; Mon, 12 Oct 2020 20:25:50 +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 E6pa+lrpEAzZ for ; Mon, 12 Oct 2020 20:25:49 +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 6295C8795B for ; Mon, 12 Oct 2020 20:25:36 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id r10so15487625pgb.10 for ; Mon, 12 Oct 2020 13:25:36 -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=sO7g/ZjqyHNRObqKQmlzAMDKETJiQqA+vuCd0T78+J8=; b=Y/zbV8zQVzzakfQnL6UjeO2YMsKbu5fhL4ssWGeGKToZllQzk88R+0YjEHSRx/BTGZ dqFBkWbUvC8y/6ObNFu2sGg69LOpz0cYbp9Yzuc4NyPYwkNnXUC0NL3VomiqKPcMsNJF uBPqoGDJBIWvaI2SOZr1scYDEabdrAwD5bINmyFxLPpPkplBMHkFfj6vJZydPjv5olYT Vt6Kb5og6Ky1F3mK5z56BIrg7GN29sHIPymdiCK1Lk9s40xevV7Tpry6FUhb3NHlOwK0 d0kNlJU1es0pD4h5wWSUHXspwvOpS0vXjcrUMQSbWcWzzNj57iOBPwTfQ949BqG1/SDD LgQQ== 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=sO7g/ZjqyHNRObqKQmlzAMDKETJiQqA+vuCd0T78+J8=; b=r228fzdGi37D6Pr10Id6MPDT9e7Xwk3jurOhCDDN0p/DLFANDHnhlRIUDg5HqScVNr jMQ9FPUmiP2e8Jn0B1+x9uk54FULxqbk/Ztt2MsbXMjyv0Fc7hcRwVBDonPrVtGBMNnd KR4wL2j5VYvr4X0wdLalEesFBv1QcdDc6kAUi0RxbQ/H3ayPt0KD7fvzN7H4BzH39Fzt 9SzR99j42H4fs/pNu7lhRgP0LJdj2M8Ug59loJgu8x10cC7QcSpD3kH5UGUEafGkD1Kh bBqlJd9f9mxmoi9nawk9FrGJ3GgNDzJmK6Y5pLvgsORFmWj6dJIUrV2m5VemEI54Anus iPfg== X-Gm-Message-State: AOAM531mcygeFAZmM65x1kqMDqg8unk5wQMwcohkEB9H3SvvY30UlyXt 3Q6LswqcLk4/dSW/wlSYbcUgD/sEF2OGIg== X-Google-Smtp-Source: ABdhPJzn6s5k2eyBV1EZqs6bIHFBjXaH3OHpb6wrViM3lOUyEnJmgDpA9v/66q3PK/fCBmCUKCRE7A== X-Received: by 2002:a17:90b:4d0d:: with SMTP id mw13mr19122164pjb.36.1602534335663; Mon, 12 Oct 2020 13:25:35 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:35 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:06 -0700 Message-Id: <20201012202511.21000-20-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: "Jason A. Donenfeld" Subject: [ovs-dev] [PATCH V4 19/24] 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 1bc8e1439..52a59f135 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 6d248b3ed..204ce5497 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 Mon Oct 12 20:25:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381162 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=AVau2L61; 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 4C99Rm3vQWz9sSn for ; Tue, 13 Oct 2020 07:35:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E904022CB0; Mon, 12 Oct 2020 20:35:46 +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 W0P5efraJsUI; Mon, 12 Oct 2020 20:35:27 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 8EFBB2E45F; Mon, 12 Oct 2020 20:27:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 841F2C0052; Mon, 12 Oct 2020 20:27:20 +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 92446C0051 for ; Mon, 12 Oct 2020 20:27:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6C3F0273A9 for ; Mon, 12 Oct 2020 20:27:18 +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 zzQZY2Oz0DTJ for ; Mon, 12 Oct 2020 20:27:09 +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 silver.osuosl.org (Postfix) with ESMTPS id 827F422D10 for ; Mon, 12 Oct 2020 20:25:37 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id b193so14605743pga.6 for ; Mon, 12 Oct 2020 13:25: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 :mime-version:content-transfer-encoding; bh=8tj8AjNAVBaoQ5jSRSS8zaCUJv9NbldneYD0gozte/4=; b=AVau2L61JRiGR0+Im5X9ph+SIpCHHmK5Mk5JxrDAkqR+ZFwxfge7JPmaplcCWskak1 NacrjDyMEn8hTDR2por1/w6DbQl1H3XN+MB8cc2i4p/lsQTQY0+oca5qN/zC690PinFB 0uaIMW4wsWxyv9B0LYx6IBCOfiIbdPLen+kSinhQ3HmHE6UfQTkNDK6818+S3F97NyBO W9gMa8vTj9jziTuNtCZGVTK83oxMcDqSu44nM5uhsqWXqGInO0KzFe3p5nQU4xwz6BNE jJ6ZgYGD6rkLVLdqGVqTV39AG7HKH9ENWMfDPm9s0lzl/ATP9H3lA56dr2sH/wesPgkv yEkg== 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=8tj8AjNAVBaoQ5jSRSS8zaCUJv9NbldneYD0gozte/4=; b=NJw2Nvd6ITiqjJIDyNOgPNQQGsiPS3QVHWyAIVpB5cvaXHSwazM9UXErbzDJktjyx5 4iwYEJn2wtHv53h+U/rXIxQFJXVvm1QILUcLF9mATMsioO1jzgDvP6Z621aVo0xMJVvB FanxE8M18MQdxY6Q2FkLhlsriN11aczraXhnApD5Wjlw7o45zxlXhthKIZquHPSvqr3R 7TZj1ZvxYUbYwWzQ/6pZ8wH2LjNjsPWYj8Y2905/EIjYdEyrxIYVumnAeVcGNY/3vA4v eem20/bd0y0MJVEyDdeg7K/her287ed5l3KC6SHlfy5vm7qb/DvbIi4icivYl4JzpHzr XkMA== X-Gm-Message-State: AOAM532y1kWbcpSH8mXqIcvY6nykQDRsAJm9NaNiJrtDfshaR5L1yopy 0hVNavep1m3xjtv9KiU7X2iKFcvSYRxGpA== X-Google-Smtp-Source: ABdhPJzLxnBhAdr6Jc/cQfgWXiX0DwvXwDEpNNBjlY0yKjmMF40+ysReL9OP78oYB4AIUFDJdWoOHA== X-Received: by 2002:a17:90a:5889:: with SMTP id j9mr14950984pji.154.1602534336753; Mon, 12 Oct 2020 13:25:36 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:36 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:07 -0700 Message-Id: <20201012202511.21000-21-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> MIME-Version: 1.0 Cc: Kees Cook Subject: [ovs-dev] [PATCH V4 20/24] 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 d3fd77106..996041602 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 Mon Oct 12 20:25:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381153 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=J8z8wmII; 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 4C99Kf0f3Zz9sSn for ; Tue, 13 Oct 2020 07:30:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6FC5522F05; Mon, 12 Oct 2020 20:30:28 +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 M8r4+7y3vh8E; Mon, 12 Oct 2020 20:30:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 90EB82E39E; Mon, 12 Oct 2020 20:25:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 65EEBC1AE8; Mon, 12 Oct 2020 20:25:56 +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 C3284C1DA1 for ; Mon, 12 Oct 2020 20:25:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BE5AF87904 for ; Mon, 12 Oct 2020 20:25:54 +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 TDTQhmDP2oHg for ; Mon, 12 Oct 2020 20:25:53 +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 hemlock.osuosl.org (Postfix) with ESMTPS id 7BD85879CF for ; Mon, 12 Oct 2020 20:25:38 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id n14so14669171pff.6 for ; Mon, 12 Oct 2020 13:25:38 -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=4/MzeZNctuRQkImYXe+RvlH0UxCYI0/QPjCuH56ISfE=; b=J8z8wmIIVJn8IopzEo2BpILxcZDzZVTbMMagcfGJkZU4t0YfUa5AUBNa31zthTJ/jt amM6DDusAAuivQN+LjrI/2Vefh6+bYcDVO8QaU/lJWL0Py/TtyVIOEx1gTfuAxChl0fm A/BqGivQzerTsA9UTsW5/OL8x21XkPOfKwbhtY2oNnCnN865mqxoAlzXpyvLP1nS8ZGW H8k+cjbxMBB2l4FDXFp4qdEdA26Byp1I+NtcF70xX41rxsVrSsdtED5Y/iSObDxEQ/+G sAqsFzSCBKJBXoxWCfU6RWuwi1JO6pB6JYRfFlPtD78VekwqZgrlgeA9QdE9tLcsfV7F g+3Q== 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=4/MzeZNctuRQkImYXe+RvlH0UxCYI0/QPjCuH56ISfE=; b=OUqPLVoExZczsjhuFejqoSukdwR7TNyDSYjSrZRiUEWaDw3+RMD4hIo2HrF8tKP4PN iyo8eIOoKaZpMuu+peZZxRFjbGAdCjKf0n2Uqs7I4+zp/8i35SOj7rbBD3G4RvhWZgWh YqzXYGuFl4pWz6hQE79c8L/Ur0WAKB4IB0Rfj/raxS/rbGoz2iNskAYzXVJzJTsjn6J1 1PPjI8nCQ1kS/n+BtzIPmWvvAHKhvZq/jymjzO57mXCM0Gm8/94oRGihCWCGEomji+ML 3pFw0NEWJOEuxAglJvkRwlkmgT1lW4mkR3A4xmSyNVJEaxKDTV9C8EuZepM3nKp2haQI jizQ== X-Gm-Message-State: AOAM5327bpDMKYu3U8dZPcR6W0kKLMGw5f7tpo8DtLWWjvzH8ocUDjAv 53g/JyE5FUi9sLywlwh8Mf40gIcj4QURcw== X-Google-Smtp-Source: ABdhPJyiCNgbFCzVsukSrAqecMqKZSog8Af9CnEZRI1MbTibxMfZdfFmHW0RBKvGxT7Xu4NbD0GQuA== X-Received: by 2002:a17:90a:af88:: with SMTP id w8mr21477271pjq.156.1602534337786; Mon, 12 Oct 2020 13:25:37 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:37 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:08 -0700 Message-Id: <20201012202511.21000-22-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 21/24] 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 Reviewed-by: Tonghao Zhang Signed-off-by: Greg Rose --- 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 bd05dd394..650338fb0 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 Mon Oct 12 20:25:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381149 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=H1lNQ9NT; 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 4C99FC4WPtz9sTK for ; Tue, 13 Oct 2020 07:26:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 361C3872FA; Mon, 12 Oct 2020 20:26: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 9hSbVZTcjWNw; Mon, 12 Oct 2020 20:26:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 1906C87A07; Mon, 12 Oct 2020 20:26:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E5E86C1AD7; Mon, 12 Oct 2020 20:26:10 +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 69833C0893 for ; Mon, 12 Oct 2020 20:26:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 50BD386EA1 for ; Mon, 12 Oct 2020 20:26:09 +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 gnze-SJMDQou for ; Mon, 12 Oct 2020 20:26:07 +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 552A586BBE for ; Mon, 12 Oct 2020 20:25:39 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id 144so14671853pfb.4 for ; Mon, 12 Oct 2020 13:25: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; bh=h5bgOfaOUJhWPcBEBsFAHHTPJ7vi+LSF6gg02borjI8=; b=H1lNQ9NTet+6JlRtJFQyEY4OGq5PpUjRS9FulNFPjUgdH/Nd5d7givK9dN9bIlBiGH zhqDBz7SpAnI3gOfvZ3iLfJfzl4fQpBwnNdY6+mb/EpQj21LNZPPlclIMbI9hQwUNesi OdgnMgodzE8lNgUbGhvv2XKdYPaucuuy7679jUCMjAP/Ozb9/l2nWjc/uPG13McIv7Pv Zq7tV7vT2qWYdeZEiVAWg9hjJKIIsaOKA1Birnsd0dv23IrttF3FZ/GFtsO9An4l4N+3 0vV8LSFqtSRg0SYEtnlYCvv/fSj9Oh2n+KPfqmixsxSm2YmFjgzVbXOFVXFe8UP0IDqu 0zRw== 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=h5bgOfaOUJhWPcBEBsFAHHTPJ7vi+LSF6gg02borjI8=; b=MUDOSlKLz0MsS8UKmvp1iIOrS/VwdqpqeDjupdffT9G2Ao5oelmLoLKm7zQ8Ooe6iM qgjZKFSNoxevKM0XUyuPoRjyQK5amyFhIW7rLNf8YPFZWzG9gw5j3UIBU7TVRkpFkecB v9pJ0YVdKDbcvOch+HL8WRdwbxA6DnPgnxGFSEj9aEzvnz3/Jj5xGv7yaJbzEHj7g7vy XZCxwOvzsf8CX0KVLZnnqxL/dfJeWzO4C72Q91tPUEpjuE/dEyL38mCIP5pIt0H2G0uv 0/TS2uWhb4/hr0m0d0U1ykYt9/L/aGWOn8qtiuwfNjJKJWQoa3GeM2dI67bwOtCOkXAU RQuQ== X-Gm-Message-State: AOAM533OXY/u0X0kVp+boCXmz1/9Lmmzq8qPb19z/gSt/oTa9vtvR/xB BzMO2unSstPoWDZlx4X2cTF41QgaN8YFuA== X-Google-Smtp-Source: ABdhPJxXHSEWYY6RH6eRXK2nnd50Jl2q2KfN6OFPIw7U2fUwbLeoFQASS03NOJPTbPTNJWO2GQjh9g== X-Received: by 2002:a17:90a:7c03:: with SMTP id v3mr21581987pjf.233.1602534338708; Mon, 12 Oct 2020 13:25:38 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:38 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:09 -0700 Message-Id: <20201012202511.21000-23-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 22/24] acinclude: Enable builds up to Linux 5.8 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.8. Signed-off-by: Greg Rose --- acinclude.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3d56510a0..1460289ca 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 8; 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.8.x is not supported (please refer to the FAQ for advice)]) fi elif test "$version" = 4; then : # Linux 4.x From patchwork Mon Oct 12 20:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381148 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=Fw8fkEys; 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 4C99F7179cz9sTK for ; Tue, 13 Oct 2020 07:26:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BA51186A08; Mon, 12 Oct 2020 20:26:33 +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 jCrTyDudRn27; Mon, 12 Oct 2020 20:26:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id A591986AC4; Mon, 12 Oct 2020 20:26:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 924A9C0051; Mon, 12 Oct 2020 20:26:13 +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 1CD67C1ADB for ; Mon, 12 Oct 2020 20:26:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1058986CC3 for ; Mon, 12 Oct 2020 20:26:12 +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 lRbIo7aCieG1 for ; Mon, 12 Oct 2020 20:26:10 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 43B3886EB2 for ; Mon, 12 Oct 2020 20:25:40 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id g29so15526692pgl.2 for ; Mon, 12 Oct 2020 13:25:40 -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=yWfnuY1V+f4mTVqXuAEs/T2ZVMqq2rCCnKkYvYqEcgg=; b=Fw8fkEysnaEAra7H5SVIvba1NNckkwM9tPImhDXaG6PTxAhTnff+Pr4gG5GcBL7Jty dQKyDTNzSJHMCAxy/QW7qIwms4GEyn6wiQ/P9YmgsHGw0GdkSADBywQB0caohSoph+Mx ObJV3gR7cHcxhz9S71/49hBYeXQSQmSP+wqBbi/yeg+Kl8QKyRZXSAUsJABnBewVmXAH Ell1nErvFC5vh+7j7PAuxkfkskssXiH1X4f56pd8XizSzBiY3DAge+9TkqUBkehwxzUT yFHfxpUmJLMb7cJyXHGBQi2qe9IY6qCpvvQNAnJu9lGn1vMC9SIjgTtVvOGMNt8W09/P RA0g== 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=yWfnuY1V+f4mTVqXuAEs/T2ZVMqq2rCCnKkYvYqEcgg=; b=exGGdy5JAH18BNYoivnQDPO2III9fOVACIb6O2XvzOnCywrM8jNgocyi+MgCqj73vN I391AlrYAI4sZRaTTqXyxXkZunT/NPc5mNgrMj9BSogCCYURHqUaTu0EoAKrVfn5sdhr 45xHjrLM8Lp+PbltRlMSA4nizMWrq3ZDSfeUVjjxKP4ERr1SWn0sr1BG1qhp39yJlrgF dEN+U73TsJVViX2dAUBNJg3/wUDk2o6/M36wIYsKemLz24ncIwg/TPIuO/nnRia6CRkm RB6NBNXxV5pqh7l7xks6VhPpFpGJyhhA+9GOFMa2CXYsAYdnQvpgsKNBsHtzfoqIlkYR 2Kpw== X-Gm-Message-State: AOAM5308cYRSGC9XvI6YK4DMHrBRETfLOcxto9ecK36dd3oDAFQWlAVV QMOKoNWMDOF6zgc7vCIpEfB5onwOeFidTA== X-Google-Smtp-Source: ABdhPJzX62NYkneJsrofDZjPJVSQKbYH3JuLXyypX73xCP7K8FNQLWAfVy7lBub3JejCZQSMT8gMUw== X-Received: by 2002:a17:90b:11d6:: with SMTP id gv22mr20794311pjb.159.1602534339676; Mon, 12 Oct 2020 13:25:39 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:39 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:10 -0700 Message-Id: <20201012202511.21000-24-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 23/24] travis: Update kernel list as of 5.8 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 list to more closely track the LTS releases on kernel.org. Signed-off-by: Greg Rose --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43e6a75cc..9fd8bbe01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,8 +38,8 @@ env: - TESTSUITE=1 OPTS="--enable-shared" - TESTSUITE=1 DPDK=1 - TESTSUITE=1 LIBS=-ljemalloc - - KERNEL_LIST="5.5 4.20 4.19 4.18 4.17 4.16" - - KERNEL_LIST="4.15 4.14 4.9 4.4 3.19 3.16" + - KERNEL_LIST="5.8 5.5 5.4 4.19" + - KERNEL_LIST="4.14 4.9 4.4 3.16" - AFXDP=1 KERNEL=5.3 - M32=1 OPTS="--disable-ssl" - DPDK=1 OPTS="--enable-shared" From patchwork Mon Oct 12 20:25:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381151 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=FaMjpCN9; 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 4C99FK4dghz9sTK for ; Tue, 13 Oct 2020 07:26:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id F288187914; Mon, 12 Oct 2020 20:26:43 +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 3qm1konXuMb1; Mon, 12 Oct 2020 20:26:40 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id E68668799C; Mon, 12 Oct 2020 20:26:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B86CDC1D81; Mon, 12 Oct 2020 20:26:14 +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 F1187C1AE2 for ; Mon, 12 Oct 2020 20:26:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D890786E26 for ; Mon, 12 Oct 2020 20:26:13 +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 ujJRbY3Pq4Ri for ; Mon, 12 Oct 2020 20:26:12 +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 whitealder.osuosl.org (Postfix) with ESMTPS id 6F55786ECF for ; Mon, 12 Oct 2020 20:25:41 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id v12so2634012ply.12 for ; Mon, 12 Oct 2020 13:25: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=NYp666JevZkZn/3WcrXxqIFsublGgAbXkIkCJbDRvmU=; b=FaMjpCN9lU/3WnIXWdIGYm5HDwfWfwx2UK1BkyahdERKPur8eXcva/lisf7E20WI+P ORX9w+IlAsbkmYjki/1qjhmtsOv9IkdafL6eG7ALD3aQbitOkwsqdtv4iX4K+8CNfTN3 BZ2Ym4zogYIl2zDcMB1ZuI7JM/dmCj/fsCw/LU7nzssLoDl2mmu3AQ6QKSEiJtvSjuMk 4ohScsrXokF/7q5TZPvzndU3gLS0hIsJhRE2ehrCCFIyGDznE7A6b4fRdv+yppsMG9de At8baJ0aGUnKHBKLB6w4VjtiYzOALOLKHF0gp0R4wtzkLqunDmglrm++Df5/JK8dDhb4 B4CA== 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=NYp666JevZkZn/3WcrXxqIFsublGgAbXkIkCJbDRvmU=; b=eWnT5Ts4XhrauDCtJlg3ow+BLJJh0kqLr0QB+lggumHMCoN5GoYa0rzXRHGL0vd54/ U1/OIJzSd9TNv2AcYeVljZOzdTbs55rs1Dj+Mrw9q3bKatayjXdzLdRT7RCdOkg86Cq+ hUYmrN4okRORVBiSrCOdRsBLSLV+wx8LMoMl4Vz3lZyTHv08SkaVBNg1/yZlDdwfRYK7 98fgQ3dEDxcZpv6WdXPz8rCbobmT97sfIxNb5KCKxbKm5ycIOa7RLK0gqEKyI+Aey59n LNhV9pUwsjt70MYHNDAIH6zKs8187Bke6FyHzgtcyC+4Cn6jJXNgc6G7QMuJSMYbd+Ye Zlpw== X-Gm-Message-State: AOAM530H8CTsRh8xKnKzwM6NXNV8+9392Zf+w2T8UiJxTLn4pjT14ovl GVvrIdTNngRxmOwoIMi30zOIKSvEwwSavQ== X-Google-Smtp-Source: ABdhPJz948ZPv0IU9cC0j7k+AalG39l9z0IaJyHRuzE/xmRtAsGu27Ebu2TZULXGQ9Z+aV47Yk8L1g== X-Received: by 2002:a17:902:8482:b029:d2:6356:82f8 with SMTP id c2-20020a1709028482b02900d2635682f8mr23841941plo.75.1602534340821; Mon, 12 Oct 2020 13:25:40 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:40 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:11 -0700 Message-Id: <20201012202511.21000-25-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 24/24] Documentation: Update faq and NEWS for kernel 5.8 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.8. Signed-off-by: Greg Rose --- Documentation/faq/releases.rst | 1 + NEWS | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Documentation/faq/releases.rst b/Documentation/faq/releases.rst index 9d5d2c3e1..dcba97e16 100644 --- a/Documentation/faq/releases.rst +++ b/Documentation/faq/releases.rst @@ -72,6 +72,7 @@ Q: What Linux kernel versions does each Open vSwitch release work with? 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.15.x 3.16 to 5.8 ============ ============== Open vSwitch userspace should also work with the Linux kernel module built diff --git a/NEWS b/NEWS index 4619e73bf..b0bce4195 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ Post-v2.14.0 * Removed support for vhost-user dequeue zero-copy. - The environment variable OVS_UNBOUND_CONF, if set, is now used as the DNS resolver's (unbound) configuration file. + - Linux datapath: + * Support for kernel versions up to 5.8.x. v2.14.0 - 17 Aug 2020